Commit fc9c6f0f authored by Sunny Sachanandani's avatar Sunny Sachanandani Committed by Commit Bot

gpu: Do not promote I420A video to overlay on Windows

GpuMemoryBufferVideoFramePool uses RGBA/BGRA as the output format for
I420A video frames, and those are promoted to overlays on all platforms.
This causes SwapBuffers to fail in the GPU process on Windows since the
direct composition path can only handle YUV video.  This wasn't a
problem until we started promoting TextureDrawQuads to overlays in
crrev.com/c/1746796 assuming that the is_overlay_candidate flag would
only be set for low latency canvas that uses a swap chain.

A pixel test with yuva420p vp9 video is added.  The video was generated
using the following ffmpeg command:

ffmpeg -i four-colors.mp4 -filter_complex \
"color=c=#7F7F7F7F:s=960x540:rate=12[a];[0][a]alphamerge,format=yuva420p" \
-c:v libvpx-vp9 -auto-alt-ref 0 four-colors-vp9-i420a.webm

Bug: 1005028
Change-Id: Idc84d29c588cf3b9273fb605b2542be5441d61d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1829556
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: default avatarDaniele Castagna <dcastagna@chromium.org>
Reviewed-by: default avatarFrank Liberato <liberato@chromium.org>
Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#702590}
parent 4222362a
...@@ -438,6 +438,7 @@ group("telemetry_gpu_integration_test") { ...@@ -438,6 +438,7 @@ group("telemetry_gpu_integration_test") {
"//media/test/data/four-colors-rot-180.mp4", "//media/test/data/four-colors-rot-180.mp4",
"//media/test/data/four-colors-rot-270.mp4", "//media/test/data/four-colors-rot-270.mp4",
"//media/test/data/four-colors-vp9.webm", "//media/test/data/four-colors-vp9.webm",
"//media/test/data/four-colors-vp9-i420a.webm",
# For power # For power
"//media/test/data/bear-1280x720.mp4", "//media/test/data/bear-1280x720.mp4",
......
<!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>VP9 I420A Video test</title>
<style type="text/css">
.nomargin {
margin: 0px auto;
}
</style>
<script src="pixel_video_test.js"></script>
</head>
<body onload="main()">
<div id="container" style="position:absolute; top:0px; left:0px">
<video class="nomargin" id="video" width="240" height="135">
<source src="/media/test/data/four-colors-vp9-i420a.webm" type="video/webm">
</video>
</div>
</body>
</html>
...@@ -1474,6 +1474,40 @@ class PixelTestPages(object): ...@@ -1474,6 +1474,40 @@ class PixelTestPages(object):
tolerance=tolerance_dc_vp9, tolerance=tolerance_dc_vp9,
expected_colors=_FOUR_COLOR_VIDEO_240x135_EXPECTED_COLORS), expected_colors=_FOUR_COLOR_VIDEO_240x135_EXPECTED_COLORS),
PixelTestPage(
'pixel_video_vp9_i420a.html',
base_name + '_DirectComposition_Video_VP9_I420A',
test_rect=[0, 0, 240, 135],
browser_args=browser_args,
other_args={'no_overlay': True},
tolerance=tolerance_dc_vp9,
expected_colors=[
{
'comment': 'top left video, yellow',
'location': [5, 5],
'size': [110, 57],
'color': [255, 255, 143],
},
{
'comment': 'top right video, red',
'location': [125, 5],
'size': [110, 57],
'color': [251, 130, 143],
},
{
'comment': 'bottom left video, blue',
'location': [5, 72],
'size': [110, 57],
'color': [135, 130, 254],
},
{
'comment': 'bottom right video, green',
'location': [125, 72],
'size': [110, 57],
'color': [160, 255, 142],
}
]),
PixelTestPage( PixelTestPage(
'pixel_video_underlay.html', 'pixel_video_underlay.html',
base_name + '_DirectComposition_Underlay', base_name + '_DirectComposition_Underlay',
......
...@@ -233,10 +233,14 @@ a rotation of 180 degrees in mp4 meta data. ...@@ -233,10 +233,14 @@ a rotation of 180 degrees in mp4 meta data.
Actual video frames are the same as four-colors.mp4, except it specifies Actual video frames are the same as four-colors.mp4, except it specifies
a rotation of 270 degrees in mp4 meta data. a rotation of 270 degrees in mp4 meta data.
#### four-colors-vp9.web #### four-colors-vp9.webm
A 960x540 vp9 video with 4 color blocks (Y,R,G,B) in every frame. This is A 960x540 vp9 video with 4 color blocks (Y,R,G,B) in every frame. This is
converted from four-colors.mp4 by ffmpeg. converted from four-colors.mp4 by ffmpeg.
#### four-colors-vp9-i420a.webm
A 960x540 yuva420p vp9 video with 4 color blocks (Y,R,G,B) in every frame. This
is converted from four-colors.mp4 by adding an opacity of 0.5 using ffmpeg.
#### bear-320x180-hi10p.mp4 #### bear-320x180-hi10p.mp4
#### bear-320x240-vp9_profile2.webm #### bear-320x240-vp9_profile2.webm
VP9 encoded video with profile 2 (10-bit, 4:2:0). VP9 encoded video with profile 2 (10-bit, 4:2:0).
......
...@@ -916,6 +916,11 @@ void GpuMemoryBufferVideoFramePool::PoolImpl:: ...@@ -916,6 +916,11 @@ void GpuMemoryBufferVideoFramePool::PoolImpl::
frame->set_color_space(video_frame->ColorSpace()); frame->set_color_space(video_frame->ColorSpace());
bool allow_overlay = false; bool allow_overlay = false;
#if defined(OS_WIN)
// Windows direct composition path only supports dual GMB NV12 video overlays.
allow_overlay = (output_format_ ==
GpuVideoAcceleratorFactories::OutputFormat::NV12_DUAL_GMB);
#else
switch (output_format_) { switch (output_format_) {
case GpuVideoAcceleratorFactories::OutputFormat::I420: case GpuVideoAcceleratorFactories::OutputFormat::I420:
allow_overlay = allow_overlay =
...@@ -925,9 +930,7 @@ void GpuMemoryBufferVideoFramePool::PoolImpl:: ...@@ -925,9 +930,7 @@ void GpuMemoryBufferVideoFramePool::PoolImpl::
allow_overlay = true; allow_overlay = true;
break; break;
case GpuVideoAcceleratorFactories::OutputFormat::NV12_DUAL_GMB: case GpuVideoAcceleratorFactories::OutputFormat::NV12_DUAL_GMB:
#if defined(OS_WIN) // Only used on Windows where we can't use single NV12 textures.
allow_overlay = true;
#endif
break; break;
case GpuVideoAcceleratorFactories::OutputFormat::XR30: case GpuVideoAcceleratorFactories::OutputFormat::XR30:
case GpuVideoAcceleratorFactories::OutputFormat::XB30: case GpuVideoAcceleratorFactories::OutputFormat::XB30:
...@@ -946,7 +949,7 @@ void GpuMemoryBufferVideoFramePool::PoolImpl:: ...@@ -946,7 +949,7 @@ void GpuMemoryBufferVideoFramePool::PoolImpl::
case GpuVideoAcceleratorFactories::OutputFormat::UNDEFINED: case GpuVideoAcceleratorFactories::OutputFormat::UNDEFINED:
break; break;
} }
#endif // OS_WIN
frame->metadata()->MergeMetadataFrom(video_frame->metadata()); frame->metadata()->MergeMetadataFrom(video_frame->metadata());
frame->metadata()->SetBoolean(VideoFrameMetadata::ALLOW_OVERLAY, frame->metadata()->SetBoolean(VideoFrameMetadata::ALLOW_OVERLAY,
allow_overlay); allow_overlay);
......
...@@ -722,8 +722,11 @@ bool SwapChainPresenter::PresentToSwapChain( ...@@ -722,8 +722,11 @@ bool SwapChainPresenter::PresentToSwapChain(
if (!nv12_image && (!y_image_memory || !uv_image_memory) && if (!nv12_image && (!y_image_memory || !uv_image_memory) &&
!swap_chain_image) { !swap_chain_image) {
DLOG(ERROR) << "Video GLImages are missing"; DLOG(ERROR) << "Video GLImages are missing";
// No need to release resources as context will be lost soon. ReleaseSwapChainResources();
return false; // We don't treat this as an error because this could mean that the client
// sent us invalid overlay candidates which we weren't able to detect prior
// to this. This would cause incorrect rendering, but not a failure loop.
return true;
} }
std::string image_type = "software video frame"; std::string image_type = "software video frame";
......
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