Commit fe136367 authored by Richard Li's avatar Richard Li Committed by Commit Bot

Tracing swap chain format of overlays with |swap_chain_format_|

Currently, we have three overlay formats: YUV, BGRA, RGB10A2. Previously,
we trace swap chain format with |is_yuv_swapchain_|, which can't provide
accurate information in current situation.

In this CL, we use a member variable |swap_chain_format_| to trace swap
chain format in use.

Bug: 1062184
Change-Id: I0d26564043f097afc0d1ef769c3854ee91a3462f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2336215
Commit-Queue: Richard Li <richard.li@intel.com>
Reviewed-by: default avatarSunny Sachanandani <sunnyps@chromium.org>
Cr-Commit-Position: refs/heads/master@{#796701}
parent 9fcf28b1
...@@ -431,7 +431,7 @@ bool DirectCompositionSurfaceWin::IsDecodeSwapChainSupported() { ...@@ -431,7 +431,7 @@ bool DirectCompositionSurfaceWin::IsDecodeSwapChainSupported() {
if (base::FeatureList::IsEnabled( if (base::FeatureList::IsEnabled(
features::kDirectCompositionUseNV12DecodeSwapChain)) { features::kDirectCompositionUseNV12DecodeSwapChain)) {
UpdateOverlaySupport(); UpdateOverlaySupport();
return GetOverlayFormatUsed() == DXGI_FORMAT_NV12; return GetOverlayFormatUsedForSDR() == DXGI_FORMAT_NV12;
} }
return false; return false;
} }
...@@ -490,7 +490,7 @@ gfx::Size DirectCompositionSurfaceWin::GetOverlayMonitorSize() { ...@@ -490,7 +490,7 @@ gfx::Size DirectCompositionSurfaceWin::GetOverlayMonitorSize() {
} }
// static // static
DXGI_FORMAT DirectCompositionSurfaceWin::GetOverlayFormatUsed() { DXGI_FORMAT DirectCompositionSurfaceWin::GetOverlayFormatUsedForSDR() {
return g_overlay_format_used; return g_overlay_format_used;
} }
...@@ -516,7 +516,7 @@ void DirectCompositionSurfaceWin::SetOverlayFormatUsedForTesting( ...@@ -516,7 +516,7 @@ void DirectCompositionSurfaceWin::SetOverlayFormatUsedForTesting(
DCHECK(format == DXGI_FORMAT_NV12 || format == DXGI_FORMAT_YUY2); DCHECK(format == DXGI_FORMAT_NV12 || format == DXGI_FORMAT_YUY2);
UpdateOverlaySupport(); UpdateOverlaySupport();
g_overlay_format_used = format; g_overlay_format_used = format;
DCHECK_EQ(format, GetOverlayFormatUsed()); DCHECK_EQ(format, GetOverlayFormatUsedForSDR());
} }
// static // static
......
...@@ -72,7 +72,7 @@ class GL_EXPORT DirectCompositionSurfaceWin : public GLSurfaceEGL, ...@@ -72,7 +72,7 @@ class GL_EXPORT DirectCompositionSurfaceWin : public GLSurfaceEGL,
static bool AreScaledOverlaysSupported(); static bool AreScaledOverlaysSupported();
// Returns preferred overlay format set when detecting overlay support. // Returns preferred overlay format set when detecting overlay support.
static DXGI_FORMAT GetOverlayFormatUsed(); static DXGI_FORMAT GetOverlayFormatUsedForSDR();
// Returns monitor size. // Returns monitor size.
static gfx::Size GetOverlayMonitorSize(); static gfx::Size GetOverlayMonitorSize();
......
This diff is collapsed.
...@@ -102,14 +102,14 @@ class SwapChainPresenter : public base::PowerObserver { ...@@ -102,14 +102,14 @@ class SwapChainPresenter : public base::PowerObserver {
// |use_yuv_swap_chain| is true, or BGRA otherwise. Sets flags based on // |use_yuv_swap_chain| is true, or BGRA otherwise. Sets flags based on
// |protected_video_type|. Returns true on success. // |protected_video_type|. Returns true on success.
bool ReallocateSwapChain(const gfx::Size& swap_chain_size, bool ReallocateSwapChain(const gfx::Size& swap_chain_size,
bool use_yuv_swap_chain, DXGI_FORMAT swap_chain_format,
gfx::ProtectedVideoType protected_video_type, gfx::ProtectedVideoType protected_video_type,
bool z_order, bool z_order,
bool content_is_hdr); bool content_is_hdr);
// Returns true if YUV swap chain should be preferred over BGRA swap chain. // Returns DXGI format that swap chain uses.
// This changes over time based on stats recorded in |presentation_history|. // This changes over time based on stats recorded in |presentation_history|.
bool ShouldUseYUVSwapChain(gfx::ProtectedVideoType protected_video_type, DXGI_FORMAT GetSwapChainFormat(gfx::ProtectedVideoType protected_video_type,
bool content_is_hdr); bool content_is_hdr);
// Perform a blit using video processor from given input texture to swap chain // Perform a blit using video processor from given input texture to swap chain
...@@ -172,8 +172,8 @@ class SwapChainPresenter : public base::PowerObserver { ...@@ -172,8 +172,8 @@ class SwapChainPresenter : public base::PowerObserver {
// Current size of swap chain. // Current size of swap chain.
gfx::Size swap_chain_size_; gfx::Size swap_chain_size_;
// Whether the current swap chain is using the preferred YUV format. // Current swap chain format.
bool is_yuv_swapchain_ = false; DXGI_FORMAT swap_chain_format_;
// Whether the swap chain was reallocated, and next present will be the first. // Whether the swap chain was reallocated, and next present will be the first.
bool first_present_ = false; bool first_present_ = false;
......
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