Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: gpu/ipc/service/direct_composition_surface_win.cc

Issue 2838013004: Report swap chain format histogram on every swap. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698