Commit 83286073 authored by Andres Calderon Jaramillo's avatar Andres Calderon Jaramillo Committed by Commit Bot

Add simple pixel test with multiple render passes.

This CL creates a simple pixel test that does not rely on WebGL, canvas,
or video and that results in multiple render passes.

Motivation: https://crrev.com/c/1637737 broke Android compositing of
some mixed WebGL/Canvas2D content. The root cause was an incorrect
assumption in that CL: that when the framebuffer for the root render
pass is bound, we wouldn't try to bind it again before swapping it. This
assumption was wrong in the case of drawing a render pass quad onto the
root render pass. See [1]. The aforementioned CL would call
BeginSharedImageAccessDirectCHROMIUM() upon binding the root render
pass' framebuffer and would call EndSharedImageAccessDirectCHROMIUM()
only when the buffer is swapped. So, binding the framebuffer multiple
times would result in the shared image system thinking that we wanted
concurrent access to the SharedImage.

When running some of the existing WebGL/Canvas2D pixel tests, I did see
artifacts resulting from the wrong assumption, but they don't happen in
all frames.

The test in this CL reliably hits the issue. It's rendered using
multiple render passes. The page is animated with JS to reliably
reproduce the problem. I tried running the test before and after the
revert of the bad CL (https://crrev.com/c/1963369). Before that revert,
the test failed 20/20 times. After the revert the test succeeded 20/20
times.

For this test to catch the regression, it must run on Android Q.

[1] https://cs.chromium.org/chromium/src/components/viz/service/display/gl_renderer.cc?l=1134-1136&rcl=64245a1d4d5484c33272c0fcb99731eff23b4103

Bug: 958670,1033279
Test: run locally on Pixel 2 w/ Android Q before/after CL:1963369.
Change-Id: Id154e45814043e8a47d58b784df3b854b6036693
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1979059
Commit-Queue: Andres Calderon Jaramillo <andrescj@chromium.org>
Reviewed-by: default avatarBrian Sheedy <bsheedy@chromium.org>
Reviewed-by: default avatarEric Karl <ericrk@chromium.org>
Reviewed-by: default avatarKenneth Russell <kbr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#733856}
parent c80f71e1
<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="initial-scale=1">
<title>A div with its reflection below which results in multiple render passes</title>
<style type="text/css">
body {
margin: 0px auto;
}
/* Both will-change and -webkit-box-reflect are needed to ensure multiple render
passes. */
#main {
position: absolute;
background-color: #FF8000;
width: 100px;
height: 400px;
will-change: transform;
-webkit-box-reflect: below 100px;
}
</style>
<script>
var frame = 0;
// It's necessary to do an animation prior to sending SUCCESS in order to
// reliably reproduce https://crbug.com/1033279.
function animate() {
frame++;
document.getElementById('main').style.top = '-' + frame + 'px';
if (frame == 300) {
domAutomationController.send("SUCCESS");
return;
}
// Use setTimeout() because window.requestAnimationFrame() doesn't reliably
// reproduce https://crbug.com/1033279.
setTimeout(animate, 20);
}
</script>
</head>
<body onload="animate()">
<div id="main"></div>
</body>
</html>
...@@ -150,6 +150,31 @@ class PixelTestPages(object): ...@@ -150,6 +150,31 @@ class PixelTestPages(object):
base_name + '_BackgroundImage', base_name + '_BackgroundImage',
test_rect=[20, 20, 370, 370]), test_rect=[20, 20, 370, 370]),
PixelTestPage(
'pixel_reflected_div.html',
base_name + '_ReflectedDiv',
test_rect=[0, 0, 100, 300],
expected_colors=[
{
'comment': 'inside original div, orange',
'location': [0, 0],
'size': [100, 99],
'color': [255, 128, 0],
},
{
'comment': 'outside both div and reflection, in between, white',
'location': [0, 101],
'size': [100, 98],
'color': [255, 255, 255],
},
{
'comment': 'inside reflection, orange',
'location': [0, 201],
'size': [100, 99],
'color': [255, 128, 0],
}
]),
PixelTestPage( PixelTestPage(
'pixel_canvas2d.html', 'pixel_canvas2d.html',
base_name + '_Canvas2DRedBox', base_name + '_Canvas2DRedBox',
......
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