Commit 6c57430b authored by Sunny Sachanandani's avatar Sunny Sachanandani Committed by Commit Bot

Revert "gpu: Remove obsolete direct composition feature flags"

This reverts commit 0e2b4943.

Reason for revert: Trace tests failing on multiple FYI bots: crbug.com/1132375, crbug.com/1132381

Original change's description:
> gpu: Remove obsolete direct composition feature flags
>
> Remove the NV12, decode swap chain, and underlay feature flags since
> these features have shipped for quite some time.  The NV12 feature flag
> was also used for using YUY2 over NV12 for tests so introduce a new flag
> for choosing the default SDR video overlay swap chain format.  Add tests
> for NV12, YUY2, and BGRA instead of just YUY2.  Also cleanup some of the
> testing code to be consistent in other_args, switch names, etc.
>
> Bug: 869677
> Change-Id: I0831b103506f394d6fe26bf1085401e2e2d50599
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2424576
> Reviewed-by: Maggie Chen <magchen@chromium.org>
> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
> Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#810453}

TBR=zmo@chromium.org,sunnyps@chromium.org,magchen@chromium.org,enga@chromium.org

Change-Id: Id3a7de405887326d0fd09d2e8efa36637ffbf4c8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 869677, 1132375, 1132381
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2432207Reviewed-by: default avatarSunny Sachanandani <sunnyps@chromium.org>
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810700}
parent bbb9f524
...@@ -226,6 +226,9 @@ bool IsProtectedVideo(const QuadList::Iterator& it) { ...@@ -226,6 +226,9 @@ bool IsProtectedVideo(const QuadList::Iterator& it) {
} }
DCLayerResult IsUnderlayAllowed(const QuadList::Iterator& it) { DCLayerResult IsUnderlayAllowed(const QuadList::Iterator& it) {
if (!base::FeatureList::IsEnabled(features::kDirectCompositionUnderlays)) {
return DC_LAYER_FAILED_OCCLUDED;
}
if (it->ShouldDrawWithBlending()) { if (it->ShouldDrawWithBlending()) {
return DC_LAYER_FAILED_TRANSPARENT; return DC_LAYER_FAILED_TRANSPARENT;
} }
......
...@@ -3186,6 +3186,8 @@ TEST_F(GLRendererPartialSwapTest, SetDrawRectangle_NoPartialSwap) { ...@@ -3186,6 +3186,8 @@ TEST_F(GLRendererPartialSwapTest, SetDrawRectangle_NoPartialSwap) {
// Test that SetEnableDCLayersCHROMIUM is properly called when enabling // Test that SetEnableDCLayersCHROMIUM is properly called when enabling
// and disabling DC layers. // and disabling DC layers.
TEST_F(GLRendererTest, DCLayerOverlaySwitch) { TEST_F(GLRendererTest, DCLayerOverlaySwitch) {
base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeature(features::kDirectCompositionUnderlays);
auto gl_owned = std::make_unique<PartialSwapMockGLES2Interface>(); auto gl_owned = std::make_unique<PartialSwapMockGLES2Interface>();
gl_owned->set_have_post_sub_buffer(true); gl_owned->set_have_post_sub_buffer(true);
auto* gl = gl_owned.get(); auto* gl = gl_owned.get();
......
...@@ -261,6 +261,8 @@ class DCLayerOverlayTest : public testing::Test { ...@@ -261,6 +261,8 @@ class DCLayerOverlayTest : public testing::Test {
}; };
TEST_F(DCLayerOverlayTest, Occluded) { TEST_F(DCLayerOverlayTest, Occluded) {
base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeature(features::kDirectCompositionUnderlays);
{ {
auto pass = CreateRenderPass(); auto pass = CreateRenderPass();
SharedQuadState* first_shared_state = pass->shared_quad_state_list.back(); SharedQuadState* first_shared_state = pass->shared_quad_state_list.back();
...@@ -358,6 +360,8 @@ TEST_F(DCLayerOverlayTest, Occluded) { ...@@ -358,6 +360,8 @@ TEST_F(DCLayerOverlayTest, Occluded) {
} }
TEST_F(DCLayerOverlayTest, DamageRectWithoutVideoDamage) { TEST_F(DCLayerOverlayTest, DamageRectWithoutVideoDamage) {
base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeature(features::kDirectCompositionUnderlays);
{ {
auto pass = CreateRenderPass(); auto pass = CreateRenderPass();
SharedQuadState* shared_quad_state = pass->shared_quad_state_list.back(); SharedQuadState* shared_quad_state = pass->shared_quad_state_list.back();
...@@ -465,6 +469,9 @@ TEST_F(DCLayerOverlayTest, DamageRect) { ...@@ -465,6 +469,9 @@ TEST_F(DCLayerOverlayTest, DamageRect) {
} }
TEST_F(DCLayerOverlayTest, ClipRect) { TEST_F(DCLayerOverlayTest, ClipRect) {
base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeature(features::kDirectCompositionUnderlays);
// Process twice. The second time through the overlay list shouldn't change, // Process twice. The second time through the overlay list shouldn't change,
// which will allow the damage rect to reflect just the changes in that // which will allow the damage rect to reflect just the changes in that
// frame. // frame.
...@@ -537,6 +544,9 @@ TEST_F(DCLayerOverlayTest, TransparentOnTop) { ...@@ -537,6 +544,9 @@ TEST_F(DCLayerOverlayTest, TransparentOnTop) {
} }
TEST_F(DCLayerOverlayTest, UnderlayDamageRectWithQuadOnTopUnchanged) { TEST_F(DCLayerOverlayTest, UnderlayDamageRectWithQuadOnTopUnchanged) {
base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeature(features::kDirectCompositionUnderlays);
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
auto pass = CreateRenderPass(); auto pass = CreateRenderPass();
// Add a solid color quad on top // Add a solid color quad on top
......
...@@ -7,28 +7,21 @@ AUTOPLAY_POLICY_NO_USER_GESTURE_REQUIRED =\ ...@@ -7,28 +7,21 @@ AUTOPLAY_POLICY_NO_USER_GESTURE_REQUIRED =\
'--autoplay-policy=no-user-gesture-required' '--autoplay-policy=no-user-gesture-required'
DISABLE_ACCELERATED_2D_CANVAS = '--disable-accelerated-2d-canvas' DISABLE_ACCELERATED_2D_CANVAS = '--disable-accelerated-2d-canvas'
DISABLE_DEVICE_DISCOVERY_NOTIFICATIONS = '--disable-features=MediaRouter' DISABLE_DEVICE_DISCOVERY_NOTIFICATIONS = '--disable-features=MediaRouter'
DISABLE_DIRECT_COMPOSITION_FORCE_FULL_DAMAGE =\
'--disable-features=DirectCompositionForceFullDamage'
DISABLE_DIRECT_COMPOSITION_VIDEO_OVERLAYS =\
'--disable-direct-composition-video-overlays'
DISABLE_DIRECT_COMPOSITION_VP_SCALING = '--disable_vp_scaling=1'
DISABLE_DOMAIN_BLOCKING_FOR_3D_APIS = '--disable-domain-blocking-for-3d-apis' DISABLE_DOMAIN_BLOCKING_FOR_3D_APIS = '--disable-domain-blocking-for-3d-apis'
DISABLE_FEATURES_D3D11_VIDEO_DECODER = '--disable-features=D3D11VideoDecoder' DISABLE_FEATURES_D3D11_VIDEO_DECODER = '--disable-features=D3D11VideoDecoder'
DISABLE_FORCE_FULL_DAMAGE =\
'--disable-features=DirectCompositionForceFullDamage'
DISABLE_GPU = '--disable-gpu' DISABLE_GPU = '--disable-gpu'
DISABLE_GPU_COMPOSITING = '--disable-gpu-compositing' DISABLE_GPU_COMPOSITING = '--disable-gpu-compositing'
DISABLE_GPU_PROCESS_CRASH_LIMIT = '--disable-gpu-process-crash-limit' DISABLE_GPU_PROCESS_CRASH_LIMIT = '--disable-gpu-process-crash-limit'
DISABLE_SOFTWARE_COMPOSITING_FALLBACK =\ DISABLE_SOFTWARE_COMPOSITING_FALLBACK =\
'--disable-software-compositing-fallback' '--disable-software-compositing-fallback'
DISABLE_SOFTWARE_RASTERIZER = '--disable-software-rasterizer' DISABLE_SOFTWARE_RASTERIZER = '--disable-software-rasterizer'
ENABLE_DIRECT_COMPOSITION_FORCE_FULL_DAMAGE =\ DISABLE_VP_SCALING = '--disable_vp_scaling=1'
'--direct-composition-force-full-damage-for-testing'
ENABLE_DIRECT_COMPOSITION_VIDEO_OVERLAYS =\
'--enable-direct-composition-video-overlays'
ENABLE_DIRECT_COMPOSITION_VP_SCALING = '--disable_vp_scaling=0'
ENABLE_EXPERIMENTAL_WEB_PLATFORM_FEATURES =\ ENABLE_EXPERIMENTAL_WEB_PLATFORM_FEATURES =\
'--enable-experimental-web-platform-features' '--enable-experimental-web-platform-features'
ENABLE_FORCE_FULL_DAMAGE = "--direct-composition-force-full-damage-for-testing"
ENABLE_GPU_BENCHMARKING = '--enable-gpu-benchmarking' ENABLE_GPU_BENCHMARKING = '--enable-gpu-benchmarking'
ENABLE_LOGGING = '--enable-logging'
ENSURE_FORCED_COLOR_PROFILE = '--ensure-forced-color-profile' ENSURE_FORCED_COLOR_PROFILE = '--ensure-forced-color-profile'
FORCE_COLOR_PROFILE_SRGB = '--force-color-profile=srgb' FORCE_COLOR_PROFILE_SRGB = '--force-color-profile=srgb'
FORCE_GPU_RASTERIZATION = '--force-gpu-rasterization' FORCE_GPU_RASTERIZATION = '--force-gpu-rasterization'
......
...@@ -72,7 +72,7 @@ class PixelTestPage(object): ...@@ -72,7 +72,7 @@ class PixelTestPage(object):
self.restart_browser_after_test = restart_browser_after_test self.restart_browser_after_test = restart_browser_after_test
# These are used to pass additional arguments to the test harness. # These are used to pass additional arguments to the test harness.
# VideoPathTraceTest and OverlayModeTest support the following boolean # VideoPathTraceTest and OverlayModeTest support the following boolean
# arguments: pixel_format, zero_copy, no_overlay, and presentation_mode. # arguments: expect_yuy2, zero_copy, video_is_rotated, and no_overlay.
self.other_args = other_args self.other_args = other_args
# This allows a newly added test to be exempted from failures for a # This allows a newly added test to be exempted from failures for a
# (hopefully) short period after being added. This is so that any slightly # (hopefully) short period after being added. This is so that any slightly
...@@ -658,27 +658,17 @@ class PixelTestPages(object): ...@@ -658,27 +658,17 @@ class PixelTestPages(object):
@staticmethod @staticmethod
def DirectCompositionPages(base_name): def DirectCompositionPages(base_name):
browser_args = [ browser_args = [
cba.ENABLE_DIRECT_COMPOSITION_VIDEO_OVERLAYS, '--enable-direct-composition-video-overlays',
# All bots are connected with a power source, however, we want to to # All bots are connected with a power source, however, we want to to
# test with the code path that's enabled with battery power. # test with the code path that's enabled with battery power.
cba.DISABLE_DIRECT_COMPOSITION_VP_SCALING, cba.DISABLE_VP_SCALING,
]
browser_args_NV12 = browser_args + [
'--direct-composition-video-swap-chain-format=nv12'
] ]
browser_args_YUY2 = browser_args + [ browser_args_YUY2 = browser_args + [
'--direct-composition-video-swap-chain-format=yuy2' '--disable-features=DirectCompositionPreferNV12Overlays'
]
browser_args_BGRA = browser_args + [
'--direct-composition-video-swap-chain-format=bgra'
] ]
browser_args_DXVA = browser_args + [ browser_args_DXVA = browser_args + [
cba.DISABLE_FEATURES_D3D11_VIDEO_DECODER cba.DISABLE_FEATURES_D3D11_VIDEO_DECODER
] ]
browser_args_vp_scaling = [
cba.ENABLE_DIRECT_COMPOSITION_VIDEO_OVERLAYS,
cba.ENABLE_DIRECT_COMPOSITION_VP_SCALING,
]
# Most tests fall roughly into 3 tiers of noisiness. # Most tests fall roughly into 3 tiers of noisiness.
# Parameter values were determined using the automated optimization script, # Parameter values were determined using the automated optimization script,
...@@ -718,31 +708,11 @@ class PixelTestPages(object): ...@@ -718,31 +708,11 @@ class PixelTestPages(object):
test_rect=[0, 0, 960, 540], test_rect=[0, 0, 960, 540],
other_args={'zero_copy': True}, other_args={'zero_copy': True},
matching_algorithm=strict_dc_sobel_algorithm), matching_algorithm=strict_dc_sobel_algorithm),
PixelTestPage('pixel_video_mp4.html',
base_name + '_DirectComposition_Video_MP4_NV12',
test_rect=[0, 0, 240, 135],
browser_args=browser_args_NV12,
other_args={'pixel_format': 'NV12'},
matching_algorithm=permissive_dc_sobel_algorithm),
PixelTestPage('pixel_video_mp4.html', PixelTestPage('pixel_video_mp4.html',
base_name + '_DirectComposition_Video_MP4_YUY2', base_name + '_DirectComposition_Video_MP4_YUY2',
test_rect=[0, 0, 240, 135], test_rect=[0, 0, 240, 135],
browser_args=browser_args_YUY2, browser_args=browser_args_YUY2,
other_args={'pixel_format': 'YUY2'}, other_args={'expect_yuy2': True},
matching_algorithm=permissive_dc_sobel_algorithm),
PixelTestPage('pixel_video_mp4.html',
base_name + '_DirectComposition_Video_MP4_BGRA',
test_rect=[0, 0, 240, 135],
browser_args=browser_args_BGRA,
other_args={
'pixel_format': 'BGRA',
'presentation_mode': 'COMPOSED'
},
matching_algorithm=permissive_dc_sobel_algorithm),
PixelTestPage('pixel_video_mp4.html',
base_name + '_DirectComposition_Video_MP4_VP_SCALING',
test_rect=[0, 0, 240, 135],
browser_args=browser_args_vp_scaling,
matching_algorithm=permissive_dc_sobel_algorithm), matching_algorithm=permissive_dc_sobel_algorithm),
PixelTestPage('pixel_video_mp4_four_colors_aspect_4x3.html', PixelTestPage('pixel_video_mp4_four_colors_aspect_4x3.html',
base_name + base_name +
...@@ -755,21 +725,21 @@ class PixelTestPages(object): ...@@ -755,21 +725,21 @@ class PixelTestPages(object):
'_DirectComposition_Video_MP4_FourColors_Rot_90', '_DirectComposition_Video_MP4_FourColors_Rot_90',
test_rect=[0, 0, 270, 240], test_rect=[0, 0, 270, 240],
browser_args=browser_args, browser_args=browser_args,
other_args={'presentation_mode': 'COMPOSED'}, other_args={'video_is_rotated': True},
matching_algorithm=strict_dc_sobel_algorithm), matching_algorithm=strict_dc_sobel_algorithm),
PixelTestPage('pixel_video_mp4_four_colors_rot_180.html', PixelTestPage('pixel_video_mp4_four_colors_rot_180.html',
base_name + base_name +
'_DirectComposition_Video_MP4_FourColors_Rot_180', '_DirectComposition_Video_MP4_FourColors_Rot_180',
test_rect=[0, 0, 240, 135], test_rect=[0, 0, 240, 135],
browser_args=browser_args, browser_args=browser_args,
other_args={'presentation_mode': 'COMPOSED'}, other_args={'video_is_rotated': True},
matching_algorithm=strict_dc_sobel_algorithm), matching_algorithm=strict_dc_sobel_algorithm),
PixelTestPage('pixel_video_mp4_four_colors_rot_270.html', PixelTestPage('pixel_video_mp4_four_colors_rot_270.html',
base_name + base_name +
'_DirectComposition_Video_MP4_FourColors_Rot_270', '_DirectComposition_Video_MP4_FourColors_Rot_270',
test_rect=[0, 0, 270, 240], test_rect=[0, 0, 270, 240],
browser_args=browser_args, browser_args=browser_args,
other_args={'presentation_mode': 'COMPOSED'}, other_args={'video_is_rotated': True},
matching_algorithm=strict_dc_sobel_algorithm), matching_algorithm=strict_dc_sobel_algorithm),
PixelTestPage('pixel_video_vp9.html', PixelTestPage('pixel_video_vp9.html',
base_name + '_DirectComposition_Video_VP9', base_name + '_DirectComposition_Video_VP9',
...@@ -794,23 +764,11 @@ class PixelTestPages(object): ...@@ -794,23 +764,11 @@ class PixelTestPages(object):
edge_threshold=10, edge_threshold=10,
ignored_border_thickness=1, ignored_border_thickness=1,
)), )),
PixelTestPage('pixel_video_vp9.html',
base_name + '_DirectComposition_Video_VP9_NV12',
test_rect=[0, 0, 240, 135],
browser_args=browser_args_NV12,
other_args={'pixel_format': 'NV12'},
matching_algorithm=very_permissive_dc_sobel_algorithm),
PixelTestPage('pixel_video_vp9.html', PixelTestPage('pixel_video_vp9.html',
base_name + '_DirectComposition_Video_VP9_YUY2', base_name + '_DirectComposition_Video_VP9_YUY2',
test_rect=[0, 0, 240, 135], test_rect=[0, 0, 240, 135],
browser_args=browser_args_YUY2, browser_args=browser_args_YUY2,
other_args={'pixel_format': 'YUY2'}, other_args={'expect_yuy2': True},
matching_algorithm=very_permissive_dc_sobel_algorithm),
PixelTestPage('pixel_video_vp9.html',
base_name + '_DirectComposition_Video_VP9_BGRA',
test_rect=[0, 0, 240, 135],
browser_args=browser_args_BGRA,
other_args={'pixel_format': 'BGRA'},
matching_algorithm=very_permissive_dc_sobel_algorithm), matching_algorithm=very_permissive_dc_sobel_algorithm),
PixelTestPage('pixel_video_vp9_i420a.html', PixelTestPage('pixel_video_vp9_i420a.html',
base_name + '_DirectComposition_Video_VP9_I420A', base_name + '_DirectComposition_Video_VP9_I420A',
...@@ -848,7 +806,7 @@ class PixelTestPages(object): ...@@ -848,7 +806,7 @@ class PixelTestPages(object):
'pixel_video_mp4.html', 'pixel_video_mp4.html',
base_name + '_DirectComposition_Video_Disable_Overlays', base_name + '_DirectComposition_Video_Disable_Overlays',
test_rect=[0, 0, 240, 135], test_rect=[0, 0, 240, 135],
browser_args=[cba.DISABLE_DIRECT_COMPOSITION_VIDEO_OVERLAYS], browser_args=['--disable-direct-composition-video-overlays'],
other_args={'no_overlay': True}, other_args={'no_overlay': True},
matching_algorithm=very_permissive_dc_sobel_algorithm), matching_algorithm=very_permissive_dc_sobel_algorithm),
] ]
...@@ -871,16 +829,14 @@ class PixelTestPages(object): ...@@ -871,16 +829,14 @@ class PixelTestPages(object):
@staticmethod @staticmethod
def ForceFullDamagePages(base_name): def ForceFullDamagePages(base_name):
return [ return [
PixelTestPage( PixelTestPage('wait_for_compositing.html',
'wait_for_compositing.html', base_name + '_ForceFullDamage',
base_name + '_ForceFullDamage', test_rect=[0, 0, 0, 0],
test_rect=[0, 0, 0, 0], other_args={'full_damage': True},
other_args={'full_damage': True}, browser_args=[cba.ENABLE_FORCE_FULL_DAMAGE]),
browser_args=[cba.ENABLE_DIRECT_COMPOSITION_FORCE_FULL_DAMAGE]), PixelTestPage('wait_for_compositing.html',
PixelTestPage( base_name + '_ForcePartialDamage',
'wait_for_compositing.html', test_rect=[0, 0, 0, 0],
base_name + '_ForcePartialDamage', other_args={'full_damage': False},
test_rect=[0, 0, 0, 0], browser_args=[cba.DISABLE_FORCE_FULL_DAMAGE]),
other_args={'full_damage': False},
browser_args=[cba.DISABLE_DIRECT_COMPOSITION_FORCE_FULL_DAMAGE]),
] ]
...@@ -460,7 +460,7 @@ class PowerMeasurementIntegrationTest(gpu_integration_test.GpuIntegrationTest): ...@@ -460,7 +460,7 @@ class PowerMeasurementIntegrationTest(gpu_integration_test.GpuIntegrationTest):
self.RestartBrowserWithArgs([ self.RestartBrowserWithArgs([
# All bots are connected with a power source, however, we want to to # All bots are connected with a power source, however, we want to to
# test with the code path that's enabled with battery power. # test with the code path that's enabled with battery power.
cba.DISABLE_DIRECT_COMPOSITION_VP_SCALING, cba.DISABLE_VP_SCALING,
'--disable-features=' + ','.join(disabled_features) '--disable-features=' + ','.join(disabled_features)
]) ])
......
...@@ -146,6 +146,10 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest): ...@@ -146,6 +146,10 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest):
success_eval_func='CheckSwapChainPath', success_eval_func='CheckSwapChainPath',
other_args=p.other_args)) other_args=p.other_args))
for p in namespace.DirectCompositionPages('OverlayModeTraceTest'): for p in namespace.DirectCompositionPages('OverlayModeTraceTest'):
if p.other_args and p.other_args.get('video_is_rotated', False):
# For all drivers we tested, when a video is rotated, frames won't
# be promoted to hardware overlays.
continue
yield (p.name, gpu_relative_path + p.url, yield (p.name, gpu_relative_path + p.url,
_TraceTestArguments( _TraceTestArguments(
browser_args=p.browser_args, browser_args=p.browser_args,
...@@ -216,11 +220,11 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest): ...@@ -216,11 +220,11 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest):
default_args = super(TraceIntegrationTest, default_args = super(TraceIntegrationTest,
cls).GenerateBrowserArgs(additional_args) cls).GenerateBrowserArgs(additional_args)
default_args.extend([ default_args.extend([
cba.ENABLE_LOGGING, '--enable-logging',
cba.ENABLE_EXPERIMENTAL_WEB_PLATFORM_FEATURES, cba.ENABLE_EXPERIMENTAL_WEB_PLATFORM_FEATURES,
# All bots are connected with a power source, however, we want to to # All bots are connected with a power source, however, we want to to
# test with the code path that's enabled with battery power. # test with the code path that's enabled with battery power.
cba.DISABLE_DIRECT_COMPOSITION_VP_SCALING, cba.DISABLE_VP_SCALING,
]) ])
return default_args return default_args
...@@ -273,49 +277,37 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest): ...@@ -273,49 +277,37 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest):
else: else:
self.fail('Trace markers for GPU category %s were not found' % category) self.fail('Trace markers for GPU category %s were not found' % category)
def _GetVideoExpectations(self, other_args): def _GetVideoPathExpectations(self, other_args):
"""Helper for creating expectations for CheckVideoPath and CheckOverlayMode. """Helper method to get expectations for CheckVideoPath.
Args: Args:
other_args: The |other_args| arg passed into the test. other_args: The |other_args| arg passed into the test.
Returns: Returns:
A _VideoExpectations instance with zero_copy, pixel_format, no_overlay, A _VideoExpectations instance with zero_copy, pixel_format, and no_overlay
and presentation_mode filled in. filled in.
""" """
overlay_bot_config = self._GetAndAssertOverlayBotConfig() overlay_bot_config = self._GetAndAssertOverlayBotConfig()
expect_yuy2 = other_args.get('expect_yuy2', False)
expected = _VideoExpectations() expected = _VideoExpectations()
expected.zero_copy = other_args.get('zero_copy', False) expected.zero_copy = other_args.get('zero_copy', False)
expected.pixel_format = other_args.get('pixel_format', None) expected.pixel_format = "NV12"
expected.no_overlay = other_args.get('no_overlay', False) expected.no_overlay = other_args.get('no_overlay', False)
expected.presentation_mode = other_args.get('presentation_mode', None)
supports_nv12_overlays = False
if overlay_bot_config.get('supports_overlays', False): if overlay_bot_config.get('supports_overlays', False):
supports_nv12_overlays = overlay_bot_config[ supports_yuy2_overlays = False
'nv12_overlay_support'] != 'NONE' if overlay_bot_config['yuy2_overlay_support'] != 'NONE':
supports_yuy2_overlays = overlay_bot_config[ supports_yuy2_overlays = True
'yuy2_overlay_support'] != 'NONE' if overlay_bot_config['nv12_overlay_support'] != 'NONE':
assert supports_nv12_overlays or supports_yuy2_overlays supports_nv12_overlays = True
assert supports_yuy2_overlays or supports_nv12_overlays
if expected.pixel_format is None: if expect_yuy2 or not supports_nv12_overlays:
if supports_nv12_overlays: if overlay_bot_config['yuy2_overlay_support'] != 'SOFTWARE':
expected.pixel_format = 'NV12' expected.pixel_format = "YUY2"
elif supports_yuy2_overlays: if not supports_nv12_overlays or overlay_bot_config[
expected.pixel_format = 'YUY2' 'nv12_overlay_support'] == 'SOFTWARE':
expected.zero_copy = False
supports_hw_nv12_overlays = overlay_bot_config[
'nv12_overlay_support'] == 'HARDWARE'
supports_hw_yuy2_overlays = overlay_bot_config[
'yuy2_overlay_support'] == 'HARDWARE'
if not supports_hw_nv12_overlays:
expected.zero_copy = False
if expected.presentation_mode is None:
if supports_hw_nv12_overlays or supports_hw_yuy2_overlays:
expected.presentation_mode = 'OVERLAY'
else:
expected.presentation_mode = 'COMPOSED'
return expected return expected
...@@ -332,7 +324,7 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest): ...@@ -332,7 +324,7 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest):
assert os_name and os_name.lower() == 'win' assert os_name and os_name.lower() == 'win'
other_args = other_args or {} other_args = other_args or {}
expected = self._GetVideoExpectations(other_args) expected = self._GetVideoPathExpectations(other_args)
# Verify expectations through captured trace events. # Verify expectations through captured trace events.
for event in event_iterator: for event in event_iterator:
...@@ -363,6 +355,26 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest): ...@@ -363,6 +355,26 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest):
self.fail( self.fail(
'Events with name %s were not found' % _SWAP_CHAIN_PRESENT_EVENT_NAME) 'Events with name %s were not found' % _SWAP_CHAIN_PRESENT_EVENT_NAME)
def _GetOverlayModeExpectations(self, other_args):
"""Helper method to get expectations for CheckOverlayMode.
Args:
other_args: The |other_args| arg passed into the test.
Returns:
A _VideoExpectations instance with presentation_mode and no_overlay filled
in.
"""
overlay_bot_config = self._GetAndAssertOverlayBotConfig()
expected = _VideoExpectations()
expected.presentation_mode = _SWAP_CHAIN_PRESENTATION_MODE_COMPOSED
expected.no_overlay = other_args.get('no_overlay', False)
if overlay_bot_config.get('supports_overlays', False):
if overlay_bot_config['nv12_overlay_support'] != 'SOFTWARE':
expected.presentation_mode = _SWAP_CHAIN_PRESENTATION_MODE_OVERLAY
return expected
def _EvaluateSuccess_CheckOverlayMode(self, category, event_iterator, def _EvaluateSuccess_CheckOverlayMode(self, category, event_iterator,
other_args): other_args):
"""Verifies video frames are promoted to overlays when supported.""" """Verifies video frames are promoted to overlays when supported."""
...@@ -370,7 +382,7 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest): ...@@ -370,7 +382,7 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest):
assert os_name and os_name.lower() == 'win' assert os_name and os_name.lower() == 'win'
other_args = other_args or {} other_args = other_args or {}
expected = self._GetVideoExpectations(other_args) expected = self._GetOverlayModeExpectations(other_args)
presentation_mode_history = [] presentation_mode_history = []
for event in event_iterator: for event in event_iterator:
...@@ -396,12 +408,12 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest): ...@@ -396,12 +408,12 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest):
or mode == _SWAP_CHAIN_GET_FRAME_STATISTICS_MEDIA_FAILED): or mode == _SWAP_CHAIN_GET_FRAME_STATISTICS_MEDIA_FAILED):
# Be more tolerant to avoid test flakiness # Be more tolerant to avoid test flakiness
continue continue
if (TraceIntegrationTest._SwapChainPresentationModeToStr(mode) != if mode != expected.presentation_mode:
expected.presentation_mode):
if index >= len(presentation_mode_history) // 2: if index >= len(presentation_mode_history) // 2:
# Be more tolerant for the first half frames in non-overlay mode. # Be more tolerant for the first half frames in non-overlay mode.
self.fail('SwapChain presentation mode mismatch, expected %s got %s' % self.fail('SwapChain presentation mode mismatch, expected %s got %s' %
(expected.presentation_mode, (TraceIntegrationTest._SwapChainPresentationModeToStr(
expected.presentation_mode),
TraceIntegrationTest._SwapChainPresentationModeListToStr( TraceIntegrationTest._SwapChainPresentationModeListToStr(
presentation_mode_history))) presentation_mode_history)))
valid_entry_found = True valid_entry_found = True
...@@ -431,8 +443,8 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest): ...@@ -431,8 +443,8 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest):
continue continue
if event.name != _PRESENT_TO_SWAP_CHAIN_EVENT_NAME: if event.name != _PRESENT_TO_SWAP_CHAIN_EVENT_NAME:
continue continue
image_type = event.args.get('image_type', None) presentation_mode = event.args.get('image_type', None)
if image_type == 'swap chain': if presentation_mode == 'swap chain':
found_overlay = True found_overlay = True
break break
if expect_overlay and not found_overlay: if expect_overlay and not found_overlay:
...@@ -494,10 +506,10 @@ class _VideoExpectations(object): ...@@ -494,10 +506,10 @@ class _VideoExpectations(object):
"""Struct-like object for passing around video test expectations.""" """Struct-like object for passing around video test expectations."""
def __init__(self): def __init__(self):
self.pixel_format = None # str self.pixel_format = None
self.zero_copy = None # bool self.zero_copy = None
self.no_overlay = None # bool self.no_overlay = None
self.presentation_mode = None # str self.presentation_mode = None
def load_tests(loader, tests, pattern): def load_tests(loader, tests, pattern):
......
...@@ -195,7 +195,9 @@ void GetGpuDriverOverlayInfo(bool* supports_overlays, ...@@ -195,7 +195,9 @@ void GetGpuDriverOverlayInfo(bool* supports_overlays,
output3->CheckOverlaySupport(DXGI_FORMAT_R10G10B10A2_UNORM, output3->CheckOverlaySupport(DXGI_FORMAT_R10G10B10A2_UNORM,
d3d11_device.Get(), d3d11_device.Get(),
rgb10a2_overlay_support_flags); rgb10a2_overlay_support_flags);
if (FlagsSupportsOverlays(*nv12_overlay_support_flags)) { if (FlagsSupportsOverlays(*nv12_overlay_support_flags) &&
base::FeatureList::IsEnabled(
features::kDirectCompositionPreferNV12Overlays)) {
// NV12 format is preferred if it's supported. // NV12 format is preferred if it's supported.
// Per Intel's request, use NV12 only when // Per Intel's request, use NV12 only when
...@@ -301,23 +303,6 @@ void UpdateOverlaySupport() { ...@@ -301,23 +303,6 @@ void UpdateOverlaySupport() {
overlay_format_used = DXGI_FORMAT_NV12; overlay_format_used = DXGI_FORMAT_NV12;
} }
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDirectCompositionVideoSwapChainFormat)) {
std::string override_format =
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kDirectCompositionVideoSwapChainFormat);
if (override_format == kSwapChainFormatNV12) {
overlay_format_used = DXGI_FORMAT_NV12;
} else if (override_format == kSwapChainFormatYUY2) {
overlay_format_used = DXGI_FORMAT_YUY2;
} else if (override_format == kSwapChainFormatBGRA) {
overlay_format_used = DXGI_FORMAT_B8G8R8A8_UNORM;
} else {
DLOG(ERROR) << "Invalid value for switch "
<< switches::kDirectCompositionVideoSwapChainFormat;
}
}
if (supports_overlays != SupportsOverlays() || if (supports_overlays != SupportsOverlays() ||
overlay_format_used != g_overlay_format_used) { overlay_format_used != g_overlay_format_used) {
// Record the new histograms // Record the new histograms
...@@ -442,7 +427,9 @@ bool DirectCompositionSurfaceWin::AreOverlaysSupported() { ...@@ -442,7 +427,9 @@ bool DirectCompositionSurfaceWin::AreOverlaysSupported() {
// static // static
bool DirectCompositionSurfaceWin::IsDecodeSwapChainSupported() { bool DirectCompositionSurfaceWin::IsDecodeSwapChainSupported() {
if (!g_decode_swap_chain_disabled) { if (!g_decode_swap_chain_disabled &&
base::FeatureList::IsEnabled(
features::kDirectCompositionUseNV12DecodeSwapChain)) {
UpdateOverlaySupport(); UpdateOverlaySupport();
return GetOverlayFormatUsedForSDR() == DXGI_FORMAT_NV12; return GetOverlayFormatUsedForSDR() == DXGI_FORMAT_NV12;
} }
...@@ -473,13 +460,9 @@ bool DirectCompositionSurfaceWin::AreScaledOverlaysSupported() { ...@@ -473,13 +460,9 @@ bool DirectCompositionSurfaceWin::AreScaledOverlaysSupported() {
(SupportsOverlays() && (SupportsOverlays() &&
base::FeatureList::IsEnabled( base::FeatureList::IsEnabled(
features::kDirectCompositionSoftwareOverlays)); features::kDirectCompositionSoftwareOverlays));
} else if (g_overlay_format_used == DXGI_FORMAT_YUY2) {
return !!(g_yuy2_overlay_support_flags & DXGI_OVERLAY_SUPPORT_FLAG_SCALING);
} else {
DCHECK_EQ(g_overlay_format_used, DXGI_FORMAT_B8G8R8A8_UNORM);
// Assume scaling is supported for BGRA overlays.
return true;
} }
DCHECK_EQ(DXGI_FORMAT_YUY2, g_overlay_format_used);
return !!(g_yuy2_overlay_support_flags & DXGI_OVERLAY_SUPPORT_FLAG_SCALING);
} }
// static // static
...@@ -536,8 +519,7 @@ void DirectCompositionSurfaceWin::SetScaledOverlaysSupportedForTesting( ...@@ -536,8 +519,7 @@ void DirectCompositionSurfaceWin::SetScaledOverlaysSupportedForTesting(
// static // static
void DirectCompositionSurfaceWin::SetOverlayFormatUsedForTesting( void DirectCompositionSurfaceWin::SetOverlayFormatUsedForTesting(
DXGI_FORMAT format) { DXGI_FORMAT format) {
DCHECK(format == DXGI_FORMAT_NV12 || format == DXGI_FORMAT_YUY2 || DCHECK(format == DXGI_FORMAT_NV12 || format == DXGI_FORMAT_YUY2);
format == DXGI_FORMAT_B8G8R8A8_UNORM);
UpdateOverlaySupport(); UpdateOverlaySupport();
g_overlay_format_used = format; g_overlay_format_used = format;
DCHECK_EQ(format, GetOverlayFormatUsedForSDR()); DCHECK_EQ(format, GetOverlayFormatUsedForSDR());
......
...@@ -42,11 +42,6 @@ const char kANGLEImplementationMetalNULLName[] = "metal-null"; ...@@ -42,11 +42,6 @@ const char kANGLEImplementationMetalNULLName[] = "metal-null";
const char kCmdDecoderValidatingName[] = "validating"; const char kCmdDecoderValidatingName[] = "validating";
const char kCmdDecoderPassthroughName[] = "passthrough"; const char kCmdDecoderPassthroughName[] = "passthrough";
// Swap chain formats for direct composition SDR video overlays.
const char kSwapChainFormatNV12[] = "nv12";
const char kSwapChainFormatYUY2[] = "yuy2";
const char kSwapChainFormatBGRA[] = "bgra";
} // namespace gl } // namespace gl
namespace switches { namespace switches {
...@@ -157,11 +152,6 @@ const char kUseAdapterLuid[] = "use-adapter-luid"; ...@@ -157,11 +152,6 @@ const char kUseAdapterLuid[] = "use-adapter-luid";
const char kDirectCompositionForceFullDamageForTesting[] = const char kDirectCompositionForceFullDamageForTesting[] =
"direct-composition-force-full-damage-for-testing"; "direct-composition-force-full-damage-for-testing";
// Used for overriding the swap chain format for direct composition SDR video
// overlays.
const char kDirectCompositionVideoSwapChainFormat[] =
"direct-composition-video-swap-chain-format";
// This is the list of switches passed from this file that are passed from the // This is the list of switches passed from this file that are passed from the
// GpuProcessHost to the GPU Process. Add your switch to this list if you need // GpuProcessHost to the GPU Process. Add your switch to this list if you need
// to read it in the GPU process, else don't add it. // to read it in the GPU process, else don't add it.
...@@ -183,7 +173,6 @@ const char* const kGLSwitchesCopiedFromGpuProcessHost[] = { ...@@ -183,7 +173,6 @@ const char* const kGLSwitchesCopiedFromGpuProcessHost[] = {
kEnableDirectCompositionVideoOverlays, kEnableDirectCompositionVideoOverlays,
kDisableDirectCompositionVideoOverlays, kDisableDirectCompositionVideoOverlays,
kDirectCompositionForceFullDamageForTesting, kDirectCompositionForceFullDamageForTesting,
kDirectCompositionVideoSwapChainFormat,
}; };
const int kGLSwitchesCopiedFromGpuProcessHostNumSwitches = const int kGLSwitchesCopiedFromGpuProcessHostNumSwitches =
base::size(kGLSwitchesCopiedFromGpuProcessHost); base::size(kGLSwitchesCopiedFromGpuProcessHost);
...@@ -203,11 +192,26 @@ const base::Feature kDirectCompositionLowLatencyPresentation{ ...@@ -203,11 +192,26 @@ const base::Feature kDirectCompositionLowLatencyPresentation{
"DirectCompositionLowLatencyPresentation", "DirectCompositionLowLatencyPresentation",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
// Overrides preferred overlay format to NV12 instead of YUY2.
const base::Feature kDirectCompositionPreferNV12Overlays{
"DirectCompositionPreferNV12Overlays", base::FEATURE_ENABLED_BY_DEFAULT};
// Allow overlay swapchain to present on all GPUs even if they only support // Allow overlay swapchain to present on all GPUs even if they only support
// software overlays. // software overlays.
const base::Feature kDirectCompositionSoftwareOverlays{ const base::Feature kDirectCompositionSoftwareOverlays{
"DirectCompositionSoftwareOverlays", base::FEATURE_DISABLED_BY_DEFAULT}; "DirectCompositionSoftwareOverlays", base::FEATURE_DISABLED_BY_DEFAULT};
// Allow putting a video swapchain underneath the main swapchain, so overlays
// can be used even if there are controls on top of the video. It can be
// enabled only when overlay is supported.
const base::Feature kDirectCompositionUnderlays{
"DirectCompositionUnderlays", base::FEATURE_ENABLED_BY_DEFAULT};
// Use decode swap chain created from compatible video decoder buffers.
const base::Feature kDirectCompositionUseNV12DecodeSwapChain{
"DirectCompositionUseNV12DecodeSwapChain",
base::FEATURE_ENABLED_BY_DEFAULT};
// Default to using ANGLE's OpenGL backend // Default to using ANGLE's OpenGL backend
const base::Feature kDefaultANGLEOpenGL{"DefaultANGLEOpenGL", const base::Feature kDefaultANGLEOpenGL{"DefaultANGLEOpenGL",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
......
...@@ -45,10 +45,6 @@ GL_EXPORT extern const char kANGLEImplementationMetalNULLName[]; ...@@ -45,10 +45,6 @@ GL_EXPORT extern const char kANGLEImplementationMetalNULLName[];
GL_EXPORT extern const char kCmdDecoderValidatingName[]; GL_EXPORT extern const char kCmdDecoderValidatingName[];
GL_EXPORT extern const char kCmdDecoderPassthroughName[]; GL_EXPORT extern const char kCmdDecoderPassthroughName[];
GL_EXPORT extern const char kSwapChainFormatNV12[];
GL_EXPORT extern const char kSwapChainFormatYUY2[];
GL_EXPORT extern const char kSwapChainFormatBGRA[];
} // namespace gl } // namespace gl
namespace switches { namespace switches {
...@@ -78,7 +74,6 @@ GL_EXPORT extern const char kDisableDirectCompositionVideoOverlays[]; ...@@ -78,7 +74,6 @@ GL_EXPORT extern const char kDisableDirectCompositionVideoOverlays[];
GL_EXPORT extern const char kUseAdapterLuid[]; GL_EXPORT extern const char kUseAdapterLuid[];
GL_EXPORT extern const char kDirectCompositionForceFullDamageForTesting[]; GL_EXPORT extern const char kDirectCompositionForceFullDamageForTesting[];
GL_EXPORT extern const char kDirectCompositionVideoSwapChainFormat[];
// These flags are used by the test harness code, not passed in by users. // These flags are used by the test harness code, not passed in by users.
GL_EXPORT extern const char kDisableGLDrawingForTests[]; GL_EXPORT extern const char kDisableGLDrawingForTests[];
...@@ -93,9 +88,14 @@ namespace features { ...@@ -93,9 +88,14 @@ namespace features {
GL_EXPORT extern const base::Feature kDirectCompositionForceFullDamage; GL_EXPORT extern const base::Feature kDirectCompositionForceFullDamage;
GL_EXPORT extern const base::Feature kDirectCompositionGpuVSync; GL_EXPORT extern const base::Feature kDirectCompositionGpuVSync;
GL_EXPORT extern const base::Feature kDirectCompositionLowLatencyPresentation; GL_EXPORT extern const base::Feature kDirectCompositionLowLatencyPresentation;
GL_EXPORT extern const base::Feature kDirectCompositionPreferNV12Overlays;
GL_EXPORT extern const base::Feature kDirectCompositionPresentationFeedback;
GL_EXPORT extern const base::Feature kDirectCompositionSoftwareOverlays; GL_EXPORT extern const base::Feature kDirectCompositionSoftwareOverlays;
GL_EXPORT extern const base::Feature kDirectCompositionUnderlays;
GL_EXPORT extern const base::Feature kDirectCompositionUseNV12DecodeSwapChain;
GL_EXPORT extern const base::Feature kDefaultANGLEOpenGL; GL_EXPORT extern const base::Feature kDefaultANGLEOpenGL;
GL_EXPORT extern const base::Feature kTrackCurrentShaders; extern const base::Feature kTrackCurrentShaders;
} // namespace features } // namespace features
#endif // UI_GL_GL_SWITCHES_H_ #endif // UI_GL_GL_SWITCHES_H_
...@@ -498,6 +498,10 @@ bool SwapChainPresenter::TryPresentToDecodeSwapChain( ...@@ -498,6 +498,10 @@ bool SwapChainPresenter::TryPresentToDecodeSwapChain(
GLImageDXGI* nv12_image, GLImageDXGI* nv12_image,
const gfx::Rect& content_rect, const gfx::Rect& content_rect,
const gfx::Size& swap_chain_size) { const gfx::Size& swap_chain_size) {
if (!base::FeatureList::IsEnabled(
features::kDirectCompositionUseNV12DecodeSwapChain))
return false;
if (ShouldUseVideoProcessorScaling()) if (ShouldUseVideoProcessorScaling())
return false; return 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