summaryrefslogtreecommitdiffstats
path: root/cc/quads
diff options
context:
space:
mode:
authorccameron <ccameron@chromium.org>2015-10-08 13:23:46 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-08 20:24:49 +0000
commit268c09fdae64b08957aba9b31797adb93525c90f (patch)
treef20a976b0b530e6338c631e8cd8cb6f29147458f /cc/quads
parent0cd4698d5a49b556b859909210287b5019e84542 (diff)
downloadchromium_src-268c09fdae64b08957aba9b31797adb93525c90f.zip
chromium_src-268c09fdae64b08957aba9b31797adb93525c90f.tar.gz
chromium_src-268c09fdae64b08957aba9b31797adb93525c90f.tar.bz2
cc: Remove redundant overlay arguments
Whether or not a quad can be made into an overlay is dependent on whether there is a GLImage backing the texture resources that the quad uses. Prior to this patch, this information was passed along to the layer or quad via a side-channel, in the form of a "allow overlay" argument. Now, store this information in the cc::Resource, in particular, through the cc::TextureMailbox that it is created from, and have the overlay strategy query the property of the cc::Resource. Add appropriate plumbing of the parameters from the cc::TextureMailbox, through the cc::Resource, to cc::TransferableResource, and finally to a cc::Resource in other compositors. R=reveman,fsamuel,dcheng TBR=danakj BUG=533690 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1387283002 Cr-Commit-Position: refs/heads/master@{#353128}
Diffstat (limited to 'cc/quads')
-rw-r--r--cc/quads/draw_quad_unittest.cc56
-rw-r--r--cc/quads/io_surface_draw_quad.cc12
-rw-r--r--cc/quads/io_surface_draw_quad.h7
-rw-r--r--cc/quads/stream_video_draw_quad.cc6
-rw-r--r--cc/quads/stream_video_draw_quad.h7
-rw-r--r--cc/quads/texture_draw_quad.cc4
-rw-r--r--cc/quads/texture_draw_quad.h8
7 files changed, 20 insertions, 80 deletions
diff --git a/cc/quads/draw_quad_unittest.cc b/cc/quads/draw_quad_unittest.cc
index a1d1a90..2fd7a80c 100644
--- a/cc/quads/draw_quad_unittest.cc
+++ b/cc/quads/draw_quad_unittest.cc
@@ -384,34 +384,22 @@ TEST(DrawQuadTest, CopyIOSurfaceDrawQuad) {
gfx::Size size(58, 95);
ResourceId resource_id = 72;
IOSurfaceDrawQuad::Orientation orientation = IOSurfaceDrawQuad::UNFLIPPED;
- bool allow_overlay = true;
CREATE_SHARED_STATE();
- CREATE_QUAD_6_NEW(IOSurfaceDrawQuad,
- opaque_rect,
- visible_rect,
- size,
- resource_id,
- orientation,
- allow_overlay);
+ CREATE_QUAD_5_NEW(IOSurfaceDrawQuad, opaque_rect, visible_rect, size,
+ resource_id, orientation);
EXPECT_EQ(DrawQuad::IO_SURFACE_CONTENT, copy_quad->material);
EXPECT_EQ(visible_rect, copy_quad->visible_rect);
EXPECT_EQ(opaque_rect, copy_quad->opaque_rect);
EXPECT_EQ(size, copy_quad->io_surface_size);
EXPECT_EQ(resource_id, copy_quad->io_surface_resource_id());
EXPECT_EQ(orientation, copy_quad->orientation);
- EXPECT_EQ(allow_overlay, copy_quad->allow_overlay);
- CREATE_QUAD_4_ALL(IOSurfaceDrawQuad,
- size,
- resource_id,
- orientation,
- allow_overlay);
+ CREATE_QUAD_3_ALL(IOSurfaceDrawQuad, size, resource_id, orientation);
EXPECT_EQ(DrawQuad::IO_SURFACE_CONTENT, copy_quad->material);
EXPECT_EQ(size, copy_quad->io_surface_size);
EXPECT_EQ(resource_id, copy_quad->io_surface_resource_id());
EXPECT_EQ(orientation, copy_quad->orientation);
- EXPECT_EQ(allow_overlay, copy_quad->allow_overlay);
}
TEST(DrawQuadTest, CopyRenderPassDrawQuad) {
@@ -495,25 +483,22 @@ TEST(DrawQuadTest, CopyStreamVideoDrawQuad) {
gfx::Rect visible_rect(40, 50, 30, 20);
ResourceId resource_id = 64;
gfx::Size resource_size_in_pixels = gfx::Size(40, 41);
- bool allow_overlay = true;
gfx::Transform matrix = gfx::Transform(0.5, 0.25, 1, 0.75, 0, 1);
CREATE_SHARED_STATE();
- CREATE_QUAD_6_NEW(StreamVideoDrawQuad, opaque_rect, visible_rect, resource_id,
- resource_size_in_pixels, allow_overlay, matrix);
+ CREATE_QUAD_5_NEW(StreamVideoDrawQuad, opaque_rect, visible_rect, resource_id,
+ resource_size_in_pixels, matrix);
EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copy_quad->material);
EXPECT_EQ(visible_rect, copy_quad->visible_rect);
EXPECT_EQ(opaque_rect, copy_quad->opaque_rect);
EXPECT_EQ(resource_id, copy_quad->resource_id());
- EXPECT_EQ(allow_overlay, copy_quad->allow_overlay());
EXPECT_EQ(resource_size_in_pixels, copy_quad->resource_size_in_pixels());
EXPECT_EQ(matrix, copy_quad->matrix);
- CREATE_QUAD_4_ALL(StreamVideoDrawQuad, resource_id, resource_size_in_pixels,
- allow_overlay, matrix);
+ CREATE_QUAD_3_ALL(StreamVideoDrawQuad, resource_id, resource_size_in_pixels,
+ matrix);
EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copy_quad->material);
EXPECT_EQ(resource_id, copy_quad->resource_id());
- EXPECT_EQ(allow_overlay, copy_quad->allow_overlay());
EXPECT_EQ(resource_size_in_pixels, copy_quad->resource_size_in_pixels());
EXPECT_EQ(matrix, copy_quad->matrix);
}
@@ -539,7 +524,6 @@ TEST(DrawQuadTest, CopyTextureDrawQuad) {
gfx::Rect visible_rect(40, 50, 30, 20);
unsigned resource_id = 82;
gfx::Size resource_size_in_pixels = gfx::Size(40, 41);
- bool allow_overlay = true;
bool premultiplied_alpha = true;
gfx::PointF uv_top_left(0.5f, 224.f);
gfx::PointF uv_bottom_right(51.5f, 260.f);
@@ -570,13 +554,12 @@ TEST(DrawQuadTest, CopyTextureDrawQuad) {
EXPECT_EQ(y_flipped, copy_quad->y_flipped);
EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor);
- CREATE_QUAD_10_ALL(TextureDrawQuad, resource_id, resource_size_in_pixels,
- allow_overlay, premultiplied_alpha, uv_top_left,
- uv_bottom_right, SK_ColorTRANSPARENT, vertex_opacity,
- y_flipped, nearest_neighbor);
+ CREATE_QUAD_9_ALL(TextureDrawQuad, resource_id, resource_size_in_pixels,
+ premultiplied_alpha, uv_top_left, uv_bottom_right,
+ SK_ColorTRANSPARENT, vertex_opacity, y_flipped,
+ nearest_neighbor);
EXPECT_EQ(DrawQuad::TEXTURE_CONTENT, copy_quad->material);
EXPECT_EQ(resource_id, copy_quad->resource_id());
- EXPECT_EQ(allow_overlay, copy_quad->allow_overlay());
EXPECT_EQ(resource_size_in_pixels, copy_quad->resource_size_in_pixels());
EXPECT_EQ(premultiplied_alpha, copy_quad->premultiplied_alpha);
EXPECT_EQ(uv_top_left, copy_quad->uv_top_left);
@@ -745,20 +728,13 @@ TEST_F(DrawQuadIteratorTest, IOSurfaceDrawQuad) {
gfx::Size size(58, 95);
ResourceId resource_id = 72;
IOSurfaceDrawQuad::Orientation orientation = IOSurfaceDrawQuad::UNFLIPPED;
- bool allow_overlay = true;
CREATE_SHARED_STATE();
- CREATE_QUAD_6_NEW(IOSurfaceDrawQuad,
- opaque_rect,
- visible_rect,
- size,
- resource_id,
- orientation,
- allow_overlay);
+ CREATE_QUAD_5_NEW(IOSurfaceDrawQuad, opaque_rect, visible_rect, size,
+ resource_id, orientation);
EXPECT_EQ(resource_id, quad_new->io_surface_resource_id());
EXPECT_EQ(1, IterateAndCount(quad_new));
EXPECT_EQ(resource_id + 1, quad_new->io_surface_resource_id());
- EXPECT_EQ(allow_overlay, copy_quad->allow_overlay);
}
TEST_F(DrawQuadIteratorTest, RenderPassDrawQuad) {
@@ -816,14 +792,12 @@ TEST_F(DrawQuadIteratorTest, StreamVideoDrawQuad) {
gfx::Rect visible_rect(40, 50, 30, 20);
ResourceId resource_id = 64;
gfx::Size resource_size_in_pixels = gfx::Size(40, 41);
- bool allow_overlay = true;
gfx::Transform matrix = gfx::Transform(0.5, 0.25, 1, 0.75, 0, 1);
CREATE_SHARED_STATE();
- CREATE_QUAD_6_NEW(StreamVideoDrawQuad, opaque_rect, visible_rect, resource_id,
- resource_size_in_pixels, allow_overlay, matrix);
+ CREATE_QUAD_5_NEW(StreamVideoDrawQuad, opaque_rect, visible_rect, resource_id,
+ resource_size_in_pixels, matrix);
EXPECT_EQ(resource_id, quad_new->resource_id());
- EXPECT_EQ(allow_overlay, quad_new->allow_overlay());
EXPECT_EQ(resource_size_in_pixels, quad_new->resource_size_in_pixels());
EXPECT_EQ(1, IterateAndCount(quad_new));
EXPECT_EQ(resource_id + 1, quad_new->resource_id());
diff --git a/cc/quads/io_surface_draw_quad.cc b/cc/quads/io_surface_draw_quad.cc
index 32e2ffc4..1ed0021 100644
--- a/cc/quads/io_surface_draw_quad.cc
+++ b/cc/quads/io_surface_draw_quad.cc
@@ -11,9 +11,7 @@
namespace cc {
-IOSurfaceDrawQuad::IOSurfaceDrawQuad()
- : orientation(FLIPPED), allow_overlay(false) {
-}
+IOSurfaceDrawQuad::IOSurfaceDrawQuad() : orientation(FLIPPED) {}
void IOSurfaceDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
const gfx::Rect& rect,
@@ -21,8 +19,7 @@ void IOSurfaceDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
const gfx::Rect& visible_rect,
const gfx::Size& io_surface_size,
unsigned io_surface_resource_id,
- Orientation orientation,
- bool allow_overlay) {
+ Orientation orientation) {
bool needs_blending = false;
DrawQuad::SetAll(shared_quad_state, DrawQuad::IO_SURFACE_CONTENT, rect,
opaque_rect, visible_rect, needs_blending);
@@ -30,7 +27,6 @@ void IOSurfaceDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
resources.ids[kIOSurfaceResourceIdIndex] = io_surface_resource_id;
resources.count = 1;
this->orientation = orientation;
- this->allow_overlay = allow_overlay;
}
void IOSurfaceDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
@@ -40,15 +36,13 @@ void IOSurfaceDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
bool needs_blending,
const gfx::Size& io_surface_size,
unsigned io_surface_resource_id,
- Orientation orientation,
- bool allow_overlay) {
+ Orientation orientation) {
DrawQuad::SetAll(shared_quad_state, DrawQuad::IO_SURFACE_CONTENT, rect,
opaque_rect, visible_rect, needs_blending);
this->io_surface_size = io_surface_size;
resources.ids[kIOSurfaceResourceIdIndex] = io_surface_resource_id;
resources.count = 1;
this->orientation = orientation;
- this->allow_overlay = allow_overlay;
}
const IOSurfaceDrawQuad* IOSurfaceDrawQuad::MaterialCast(
diff --git a/cc/quads/io_surface_draw_quad.h b/cc/quads/io_surface_draw_quad.h
index 0374aa9..4a8a072 100644
--- a/cc/quads/io_surface_draw_quad.h
+++ b/cc/quads/io_surface_draw_quad.h
@@ -28,8 +28,7 @@ class CC_EXPORT IOSurfaceDrawQuad : public DrawQuad {
const gfx::Rect& visible_rect,
const gfx::Size& io_surface_size,
unsigned io_surface_resource_id,
- Orientation orientation,
- bool allow_overlay);
+ Orientation orientation);
void SetAll(const SharedQuadState* shared_quad_state,
const gfx::Rect& rect,
@@ -38,12 +37,10 @@ class CC_EXPORT IOSurfaceDrawQuad : public DrawQuad {
bool needs_blending,
const gfx::Size& io_surface_size,
unsigned io_surface_resource_id,
- Orientation orientation,
- bool allow_overlay);
+ Orientation orientation);
gfx::Size io_surface_size;
Orientation orientation;
- bool allow_overlay;
ResourceId io_surface_resource_id() const {
return resources.ids[kIOSurfaceResourceIdIndex];
diff --git a/cc/quads/stream_video_draw_quad.cc b/cc/quads/stream_video_draw_quad.cc
index c25e5d5..7760168 100644
--- a/cc/quads/stream_video_draw_quad.cc
+++ b/cc/quads/stream_video_draw_quad.cc
@@ -20,14 +20,12 @@ void StreamVideoDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
const gfx::Rect& visible_rect,
unsigned resource_id,
gfx::Size resource_size_in_pixels,
- bool allow_overlay,
const gfx::Transform& matrix) {
bool needs_blending = false;
DrawQuad::SetAll(shared_quad_state, DrawQuad::STREAM_VIDEO_CONTENT, rect,
opaque_rect, visible_rect, needs_blending);
resources.ids[kResourceIdIndex] = resource_id;
overlay_resources.size_in_pixels[kResourceIdIndex] = resource_size_in_pixels;
- overlay_resources.allow_overlay[kResourceIdIndex] = allow_overlay;
resources.count = 1;
this->matrix = matrix;
}
@@ -39,13 +37,11 @@ void StreamVideoDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
bool needs_blending,
unsigned resource_id,
gfx::Size resource_size_in_pixels,
- bool allow_overlay,
const gfx::Transform& matrix) {
DrawQuad::SetAll(shared_quad_state, DrawQuad::STREAM_VIDEO_CONTENT, rect,
opaque_rect, visible_rect, needs_blending);
resources.ids[kResourceIdIndex] = resource_id;
overlay_resources.size_in_pixels[kResourceIdIndex] = resource_size_in_pixels;
- overlay_resources.allow_overlay[kResourceIdIndex] = allow_overlay;
resources.count = 1;
this->matrix = matrix;
}
@@ -63,8 +59,6 @@ void StreamVideoDrawQuad::ExtendValue(
}
StreamVideoDrawQuad::OverlayResources::OverlayResources() {
- for (size_t i = 0; i < Resources::kMaxResourceIdCount; ++i)
- allow_overlay[i] = false;
}
} // namespace cc
diff --git a/cc/quads/stream_video_draw_quad.h b/cc/quads/stream_video_draw_quad.h
index 519c353..1044fdc 100644
--- a/cc/quads/stream_video_draw_quad.h
+++ b/cc/quads/stream_video_draw_quad.h
@@ -22,7 +22,6 @@ class CC_EXPORT StreamVideoDrawQuad : public DrawQuad {
const gfx::Rect& visible_rect,
unsigned resource_id,
gfx::Size resource_size_in_pixels,
- bool allow_overlay,
const gfx::Transform& matrix);
void SetAll(const SharedQuadState* shared_quad_state,
@@ -32,16 +31,13 @@ class CC_EXPORT StreamVideoDrawQuad : public DrawQuad {
bool needs_blending,
unsigned resource_id,
gfx::Size resource_size_in_pixels,
- bool allow_overlay,
const gfx::Transform& matrix);
gfx::Transform matrix;
struct OverlayResources {
OverlayResources();
-
gfx::Size size_in_pixels[Resources::kMaxResourceIdCount];
- bool allow_overlay[Resources::kMaxResourceIdCount];
};
OverlayResources overlay_resources;
@@ -51,9 +47,6 @@ class CC_EXPORT StreamVideoDrawQuad : public DrawQuad {
const gfx::Size& resource_size_in_pixels() const {
return overlay_resources.size_in_pixels[kResourceIdIndex];
}
- bool allow_overlay() const {
- return overlay_resources.allow_overlay[kResourceIdIndex];
- }
private:
static const size_t kResourceIdIndex = 0;
diff --git a/cc/quads/texture_draw_quad.cc b/cc/quads/texture_draw_quad.cc
index c469c87..370277b 100644
--- a/cc/quads/texture_draw_quad.cc
+++ b/cc/quads/texture_draw_quad.cc
@@ -60,7 +60,6 @@ void TextureDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
bool needs_blending,
unsigned resource_id,
gfx::Size resource_size_in_pixels,
- bool allow_overlay,
bool premultiplied_alpha,
const gfx::PointF& uv_top_left,
const gfx::PointF& uv_bottom_right,
@@ -72,7 +71,6 @@ void TextureDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
opaque_rect, visible_rect, needs_blending);
resources.ids[kResourceIdIndex] = resource_id;
overlay_resources.size_in_pixels[kResourceIdIndex] = resource_size_in_pixels;
- overlay_resources.allow_overlay[kResourceIdIndex] = allow_overlay;
resources.count = 1;
this->premultiplied_alpha = premultiplied_alpha;
this->uv_top_left = uv_top_left;
@@ -110,8 +108,6 @@ void TextureDrawQuad::ExtendValue(base::trace_event::TracedValue* value) const {
}
TextureDrawQuad::OverlayResources::OverlayResources() {
- for (size_t i = 0; i < Resources::kMaxResourceIdCount; ++i)
- allow_overlay[i] = false;
}
} // namespace cc
diff --git a/cc/quads/texture_draw_quad.h b/cc/quads/texture_draw_quad.h
index 40c7623..9b9fab9 100644
--- a/cc/quads/texture_draw_quad.h
+++ b/cc/quads/texture_draw_quad.h
@@ -36,7 +36,6 @@ class CC_EXPORT TextureDrawQuad : public DrawQuad {
bool needs_blending,
unsigned resource_id,
gfx::Size resource_size_in_pixels,
- bool allow_overlay,
bool premultiplied_alpha,
const gfx::PointF& uv_top_left,
const gfx::PointF& uv_bottom_right,
@@ -57,7 +56,6 @@ class CC_EXPORT TextureDrawQuad : public DrawQuad {
OverlayResources();
gfx::Size size_in_pixels[Resources::kMaxResourceIdCount];
- bool allow_overlay[Resources::kMaxResourceIdCount];
};
OverlayResources overlay_resources;
@@ -68,12 +66,6 @@ class CC_EXPORT TextureDrawQuad : public DrawQuad {
void set_resource_size_in_pixels(const gfx::Size& size_in_pixels) {
overlay_resources.size_in_pixels[kResourceIdIndex] = size_in_pixels;
}
- bool allow_overlay() const {
- return overlay_resources.allow_overlay[kResourceIdIndex];
- }
- void set_allow_overlay(bool allow_overlay) {
- overlay_resources.allow_overlay[kResourceIdIndex] = allow_overlay;
- }
static const TextureDrawQuad* MaterialCast(const DrawQuad*);