OLD | NEW |
---|---|
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 "base/optional.h" | 7 #include "base/optional.h" |
8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
9 #include "base/win/windows_version.h" | |
9 #include "gpu/ipc/service/gpu_channel_manager.h" | 10 #include "gpu/ipc/service/gpu_channel_manager.h" |
10 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" | 11 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" |
11 #include "gpu/ipc/service/switches.h" | 12 #include "gpu/ipc/service/switches.h" |
12 #include "ui/display/display_switches.h" | 13 #include "ui/display/display_switches.h" |
13 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
14 #include "ui/gl/egl_util.h" | 15 #include "ui/gl/egl_util.h" |
15 #include "ui/gl/gl_angle_util_win.h" | 16 #include "ui/gl/gl_angle_util_win.h" |
16 #include "ui/gl/gl_context.h" | 17 #include "ui/gl/gl_context.h" |
17 #include "ui/gl/gl_surface_egl.h" | 18 #include "ui/gl/gl_surface_egl.h" |
18 #include "ui/gl/scoped_make_current.h" | 19 #include "ui/gl/scoped_make_current.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 // static | 68 // static |
68 bool DirectCompositionSurfaceWin::AreOverlaysSupported() { | 69 bool DirectCompositionSurfaceWin::AreOverlaysSupported() { |
69 if (!base::FeatureList::IsEnabled(switches::kDirectCompositionOverlays)) | 70 if (!base::FeatureList::IsEnabled(switches::kDirectCompositionOverlays)) |
70 return false; | 71 return false; |
71 | 72 |
72 if (!gl::GLSurfaceEGL::IsDirectCompositionSupported()) | 73 if (!gl::GLSurfaceEGL::IsDirectCompositionSupported()) |
73 return false; | 74 return false; |
74 | 75 |
75 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 76 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
76 if (command_line->HasSwitch(switches::kEnableDirectCompositionLayers)) | 77 if (command_line->HasSwitch(switches::kEnableDirectCompositionLayers)) |
77 return true; | 78 return true; |
scottmg
2017/03/29 03:16:02
Did you mean to put it after this line?
jbauman
2017/03/29 18:55:36
Yes, this switch allows us to test the directcompo
| |
78 if (command_line->HasSwitch(switches::kDisableDirectCompositionLayers)) | 79 if (command_line->HasSwitch(switches::kDisableDirectCompositionLayers)) |
79 return false; | 80 return false; |
80 | 81 |
82 // Before Windows 10 Anniversary Update (Redstone 1), overlay planes | |
83 // wouldn't be assigned to non-UWP apps. | |
84 if (base::win::GetVersion() < base::win::VERSION_WIN10_R1) | |
85 return false; | |
86 | |
81 base::win::ScopedComPtr<ID3D11Device> d3d11_device = | 87 base::win::ScopedComPtr<ID3D11Device> d3d11_device = |
82 gl::QueryD3D11DeviceObjectFromANGLE(); | 88 gl::QueryD3D11DeviceObjectFromANGLE(); |
83 DCHECK(d3d11_device); | 89 DCHECK(d3d11_device); |
84 | 90 |
85 base::win::ScopedComPtr<IDXGIDevice> dxgi_device; | 91 base::win::ScopedComPtr<IDXGIDevice> dxgi_device; |
86 d3d11_device.QueryInterface(dxgi_device.Receive()); | 92 d3d11_device.QueryInterface(dxgi_device.Receive()); |
87 base::win::ScopedComPtr<IDXGIAdapter> dxgi_adapter; | 93 base::win::ScopedComPtr<IDXGIAdapter> dxgi_adapter; |
88 dxgi_device->GetAdapter(dxgi_adapter.Receive()); | 94 dxgi_device->GetAdapter(dxgi_adapter.Receive()); |
89 | 95 |
90 unsigned int i = 0; | 96 unsigned int i = 0; |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
455 transform(transform), | 461 transform(transform), |
456 image(image), | 462 image(image), |
457 bounds_rect(bounds_rect), | 463 bounds_rect(bounds_rect), |
458 crop_rect(crop_rect) {} | 464 crop_rect(crop_rect) {} |
459 | 465 |
460 DirectCompositionSurfaceWin::Overlay::Overlay(const Overlay& overlay) = default; | 466 DirectCompositionSurfaceWin::Overlay::Overlay(const Overlay& overlay) = default; |
461 | 467 |
462 DirectCompositionSurfaceWin::Overlay::~Overlay() {} | 468 DirectCompositionSurfaceWin::Overlay::~Overlay() {} |
463 | 469 |
464 } // namespace gpu | 470 } // namespace gpu |
OLD | NEW |