| 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 <deque> | 10 #include <deque> |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 // Before Windows 10 Anniversary Update (Redstone 1), overlay planes | 118 // Before Windows 10 Anniversary Update (Redstone 1), overlay planes |
| 119 // wouldn't be assigned to non-UWP apps. | 119 // wouldn't be assigned to non-UWP apps. |
| 120 if (base::win::GetVersion() < base::win::VERSION_WIN10_R1) | 120 if (base::win::GetVersion() < base::win::VERSION_WIN10_R1) |
| 121 return false; | 121 return false; |
| 122 | 122 |
| 123 base::win::ScopedComPtr<ID3D11Device> d3d11_device = | 123 base::win::ScopedComPtr<ID3D11Device> d3d11_device = |
| 124 gl::QueryD3D11DeviceObjectFromANGLE(); | 124 gl::QueryD3D11DeviceObjectFromANGLE(); |
| 125 DCHECK(d3d11_device); | 125 DCHECK(d3d11_device); |
| 126 | 126 |
| 127 base::win::ScopedComPtr<IDXGIDevice> dxgi_device; | 127 base::win::ScopedComPtr<IDXGIDevice> dxgi_device; |
| 128 d3d11_device.QueryInterface(dxgi_device.Receive()); | 128 d3d11_device.CopyTo(dxgi_device.Receive()); |
| 129 base::win::ScopedComPtr<IDXGIAdapter> dxgi_adapter; | 129 base::win::ScopedComPtr<IDXGIAdapter> dxgi_adapter; |
| 130 dxgi_device->GetAdapter(dxgi_adapter.Receive()); | 130 dxgi_device->GetAdapter(dxgi_adapter.Receive()); |
| 131 | 131 |
| 132 unsigned int i = 0; | 132 unsigned int i = 0; |
| 133 while (true) { | 133 while (true) { |
| 134 base::win::ScopedComPtr<IDXGIOutput> output; | 134 base::win::ScopedComPtr<IDXGIOutput> output; |
| 135 if (FAILED(dxgi_adapter->EnumOutputs(i++, output.Receive()))) | 135 if (FAILED(dxgi_adapter->EnumOutputs(i++, output.Receive()))) |
| 136 break; | 136 break; |
| 137 base::win::ScopedComPtr<IDXGIOutput3> output3; | 137 base::win::ScopedComPtr<IDXGIOutput3> output3; |
| 138 if (FAILED(output.QueryInterface(output3.Receive()))) | 138 if (FAILED(output.CopyTo(output3.Receive()))) |
| 139 continue; | 139 continue; |
| 140 | 140 |
| 141 UINT flags = 0; | 141 UINT flags = 0; |
| 142 if (FAILED(output3->CheckOverlaySupport(DXGI_FORMAT_YUY2, | 142 if (FAILED(output3->CheckOverlaySupport(DXGI_FORMAT_YUY2, |
| 143 d3d11_device.Get(), &flags))) | 143 d3d11_device.Get(), &flags))) |
| 144 continue; | 144 continue; |
| 145 | 145 |
| 146 // Direct-only support might be ok in some circumstances, but since the | 146 // Direct-only support might be ok in some circumstances, but since the |
| 147 // overlay processor isn't set up to try to distinguish, only try to use | 147 // overlay processor isn't set up to try to distinguish, only try to use |
| 148 // overlays when scaling's enabled. | 148 // overlays when scaling's enabled. |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 video_processor_enumerator_; | 290 video_processor_enumerator_; |
| 291 base::win::ScopedComPtr<ID3D11VideoDevice> video_device_; | 291 base::win::ScopedComPtr<ID3D11VideoDevice> video_device_; |
| 292 base::win::ScopedComPtr<ID3D11VideoContext> video_context_; | 292 base::win::ScopedComPtr<ID3D11VideoContext> video_context_; |
| 293 | 293 |
| 294 base::win::ScopedHandle swap_chain_handle_; | 294 base::win::ScopedHandle swap_chain_handle_; |
| 295 | 295 |
| 296 DISALLOW_COPY_AND_ASSIGN(SwapChainPresenter); | 296 DISALLOW_COPY_AND_ASSIGN(SwapChainPresenter); |
| 297 }; | 297 }; |
| 298 | 298 |
| 299 bool DCLayerTree::Initialize(HWND window) { | 299 bool DCLayerTree::Initialize(HWND window) { |
| 300 d3d11_device_.QueryInterface(video_device_.Receive()); | 300 d3d11_device_.CopyTo(video_device_.Receive()); |
| 301 base::win::ScopedComPtr<ID3D11DeviceContext> context; | 301 base::win::ScopedComPtr<ID3D11DeviceContext> context; |
| 302 d3d11_device_->GetImmediateContext(context.Receive()); | 302 d3d11_device_->GetImmediateContext(context.Receive()); |
| 303 context.QueryInterface(video_context_.Receive()); | 303 context.CopyTo(video_context_.Receive()); |
| 304 | 304 |
| 305 base::win::ScopedComPtr<IDCompositionDesktopDevice> desktop_device; | 305 base::win::ScopedComPtr<IDCompositionDesktopDevice> desktop_device; |
| 306 dcomp_device_.QueryInterface(desktop_device.Receive()); | 306 dcomp_device_.CopyTo(desktop_device.Receive()); |
| 307 | 307 |
| 308 HRESULT hr = desktop_device->CreateTargetForHwnd(window, TRUE, | 308 HRESULT hr = desktop_device->CreateTargetForHwnd(window, TRUE, |
| 309 dcomp_target_.Receive()); | 309 dcomp_target_.Receive()); |
| 310 if (FAILED(hr)) | 310 if (FAILED(hr)) |
| 311 return false; | 311 return false; |
| 312 | 312 |
| 313 hr = dcomp_device_->CreateVisual(root_visual_.Receive()); | 313 hr = dcomp_device_->CreateVisual(root_visual_.Receive()); |
| 314 if (FAILED(hr)) | 314 if (FAILED(hr)) |
| 315 return false; | 315 return false; |
| 316 | 316 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 DCLayerTree::GetLayerSwapChainForTesting(size_t index) const { | 352 DCLayerTree::GetLayerSwapChainForTesting(size_t index) const { |
| 353 if (index >= visual_info_.size()) | 353 if (index >= visual_info_.size()) |
| 354 return base::win::ScopedComPtr<IDXGISwapChain1>(); | 354 return base::win::ScopedComPtr<IDXGISwapChain1>(); |
| 355 return visual_info_[index].swap_chain; | 355 return visual_info_[index].swap_chain; |
| 356 } | 356 } |
| 357 | 357 |
| 358 DCLayerTree::SwapChainPresenter::SwapChainPresenter( | 358 DCLayerTree::SwapChainPresenter::SwapChainPresenter( |
| 359 DCLayerTree* surface, | 359 DCLayerTree* surface, |
| 360 base::win::ScopedComPtr<ID3D11Device> d3d11_device) | 360 base::win::ScopedComPtr<ID3D11Device> d3d11_device) |
| 361 : surface_(surface), d3d11_device_(d3d11_device) { | 361 : surface_(surface), d3d11_device_(d3d11_device) { |
| 362 d3d11_device_.QueryInterface(video_device_.Receive()); | 362 d3d11_device_.CopyTo(video_device_.Receive()); |
| 363 base::win::ScopedComPtr<ID3D11DeviceContext> context; | 363 base::win::ScopedComPtr<ID3D11DeviceContext> context; |
| 364 d3d11_device_->GetImmediateContext(context.Receive()); | 364 d3d11_device_->GetImmediateContext(context.Receive()); |
| 365 context.QueryInterface(video_context_.Receive()); | 365 context.CopyTo(video_context_.Receive()); |
| 366 HMODULE dcomp = ::GetModuleHandleA("dcomp.dll"); | 366 HMODULE dcomp = ::GetModuleHandleA("dcomp.dll"); |
| 367 CHECK(dcomp); | 367 CHECK(dcomp); |
| 368 create_surface_handle_function_ = | 368 create_surface_handle_function_ = |
| 369 reinterpret_cast<PFN_DCOMPOSITION_CREATE_SURFACE_HANDLE>( | 369 reinterpret_cast<PFN_DCOMPOSITION_CREATE_SURFACE_HANDLE>( |
| 370 GetProcAddress(dcomp, "DCompositionCreateSurfaceHandle")); | 370 GetProcAddress(dcomp, "DCompositionCreateSurfaceHandle")); |
| 371 CHECK(create_surface_handle_function_); | 371 CHECK(create_surface_handle_function_); |
| 372 } | 372 } |
| 373 | 373 |
| 374 DCLayerTree::SwapChainPresenter::~SwapChainPresenter() {} | 374 DCLayerTree::SwapChainPresenter::~SwapChainPresenter() {} |
| 375 | 375 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 out_desc.Texture2D.MipSlice = 0; | 440 out_desc.Texture2D.MipSlice = 0; |
| 441 HRESULT hr = video_device_->CreateVideoProcessorOutputView( | 441 HRESULT hr = video_device_->CreateVideoProcessorOutputView( |
| 442 texture.Get(), video_processor_enumerator_.Get(), &out_desc, | 442 texture.Get(), video_processor_enumerator_.Get(), &out_desc, |
| 443 out_view_.Receive()); | 443 out_view_.Receive()); |
| 444 CHECK(SUCCEEDED(hr)); | 444 CHECK(SUCCEEDED(hr)); |
| 445 } | 445 } |
| 446 | 446 |
| 447 // TODO(jbauman): Use correct colorspace. | 447 // TODO(jbauman): Use correct colorspace. |
| 448 gfx::ColorSpace src_color_space = gfx::ColorSpace::CreateREC709(); | 448 gfx::ColorSpace src_color_space = gfx::ColorSpace::CreateREC709(); |
| 449 base::win::ScopedComPtr<ID3D11VideoContext1> context1; | 449 base::win::ScopedComPtr<ID3D11VideoContext1> context1; |
| 450 if (SUCCEEDED(video_context_.QueryInterface(context1.Receive()))) { | 450 if (SUCCEEDED(video_context_.CopyTo(context1.Receive()))) { |
| 451 context1->VideoProcessorSetStreamColorSpace1( | 451 context1->VideoProcessorSetStreamColorSpace1( |
| 452 video_processor_.Get(), 0, | 452 video_processor_.Get(), 0, |
| 453 gfx::ColorSpaceWin::GetDXGIColorSpace(src_color_space)); | 453 gfx::ColorSpaceWin::GetDXGIColorSpace(src_color_space)); |
| 454 } else { | 454 } else { |
| 455 // This can't handle as many different types of color spaces, so use it | 455 // This can't handle as many different types of color spaces, so use it |
| 456 // only if ID3D11VideoContext1 isn't available. | 456 // only if ID3D11VideoContext1 isn't available. |
| 457 D3D11_VIDEO_PROCESSOR_COLOR_SPACE color_space = | 457 D3D11_VIDEO_PROCESSOR_COLOR_SPACE color_space = |
| 458 gfx::ColorSpaceWin::GetD3D11ColorSpace(src_color_space); | 458 gfx::ColorSpaceWin::GetD3D11ColorSpace(src_color_space); |
| 459 video_context_->VideoProcessorSetStreamColorSpace(video_processor_.Get(), 0, | 459 video_context_->VideoProcessorSetStreamColorSpace(video_processor_.Get(), 0, |
| 460 &color_space); | 460 &color_space); |
| 461 } | 461 } |
| 462 | 462 |
| 463 gfx::ColorSpace output_color_space = | 463 gfx::ColorSpace output_color_space = |
| 464 is_yuy2_swapchain_ ? src_color_space : gfx::ColorSpace::CreateSRGB(); | 464 is_yuy2_swapchain_ ? src_color_space : gfx::ColorSpace::CreateSRGB(); |
| 465 if (base::FeatureList::IsEnabled(kFallbackBT709VideoToBT601) && | 465 if (base::FeatureList::IsEnabled(kFallbackBT709VideoToBT601) && |
| 466 (output_color_space == gfx::ColorSpace::CreateREC709())) { | 466 (output_color_space == gfx::ColorSpace::CreateREC709())) { |
| 467 output_color_space = gfx::ColorSpace::CreateREC601(); | 467 output_color_space = gfx::ColorSpace::CreateREC601(); |
| 468 } | 468 } |
| 469 | 469 |
| 470 base::win::ScopedComPtr<IDXGISwapChain3> swap_chain3; | 470 base::win::ScopedComPtr<IDXGISwapChain3> swap_chain3; |
| 471 if (SUCCEEDED(swap_chain_.QueryInterface(swap_chain3.Receive()))) { | 471 if (SUCCEEDED(swap_chain_.CopyTo(swap_chain3.Receive()))) { |
| 472 DXGI_COLOR_SPACE_TYPE color_space = | 472 DXGI_COLOR_SPACE_TYPE color_space = |
| 473 gfx::ColorSpaceWin::GetDXGIColorSpace(output_color_space); | 473 gfx::ColorSpaceWin::GetDXGIColorSpace(output_color_space); |
| 474 HRESULT hr = swap_chain3->SetColorSpace1(color_space); | 474 HRESULT hr = swap_chain3->SetColorSpace1(color_space); |
| 475 CHECK(SUCCEEDED(hr)); | 475 CHECK(SUCCEEDED(hr)); |
| 476 if (context1) { | 476 if (context1) { |
| 477 context1->VideoProcessorSetOutputColorSpace1(video_processor_.Get(), | 477 context1->VideoProcessorSetOutputColorSpace1(video_processor_.Get(), |
| 478 color_space); | 478 color_space); |
| 479 } else { | 479 } else { |
| 480 D3D11_VIDEO_PROCESSOR_COLOR_SPACE d3d11_color_space = | 480 D3D11_VIDEO_PROCESSOR_COLOR_SPACE d3d11_color_space = |
| 481 gfx::ColorSpaceWin::GetD3D11ColorSpace(output_color_space); | 481 gfx::ColorSpaceWin::GetD3D11ColorSpace(output_color_space); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 context->CopyResource(dest_texture.Get(), src_texture.Get()); | 542 context->CopyResource(dest_texture.Get(), src_texture.Get()); |
| 543 } | 543 } |
| 544 | 544 |
| 545 swap_chain_->Present(1, 0); | 545 swap_chain_->Present(1, 0); |
| 546 | 546 |
| 547 UMA_HISTOGRAM_BOOLEAN("GPU.DirectComposition.SwapchainFormat", | 547 UMA_HISTOGRAM_BOOLEAN("GPU.DirectComposition.SwapchainFormat", |
| 548 is_yuy2_swapchain_); | 548 is_yuy2_swapchain_); |
| 549 frames_since_color_space_change_++; | 549 frames_since_color_space_change_++; |
| 550 | 550 |
| 551 base::win::ScopedComPtr<IDXGISwapChainMedia> swap_chain_media; | 551 base::win::ScopedComPtr<IDXGISwapChainMedia> swap_chain_media; |
| 552 if (SUCCEEDED(swap_chain_.QueryInterface(swap_chain_media.Receive()))) { | 552 if (SUCCEEDED(swap_chain_.CopyTo(swap_chain_media.Receive()))) { |
| 553 DXGI_FRAME_STATISTICS_MEDIA stats = {}; | 553 DXGI_FRAME_STATISTICS_MEDIA stats = {}; |
| 554 if (SUCCEEDED(swap_chain_media->GetFrameStatisticsMedia(&stats))) { | 554 if (SUCCEEDED(swap_chain_media->GetFrameStatisticsMedia(&stats))) { |
| 555 UMA_HISTOGRAM_SPARSE_SLOWLY("GPU.DirectComposition.CompositionMode", | 555 UMA_HISTOGRAM_SPARSE_SLOWLY("GPU.DirectComposition.CompositionMode", |
| 556 stats.CompositionMode); | 556 stats.CompositionMode); |
| 557 presentation_history_.AddSample(stats.CompositionMode); | 557 presentation_history_.AddSample(stats.CompositionMode); |
| 558 } | 558 } |
| 559 } | 559 } |
| 560 } | 560 } |
| 561 | 561 |
| 562 bool DCLayerTree::SwapChainPresenter::InitializeVideoProcessor( | 562 bool DCLayerTree::SwapChainPresenter::InitializeVideoProcessor( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 575 // recreated if the enumerator is. | 575 // recreated if the enumerator is. |
| 576 out_view_.Reset(); | 576 out_view_.Reset(); |
| 577 return true; | 577 return true; |
| 578 } | 578 } |
| 579 | 579 |
| 580 void DCLayerTree::SwapChainPresenter::ReallocateSwapChain(bool yuy2) { | 580 void DCLayerTree::SwapChainPresenter::ReallocateSwapChain(bool yuy2) { |
| 581 TRACE_EVENT0("gpu", "DCLayerTree::SwapChainPresenter::ReallocateSwapChain"); | 581 TRACE_EVENT0("gpu", "DCLayerTree::SwapChainPresenter::ReallocateSwapChain"); |
| 582 DCHECK(!swap_chain_); | 582 DCHECK(!swap_chain_); |
| 583 | 583 |
| 584 base::win::ScopedComPtr<IDXGIDevice> dxgi_device; | 584 base::win::ScopedComPtr<IDXGIDevice> dxgi_device; |
| 585 d3d11_device_.QueryInterface(dxgi_device.Receive()); | 585 d3d11_device_.CopyTo(dxgi_device.Receive()); |
| 586 base::win::ScopedComPtr<IDXGIAdapter> dxgi_adapter; | 586 base::win::ScopedComPtr<IDXGIAdapter> dxgi_adapter; |
| 587 dxgi_device->GetAdapter(dxgi_adapter.Receive()); | 587 dxgi_device->GetAdapter(dxgi_adapter.Receive()); |
| 588 base::win::ScopedComPtr<IDXGIFactory2> dxgi_factory; | 588 base::win::ScopedComPtr<IDXGIFactory2> dxgi_factory; |
| 589 dxgi_adapter->GetParent(IID_PPV_ARGS(dxgi_factory.Receive())); | 589 dxgi_adapter->GetParent(IID_PPV_ARGS(dxgi_factory.Receive())); |
| 590 | 590 |
| 591 base::win::ScopedComPtr<IDXGIFactoryMedia> media_factory; | 591 base::win::ScopedComPtr<IDXGIFactoryMedia> media_factory; |
| 592 dxgi_factory.QueryInterface(media_factory.Receive()); | 592 dxgi_factory.CopyTo(media_factory.Receive()); |
| 593 DXGI_SWAP_CHAIN_DESC1 desc = {}; | 593 DXGI_SWAP_CHAIN_DESC1 desc = {}; |
| 594 desc.Width = swap_chain_size_.width(); | 594 desc.Width = swap_chain_size_.width(); |
| 595 desc.Height = swap_chain_size_.height(); | 595 desc.Height = swap_chain_size_.height(); |
| 596 desc.Format = DXGI_FORMAT_YUY2; | 596 desc.Format = DXGI_FORMAT_YUY2; |
| 597 desc.Stereo = FALSE; | 597 desc.Stereo = FALSE; |
| 598 desc.SampleDesc.Count = 1; | 598 desc.SampleDesc.Count = 1; |
| 599 desc.BufferCount = 2; | 599 desc.BufferCount = 2; |
| 600 desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; | 600 desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; |
| 601 desc.Scaling = DXGI_SCALING_STRETCH; | 601 desc.Scaling = DXGI_SCALING_STRETCH; |
| 602 desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; | 602 desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 // become transparent. | 914 // become transparent. |
| 915 HRESULT hr = dcomp_device_->CreateSurface( | 915 HRESULT hr = dcomp_device_->CreateSurface( |
| 916 size_.width(), size_.height(), output_format, | 916 size_.width(), size_.height(), output_format, |
| 917 DXGI_ALPHA_MODE_PREMULTIPLIED, dcomp_surface_.Receive()); | 917 DXGI_ALPHA_MODE_PREMULTIPLIED, dcomp_surface_.Receive()); |
| 918 has_been_rendered_to_ = false; | 918 has_been_rendered_to_ = false; |
| 919 CHECK(SUCCEEDED(hr)); | 919 CHECK(SUCCEEDED(hr)); |
| 920 } else { | 920 } else { |
| 921 DXGI_ALPHA_MODE alpha_mode = | 921 DXGI_ALPHA_MODE alpha_mode = |
| 922 has_alpha_ ? DXGI_ALPHA_MODE_PREMULTIPLIED : DXGI_ALPHA_MODE_IGNORE; | 922 has_alpha_ ? DXGI_ALPHA_MODE_PREMULTIPLIED : DXGI_ALPHA_MODE_IGNORE; |
| 923 base::win::ScopedComPtr<IDXGIDevice> dxgi_device; | 923 base::win::ScopedComPtr<IDXGIDevice> dxgi_device; |
| 924 d3d11_device_.QueryInterface(dxgi_device.Receive()); | 924 d3d11_device_.CopyTo(dxgi_device.Receive()); |
| 925 base::win::ScopedComPtr<IDXGIAdapter> dxgi_adapter; | 925 base::win::ScopedComPtr<IDXGIAdapter> dxgi_adapter; |
| 926 dxgi_device->GetAdapter(dxgi_adapter.Receive()); | 926 dxgi_device->GetAdapter(dxgi_adapter.Receive()); |
| 927 base::win::ScopedComPtr<IDXGIFactory2> dxgi_factory; | 927 base::win::ScopedComPtr<IDXGIFactory2> dxgi_factory; |
| 928 dxgi_adapter->GetParent(IID_PPV_ARGS(dxgi_factory.Receive())); | 928 dxgi_adapter->GetParent(IID_PPV_ARGS(dxgi_factory.Receive())); |
| 929 | 929 |
| 930 DXGI_SWAP_CHAIN_DESC1 desc = {}; | 930 DXGI_SWAP_CHAIN_DESC1 desc = {}; |
| 931 desc.Width = size_.width(); | 931 desc.Width = size_.width(); |
| 932 desc.Height = size_.height(); | 932 desc.Height = size_.height(); |
| 933 desc.Format = output_format; | 933 desc.Format = output_format; |
| 934 desc.Stereo = FALSE; | 934 desc.Stereo = FALSE; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 961 DXGI_PRESENT_PARAMETERS params = {}; | 961 DXGI_PRESENT_PARAMETERS params = {}; |
| 962 RECT dirty_rect = swap_rect_.ToRECT(); | 962 RECT dirty_rect = swap_rect_.ToRECT(); |
| 963 params.DirtyRectsCount = 1; | 963 params.DirtyRectsCount = 1; |
| 964 params.pDirtyRects = &dirty_rect; | 964 params.pDirtyRects = &dirty_rect; |
| 965 swap_chain_->Present1(first_swap_ ? 0 : 1, 0, ¶ms); | 965 swap_chain_->Present1(first_swap_ ? 0 : 1, 0, ¶ms); |
| 966 if (first_swap_) { | 966 if (first_swap_) { |
| 967 // Wait for the GPU to finish executing its commands before | 967 // Wait for the GPU to finish executing its commands before |
| 968 // committing the DirectComposition tree, or else the swapchain | 968 // committing the DirectComposition tree, or else the swapchain |
| 969 // may flicker black when it's first presented. | 969 // may flicker black when it's first presented. |
| 970 base::win::ScopedComPtr<IDXGIDevice2> dxgi_device2; | 970 base::win::ScopedComPtr<IDXGIDevice2> dxgi_device2; |
| 971 HRESULT hr = d3d11_device_.QueryInterface(dxgi_device2.Receive()); | 971 HRESULT hr = d3d11_device_.CopyTo(dxgi_device2.Receive()); |
| 972 DCHECK(SUCCEEDED(hr)); | 972 DCHECK(SUCCEEDED(hr)); |
| 973 base::WaitableEvent event( | 973 base::WaitableEvent event( |
| 974 base::WaitableEvent::ResetPolicy::AUTOMATIC, | 974 base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 975 base::WaitableEvent::InitialState::NOT_SIGNALED); | 975 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 976 dxgi_device2->EnqueueSetEvent(event.handle()); | 976 dxgi_device2->EnqueueSetEvent(event.handle()); |
| 977 event.Wait(); | 977 event.Wait(); |
| 978 first_swap_ = false; | 978 first_swap_ = false; |
| 979 } | 979 } |
| 980 } | 980 } |
| 981 } | 981 } |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1170 DirectCompositionSurfaceWin::GetWindowTaskRunnerForTesting() { | 1170 DirectCompositionSurfaceWin::GetWindowTaskRunnerForTesting() { |
| 1171 return child_window_.GetTaskRunnerForTesting(); | 1171 return child_window_.GetTaskRunnerForTesting(); |
| 1172 } | 1172 } |
| 1173 | 1173 |
| 1174 base::win::ScopedComPtr<IDXGISwapChain1> | 1174 base::win::ScopedComPtr<IDXGISwapChain1> |
| 1175 DirectCompositionSurfaceWin::GetLayerSwapChainForTesting(size_t index) const { | 1175 DirectCompositionSurfaceWin::GetLayerSwapChainForTesting(size_t index) const { |
| 1176 return layer_tree_->GetLayerSwapChainForTesting(index); | 1176 return layer_tree_->GetLayerSwapChainForTesting(index); |
| 1177 } | 1177 } |
| 1178 | 1178 |
| 1179 } // namespace gpu | 1179 } // namespace gpu |
| OLD | NEW |