| Index: gpu/ipc/service/child_window_surface_win.cc
|
| diff --git a/gpu/ipc/service/child_window_surface_win.cc b/gpu/ipc/service/child_window_surface_win.cc
|
| index 36b65a7ef87af76ecdf644f415717220e0beb837..f428dd0f8948b8c7c2e513a5744d3139caa23c93 100644
|
| --- a/gpu/ipc/service/child_window_surface_win.cc
|
| +++ b/gpu/ipc/service/child_window_surface_win.cc
|
| @@ -4,20 +4,29 @@
|
|
|
| #include "gpu/ipc/service/child_window_surface_win.h"
|
|
|
| +#include <d3d11_1.h>
|
| #include <memory>
|
|
|
| #include "base/compiler_specific.h"
|
| #include "base/memory/ptr_util.h"
|
| +#include "base/metrics/histogram_macros.h"
|
| +#include "base/win/scoped_comptr.h"
|
| #include "gpu/ipc/common/gpu_messages.h"
|
| #include "gpu/ipc/service/gpu_channel_manager.h"
|
| #include "gpu/ipc/service/gpu_channel_manager_delegate.h"
|
| #include "ui/display/display_switches.h"
|
| #include "ui/gfx/native_widget_types.h"
|
| #include "ui/gl/egl_util.h"
|
| +#include "ui/gl/gl_angle_util_win.h"
|
| #include "ui/gl/gl_context.h"
|
| #include "ui/gl/gl_surface_egl.h"
|
| #include "ui/gl/scoped_make_current.h"
|
|
|
| +#if defined(NTDDI_WIN10_RS2)
|
| +#define ENABLE_HDR_DETECTION
|
| +#include <dxgi1_6.h>
|
| +#endif
|
| +
|
| namespace gpu {
|
|
|
| ChildWindowSurfaceWin::ChildWindowSurfaceWin(
|
| @@ -33,6 +42,46 @@ ChildWindowSurfaceWin::ChildWindowSurfaceWin(
|
| enable_fixed_size_angle_ = false;
|
| }
|
|
|
| +bool ChildWindowSurfaceWin::IsHDRSupported() {
|
| +#if defined(ENABLE_HDR_DETECTION)
|
| + base::win::ScopedComPtr<ID3D11Device> d3d11_device =
|
| + gl::QueryD3D11DeviceObjectFromANGLE();
|
| + if (!d3d11_device) {
|
| + DLOG(ERROR) << "Failing to detect HDR, couldn't retrieve D3D11 "
|
| + << "device from ANGLE.";
|
| + return false;
|
| + }
|
| + base::win::ScopedComPtr<IDXGIDevice> dxgi_device;
|
| + d3d11_device.CopyTo(dxgi_device.GetAddressOf());
|
| + base::win::ScopedComPtr<IDXGIAdapter> dxgi_adapter;
|
| + dxgi_device->GetAdapter(dxgi_adapter.GetAddressOf());
|
| +
|
| + unsigned int i = 0;
|
| + while (true) {
|
| + base::win::ScopedComPtr<IDXGIOutput> output;
|
| + if (FAILED(dxgi_adapter->EnumOutputs(i++, output.GetAddressOf())))
|
| + break;
|
| + base::win::ScopedComPtr<IDXGIOutput6> output6;
|
| + if (FAILED(output.CopyTo(output6.GetAddressOf())))
|
| + continue;
|
| +
|
| + DXGI_OUTPUT_DESC1 desc;
|
| + if (FAILED(output6->GetDesc1(&desc)))
|
| + continue;
|
| +
|
| + UMA_HISTOGRAM_SPARSE_SLOWLY("GPU.Output.ColorSpace", desc.ColorSpace);
|
| + UMA_HISTOGRAM_SPARSE_SLOWLY("GPU.Output.MaxLuminance", desc.MaxLuminance);
|
| +
|
| + if (desc.ColorSpace == DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020) {
|
| + UMA_HISTOGRAM_BOOLEAN("GPU.Output.HDR", true);
|
| + return true;
|
| + }
|
| + }
|
| + UMA_HISTOGRAM_BOOLEAN("GPU.Output.HDR", false);
|
| +#endif
|
| + return false;
|
| +}
|
| +
|
| EGLConfig ChildWindowSurfaceWin::GetConfig() {
|
| if (!config_) {
|
| int alpha_size = alpha_ ? 8 : EGL_DONT_CARE;
|
|
|