| 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 <d3d11_1.h> | 7 #include <d3d11_1.h> |
| 8 #include <dcomptypes.h> | 8 #include <dcomptypes.h> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/optional.h" | 11 #include "base/optional.h" |
| 12 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
| 13 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
| 14 #include "base/win/scoped_handle.h" | 14 #include "base/win/scoped_handle.h" |
| 15 #include "base/win/windows_version.h" |
| 15 #include "gpu/ipc/service/gpu_channel_manager.h" | 16 #include "gpu/ipc/service/gpu_channel_manager.h" |
| 16 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" | 17 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" |
| 17 #include "gpu/ipc/service/switches.h" | 18 #include "gpu/ipc/service/switches.h" |
| 18 #include "ui/display/display_switches.h" | 19 #include "ui/display/display_switches.h" |
| 19 #include "ui/gfx/geometry/size_conversions.h" | 20 #include "ui/gfx/geometry/size_conversions.h" |
| 20 #include "ui/gfx/native_widget_types.h" | 21 #include "ui/gfx/native_widget_types.h" |
| 21 #include "ui/gfx/transform.h" | 22 #include "ui/gfx/transform.h" |
| 22 #include "ui/gl/dc_renderer_layer_params.h" | 23 #include "ui/gl/dc_renderer_layer_params.h" |
| 23 #include "ui/gl/egl_util.h" | 24 #include "ui/gl/egl_util.h" |
| 24 #include "ui/gl/gl_angle_util_win.h" | 25 #include "ui/gl/gl_angle_util_win.h" |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 | 628 |
| 628 if (!gl::GLSurfaceEGL::IsDirectCompositionSupported()) | 629 if (!gl::GLSurfaceEGL::IsDirectCompositionSupported()) |
| 629 return false; | 630 return false; |
| 630 | 631 |
| 631 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 632 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 632 if (command_line->HasSwitch(switches::kEnableDirectCompositionLayers)) | 633 if (command_line->HasSwitch(switches::kEnableDirectCompositionLayers)) |
| 633 return true; | 634 return true; |
| 634 if (command_line->HasSwitch(switches::kDisableDirectCompositionLayers)) | 635 if (command_line->HasSwitch(switches::kDisableDirectCompositionLayers)) |
| 635 return false; | 636 return false; |
| 636 | 637 |
| 638 // Before Windows 10 Anniversary Update (Redstone 1), overlay planes |
| 639 // wouldn't be assigned to non-UWP apps. |
| 640 if (base::win::GetVersion() < base::win::VERSION_WIN10_R1) |
| 641 return false; |
| 642 |
| 637 base::win::ScopedComPtr<ID3D11Device> d3d11_device = | 643 base::win::ScopedComPtr<ID3D11Device> d3d11_device = |
| 638 gl::QueryD3D11DeviceObjectFromANGLE(); | 644 gl::QueryD3D11DeviceObjectFromANGLE(); |
| 639 DCHECK(d3d11_device); | 645 DCHECK(d3d11_device); |
| 640 | 646 |
| 641 base::win::ScopedComPtr<IDXGIDevice> dxgi_device; | 647 base::win::ScopedComPtr<IDXGIDevice> dxgi_device; |
| 642 d3d11_device.QueryInterface(dxgi_device.Receive()); | 648 d3d11_device.QueryInterface(dxgi_device.Receive()); |
| 643 base::win::ScopedComPtr<IDXGIAdapter> dxgi_adapter; | 649 base::win::ScopedComPtr<IDXGIAdapter> dxgi_adapter; |
| 644 dxgi_device->GetAdapter(dxgi_adapter.Receive()); | 650 dxgi_device->GetAdapter(dxgi_adapter.Receive()); |
| 645 | 651 |
| 646 unsigned int i = 0; | 652 unsigned int i = 0; |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 gfx::Vector2d DirectCompositionSurfaceWin::GetDrawOffset() const { | 978 gfx::Vector2d DirectCompositionSurfaceWin::GetDrawOffset() const { |
| 973 return draw_offset_; | 979 return draw_offset_; |
| 974 } | 980 } |
| 975 | 981 |
| 976 scoped_refptr<base::TaskRunner> | 982 scoped_refptr<base::TaskRunner> |
| 977 DirectCompositionSurfaceWin::GetWindowTaskRunnerForTesting() { | 983 DirectCompositionSurfaceWin::GetWindowTaskRunnerForTesting() { |
| 978 return child_window_.GetTaskRunnerForTesting(); | 984 return child_window_.GetTaskRunnerForTesting(); |
| 979 } | 985 } |
| 980 | 986 |
| 981 } // namespace gpu | 987 } // namespace gpu |
| OLD | NEW |