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

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

Issue 2799183002: Add UMA histogram about what format of swapchain is created for overlays (Closed)
Patch Set: rebase 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 | tools/metrics/histograms/histograms.xml » ('j') | 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 "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 create_surface_handle_function_(COMPOSITIONOBJECT_ALL_ACCESS, nullptr, 425 create_surface_handle_function_(COMPOSITIONOBJECT_ALL_ACCESS, nullptr,
426 &handle); 426 &handle);
427 swap_chain_handle_.Set(handle); 427 swap_chain_handle_.Set(handle);
428 428
429 // The composition surface handle isn't actually used, but 429 // The composition surface handle isn't actually used, but
430 // CreateSwapChainForComposition can't create YUY2 swapchains. 430 // CreateSwapChainForComposition can't create YUY2 swapchains.
431 HRESULT hr = media_factory->CreateSwapChainForCompositionSurfaceHandle( 431 HRESULT hr = media_factory->CreateSwapChainForCompositionSurfaceHandle(
432 d3d11_device_.get(), swap_chain_handle_.Get(), &desc, nullptr, 432 d3d11_device_.get(), swap_chain_handle_.Get(), &desc, nullptr,
433 swap_chain_.Receive()); 433 swap_chain_.Receive());
434 434
435 bool yuy2_swapchain = true;
436
435 if (FAILED(hr)) { 437 if (FAILED(hr)) {
436 // This should not be hit in production but is a simple fallback for 438 // This should not be hit in production but is a simple fallback for
437 // testing on systems without YUY2 swapchain support. 439 // testing on systems without YUY2 swapchain support.
438 DLOG(ERROR) << "YUY2 creation failed with " << std::hex << hr 440 DLOG(ERROR) << "YUY2 creation failed with " << std::hex << hr
439 << ". Falling back to BGRA"; 441 << ". Falling back to BGRA";
440 desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; 442 desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
441 desc.Flags = 0; 443 desc.Flags = 0;
442 hr = media_factory->CreateSwapChainForCompositionSurfaceHandle( 444 hr = media_factory->CreateSwapChainForCompositionSurfaceHandle(
443 d3d11_device_.get(), swap_chain_handle_.Get(), &desc, nullptr, 445 d3d11_device_.get(), swap_chain_handle_.Get(), &desc, nullptr,
444 swap_chain_.Receive()); 446 swap_chain_.Receive());
445 CHECK(SUCCEEDED(hr)); 447 CHECK(SUCCEEDED(hr));
448 yuy2_swapchain = false;
446 } else { 449 } else {
447 // This is a sensible default colorspace for most videos. 450 // This is a sensible default colorspace for most videos.
448 // TODO(jbauman): Use correct colorspace. 451 // TODO(jbauman): Use correct colorspace.
449 base::win::ScopedComPtr<IDXGISwapChain3> swap_chain3; 452 base::win::ScopedComPtr<IDXGISwapChain3> swap_chain3;
450 swap_chain_.QueryInterface(swap_chain3.Receive()); 453 swap_chain_.QueryInterface(swap_chain3.Receive());
451 hr = swap_chain3->SetColorSpace1( 454 hr = swap_chain3->SetColorSpace1(
452 DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709); 455 DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709);
453 CHECK(SUCCEEDED(hr)); 456 CHECK(SUCCEEDED(hr));
454 } 457 }
458 UMA_HISTOGRAM_BOOLEAN("GPU.DirectComposition.SwapchainFormat",
459 yuy2_swapchain);
455 out_view_.Reset(); 460 out_view_.Reset();
456 } 461 }
457 462
458 void DCLayerTree::InitVisual(size_t i) { 463 void DCLayerTree::InitVisual(size_t i) {
459 DCHECK_GT(visual_info_.size(), i); 464 DCHECK_GT(visual_info_.size(), i);
460 VisualInfo* visual_info = &visual_info_[i]; 465 VisualInfo* visual_info = &visual_info_[i];
461 if (visual_info->content_visual) 466 if (visual_info->content_visual)
462 return; 467 return;
463 DCHECK(!visual_info->clip_visual); 468 DCHECK(!visual_info->clip_visual);
464 base::win::ScopedComPtr<IDCompositionVisual2> visual; 469 base::win::ScopedComPtr<IDCompositionVisual2> visual;
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 DirectCompositionSurfaceWin::GetWindowTaskRunnerForTesting() { 1024 DirectCompositionSurfaceWin::GetWindowTaskRunnerForTesting() {
1020 return child_window_.GetTaskRunnerForTesting(); 1025 return child_window_.GetTaskRunnerForTesting();
1021 } 1026 }
1022 1027
1023 base::win::ScopedComPtr<IDXGISwapChain1> 1028 base::win::ScopedComPtr<IDXGISwapChain1>
1024 DirectCompositionSurfaceWin::GetLayerSwapChainForTesting(size_t index) const { 1029 DirectCompositionSurfaceWin::GetLayerSwapChainForTesting(size_t index) const {
1025 return layer_tree_->GetLayerSwapChainForTesting(index); 1030 return layer_tree_->GetLayerSwapChainForTesting(index);
1026 } 1031 }
1027 1032
1028 } // namespace gpu 1033 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698