Commit f346197c authored by Zhenyao Mo's avatar Zhenyao Mo Committed by Commit Bot

Wire ForceFullDamage to UseSkiaRenderer.

The feature does not work with GL renderer.

Also, set |supports_target_damage| cap to false on
Windows. Otherwise we saw black flashes when switching
from video overlay mode to chrome compositing mode.

BUG=1122686,1117185
TEST=manual
R=kylechar@chromium.org

Change-Id: I9e759b2b58e26b76972fb0e3373540f83a560904
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2490411
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: default avatarkylechar <kylechar@chromium.org>
Auto-Submit: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#819558}
parent 28b249f7
......@@ -127,6 +127,9 @@ SkiaOutputDeviceBufferQueue::SkiaOutputDeviceBufferQueue(
capabilities_.max_frames_pending = capabilities_.number_of_buffers - 1;
presenter_->InitializeCapabilities(&capabilities_);
if (capabilities_.supports_post_sub_buffer)
capabilities_.supports_target_damage = true;
}
SkiaOutputDeviceBufferQueue::~SkiaOutputDeviceBufferQueue() {
......
......@@ -302,6 +302,7 @@ bool SkiaOutputDeviceVulkan::Initialize() {
capabilities_.preserve_buffer_content = true;
capabilities_.output_surface_origin = gfx::SurfaceOrigin::kTopLeft;
capabilities_.supports_post_sub_buffer = true;
capabilities_.supports_target_damage = true;
capabilities_.orientation_mode = OutputSurface::OrientationMode::kHardware;
#if defined(OS_ANDROID)
// With vulkan, if the chrome is launched in landscape mode, the chrome is
......
......@@ -773,7 +773,6 @@ bool SkiaOutputSurfaceImpl::Initialize() {
if (capabilities_.preserve_buffer_content &&
capabilities_.supports_post_sub_buffer) {
capabilities_.only_invalidates_damage_rect = false;
capabilities_.supports_target_damage = true;
// If there is only one pending frame, then we can use damage area hint from
// SkiaOutputDevice, otherwise we have to track damage area in
// SkiaOutputSurfaceImpl.
......
......@@ -17,6 +17,7 @@
#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_surface_egl.h"
#include "ui/gl/gl_switches.h"
#include "ui/gl/gl_utils.h"
#include "ui/gl/init/gl_factory.h"
#include "ui/gl/vsync_provider_win.h"
......@@ -34,6 +35,9 @@ CreateDirectCompositionSurfaceSettings(
settings.use_angle_texture_offset = features::IsUsingSkiaRenderer();
settings.reset_vp_when_colorspace_changes =
workarounds.reset_vp_when_colorspace_changes;
settings.force_root_surface_full_damage =
features::IsUsingSkiaRenderer() &&
gl::ShouldForceDirectCompositionRootSurfaceFullDamage();
return settings;
}
} // namespace
......
......@@ -72,10 +72,12 @@ DirectCompositionChildSurfaceWin::PendingFrame::operator=(
DirectCompositionChildSurfaceWin::DirectCompositionChildSurfaceWin(
VSyncCallback vsync_callback,
bool use_angle_texture_offset,
size_t max_pending_frames)
size_t max_pending_frames,
bool force_full_damage)
: vsync_callback_(std::move(vsync_callback)),
use_angle_texture_offset_(use_angle_texture_offset),
max_pending_frames_(max_pending_frames),
force_full_damage_(force_full_damage),
vsync_thread_(VSyncThreadWin::GetInstance()),
task_runner_(base::ThreadTaskRunnerHandle::Get()) {}
......@@ -150,13 +152,11 @@ bool DirectCompositionChildSurfaceWin::ReleaseDrawTexture(bool will_discard) {
first_swap_ || !vsync_enabled_ || use_swap_chain_tearing ? 0 : 1;
UINT flags = use_swap_chain_tearing ? DXGI_PRESENT_ALLOW_TEARING : 0;
bool force_full_damage =
ShouldForceDirectCompositionRootSurfaceFullDamage();
TRACE_EVENT2("gpu", "DirectCompositionChildSurfaceWin::PresentSwapChain",
"interval", interval, "dirty_rect",
force_full_damage ? "full_damage" : swap_rect_.ToString());
force_full_damage_ ? "full_damage" : swap_rect_.ToString());
HRESULT hr;
if (force_full_damage) {
if (force_full_damage_) {
hr = swap_chain_->Present(interval, flags);
} else {
DXGI_PRESENT_PARAMETERS params = {};
......
......@@ -33,7 +33,8 @@ class GL_EXPORT DirectCompositionChildSurfaceWin : public GLSurfaceEGL,
base::RepeatingCallback<void(base::TimeTicks, base::TimeDelta)>;
DirectCompositionChildSurfaceWin(VSyncCallback vsync_callback,
bool use_angle_texture_offset,
size_t max_pending_frames);
size_t max_pending_frames,
bool force_full_damage);
// GLSurfaceEGL implementation.
bool Initialize(GLSurfaceFormat format) override;
......@@ -140,6 +141,7 @@ class GL_EXPORT DirectCompositionChildSurfaceWin : public GLSurfaceEGL,
const VSyncCallback vsync_callback_;
const bool use_angle_texture_offset_;
const size_t max_pending_frames_;
const bool force_full_damage_;
VSyncThreadWin* const vsync_thread_;
scoped_refptr<base::SequencedTaskRunner> task_runner_;
......
......@@ -357,7 +357,8 @@ DirectCompositionSurfaceWin::DirectCompositionSurfaceWin(
root_surface_(new DirectCompositionChildSurfaceWin(
std::move(vsync_callback),
settings.use_angle_texture_offset,
settings.max_pending_frames)),
settings.max_pending_frames,
settings.force_root_surface_full_damage)),
layer_tree_(std::make_unique<DCLayerTree>(
settings.disable_nv12_dynamic_textures,
settings.disable_larger_than_screen_overlays,
......
......@@ -36,6 +36,7 @@ class GL_EXPORT DirectCompositionSurfaceWin : public GLSurfaceEGL,
size_t max_pending_frames = 2;
bool use_angle_texture_offset = false;
bool reset_vp_when_colorspace_changes = false;
bool force_root_surface_full_damage = false;
};
DirectCompositionSurfaceWin(
......
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