Commit ea717408 authored by Maggie Chen's avatar Maggie Chen Committed by Commit Bot

Update ShouldUseYUVSwapChain()

When decideing whether a YUV format should be used for swapchain creation,
check the current protected video type instead of the one from the previous
swap chain creation.

Bug: 903552
Change-Id: I028b32dcbcd66763ac8f4220f79fc6674f28bcdf
Reviewed-on: https://chromium-review.googlesource.com/c/1352431
Commit-Queue: Maggie Chen <magchen@chromium.org>
Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611619}
parent cfb90ecb
......@@ -470,7 +470,7 @@ class DCLayerTree::SwapChainPresenter {
// Returns true if YUV swap chain should be preferred over BGRA swap chain.
// This changes over time based on stats recorded in |presentation_history|.
bool ShouldUseYUVSwapChain();
bool ShouldUseYUVSwapChain(ui::ProtectedVideoType protected_video_type);
// Perform a blit using video processor from given input texture to swap chain
// backbuffer. |input_texture| is the input texture (array), and |input_level|
......@@ -664,19 +664,20 @@ DCLayerTree::SwapChainPresenter::SwapChainPresenter(
DCLayerTree::SwapChainPresenter::~SwapChainPresenter() {}
bool DCLayerTree::SwapChainPresenter::ShouldUseYUVSwapChain() {
bool DCLayerTree::SwapChainPresenter::ShouldUseYUVSwapChain(
ui::ProtectedVideoType protected_video_type) {
// TODO(crbug.com/850799): Assess power/perf impact when protected video
// swap chain is composited by DWM.
// Always prefer YUV swap chain for hardware protected video for now.
if (protected_video_type_ == ui::ProtectedVideoType::kHardwareProtected)
if (protected_video_type == ui::ProtectedVideoType::kHardwareProtected)
return true;
// For software protected video, BGRA swap chain is preferred if hardware
// overlay is not supported for better power efficiency.
// Currently, software protected video is the only case that overlay swap
// chain is used when hardware overlay is not suppported.
if (protected_video_type_ == ui::ProtectedVideoType::kSoftwareProtected &&
if (protected_video_type == ui::ProtectedVideoType::kSoftwareProtected &&
!g_supports_overlays)
return false;
......@@ -950,7 +951,7 @@ bool DCLayerTree::SwapChainPresenter::PresentToSwapChain(
*needs_commit = true;
bool swap_chain_resized = swap_chain_size_ != swap_chain_size;
bool use_yuv_swap_chain = ShouldUseYUVSwapChain();
bool use_yuv_swap_chain = ShouldUseYUVSwapChain(params.protected_video_type);
bool toggle_yuv_swapchain = use_yuv_swap_chain != is_yuv_swapchain_;
bool toggle_protected_video =
protected_video_type_ != params.protected_video_type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment