summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer
diff options
context:
space:
mode:
authorwatk <watk@chromium.org>2015-11-30 14:45:49 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-30 22:46:29 +0000
commitf3c6a7898179b250386d04d621a30bc239ae9af8 (patch)
treedcf651a63f0678c67b2ff288e303bff64962d743 /gpu/command_buffer
parentcac15a242b84f7af0e474cc2bc37fc28ccf67fcd (diff)
downloadchromium_src-f3c6a7898179b250386d04d621a30bc239ae9af8.zip
chromium_src-f3c6a7898179b250386d04d621a30bc239ae9af8.tar.gz
chromium_src-f3c6a7898179b250386d04d621a30bc239ae9af8.tar.bz2
Add CommitOverlayPlanesCHROMIUM command buffer function
This extension is for displaying overlay planes without swapping the framebuffer. This is useful when overlays account for all the damage and it would be more efficient to not swap. This patch is the result of adding the command to cmd_buffer_functions.txt and build_gles2_cmd_buffer.py and running the latter. The implementations will be added in a following CL. BUG=560592 Review URL: https://codereview.chromium.org/1472993003 Cr-Commit-Position: refs/heads/master@{#362253}
Diffstat (limited to 'gpu/command_buffer')
-rwxr-xr-xgpu/command_buffer/build_gles2_cmd_buffer.py8
-rw-r--r--gpu/command_buffer/client/gles2_c_lib_autogen.h7
-rw-r--r--gpu/command_buffer/client/gles2_cmd_helper_autogen.h8
-rw-r--r--gpu/command_buffer/client/gles2_implementation.cc5
-rw-r--r--gpu/command_buffer/client/gles2_implementation_autogen.h2
-rw-r--r--gpu/command_buffer/client/gles2_interface_autogen.h1
-rw-r--r--gpu/command_buffer/client/gles2_interface_stub_autogen.h1
-rw-r--r--gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h1
-rw-r--r--gpu/command_buffer/client/gles2_trace_implementation_autogen.h1
-rw-r--r--gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h6
-rw-r--r--gpu/command_buffer/cmd_buffer_functions.txt1
-rw-r--r--gpu/command_buffer/common/gles2_cmd_format_autogen.h27
-rw-r--r--gpu/command_buffer/common/gles2_cmd_format_test_autogen.h10
-rw-r--r--gpu/command_buffer/common/gles2_cmd_ids_autogen.h55
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc7
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_autogen.h10
16 files changed, 123 insertions, 27 deletions
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py
index 6897f0d..0d8b7df 100755
--- a/gpu/command_buffer/build_gles2_cmd_buffer.py
+++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -4153,6 +4153,14 @@ _FUNCTION_INFO = {
'extension': 'CHROMIUM_schedule_ca_layer',
'chromium': True,
},
+ 'CommitOverlayPlanesCHROMIUM': {
+ 'impl_func': False,
+ 'decoder_func': 'DoCommitOverlayPlanes',
+ 'unit_test': False,
+ 'client_test': False,
+ 'extension': 'CHROMIUM_commit_overlay_planes',
+ 'chromium': True,
+ },
'MatrixLoadfCHROMIUM': {
'type': 'PUT',
'count': 16,
diff --git a/gpu/command_buffer/client/gles2_c_lib_autogen.h b/gpu/command_buffer/client/gles2_c_lib_autogen.h
index 112889c..7003cbc 100644
--- a/gpu/command_buffer/client/gles2_c_lib_autogen.h
+++ b/gpu/command_buffer/client/gles2_c_lib_autogen.h
@@ -1523,6 +1523,9 @@ void GL_APIENTRY GLES2ScheduleCALayerCHROMIUM(GLuint contents_texture_id,
contents_texture_id, contents_rect, opacity, background_color,
bounds_size, transform);
}
+void GL_APIENTRY GLES2CommitOverlayPlanesCHROMIUM() {
+ gles2::GetGLContext()->CommitOverlayPlanesCHROMIUM();
+}
void GL_APIENTRY GLES2SwapInterval(GLint interval) {
gles2::GetGLContext()->SwapInterval(interval);
}
@@ -2863,6 +2866,10 @@ extern const NameToFunc g_gles2_function_table[] = {
reinterpret_cast<GLES2FunctionPointer>(glScheduleCALayerCHROMIUM),
},
{
+ "glCommitOverlayPlanesCHROMIUM",
+ reinterpret_cast<GLES2FunctionPointer>(glCommitOverlayPlanesCHROMIUM),
+ },
+ {
"glSwapInterval",
reinterpret_cast<GLES2FunctionPointer>(glSwapInterval),
},
diff --git a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
index ce1d8b7..e2123f5 100644
--- a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
+++ b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
@@ -2847,6 +2847,14 @@ void ScheduleCALayerCHROMIUM(GLuint contents_texture_id,
}
}
+void CommitOverlayPlanesCHROMIUM() {
+ gles2::cmds::CommitOverlayPlanesCHROMIUM* c =
+ GetCmdSpace<gles2::cmds::CommitOverlayPlanesCHROMIUM>();
+ if (c) {
+ c->Init();
+ }
+}
+
void SwapInterval(GLint interval) {
gles2::cmds::SwapInterval* c = GetCmdSpace<gles2::cmds::SwapInterval>();
if (c) {
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 99b2450..7a73f60 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -4293,6 +4293,11 @@ void GLES2Implementation::PartialSwapBuffers(const gfx::Rect& sub_buffer) {
sub_buffer.x(), sub_buffer.y(), sub_buffer.width(), sub_buffer.height());
}
+void GLES2Implementation::CommitOverlayPlanesCHROMIUM() {
+ // TODO(watk): crbug.com/560592
+ NOTIMPLEMENTED();
+}
+
static GLenum GetGLESOverlayTransform(gfx::OverlayTransform plane_transform) {
switch (plane_transform) {
case gfx::OVERLAY_TRANSFORM_INVALID:
diff --git a/gpu/command_buffer/client/gles2_implementation_autogen.h b/gpu/command_buffer/client/gles2_implementation_autogen.h
index b74d150..fc99066 100644
--- a/gpu/command_buffer/client/gles2_implementation_autogen.h
+++ b/gpu/command_buffer/client/gles2_implementation_autogen.h
@@ -1057,6 +1057,8 @@ void ScheduleCALayerCHROMIUM(GLuint contents_texture_id,
const GLfloat* bounds_size,
const GLfloat* transform) override;
+void CommitOverlayPlanesCHROMIUM() override;
+
void SwapInterval(GLint interval) override;
void FlushDriverCachesCHROMIUM() override;
diff --git a/gpu/command_buffer/client/gles2_interface_autogen.h b/gpu/command_buffer/client/gles2_interface_autogen.h
index 461d597..9edbc49 100644
--- a/gpu/command_buffer/client/gles2_interface_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_autogen.h
@@ -785,6 +785,7 @@ virtual void ScheduleCALayerCHROMIUM(GLuint contents_texture_id,
const GLuint background_color,
const GLfloat* bounds_size,
const GLfloat* transform) = 0;
+virtual void CommitOverlayPlanesCHROMIUM() = 0;
virtual void SwapInterval(GLint interval) = 0;
virtual void FlushDriverCachesCHROMIUM() = 0;
virtual void MatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat* m) = 0;
diff --git a/gpu/command_buffer/client/gles2_interface_stub_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_autogen.h
index 9ad7c50..bc478cb 100644
--- a/gpu/command_buffer/client/gles2_interface_stub_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_stub_autogen.h
@@ -761,6 +761,7 @@ void ScheduleCALayerCHROMIUM(GLuint contents_texture_id,
const GLuint background_color,
const GLfloat* bounds_size,
const GLfloat* transform) override;
+void CommitOverlayPlanesCHROMIUM() override;
void SwapInterval(GLint interval) override;
void FlushDriverCachesCHROMIUM() override;
void MatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat* m) override;
diff --git a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
index ddc7cec..4e3a712 100644
--- a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
@@ -1040,6 +1040,7 @@ void GLES2InterfaceStub::ScheduleCALayerCHROMIUM(
const GLuint /* background_color */,
const GLfloat* /* bounds_size */,
const GLfloat* /* transform */) {}
+void GLES2InterfaceStub::CommitOverlayPlanesCHROMIUM() {}
void GLES2InterfaceStub::SwapInterval(GLint /* interval */) {}
void GLES2InterfaceStub::FlushDriverCachesCHROMIUM() {}
void GLES2InterfaceStub::MatrixLoadfCHROMIUM(GLenum /* matrixMode */,
diff --git a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
index 8779c04..27923ea 100644
--- a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
+++ b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
@@ -761,6 +761,7 @@ void ScheduleCALayerCHROMIUM(GLuint contents_texture_id,
const GLuint background_color,
const GLfloat* bounds_size,
const GLfloat* transform) override;
+void CommitOverlayPlanesCHROMIUM() override;
void SwapInterval(GLint interval) override;
void FlushDriverCachesCHROMIUM() override;
void MatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat* m) override;
diff --git a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
index 9d80272..1fc343f 100644
--- a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
+++ b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
@@ -2220,6 +2220,12 @@ void GLES2TraceImplementation::ScheduleCALayerCHROMIUM(
background_color, bounds_size, transform);
}
+void GLES2TraceImplementation::CommitOverlayPlanesCHROMIUM() {
+ TRACE_EVENT_BINARY_EFFICIENT0("gpu",
+ "GLES2Trace::CommitOverlayPlanesCHROMIUM");
+ gl_->CommitOverlayPlanesCHROMIUM();
+}
+
void GLES2TraceImplementation::SwapInterval(GLint interval) {
TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::SwapInterval");
gl_->SwapInterval(interval);
diff --git a/gpu/command_buffer/cmd_buffer_functions.txt b/gpu/command_buffer/cmd_buffer_functions.txt
index de2a6f1..fe6e9e9 100644
--- a/gpu/command_buffer/cmd_buffer_functions.txt
+++ b/gpu/command_buffer/cmd_buffer_functions.txt
@@ -314,6 +314,7 @@ GL_APICALL void GL_APIENTRY glDrawBuffersEXT (GLsizei count, const GLenu
GL_APICALL void GL_APIENTRY glDiscardBackbufferCHROMIUM (void);
GL_APICALL void GL_APIENTRY glScheduleOverlayPlaneCHROMIUM (GLint plane_z_order, GLenum plane_transform, GLuint overlay_texture_id, GLint bounds_x, GLint bounds_y, GLint bounds_width, GLint bounds_height, GLfloat uv_x, GLfloat uv_y, GLfloat uv_width, GLfloat uv_height);
GL_APICALL void GL_APIENTRY glScheduleCALayerCHROMIUM (GLuint contents_texture_id, const GLfloat* contents_rect, GLfloat opacity, const GLuint background_color, const GLfloat* bounds_size, const GLfloat* transform);
+GL_APICALL void GL_APIENTRY glCommitOverlayPlanesCHROMIUM (void);
GL_APICALL void GL_APIENTRY glSwapInterval (GLint interval);
GL_APICALL void GL_APIENTRY glFlushDriverCachesCHROMIUM (void);
diff --git a/gpu/command_buffer/common/gles2_cmd_format_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_autogen.h
index 01610ae..95bf3a8 100644
--- a/gpu/command_buffer/common/gles2_cmd_format_autogen.h
+++ b/gpu/command_buffer/common/gles2_cmd_format_autogen.h
@@ -13869,6 +13869,33 @@ static_assert(offsetof(ScheduleCALayerCHROMIUM, shm_id) == 16,
static_assert(offsetof(ScheduleCALayerCHROMIUM, shm_offset) == 20,
"offset of ScheduleCALayerCHROMIUM shm_offset should be 20");
+struct CommitOverlayPlanesCHROMIUM {
+ typedef CommitOverlayPlanesCHROMIUM ValueType;
+ static const CommandId kCmdId = kCommitOverlayPlanesCHROMIUM;
+ static const cmd::ArgFlags kArgFlags = cmd::kFixed;
+ static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3);
+
+ static uint32_t ComputeSize() {
+ return static_cast<uint32_t>(sizeof(ValueType)); // NOLINT
+ }
+
+ void SetHeader() { header.SetCmd<ValueType>(); }
+
+ void Init() { SetHeader(); }
+
+ void* Set(void* cmd) {
+ static_cast<ValueType*>(cmd)->Init();
+ return NextCmdAddress<ValueType>(cmd);
+ }
+
+ gpu::CommandHeader header;
+};
+
+static_assert(sizeof(CommitOverlayPlanesCHROMIUM) == 4,
+ "size of CommitOverlayPlanesCHROMIUM should be 4");
+static_assert(offsetof(CommitOverlayPlanesCHROMIUM, header) == 0,
+ "offset of CommitOverlayPlanesCHROMIUM header should be 0");
+
struct SwapInterval {
typedef SwapInterval ValueType;
static const CommandId kCmdId = kSwapInterval;
diff --git a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h
index 25d92e1..b165447 100644
--- a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h
+++ b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h
@@ -4826,6 +4826,16 @@ TEST_F(GLES2FormatTest, ScheduleCALayerCHROMIUM) {
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
+TEST_F(GLES2FormatTest, CommitOverlayPlanesCHROMIUM) {
+ cmds::CommitOverlayPlanesCHROMIUM& cmd =
+ *GetBufferAs<cmds::CommitOverlayPlanesCHROMIUM>();
+ void* next_cmd = cmd.Set(&cmd);
+ EXPECT_EQ(static_cast<uint32_t>(cmds::CommitOverlayPlanesCHROMIUM::kCmdId),
+ cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
+ CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
+}
+
TEST_F(GLES2FormatTest, SwapInterval) {
cmds::SwapInterval& cmd = *GetBufferAs<cmds::SwapInterval>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11));
diff --git a/gpu/command_buffer/common/gles2_cmd_ids_autogen.h b/gpu/command_buffer/common/gles2_cmd_ids_autogen.h
index bc97a30..22e5b0a 100644
--- a/gpu/command_buffer/common/gles2_cmd_ids_autogen.h
+++ b/gpu/command_buffer/common/gles2_cmd_ids_autogen.h
@@ -304,33 +304,34 @@
OP(DiscardBackbufferCHROMIUM) /* 545 */ \
OP(ScheduleOverlayPlaneCHROMIUM) /* 546 */ \
OP(ScheduleCALayerCHROMIUM) /* 547 */ \
- OP(SwapInterval) /* 548 */ \
- OP(FlushDriverCachesCHROMIUM) /* 549 */ \
- OP(MatrixLoadfCHROMIUMImmediate) /* 550 */ \
- OP(MatrixLoadIdentityCHROMIUM) /* 551 */ \
- OP(GenPathsCHROMIUM) /* 552 */ \
- OP(DeletePathsCHROMIUM) /* 553 */ \
- OP(IsPathCHROMIUM) /* 554 */ \
- OP(PathCommandsCHROMIUM) /* 555 */ \
- OP(PathParameterfCHROMIUM) /* 556 */ \
- OP(PathParameteriCHROMIUM) /* 557 */ \
- OP(PathStencilFuncCHROMIUM) /* 558 */ \
- OP(StencilFillPathCHROMIUM) /* 559 */ \
- OP(StencilStrokePathCHROMIUM) /* 560 */ \
- OP(CoverFillPathCHROMIUM) /* 561 */ \
- OP(CoverStrokePathCHROMIUM) /* 562 */ \
- OP(StencilThenCoverFillPathCHROMIUM) /* 563 */ \
- OP(StencilThenCoverStrokePathCHROMIUM) /* 564 */ \
- OP(StencilFillPathInstancedCHROMIUM) /* 565 */ \
- OP(StencilStrokePathInstancedCHROMIUM) /* 566 */ \
- OP(CoverFillPathInstancedCHROMIUM) /* 567 */ \
- OP(CoverStrokePathInstancedCHROMIUM) /* 568 */ \
- OP(StencilThenCoverFillPathInstancedCHROMIUM) /* 569 */ \
- OP(StencilThenCoverStrokePathInstancedCHROMIUM) /* 570 */ \
- OP(BindFragmentInputLocationCHROMIUMBucket) /* 571 */ \
- OP(ProgramPathFragmentInputGenCHROMIUM) /* 572 */ \
- OP(BlendBarrierKHR) /* 573 */ \
- OP(ApplyScreenSpaceAntialiasingCHROMIUM) /* 574 */
+ OP(CommitOverlayPlanesCHROMIUM) /* 548 */ \
+ OP(SwapInterval) /* 549 */ \
+ OP(FlushDriverCachesCHROMIUM) /* 550 */ \
+ OP(MatrixLoadfCHROMIUMImmediate) /* 551 */ \
+ OP(MatrixLoadIdentityCHROMIUM) /* 552 */ \
+ OP(GenPathsCHROMIUM) /* 553 */ \
+ OP(DeletePathsCHROMIUM) /* 554 */ \
+ OP(IsPathCHROMIUM) /* 555 */ \
+ OP(PathCommandsCHROMIUM) /* 556 */ \
+ OP(PathParameterfCHROMIUM) /* 557 */ \
+ OP(PathParameteriCHROMIUM) /* 558 */ \
+ OP(PathStencilFuncCHROMIUM) /* 559 */ \
+ OP(StencilFillPathCHROMIUM) /* 560 */ \
+ OP(StencilStrokePathCHROMIUM) /* 561 */ \
+ OP(CoverFillPathCHROMIUM) /* 562 */ \
+ OP(CoverStrokePathCHROMIUM) /* 563 */ \
+ OP(StencilThenCoverFillPathCHROMIUM) /* 564 */ \
+ OP(StencilThenCoverStrokePathCHROMIUM) /* 565 */ \
+ OP(StencilFillPathInstancedCHROMIUM) /* 566 */ \
+ OP(StencilStrokePathInstancedCHROMIUM) /* 567 */ \
+ OP(CoverFillPathInstancedCHROMIUM) /* 568 */ \
+ OP(CoverStrokePathInstancedCHROMIUM) /* 569 */ \
+ OP(StencilThenCoverFillPathInstancedCHROMIUM) /* 570 */ \
+ OP(StencilThenCoverStrokePathInstancedCHROMIUM) /* 571 */ \
+ OP(BindFragmentInputLocationCHROMIUMBucket) /* 572 */ \
+ OP(ProgramPathFragmentInputGenCHROMIUM) /* 573 */ \
+ OP(BlendBarrierKHR) /* 574 */ \
+ OP(ApplyScreenSpaceAntialiasingCHROMIUM) /* 575 */
enum CommandId {
kStartPoint = cmd::kLastCommonId, // All GLES2 commands start after this.
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index af0a62f..eabf876 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -876,6 +876,8 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient {
// Callback for async SwapBuffers.
void FinishSwapBuffers(gfx::SwapResult result);
+ void DoCommitOverlayPlanes();
+
// Wrapper for SwapInterval.
void DoSwapInterval(int interval);
@@ -11782,6 +11784,11 @@ void GLES2DecoderImpl::FinishSwapBuffers(gfx::SwapResult result) {
}
}
+void GLES2DecoderImpl::DoCommitOverlayPlanes() {
+ // TODO(watk): crbug.com/560592
+ NOTIMPLEMENTED();
+}
+
void GLES2DecoderImpl::DoSwapInterval(int interval) {
context_->SetSwapInterval(interval);
}
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
index 4fb5ca3..892d6da 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
@@ -4909,6 +4909,16 @@ error::Error GLES2DecoderImpl::HandleDrawBuffersEXTImmediate(
return error::kNoError;
}
+error::Error GLES2DecoderImpl::HandleCommitOverlayPlanesCHROMIUM(
+ uint32_t immediate_data_size,
+ const void* cmd_data) {
+ const gles2::cmds::CommitOverlayPlanesCHROMIUM& c =
+ *static_cast<const gles2::cmds::CommitOverlayPlanesCHROMIUM*>(cmd_data);
+ (void)c;
+ DoCommitOverlayPlanes();
+ return error::kNoError;
+}
+
error::Error GLES2DecoderImpl::HandleSwapInterval(uint32_t immediate_data_size,
const void* cmd_data) {
const gles2::cmds::SwapInterval& c =