Commit b52ea8e2 authored by Daniele Castagna's avatar Daniele Castagna Committed by Commit Bot

Check VideoFrameSubmitter produces only one quad

blink::VideoFrameSubmitter produces quads using
VideoFrameResourceProvider.VideoFrameSubmitter, that
produces at most one quad.

This CL DCHECKs that at most one quad is produced, since
we want to use this property for optimizing damage
tracking in SurfaceAggregator/GLRenderer.

Having the guarantee that only one quad will be produced
for this CompositorFrame will allow us to mark the video as
the only quad producing damage in SurfaceAggregator.
In this way GLRenderer will be able to promote to HW overlay
the quad for the video and completely skip compositing of the
remaining quads.
This will result in significant power savings.

Bug: 795008, b/80061773
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: Ic4c612c5c221366bd67039d937dc0e42104b4c56
Reviewed-on: https://chromium-review.googlesource.com/1083977Reviewed-by: default avatarDan Sanders <sandersd@chromium.org>
Reviewed-by: default avatarStephen White <senorblanco@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Reviewed-by: default avatarCJ DiMeglio <lethalantidote@chromium.org>
Commit-Queue: Daniele Castagna <dcastagna@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565337}
parent 2e3db781
...@@ -97,6 +97,11 @@ class MEDIA_EXPORT VideoResourceUpdater ...@@ -97,6 +97,11 @@ class MEDIA_EXPORT VideoResourceUpdater
// remove imported resources from viz::ClientResourceProvider. // remove imported resources from viz::ClientResourceProvider.
void ObtainFrameResources(scoped_refptr<VideoFrame> video_frame); void ObtainFrameResources(scoped_refptr<VideoFrame> video_frame);
void ReleaseFrameResources(); void ReleaseFrameResources();
// Appends a quad representing |frame| to |render_pass|.
// At most one quad is expected to be appended, this is enforced by the users
// of this class (e.g: VideoFrameSubmitter). Producing only one quad will
// allow viz to optimize compositing when the only content changing per-frame
// is the video.
void AppendQuads(viz::RenderPass* render_pass, void AppendQuads(viz::RenderPass* render_pass,
scoped_refptr<VideoFrame> frame, scoped_refptr<VideoFrame> frame,
gfx::Transform transform, gfx::Transform transform,
......
...@@ -210,8 +210,10 @@ void VideoFrameSubmitter::SubmitFrame( ...@@ -210,8 +210,10 @@ void VideoFrameSubmitter::SubmitFrame(
compositor_frame.metadata.may_contain_video = true; compositor_frame.metadata.may_contain_video = true;
std::vector<viz::ResourceId> resources; std::vector<viz::ResourceId> resources;
for (auto* quad : render_pass->quad_list) { DCHECK_LE(render_pass->quad_list.size(), 1u);
for (viz::ResourceId resource_id : quad->resources) { if (!render_pass->quad_list.empty()) {
for (viz::ResourceId resource_id :
render_pass->quad_list.front()->resources) {
resources.push_back(resource_id); resources.push_back(resource_id);
} }
} }
......
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