Commit 42f22d64 authored by Sunny Sachanandani's avatar Sunny Sachanandani Committed by Commit Bot

viz: Do not promote quads affected by backdrop filters to overlays

Make DCLayerOverlayProcessor keep track of output rects of each child
render pass that has filter operations and compare that with the quad
target rect when deciding whether to promote to overlay.

Bug: 997517
Change-Id: Iee6cc6acfea1ae00ce1aa676138440949cfabd21
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1817269Reviewed-by: default avatarMaggie Chen <magchen@chromium.org>
Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Reviewed-by: default avatarMason Freed <masonfreed@chromium.org>
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Cr-Commit-Position: refs/heads/master@{#700061}
parent c8236710
...@@ -139,11 +139,25 @@ class VIZ_SERVICE_EXPORT DCLayerOverlayProcessor { ...@@ -139,11 +139,25 @@ class VIZ_SERVICE_EXPORT DCLayerOverlayProcessor {
int previous_frame_processed_overlay_count_ = 0; int previous_frame_processed_overlay_count_ = 0;
int current_frame_processed_overlay_count_ = 0; int current_frame_processed_overlay_count_ = 0;
// Store information about clipped punch-through rects in target space for struct RenderPassData {
// non-root render passes. These rects are used to clear the corresponding RenderPassData();
// areas in parent render passes. RenderPassData(const RenderPassData& other);
base::flat_map<RenderPassId, std::vector<gfx::Rect>> ~RenderPassData();
pass_punch_through_rects_;
// Store information about clipped punch-through rects in target space for
// non-root render passes. These rects are used to clear the corresponding
// areas in parent render passes.
std::vector<gfx::Rect> punch_through_rects;
// Output rects of child render passes that have backdrop filters in target
// space. These rects are used to determine if the overlay rect could be
// read by backdrop filters.
std::vector<gfx::Rect> backdrop_filter_rects;
// Whether this render pass has backdrop filters.
bool has_backdrop_filters = false;
};
base::flat_map<RenderPassId, RenderPassData> render_pass_data_;
DISALLOW_COPY_AND_ASSIGN(DCLayerOverlayProcessor); DISALLOW_COPY_AND_ASSIGN(DCLayerOverlayProcessor);
}; };
......
<!DOCTYPE HTML>
<!-- READ BEFORE UPDATING:
If this test is updated make sure to increment the "revision" value of the
associated test in content/test/gpu/page_sets/pixel_tests.py. This will ensure
that the baseline images are regenerated on the next run.
-->
<html>
<head>
<meta name="viewport" content="initial-scale=1">
<title>MP4 Video with Backdrop Filter Test</title>
<style type="text/css">
.nomargin {
margin: 0px auto;
}
.absolute {
position: absolute;
top: 0px;
left: 0px;
}
.backdrop {
width: 200px;
height: 100px;
backdrop-filter: grayscale(1);
z-index: 1;
}
</style>
<script src="pixel_video_test.js"></script>
</head>
<body onload="main()">
<div id="container" class="absolute">
<video class="nomargin" id="video" width="240" height="135">
<source src="/media/test/data/four-colors.mp4" type="video/mp4">
</video>
<div class="nomargin absolute backdrop"></div>
</div>
</body>
</html>
...@@ -62,7 +62,9 @@ class PixelTestPage(object): ...@@ -62,7 +62,9 @@ class PixelTestPage(object):
# action here is "CrashGpuProcess" then it would be defined in a # action here is "CrashGpuProcess" then it would be defined in a
# "_CrashGpuProcess" method in PixelIntegrationTest. # "_CrashGpuProcess" method in PixelIntegrationTest.
self.optional_action = optional_action self.optional_action = optional_action
# Whatever other settings a test need to specify. # These are used to pass additional arguments to the test harness.
# VideoPathTraceTest and OverlayModeTest support the following boolean
# arguments: expect_yuy2, zero_copy, video_is_rotated, and no_overlay.
self.other_args = other_args self.other_args = other_args
def CopyWithNewBrowserArgsAndSuffix(self, browser_args, suffix): def CopyWithNewBrowserArgsAndSuffix(self, browser_args, suffix):
...@@ -467,6 +469,13 @@ class PixelTestPages(object): ...@@ -467,6 +469,13 @@ class PixelTestPages(object):
tolerance=tolerance_vp9, tolerance=tolerance_vp9,
expected_colors=_FOUR_COLOR_VIDEO_240x135_EXPECTED_COLORS), expected_colors=_FOUR_COLOR_VIDEO_240x135_EXPECTED_COLORS),
PixelTestPage(
'pixel_video_backdrop_filter.html',
base_name + '_Video_BackdropFilter',
test_rect=[0, 0, 240, 135],
revision=1,
tolerance=tolerance),
PixelTestPage( PixelTestPage(
'pixel_webgl_premultiplied_alpha_false.html', 'pixel_webgl_premultiplied_alpha_false.html',
base_name + '_WebGL_PremultipliedAlpha_False', base_name + '_WebGL_PremultipliedAlpha_False',
...@@ -1238,8 +1247,6 @@ class PixelTestPages(object): ...@@ -1238,8 +1247,6 @@ class PixelTestPages(object):
# All bots are connected with a power source, however, we want to to test # All bots are connected with a power source, however, we want to to test
# with the code path that's enabled with battery power. # with the code path that's enabled with battery power.
'--disable_vp_scaling=1'] '--disable_vp_scaling=1']
browser_args_Underlay = browser_args + [
'--enable-features=DirectCompositionUnderlays']
browser_args_Nonroot = browser_args +[ browser_args_Nonroot = browser_args +[
'--enable-features=DirectCompositionNonrootOverlays,' + '--enable-features=DirectCompositionNonrootOverlays,' +
'DirectCompositionUnderlays'] 'DirectCompositionUnderlays']
...@@ -1251,9 +1258,6 @@ class PixelTestPages(object): ...@@ -1251,9 +1258,6 @@ class PixelTestPages(object):
'--disable-features=DirectCompositionPreferNV12Overlays'] '--disable-features=DirectCompositionPreferNV12Overlays']
browser_args_DXVA = browser_args + [ browser_args_DXVA = browser_args + [
'--disable-features=D3D11VideoDecoder'] '--disable-features=D3D11VideoDecoder']
browser_args_Underlay_DXVA = browser_args + [
'--enable-features=DirectCompositionUnderlays',
'--disable-features=D3D11VideoDecoder']
tolerance_dc = 5 tolerance_dc = 5
tolerance_dc_vp9 = 15 tolerance_dc_vp9 = 15
...@@ -1562,7 +1566,7 @@ class PixelTestPages(object): ...@@ -1562,7 +1566,7 @@ class PixelTestPages(object):
base_name + '_DirectComposition_Underlay', base_name + '_DirectComposition_Underlay',
test_rect=[0, 0, 240, 136], test_rect=[0, 0, 240, 136],
revision=0, # Golden image revision is not used revision=0, # Golden image revision is not used
browser_args=browser_args_Underlay, browser_args=browser_args,
tolerance=tolerance_dc, tolerance=tolerance_dc,
expected_colors=[ expected_colors=[
{ {
...@@ -1602,7 +1606,7 @@ class PixelTestPages(object): ...@@ -1602,7 +1606,7 @@ class PixelTestPages(object):
base_name + '_DirectComposition_Underlay_DXVA', base_name + '_DirectComposition_Underlay_DXVA',
test_rect=[0, 0, 240, 136], test_rect=[0, 0, 240, 136],
revision=0, # Golden image revision is not used revision=0, # Golden image revision is not used
browser_args=browser_args_Underlay_DXVA, browser_args=browser_args_DXVA,
tolerance=tolerance_dc, tolerance=tolerance_dc,
expected_colors=[ expected_colors=[
{ {
...@@ -1642,7 +1646,7 @@ class PixelTestPages(object): ...@@ -1642,7 +1646,7 @@ class PixelTestPages(object):
base_name + '_DirectComposition_Underlay_Fullsize', base_name + '_DirectComposition_Underlay_Fullsize',
test_rect=[0, 0, 960, 540], test_rect=[0, 0, 960, 540],
revision=0, # Golden image revision is not used revision=0, # Golden image revision is not used
browser_args=browser_args_Underlay, browser_args=browser_args,
other_args={'zero_copy': True}, other_args={'zero_copy': True},
tolerance=tolerance_dc, tolerance=tolerance_dc,
expected_colors=[ expected_colors=[
...@@ -1765,4 +1769,13 @@ class PixelTestPages(object): ...@@ -1765,4 +1769,13 @@ class PixelTestPages(object):
revision=0, revision=0,
browser_args=browser_args, browser_args=browser_args,
tolerance=tolerance_dc), tolerance=tolerance_dc),
PixelTestPage(
'pixel_video_backdrop_filter.html',
base_name + '_DirectComposition_Video_BackdropFilter',
test_rect=[0, 0, 240, 135],
revision=1,
browser_args=browser_args,
other_args={'no_overlay': True},
tolerance=tolerance_dc),
] ]
...@@ -222,6 +222,7 @@ crbug.com/991291 [ android skia-renderer use-vulkan ] Pixel_Video_MP4_FourColors ...@@ -222,6 +222,7 @@ crbug.com/991291 [ android skia-renderer use-vulkan ] Pixel_Video_MP4_FourColors
crbug.com/991291 [ android skia-renderer use-vulkan ] Pixel_Video_MP4_FourColors_Rot_270 [ Skip ] crbug.com/991291 [ android skia-renderer use-vulkan ] Pixel_Video_MP4_FourColors_Rot_270 [ Skip ]
crbug.com/991291 [ android skia-renderer use-vulkan ] Pixel_Video_MP4_FourColors_Rot_90 [ Skip ] crbug.com/991291 [ android skia-renderer use-vulkan ] Pixel_Video_MP4_FourColors_Rot_90 [ Skip ]
crbug.com/991291 [ android skia-renderer use-vulkan ] Pixel_Video_VP9 [ Skip ] crbug.com/991291 [ android skia-renderer use-vulkan ] Pixel_Video_VP9 [ Skip ]
crbug.com/991291 [ android skia-renderer use-vulkan ] Pixel_Video_BackdropFilter [ Skip ]
# Fails when the browser features SkiaRenderer & GL are enabled on Android. # Fails when the browser features SkiaRenderer & GL are enabled on Android.
# The more specific matching criteria is to prevent collisions with other expectations. # The more specific matching criteria is to prevent collisions with other expectations.
......
...@@ -261,8 +261,7 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest): ...@@ -261,8 +261,7 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest):
assert os_name and os_name.lower() == 'win' assert os_name and os_name.lower() == 'win'
# Calculate expectations. # Calculate expectations.
if other_args is None: other_args = other_args if other_args is not None else {}
other_args = {}
expect_yuy2 = other_args.get('expect_yuy2', False) expect_yuy2 = other_args.get('expect_yuy2', False)
zero_copy = other_args.get('zero_copy', False) zero_copy = other_args.get('zero_copy', False)
...@@ -285,12 +284,16 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest): ...@@ -285,12 +284,16 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest):
if not supports_nv12_overlays: if not supports_nv12_overlays:
zero_copy = False zero_copy = False
expect_no_overlay = other_args.get('no_overlay', False)
# Verify expectations through captured trace events. # Verify expectations through captured trace events.
for event in event_iterator: for event in event_iterator:
if event.category != category: if event.category != category:
continue continue
if event.name != _SWAP_CHAIN_PRESENT_EVENT_NAME: if event.name != _SWAP_CHAIN_PRESENT_EVENT_NAME:
continue continue
if expect_no_overlay:
self.fail('Expected no overlay got %s' % _SWAP_CHAIN_PRESENT_EVENT_NAME)
detected_pixel_format = event.args.get('PixelFormat', None) detected_pixel_format = event.args.get('PixelFormat', None)
if detected_pixel_format is None: if detected_pixel_format is None:
self.fail('PixelFormat is missing from event %s' % self.fail('PixelFormat is missing from event %s' %
...@@ -307,6 +310,8 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest): ...@@ -307,6 +310,8 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest):
(zero_copy, detected_zero_copy)) (zero_copy, detected_zero_copy))
break break
else: else:
if expect_no_overlay:
return
self.fail('Events with name %s were not found' % self.fail('Events with name %s were not found' %
_SWAP_CHAIN_PRESENT_EVENT_NAME) _SWAP_CHAIN_PRESENT_EVENT_NAME)
...@@ -325,17 +330,26 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest): ...@@ -325,17 +330,26 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest):
if overlay_bot_config.get('supports_overlays', False): if overlay_bot_config.get('supports_overlays', False):
expected_presentation_mode = _SWAP_CHAIN_PRESENTATION_MODE_OVERLAY expected_presentation_mode = _SWAP_CHAIN_PRESENTATION_MODE_OVERLAY
other_args = other_args if other_args is not None else {}
expect_no_overlay = other_args.get('no_overlay', False)
presentation_mode_history = [] presentation_mode_history = []
for event in event_iterator: for event in event_iterator:
if event.category != category: if event.category != category:
continue continue
if event.name != _GET_STATISTICS_EVENT_NAME: if event.name != _GET_STATISTICS_EVENT_NAME:
continue continue
if expect_no_overlay:
self.fail('Expected no overlay got %s' % _GET_STATISTICS_EVENT_NAME)
detected_presentation_mode = event.args.get('CompositionMode', None) detected_presentation_mode = event.args.get('CompositionMode', None)
if detected_presentation_mode is None: if detected_presentation_mode is None:
self.fail('PresentationMode is missing from event %s' % self.fail('PresentationMode is missing from event %s' %
_GET_STATISTICS_EVENT_NAME) _GET_STATISTICS_EVENT_NAME)
presentation_mode_history.append(detected_presentation_mode) presentation_mode_history.append(detected_presentation_mode)
if expect_no_overlay:
return
valid_entry_found = False valid_entry_found = False
for index in range(len(presentation_mode_history)): for index in range(len(presentation_mode_history)):
mode = presentation_mode_history[index] mode = presentation_mode_history[index]
......
...@@ -13104,6 +13104,7 @@ Called by update_net_error_codes.py.--> ...@@ -13104,6 +13104,7 @@ Called by update_net_error_codes.py.-->
<int value="8" label="Failed too many overlays"/> <int value="8" label="Failed too many overlays"/>
<int value="9" label="Failed no hw overlay support (deprecated)"/> <int value="9" label="Failed no hw overlay support (deprecated)"/>
<int value="10" label="Failed quad has rounded corners"/> <int value="10" label="Failed quad has rounded corners"/>
<int value="11" label="Failed read by backdrop filters"/>
</enum> </enum>
<enum name="DeclarativeAPIFunctionType"> <enum name="DeclarativeAPIFunctionType">
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