| 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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 base::win::ScopedComPtr<ID3D11Texture2D> src_texture; | 489 base::win::ScopedComPtr<ID3D11Texture2D> src_texture; |
| 490 hr = swap_chain_->GetBuffer(1, IID_PPV_ARGS(src_texture.Receive())); | 490 hr = swap_chain_->GetBuffer(1, IID_PPV_ARGS(src_texture.Receive())); |
| 491 DCHECK(SUCCEEDED(hr)); | 491 DCHECK(SUCCEEDED(hr)); |
| 492 base::win::ScopedComPtr<ID3D11DeviceContext> context; | 492 base::win::ScopedComPtr<ID3D11DeviceContext> context; |
| 493 d3d11_device_->GetImmediateContext(context.Receive()); | 493 d3d11_device_->GetImmediateContext(context.Receive()); |
| 494 context->CopyResource(dest_texture.get(), src_texture.get()); | 494 context->CopyResource(dest_texture.get(), src_texture.get()); |
| 495 } | 495 } |
| 496 | 496 |
| 497 swap_chain_->Present(1, 0); | 497 swap_chain_->Present(1, 0); |
| 498 | 498 |
| 499 UMA_HISTOGRAM_BOOLEAN("GPU.DirectComposition.SwapchainFormat", |
| 500 is_yuy2_swapchain_); |
| 499 frames_since_color_space_change_++; | 501 frames_since_color_space_change_++; |
| 500 | 502 |
| 501 base::win::ScopedComPtr<IDXGISwapChainMedia> swap_chain_media; | 503 base::win::ScopedComPtr<IDXGISwapChainMedia> swap_chain_media; |
| 502 if (SUCCEEDED(swap_chain_.QueryInterface(swap_chain_media.Receive()))) { | 504 if (SUCCEEDED(swap_chain_.QueryInterface(swap_chain_media.Receive()))) { |
| 503 DXGI_FRAME_STATISTICS_MEDIA stats = {}; | 505 DXGI_FRAME_STATISTICS_MEDIA stats = {}; |
| 504 if (SUCCEEDED(swap_chain_media->GetFrameStatisticsMedia(&stats))) { | 506 if (SUCCEEDED(swap_chain_media->GetFrameStatisticsMedia(&stats))) { |
| 505 UMA_HISTOGRAM_SPARSE_SLOWLY("GPU.DirectComposition.CompositionMode", | 507 UMA_HISTOGRAM_SPARSE_SLOWLY("GPU.DirectComposition.CompositionMode", |
| 506 stats.CompositionMode); | 508 stats.CompositionMode); |
| 507 presentation_history_.AddSample(stats.CompositionMode); | 509 presentation_history_.AddSample(stats.CompositionMode); |
| 508 } | 510 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 DLOG(ERROR) << "YUY2 creation failed with " << std::hex << hr | 586 DLOG(ERROR) << "YUY2 creation failed with " << std::hex << hr |
| 585 << ". Falling back to BGRA"; | 587 << ". Falling back to BGRA"; |
| 586 } | 588 } |
| 587 desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; | 589 desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; |
| 588 desc.Flags = 0; | 590 desc.Flags = 0; |
| 589 hr = media_factory->CreateSwapChainForCompositionSurfaceHandle( | 591 hr = media_factory->CreateSwapChainForCompositionSurfaceHandle( |
| 590 d3d11_device_.get(), swap_chain_handle_.Get(), &desc, nullptr, | 592 d3d11_device_.get(), swap_chain_handle_.Get(), &desc, nullptr, |
| 591 swap_chain_.Receive()); | 593 swap_chain_.Receive()); |
| 592 CHECK(SUCCEEDED(hr)); | 594 CHECK(SUCCEEDED(hr)); |
| 593 } | 595 } |
| 594 UMA_HISTOGRAM_BOOLEAN("GPU.DirectComposition.SwapchainFormat", | |
| 595 is_yuy2_swapchain_); | |
| 596 out_view_.Reset(); | 596 out_view_.Reset(); |
| 597 } | 597 } |
| 598 | 598 |
| 599 void DCLayerTree::InitVisual(size_t i) { | 599 void DCLayerTree::InitVisual(size_t i) { |
| 600 DCHECK_GT(visual_info_.size(), i); | 600 DCHECK_GT(visual_info_.size(), i); |
| 601 VisualInfo* visual_info = &visual_info_[i]; | 601 VisualInfo* visual_info = &visual_info_[i]; |
| 602 if (visual_info->content_visual) | 602 if (visual_info->content_visual) |
| 603 return; | 603 return; |
| 604 DCHECK(!visual_info->clip_visual); | 604 DCHECK(!visual_info->clip_visual); |
| 605 base::win::ScopedComPtr<IDCompositionVisual2> visual; | 605 base::win::ScopedComPtr<IDCompositionVisual2> visual; |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 DirectCompositionSurfaceWin::GetWindowTaskRunnerForTesting() { | 1157 DirectCompositionSurfaceWin::GetWindowTaskRunnerForTesting() { |
| 1158 return child_window_.GetTaskRunnerForTesting(); | 1158 return child_window_.GetTaskRunnerForTesting(); |
| 1159 } | 1159 } |
| 1160 | 1160 |
| 1161 base::win::ScopedComPtr<IDXGISwapChain1> | 1161 base::win::ScopedComPtr<IDXGISwapChain1> |
| 1162 DirectCompositionSurfaceWin::GetLayerSwapChainForTesting(size_t index) const { | 1162 DirectCompositionSurfaceWin::GetLayerSwapChainForTesting(size_t index) const { |
| 1163 return layer_tree_->GetLayerSwapChainForTesting(index); | 1163 return layer_tree_->GetLayerSwapChainForTesting(index); |
| 1164 } | 1164 } |
| 1165 | 1165 |
| 1166 } // namespace gpu | 1166 } // namespace gpu |
| OLD | NEW |