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

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

Issue 2958143002: Fix some bugs in the HDR detection code (Closed)
Patch Set: Created 3 years, 5 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 | « no previous file | no next file » | 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 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 // static 992 // static
993 bool DirectCompositionSurfaceWin::AreOverlaysSupported() { 993 bool DirectCompositionSurfaceWin::AreOverlaysSupported() {
994 if (!HardwareSupportsOverlays()) 994 if (!HardwareSupportsOverlays())
995 return false; 995 return false;
996 996
997 return base::FeatureList::IsEnabled(switches::kDirectCompositionOverlays); 997 return base::FeatureList::IsEnabled(switches::kDirectCompositionOverlays);
998 } 998 }
999 999
1000 // static 1000 // static
1001 bool DirectCompositionSurfaceWin::IsHDRSupported() { 1001 bool DirectCompositionSurfaceWin::IsHDRSupported() {
1002 bool hdr_monitor_found = true; 1002 bool hdr_monitor_found = false;
1003 #if defined(ENABLE_HDR_DETECTION) 1003 #if defined(ENABLE_HDR_DETECTION)
1004 base::win::ScopedComPtr<ID3D11Device> d3d11_device = 1004 base::win::ScopedComPtr<ID3D11Device> d3d11_device =
1005 gl::QueryD3D11DeviceObjectFromANGLE(); 1005 gl::QueryD3D11DeviceObjectFromANGLE();
1006 if (!d3d11_device) { 1006 if (!d3d11_device) {
1007 DLOG(ERROR) << "Failing to detect HDR, couldn't retrieve D3D11 " 1007 DLOG(ERROR) << "Failing to detect HDR, couldn't retrieve D3D11 "
1008 << "device from ANGLE."; 1008 << "device from ANGLE.";
1009 return false; 1009 return false;
1010 } 1010 }
1011 base::win::ScopedComPtr<IDXGIDevice> dxgi_device; 1011 base::win::ScopedComPtr<IDXGIDevice> dxgi_device;
1012 d3d11_device.CopyTo(dxgi_device.GetAddressOf()); 1012 d3d11_device.CopyTo(dxgi_device.GetAddressOf());
(...skipping 11 matching lines...) Expand all
1024 1024
1025 DXGI_OUTPUT_DESC1 desc; 1025 DXGI_OUTPUT_DESC1 desc;
1026 if (FAILED(output6->GetDesc1(&desc))) 1026 if (FAILED(output6->GetDesc1(&desc)))
1027 continue; 1027 continue;
1028 1028
1029 UMA_HISTOGRAM_SPARSE_SLOWLY("GPU.Output.ColorSpace", desc.ColorSpace); 1029 UMA_HISTOGRAM_SPARSE_SLOWLY("GPU.Output.ColorSpace", desc.ColorSpace);
1030 UMA_HISTOGRAM_SPARSE_SLOWLY("GPU.Output.MaxLuminance", desc.MaxLuminance); 1030 UMA_HISTOGRAM_SPARSE_SLOWLY("GPU.Output.MaxLuminance", desc.MaxLuminance);
1031 1031
1032 if (desc.ColorSpace == DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020) { 1032 if (desc.ColorSpace == DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020) {
1033 hdr_monitor_found = true; 1033 hdr_monitor_found = true;
1034 return true;
1035 } 1034 }
1036 } 1035 }
1037 UMA_HISTOGRAM_BOOLEAN("GPU.Output.HDR", hdr_monitor_found); 1036 UMA_HISTOGRAM_BOOLEAN("GPU.Output.HDR", hdr_monitor_found);
1037 #endif
1038 return hdr_monitor_found; 1038 return hdr_monitor_found;
1039 #else
1040 return false;
1041 #endif
1042 } 1039 }
1043 1040
1044 bool DirectCompositionSurfaceWin::InitializeNativeWindow() { 1041 bool DirectCompositionSurfaceWin::InitializeNativeWindow() {
1045 if (window_) 1042 if (window_)
1046 return true; 1043 return true;
1047 1044
1048 bool result = child_window_.Initialize(); 1045 bool result = child_window_.Initialize();
1049 window_ = child_window_.window(); 1046 window_ = child_window_.window();
1050 return result; 1047 return result;
1051 } 1048 }
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 DirectCompositionSurfaceWin::GetWindowTaskRunnerForTesting() { 1215 DirectCompositionSurfaceWin::GetWindowTaskRunnerForTesting() {
1219 return child_window_.GetTaskRunnerForTesting(); 1216 return child_window_.GetTaskRunnerForTesting();
1220 } 1217 }
1221 1218
1222 base::win::ScopedComPtr<IDXGISwapChain1> 1219 base::win::ScopedComPtr<IDXGISwapChain1>
1223 DirectCompositionSurfaceWin::GetLayerSwapChainForTesting(size_t index) const { 1220 DirectCompositionSurfaceWin::GetLayerSwapChainForTesting(size_t index) const {
1224 return layer_tree_->GetLayerSwapChainForTesting(index); 1221 return layer_tree_->GetLayerSwapChainForTesting(index);
1225 } 1222 }
1226 1223
1227 } // namespace gpu 1224 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698