0

Enable MPO for moving clear video quads on new Intel GPU drivers

Intel gfx driver team cannot reproduce this issue on the new GPU
drivers. A patch inside 31.0.101.4471 driver binary has fixed the
problem.

At the same time, AMD/NVIDIA GPU drivers are kept being disabled as before from the manual test results provided here. More evidence and verification are required for their better fixing in future.

Bug: 40677119
Change-Id: Id1f512d45fa803be7e233b5753a09fba5c64cd99
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5831715
Commit-Queue: Chunbo Hua <chunbo.hua@intel.com>
Reviewed-by: Michael Tang <tangm@microsoft.com>
Reviewed-by: Maggie Chen <magchen@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1354935}
This commit is contained in:
Chunbo Hua
2024-09-13 01:10:00 +00:00
committed by Chromium LUCI CQ
parent 874ab5e3c0
commit 11a0f1ec38
8 changed files with 66 additions and 35 deletions

@ -659,14 +659,16 @@ std::optional<OverlayCandidate> DCLayerOverlayProcessor::FromTextureOrYuvQuad(
DCLayerOverlayProcessor::DCLayerOverlayProcessor(
int allowed_yuv_overlay_count,
bool disable_video_overlay_if_moving,
bool skip_initialization_for_testing)
: has_overlay_support_(skip_initialization_for_testing),
allowed_yuv_overlay_count_(allowed_yuv_overlay_count),
is_on_battery_power_(
base::PowerMonitor::GetInstance()
->AddPowerStateObserverAndReturnOnBatteryState(this)),
no_undamaged_overlay_promotion_(base::FeatureList::IsEnabled(
features::kNoUndamagedOverlayPromotion)) {
no_undamaged_overlay_promotion_(
base::FeatureList::IsEnabled(features::kNoUndamagedOverlayPromotion)),
disable_video_overlay_if_moving_(disable_video_overlay_if_moving) {
if (!skip_initialization_for_testing) {
UpdateHasHwOverlaySupport();
UpdateSystemHDRStatus();
@ -1123,8 +1125,7 @@ void DCLayerOverlayProcessor::Process(
// Recount the YUV overlays when they are added to the overlay list
// successfully.
global_overlay_state.processed_yuv_overlay_count = 0;
if (base::FeatureList::IsEnabled(features::kDisableVideoOverlayIfMoving)) {
if (disable_video_overlay_if_moving_) {
RemoveClearVideoQuadCandidatesIfMoving(
resource_provider, render_pass_overlay_data_map, render_pass_state_map);
}

@ -36,6 +36,7 @@ class VIZ_SERVICE_EXPORT DCLayerOverlayProcessor final
// for unit tests.
explicit DCLayerOverlayProcessor(
int allowed_yuv_overlay_count,
bool disable_video_overlay_if_moving,
bool skip_initialization_for_testing = false);
DCLayerOverlayProcessor(const DCLayerOverlayProcessor&) = delete;
@ -110,6 +111,9 @@ class VIZ_SERVICE_EXPORT DCLayerOverlayProcessor final
void set_is_on_battery_power_for_testing(bool value) {
is_on_battery_power_ = value;
}
void set_disable_video_overlay_if_moving_for_testing(bool value) {
disable_video_overlay_if_moving_ = value;
}
bool force_overlay_for_auto_hdr() {
return system_hdr_enabled_on_any_display_ &&
has_auto_hdr_video_processor_support_ && !is_on_battery_power_;
@ -369,6 +373,7 @@ class VIZ_SERVICE_EXPORT DCLayerOverlayProcessor final
std::vector<gfx::Rect> previous_frame_overlay_candidate_rects_;
int frames_since_last_overlay_candidate_rects_change_ = 0;
bool no_undamaged_overlay_promotion_;
bool disable_video_overlay_if_moving_;
THREAD_CHECKER(thread_checker_);
};

@ -220,12 +220,6 @@ class OverlayProcessorTestBase : public testing::Test {
std::vector<base::test::FeatureRef> enabled_features;
std::vector<base::test::FeatureRef> disabled_features;
// With DisableVideoOverlayIfMoving, videos are required to be stable for a
// certain number of frames to be considered for overlay promotion. This
// complicates tests since it adds behavior dependent on the number of times
// |Process| is called.
disabled_features.push_back(features::kDisableVideoOverlayIfMoving);
feature_list_.InitWithFeatures(enabled_features, disabled_features);
}
@ -265,8 +259,14 @@ class DCLayerOverlayProcessorTest : public OverlayProcessorTestBase {
protected:
void InitializeDCLayerOverlayProcessor(int allowed_yuv_overlay_count = 1) {
CHECK(!dc_layer_overlay_processor_);
// With disable_video_overlay_if_moving enabled, videos are required to be
// stable for a certain number of frames to be considered for overlay
// promotion. This complicates tests since it adds behavior dependent on
// the number of times |Process| is called.
dc_layer_overlay_processor_ = std::make_unique<DCLayerOverlayProcessor>(
allowed_yuv_overlay_count,
/*disable_video_overlay_if_moving=*/false,
/*skip_initialization_for_testing=*/true);
dc_layer_overlay_processor_
@ -315,7 +315,7 @@ class DCLayerOverlayProcessorTest : public OverlayProcessorTestBase {
std::unique_ptr<DCLayerOverlayProcessor> dc_layer_overlay_processor_;
};
TEST_F(DCLayerOverlayProcessorTest, DisableVideoOverlayIfMovingFeature) {
TEST_F(DCLayerOverlayProcessorTest, DisableVideoOverlayIfMovingWorkaround) {
InitializeDCLayerOverlayProcessor();
auto ProcessForOverlaysSingleVideoRectWithOffset =
[&](gfx::Vector2d video_rect_offset, bool is_hdr = false,
@ -393,17 +393,15 @@ TEST_F(DCLayerOverlayProcessorTest, DisableVideoOverlayIfMovingFeature) {
};
{
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndDisableFeature(
features::kDisableVideoOverlayIfMoving);
dc_layer_overlay_processor_
->set_disable_video_overlay_if_moving_for_testing(false);
EXPECT_EQ(1U, ProcessForOverlaysSingleVideoRectWithOffset({0, 0}).size());
EXPECT_EQ(1U, ProcessForOverlaysSingleVideoRectWithOffset({1, 0}).size());
}
{
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeature(
features::kDisableVideoOverlayIfMoving);
dc_layer_overlay_processor_
->set_disable_video_overlay_if_moving_for_testing(true);
// We expect an overlay promotion after a couple frames of no movement
for (int i = 0; i < 10; i++) {
ProcessForOverlaysSingleVideoRectWithOffset({0, 0}).size();
@ -421,9 +419,8 @@ TEST_F(DCLayerOverlayProcessorTest, DisableVideoOverlayIfMovingFeature) {
}
{
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeature(
features::kDisableVideoOverlayIfMoving);
dc_layer_overlay_processor_
->set_disable_video_overlay_if_moving_for_testing(true);
// We expect an overlay promotion after a couple frames of no movement
for (int i = 0; i < 10; i++) {
ProcessForOverlaysSingleVideoRectWithOffset({0, 0}, /*is_hdr=*/false,
@ -442,9 +439,8 @@ TEST_F(DCLayerOverlayProcessorTest, DisableVideoOverlayIfMovingFeature) {
}
{
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeature(
features::kDisableVideoOverlayIfMoving);
dc_layer_overlay_processor_
->set_disable_video_overlay_if_moving_for_testing(true);
// We expect an overlay promotion after a couple frames of no movement
for (int i = 0; i < 10; i++) {
ProcessForOverlaysSingleVideoRectWithOffset({0, 0}, /*is_hdr=*/true)
@ -2260,11 +2256,13 @@ TEST_F(OverlayProcessorWinStaticTest,
class TestOverlayProcessorWin : public OverlayProcessorWin {
public:
explicit TestOverlayProcessorWin(int allowed_yuv_overlay_count)
explicit TestOverlayProcessorWin(int allowed_yuv_overlay_count,
bool disable_video_overlay_if_moving)
: OverlayProcessorWin(OutputSurface::DCSupportLevel::kDCompTexture,
&debug_settings_,
std::make_unique<DCLayerOverlayProcessor>(
allowed_yuv_overlay_count,
disable_video_overlay_if_moving,
/*skip_initialization_for_testing=*/true)) {}
DebugRendererSettings debug_settings_;
};
@ -2274,8 +2272,13 @@ class OverlayProcessorWinTest : public OverlayProcessorTestBase {
void SetUp() override {
OverlayProcessorTestBase::SetUp();
// With disable_video_overlay_if_moving enabled, videos are required to be
// stable for a certain number of frames to be considered for overlay
// promotion. This complicates tests since it adds behavior dependent on
// the number of times |Process| is called.
overlay_processor_ = std::make_unique<TestOverlayProcessorWin>(
/*allowed_yuv_overlay_count=*/1);
/*allowed_yuv_overlay_count=*/1,
/*disable_video_overlay_if_moving=*/false);
overlay_processor_->SetUsingDCLayersForTesting(kDefaultRootPassId, true);
overlay_processor_->SetViewportSize(gfx::Size(256, 256));

@ -16,6 +16,7 @@
#include "components/viz/common/features.h"
#include "components/viz/service/display/display_compositor_memory_and_task_controller.h"
#include "components/viz/service/display/overlay_processor_stub.h"
#include "components/viz/service/display_embedder/skia_output_surface_dependency.h"
#include "ui/gfx/overlay_priority_hint.h"
#if BUILDFLAG(IS_APPLE)
@ -110,10 +111,16 @@ OverlayProcessorInterface::CreateOverlayProcessor(
return std::make_unique<OverlayProcessorStub>();
}
DCHECK(display_controller);
DCHECK(display_controller->skia_dependency());
return std::make_unique<OverlayProcessorWin>(
capabilities.dc_support_level, debug_settings,
std::make_unique<DCLayerOverlayProcessor>(
capabilities.allowed_yuv_overlay_count));
capabilities.allowed_yuv_overlay_count,
display_controller->skia_dependency()
->GetGpuDriverBugWorkarounds()
.disable_video_overlay_if_moving));
#elif BUILDFLAG(IS_OZONE)
#if !BUILDFLAG(IS_CASTOS)
// In tests and Ozone/X11, we do not expect surfaceless surface support.

@ -3399,6 +3399,29 @@
"features": [
"disable_accelerated_h264_encode"
]
},
{
"id": 436,
"cr_bugs": [40677119],
"description": "Disable overlay promotion for clear video quads when their MPO quads would move",
"os": {
"type" : "win"
},
"exceptions": [
{
"vendor_id": "0x8086",
"os": {
"type" : "win"
},
"driver_version": {
"op": ">=",
"value": "31.0.101.4471"
}
}
],
"features": [
"disable_video_overlay_if_moving"
]
}
]
}

@ -185,12 +185,6 @@ BASE_FEATURE(kDawnSIRepsUseClientProvidedInternalUsages,
base::FEATURE_ENABLED_BY_DEFAULT);
#if BUILDFLAG(IS_WIN)
// Disable overlay promotion for clear video quads when their MPO quad would
// move.
BASE_FEATURE(kDisableVideoOverlayIfMoving,
"DisableVideoOverlayIfMoving",
base::FEATURE_ENABLED_BY_DEFAULT);
BASE_FEATURE(kNoUndamagedOverlayPromotion,
"NoUndamagedOverlayPromotion",
base::FEATURE_DISABLED_BY_DEFAULT);

@ -44,10 +44,7 @@ GPU_EXPORT BASE_DECLARE_FEATURE(kEnableMSAAOnNewIntelGPUs);
GPU_EXPORT BASE_DECLARE_FEATURE(kDawnSIRepsUseClientProvidedInternalUsages);
#if BUILDFLAG(IS_WIN)
GPU_EXPORT BASE_DECLARE_FEATURE(kDisableVideoOverlayIfMoving);
GPU_EXPORT BASE_DECLARE_FEATURE(kNoUndamagedOverlayPromotion);
#endif
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_IOS)

@ -56,6 +56,7 @@ disable_software_to_accelerated_canvas_upgrade
disable_svc_encoding
disable_texture_storage
disable_timestamp_queries
disable_video_overlay_if_moving
disable_vp9_hmft_temporal_encoding
disable_vp_auto_hdr
disable_vp_scaling