diff options
author | alexst@chromium.org <alexst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-20 05:56:39 +0000 |
---|---|---|
committer | alexst@chromium.org <alexst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-20 05:56:39 +0000 |
commit | 63880f8df2c37a295bf06d5174a502d5b3833d35 (patch) | |
tree | 033a3c0d8db3028760c1f1b954772af2336dc1f2 /cc/quads | |
parent | 47be222062b4141ef06182b47d198e6f4b8c88cc (diff) | |
download | chromium_src-63880f8df2c37a295bf06d5174a502d5b3833d35.zip chromium_src-63880f8df2c37a295bf06d5174a502d5b3833d35.tar.gz chromium_src-63880f8df2c37a295bf06d5174a502d5b3833d35.tar.bz2 |
Start of hardware overlay support in CC with Ubercompositor.
I'm trying to introduce everything as small unit tested pieces.
This adds some machinery for checking if quads inside a render pass could
be placed into an overlay. A capability checker is added to the output
surface, so that a particular overlay configuration could be validated
against a specific display device. If an external monitor is plugged in,
its output surface may behave differently that that of the primary on
a laptop, for example.
The intention is for OverlayCandidates checker to be created as part of
BrowserCompositorOutputSurface where the actual hardware knowledge can
be delegated to the Ozone platform and the HW specific bits can live there,
leaving CC and content platform agnostic.
BUG=
Review URL: https://codereview.chromium.org/197223003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258209 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/quads')
-rw-r--r-- | cc/quads/render_pass.cc | 16 | ||||
-rw-r--r-- | cc/quads/render_pass.h | 10 | ||||
-rw-r--r-- | cc/quads/render_pass_unittest.cc | 19 |
3 files changed, 35 insertions, 10 deletions
diff --git a/cc/quads/render_pass.cc b/cc/quads/render_pass.cc index cdf3b94..1eeefe4 100644 --- a/cc/quads/render_pass.cc +++ b/cc/quads/render_pass.cc @@ -35,14 +35,16 @@ scoped_ptr<RenderPass> RenderPass::Create(size_t num_layers) { RenderPass::RenderPass() : id(Id(-1, -1)), - has_transparent_background(true) { + has_transparent_background(true), + overlay_state(NO_OVERLAY) { shared_quad_state_list.reserve(kDefaultNumSharedQuadStatesToReserve); quad_list.reserve(kDefaultNumQuadsToReserve); } RenderPass::RenderPass(size_t num_layers) : id(Id(-1, -1)), - has_transparent_background(true) { + has_transparent_background(true), + overlay_state(NO_OVERLAY) { // Each layer usually produces one shared quad state, so the number of layers // is a good hint for what to reserve here. shared_quad_state_list.reserve(num_layers); @@ -61,7 +63,8 @@ scoped_ptr<RenderPass> RenderPass::Copy(Id new_id) const { output_rect, damage_rect, transform_to_root_target, - has_transparent_background); + has_transparent_background, + overlay_state); return copy_pass.Pass(); } @@ -80,7 +83,8 @@ void RenderPass::CopyAll(const ScopedPtrVector<RenderPass>& in, source->output_rect, source->damage_rect, source->transform_to_root_target, - source->has_transparent_background); + source->has_transparent_background, + source->overlay_state); for (size_t i = 0; i < source->shared_quad_state_list.size(); ++i) { copy_pass->shared_quad_state_list.push_back( source->shared_quad_state_list[i]->Copy()); @@ -131,7 +135,8 @@ void RenderPass::SetAll(Id id, const gfx::Rect& output_rect, const gfx::RectF& damage_rect, const gfx::Transform& transform_to_root_target, - bool has_transparent_background) { + bool has_transparent_background, + OverlayState overlay_state) { DCHECK_GT(id.layer_id, 0); DCHECK_GE(id.index, 0); @@ -140,6 +145,7 @@ void RenderPass::SetAll(Id id, this->damage_rect = damage_rect; this->transform_to_root_target = transform_to_root_target; this->has_transparent_background = has_transparent_background; + this->overlay_state = overlay_state; DCHECK(quad_list.empty()); DCHECK(shared_quad_state_list.empty()); diff --git a/cc/quads/render_pass.h b/cc/quads/render_pass.h index 4285e53..5cada2a 100644 --- a/cc/quads/render_pass.h +++ b/cc/quads/render_pass.h @@ -62,6 +62,11 @@ class CC_EXPORT RenderPass { } }; + // Specifies whether the pass is going into an overlay, needs to be rendered + // into a buffer before it can be presented to overlay hardware or a quad + // inside it is presented as is. + enum OverlayState { NO_OVERLAY, RENDER_AND_OVERLAY, SIMPLE_OVERLAY, }; + ~RenderPass(); static scoped_ptr<RenderPass> Create(); @@ -84,7 +89,8 @@ class CC_EXPORT RenderPass { const gfx::Rect& output_rect, const gfx::RectF& damage_rect, const gfx::Transform& transform_to_root_target, - bool has_transparent_background); + bool has_transparent_background, + OverlayState overlay_state); scoped_ptr<base::Value> AsValue() const; @@ -111,6 +117,8 @@ class CC_EXPORT RenderPass { QuadList quad_list; SharedQuadStateList shared_quad_state_list; + OverlayState overlay_state; + protected: explicit RenderPass(size_t num_layers); RenderPass(); diff --git a/cc/quads/render_pass_unittest.cc b/cc/quads/render_pass_unittest.cc index fd58523..1305741 100644 --- a/cc/quads/render_pass_unittest.cc +++ b/cc/quads/render_pass_unittest.cc @@ -31,6 +31,7 @@ struct RenderPassSize { gfx::RectF damage_rect; bool has_transparent_background; ScopedPtrVector<CopyOutputRequest> copy_callbacks; + RenderPass::OverlayState overlay_state; }; static void CompareRenderPassLists(const RenderPassList& expected_list, @@ -47,6 +48,7 @@ static void CompareRenderPassLists(const RenderPassList& expected_list, EXPECT_RECT_EQ(expected->damage_rect, actual->damage_rect); EXPECT_EQ(expected->has_transparent_background, actual->has_transparent_background); + EXPECT_EQ(expected->overlay_state, actual->overlay_state); EXPECT_EQ(expected->shared_quad_state_list.size(), actual->shared_quad_state_list.size()); @@ -69,13 +71,15 @@ TEST(RenderPassTest, CopyShouldBeIdenticalExceptIdAndQuads) { gfx::Transform(1.0, 0.5, 0.5, -0.5, -1.0, 0.0); gfx::Rect damage_rect(56, 123, 19, 43); bool has_transparent_background = true; + RenderPass::OverlayState overlay_state = RenderPass::SIMPLE_OVERLAY; scoped_ptr<TestRenderPass> pass = TestRenderPass::Create(); pass->SetAll(id, output_rect, damage_rect, transform_to_root, - has_transparent_background); + has_transparent_background, + overlay_state); pass->copy_requests.push_back(CopyOutputRequest::CreateEmptyRequest()); // Stick a quad in the pass, this should not get copied. @@ -103,6 +107,7 @@ TEST(RenderPassTest, CopyShouldBeIdenticalExceptIdAndQuads) { EXPECT_EQ(pass->transform_to_root_target, copy->transform_to_root_target); EXPECT_RECT_EQ(pass->damage_rect, copy->damage_rect); EXPECT_EQ(pass->has_transparent_background, copy->has_transparent_background); + EXPECT_EQ(pass->overlay_state, copy->overlay_state); EXPECT_EQ(0u, copy->quad_list.size()); // The copy request should not be copied/duplicated. @@ -121,13 +126,15 @@ TEST(RenderPassTest, CopyAllShouldBeIdentical) { gfx::Transform(1.0, 0.5, 0.5, -0.5, -1.0, 0.0); gfx::Rect damage_rect(56, 123, 19, 43); bool has_transparent_background = true; + RenderPass::OverlayState overlay_state = RenderPass::SIMPLE_OVERLAY; scoped_ptr<TestRenderPass> pass = TestRenderPass::Create(); pass->SetAll(id, output_rect, damage_rect, transform_to_root, - has_transparent_background); + has_transparent_background, + overlay_state); // Two quads using one shared state. scoped_ptr<SharedQuadState> shared_state1 = SharedQuadState::Create(); @@ -190,13 +197,15 @@ TEST(RenderPassTest, CopyAllShouldBeIdentical) { gfx::Transform(1.0, 0.5, 0.5, -0.5, -1.0, 0.0); gfx::Rect contrib_damage_rect(11, 16, 10, 15); bool contrib_has_transparent_background = true; + RenderPass::OverlayState contrib_overlay_state = RenderPass::SIMPLE_OVERLAY; scoped_ptr<TestRenderPass> contrib = TestRenderPass::Create(); contrib->SetAll(contrib_id, contrib_output_rect, contrib_damage_rect, contrib_transform_to_root, - contrib_has_transparent_background); + contrib_has_transparent_background, + contrib_overlay_state); scoped_ptr<SharedQuadState> contrib_shared_state = SharedQuadState::Create(); contrib_shared_state->SetAll(gfx::Transform(), @@ -249,13 +258,15 @@ TEST(RenderPassTest, CopyAllWithCulledQuads) { gfx::Transform(1.0, 0.5, 0.5, -0.5, -1.0, 0.0); gfx::Rect damage_rect(56, 123, 19, 43); bool has_transparent_background = true; + RenderPass::OverlayState overlay_state = RenderPass::SIMPLE_OVERLAY; scoped_ptr<TestRenderPass> pass = TestRenderPass::Create(); pass->SetAll(id, output_rect, damage_rect, transform_to_root, - has_transparent_background); + has_transparent_background, + overlay_state); // A shared state with a quad. scoped_ptr<SharedQuadState> shared_state1 = SharedQuadState::Create(); |