Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(585)

Side by Side Diff: gpu/ipc/service/direct_composition_surface_win.cc

Issue 2933453002: Always use DirectCompositionSurfaceWin when using DirectComposition (Closed)
Patch Set: post-review fixes Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gpu/ipc/service/direct_composition_surface_win.h ('k') | gpu/ipc/service/gpu_init.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/ipc/service/direct_composition_surface_win.h" 5 #include "gpu/ipc/service/direct_composition_surface_win.h"
6 6
7 #include <d3d11_1.h> 7 #include <d3d11_1.h>
8 #include <dcomptypes.h> 8 #include <dcomptypes.h>
9 9
10 #include <deque> 10 #include <deque>
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 child_window_(delegate, parent_window), 1006 child_window_(delegate, parent_window),
1007 workarounds_(delegate->GetFeatureInfo()->workarounds()), 1007 workarounds_(delegate->GetFeatureInfo()->workarounds()),
1008 vsync_provider_(std::move(vsync_provider)) {} 1008 vsync_provider_(std::move(vsync_provider)) {}
1009 1009
1010 DirectCompositionSurfaceWin::~DirectCompositionSurfaceWin() { 1010 DirectCompositionSurfaceWin::~DirectCompositionSurfaceWin() {
1011 Destroy(); 1011 Destroy();
1012 } 1012 }
1013 1013
1014 // static 1014 // static
1015 bool DirectCompositionSurfaceWin::AreOverlaysSupported() { 1015 bool DirectCompositionSurfaceWin::AreOverlaysSupported() {
1016 if (!HardwareSupportsOverlays()) 1016 static bool initialized;
1017 return false; 1017 static bool overlays_supported;
1018 if (initialized)
1019 return overlays_supported;
1018 1020
1019 return base::FeatureList::IsEnabled(switches::kDirectCompositionOverlays); 1021 initialized = true;
1022
1023 overlays_supported =
1024 HardwareSupportsOverlays() &&
1025 base::FeatureList::IsEnabled(switches::kDirectCompositionOverlays);
1026
1027 UMA_HISTOGRAM_BOOLEAN("GPU.DirectComposition.OverlaysSupported",
1028 overlays_supported);
1029 return overlays_supported;
1020 } 1030 }
1021 1031
1022 // static 1032 // static
1023 bool DirectCompositionSurfaceWin::IsHDRSupported() { 1033 bool DirectCompositionSurfaceWin::IsHDRSupported() {
1024 bool hdr_monitor_found = false; 1034 bool hdr_monitor_found = false;
1025 #if defined(ENABLE_HDR_DETECTION) 1035 #if defined(ENABLE_HDR_DETECTION)
1026 base::win::ScopedComPtr<ID3D11Device> d3d11_device = 1036 base::win::ScopedComPtr<ID3D11Device> d3d11_device =
1027 gl::QueryD3D11DeviceObjectFromANGLE(); 1037 gl::QueryD3D11DeviceObjectFromANGLE();
1028 if (!d3d11_device) { 1038 if (!d3d11_device) {
1029 DLOG(ERROR) << "Failing to detect HDR, couldn't retrieve D3D11 " 1039 DLOG(ERROR) << "Failing to detect HDR, couldn't retrieve D3D11 "
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 bool DirectCompositionSurfaceWin::OnMakeCurrent(gl::GLContext* context) { 1203 bool DirectCompositionSurfaceWin::OnMakeCurrent(gl::GLContext* context) {
1194 if (root_surface_) 1204 if (root_surface_)
1195 return root_surface_->OnMakeCurrent(context); 1205 return root_surface_->OnMakeCurrent(context);
1196 return true; 1206 return true;
1197 } 1207 }
1198 1208
1199 bool DirectCompositionSurfaceWin::SupportsDCLayers() const { 1209 bool DirectCompositionSurfaceWin::SupportsDCLayers() const {
1200 return true; 1210 return true;
1201 } 1211 }
1202 1212
1213 bool DirectCompositionSurfaceWin::UseOverlaysForVideo() const {
1214 return AreOverlaysSupported();
1215 }
1216
1203 bool DirectCompositionSurfaceWin::SetDrawRectangle(const gfx::Rect& rectangle) { 1217 bool DirectCompositionSurfaceWin::SetDrawRectangle(const gfx::Rect& rectangle) {
1204 if (root_surface_) 1218 if (root_surface_)
1205 return root_surface_->SetDrawRectangle(rectangle); 1219 return root_surface_->SetDrawRectangle(rectangle);
1206 return false; 1220 return false;
1207 } 1221 }
1208 1222
1209 gfx::Vector2d DirectCompositionSurfaceWin::GetDrawOffset() const { 1223 gfx::Vector2d DirectCompositionSurfaceWin::GetDrawOffset() const {
1210 if (root_surface_) 1224 if (root_surface_)
1211 return root_surface_->GetDrawOffset(); 1225 return root_surface_->GetDrawOffset();
1212 return gfx::Vector2d(); 1226 return gfx::Vector2d();
(...skipping 24 matching lines...) Expand all
1237 DirectCompositionSurfaceWin::GetWindowTaskRunnerForTesting() { 1251 DirectCompositionSurfaceWin::GetWindowTaskRunnerForTesting() {
1238 return child_window_.GetTaskRunnerForTesting(); 1252 return child_window_.GetTaskRunnerForTesting();
1239 } 1253 }
1240 1254
1241 base::win::ScopedComPtr<IDXGISwapChain1> 1255 base::win::ScopedComPtr<IDXGISwapChain1>
1242 DirectCompositionSurfaceWin::GetLayerSwapChainForTesting(size_t index) const { 1256 DirectCompositionSurfaceWin::GetLayerSwapChainForTesting(size_t index) const {
1243 return layer_tree_->GetLayerSwapChainForTesting(index); 1257 return layer_tree_->GetLayerSwapChainForTesting(index);
1244 } 1258 }
1245 1259
1246 } // namespace gpu 1260 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/service/direct_composition_surface_win.h ('k') | gpu/ipc/service/gpu_init.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698