summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authordanakj <danakj@chromium.org>2016-03-16 19:41:24 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-17 02:42:54 +0000
commit97aa5e3544f15ec76416eae93a149dc250c4a647 (patch)
treebfa437d751346d573bdd5458c7f5921fb6a56680 /gpu
parent66d29099edf0173af60245daa273b0a954d4aa11 (diff)
downloadchromium_src-97aa5e3544f15ec76416eae93a149dc250c4a647.zip
chromium_src-97aa5e3544f15ec76416eae93a149dc250c4a647.tar.gz
chromium_src-97aa5e3544f15ec76416eae93a149dc250c4a647.tar.bz2
Move flush id from WebGraphicsContext3DImpl to GLES2Implementation.
This means calls to any flush or finish methods on GLES2Implementation will update the flush id, and calls to either WebGraphicsContext3D::lastFlushID() or to GLES2Interface::GetLastFlushIdCHROMIUM() will return the same answer always. R=kbr@chromium.org, piman BUG=584497 CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_optional_gpu_tests_rel;tryserver.chromium.mac:mac_optional_gpu_tests_rel Review URL: https://codereview.chromium.org/1814573002 Cr-Commit-Position: refs/heads/master@{#381647}
Diffstat (limited to 'gpu')
-rw-r--r--gpu/GLES2/gl2chromium_autogen.h1
-rw-r--r--gpu/blink/webgraphicscontext3d_impl.cc31
-rw-r--r--gpu/blink/webgraphicscontext3d_impl.h1
-rwxr-xr-xgpu/command_buffer/build_gles2_cmd_buffer.py6
-rw-r--r--gpu/command_buffer/client/gles2_c_lib_autogen.h7
-rw-r--r--gpu/command_buffer/client/gles2_implementation.cc18
-rw-r--r--gpu/command_buffer/client/gles2_implementation.h3
-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.h3
-rw-r--r--gpu/command_buffer/client/gles2_trace_implementation_autogen.h1
-rw-r--r--gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h5
-rw-r--r--gpu/command_buffer/cmd_buffer_functions.txt1
14 files changed, 53 insertions, 28 deletions
diff --git a/gpu/GLES2/gl2chromium_autogen.h b/gpu/GLES2/gl2chromium_autogen.h
index 8909cd7..e4bd8f2 100644
--- a/gpu/GLES2/gl2chromium_autogen.h
+++ b/gpu/GLES2/gl2chromium_autogen.h
@@ -337,6 +337,7 @@
#define glCommitOverlayPlanesCHROMIUM GLES2_GET_FUN(CommitOverlayPlanesCHROMIUM)
#define glSwapInterval GLES2_GET_FUN(SwapInterval)
#define glFlushDriverCachesCHROMIUM GLES2_GET_FUN(FlushDriverCachesCHROMIUM)
+#define glGetLastFlushIdCHROMIUM GLES2_GET_FUN(GetLastFlushIdCHROMIUM)
#define glMatrixLoadfCHROMIUM GLES2_GET_FUN(MatrixLoadfCHROMIUM)
#define glMatrixLoadIdentityCHROMIUM GLES2_GET_FUN(MatrixLoadIdentityCHROMIUM)
#define glGenPathsCHROMIUM GLES2_GET_FUN(GenPathsCHROMIUM)
diff --git a/gpu/blink/webgraphicscontext3d_impl.cc b/gpu/blink/webgraphicscontext3d_impl.cc
index 1be79ec..d4e0a65 100644
--- a/gpu/blink/webgraphicscontext3d_impl.cc
+++ b/gpu/blink/webgraphicscontext3d_impl.cc
@@ -42,18 +42,6 @@ using blink::WGC3Dsync;
namespace gpu_blink {
-namespace {
-
-uint32_t GenFlushID() {
- static base::subtle::Atomic32 flush_id = 0;
-
- base::subtle::Atomic32 my_id = base::subtle::Barrier_AtomicIncrement(
- &flush_id, 1);
- return static_cast<uint32_t>(my_id);
-}
-
-} // namespace anonymous
-
class WebGraphicsContext3DErrorMessageCallback
: public ::gpu::gles2::GLES2ImplementationErrorMessageCallback {
public:
@@ -198,9 +186,7 @@ WebGraphicsContext3DImpl::WebGraphicsContext3DImpl()
initialize_failed_(false),
context_lost_callback_(0),
error_message_callback_(0),
- gl_(NULL),
- flush_id_(0) {
-}
+ gl_(NULL) {}
WebGraphicsContext3DImpl::~WebGraphicsContext3DImpl() {
@@ -213,9 +199,7 @@ void WebGraphicsContext3DImpl::synthesizeGLError(WGC3Denum error) {
}
}
-uint32_t WebGraphicsContext3DImpl::lastFlushID() {
- return flush_id_;
-}
+DELEGATE_TO_GL_R(lastFlushID, GetLastFlushIdCHROMIUM, WebGLId)
DELEGATE_TO_GL_R(insertFenceSyncCHROMIUM, InsertFenceSyncCHROMIUM, WGC3Duint64)
@@ -354,15 +338,8 @@ DELEGATE_TO_GL_1(enable, Enable, WGC3Denum)
DELEGATE_TO_GL_1(enableVertexAttribArray, EnableVertexAttribArray,
WGC3Duint)
-void WebGraphicsContext3DImpl::finish() {
- flush_id_ = GenFlushID();
- gl_->Finish();
-}
-
-void WebGraphicsContext3DImpl::flush() {
- flush_id_ = GenFlushID();
- gl_->Flush();
-}
+DELEGATE_TO_GL(finish, Finish)
+DELEGATE_TO_GL(flush, Flush)
DELEGATE_TO_GL_4(framebufferRenderbuffer, FramebufferRenderbuffer,
WGC3Denum, WGC3Denum, WGC3Denum, WebGLId)
diff --git a/gpu/blink/webgraphicscontext3d_impl.h b/gpu/blink/webgraphicscontext3d_impl.h
index 0e8ed7e..e33e877 100644
--- a/gpu/blink/webgraphicscontext3d_impl.h
+++ b/gpu/blink/webgraphicscontext3d_impl.h
@@ -922,7 +922,6 @@ class GPU_BLINK_EXPORT WebGraphicsContext3DImpl
::gpu::gles2::GLES2Interface* gl_;
bool lose_context_when_out_of_memory_;
- uint32_t flush_id_;
};
} // namespace gpu_blink
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py
index 3ee217d..4d94ddf 100755
--- a/gpu/command_buffer/build_gles2_cmd_buffer.py
+++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -3479,6 +3479,12 @@ _FUNCTION_INFO = {
'expectation': False,
'unsafe': True,
},
+ 'GetLastFlushIdCHROMIUM': {
+ 'gen_cmd': False,
+ 'impl_func': 'False',
+ 'result': ['GLuint'],
+ 'extension': True,
+ },
'LinkProgram': {
'decoder_func': 'DoLinkProgram',
'impl_func': False,
diff --git a/gpu/command_buffer/client/gles2_c_lib_autogen.h b/gpu/command_buffer/client/gles2_c_lib_autogen.h
index 1aa3cbd..67f1e05 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 GLES2SwapInterval(GLint interval) {
void GL_APIENTRY GLES2FlushDriverCachesCHROMIUM() {
gles2::GetGLContext()->FlushDriverCachesCHROMIUM();
}
+GLuint GL_APIENTRY GLES2GetLastFlushIdCHROMIUM() {
+ return gles2::GetGLContext()->GetLastFlushIdCHROMIUM();
+}
void GL_APIENTRY GLES2MatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat* m) {
gles2::GetGLContext()->MatrixLoadfCHROMIUM(matrixMode, m);
}
@@ -2888,6 +2891,10 @@ extern const NameToFunc g_gles2_function_table[] = {
reinterpret_cast<GLES2FunctionPointer>(glFlushDriverCachesCHROMIUM),
},
{
+ "glGetLastFlushIdCHROMIUM",
+ reinterpret_cast<GLES2FunctionPointer>(glGetLastFlushIdCHROMIUM),
+ },
+ {
"glMatrixLoadfCHROMIUM",
reinterpret_cast<GLES2FunctionPointer>(glMatrixLoadfCHROMIUM),
},
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 4cda61b..9bb6232 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -76,6 +76,13 @@ GLuint ToGLuint(const void* ptr) {
return static_cast<GLuint>(reinterpret_cast<size_t>(ptr));
}
+uint32_t GenerateNextFlushId() {
+ static base::subtle::Atomic32 flush_id = 0;
+ base::subtle::Atomic32 my_id =
+ base::subtle::Barrier_AtomicIncrement(&flush_id, 1);
+ return static_cast<uint32_t>(my_id);
+}
+
} // anonymous namespace
#if !defined(_MSC_VER)
@@ -142,6 +149,7 @@ GLES2Implementation::GLES2Implementation(
lose_context_when_out_of_memory_(lose_context_when_out_of_memory),
support_client_side_arrays_(support_client_side_arrays),
use_count_(0),
+ flush_id_(0),
max_extra_transfer_buffer_size_(
#if defined(OS_NACL)
0),
@@ -1326,6 +1334,7 @@ void GLES2Implementation::DrawElementsImpl(
void GLES2Implementation::Flush() {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFlush()");
+ flush_id_ = GenerateNextFlushId();
// Insert the cmd to call glFlush
helper_->Flush();
FlushHelper();
@@ -1334,6 +1343,7 @@ void GLES2Implementation::Flush() {
void GLES2Implementation::ShallowFlushCHROMIUM() {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glShallowFlushCHROMIUM()");
+ flush_id_ = GenerateNextFlushId();
FlushHelper();
}
@@ -1355,12 +1365,14 @@ void GLES2Implementation::OrderingBarrierCHROMIUM() {
void GLES2Implementation::Finish() {
GPU_CLIENT_SINGLE_THREAD_CHECK();
+ flush_id_ = GenerateNextFlushId();
FinishHelper();
}
void GLES2Implementation::ShallowFinishCHROMIUM() {
GPU_CLIENT_SINGLE_THREAD_CHECK();
TRACE_EVENT0("gpu", "GLES2::ShallowFinishCHROMIUM");
+ flush_id_ = GenerateNextFlushId();
// Flush our command buffer (tell the service to execute up to the flush cmd
// and don't return until it completes).
helper_->CommandBufferHelper::Finish();
@@ -1383,6 +1395,12 @@ void GLES2Implementation::FinishHelper() {
FreeEverything();
}
+GLuint GLES2Implementation::GetLastFlushIdCHROMIUM() {
+ GPU_CLIENT_SINGLE_THREAD_CHECK();
+ GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetLastFlushIdCHROMIUM()");
+ return flush_id_;
+}
+
void GLES2Implementation::SwapBuffers() {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSwapBuffers()");
diff --git a/gpu/command_buffer/client/gles2_implementation.h b/gpu/command_buffer/client/gles2_implementation.h
index 02314d0..6ee901e 100644
--- a/gpu/command_buffer/client/gles2_implementation.h
+++ b/gpu/command_buffer/client/gles2_implementation.h
@@ -792,6 +792,9 @@ class GLES2_IMPL_EXPORT GLES2Implementation
// Used to check for single threaded access.
int use_count_;
+ // Changed every time a flush or finish occurs.
+ uint32_t flush_id_;
+
// Maximum amount of extra memory from the mapped memory pool to use when
// needing to transfer something exceeding the default transfer buffer.
// This should be 0 for low memory devices since they are already memory
diff --git a/gpu/command_buffer/client/gles2_implementation_autogen.h b/gpu/command_buffer/client/gles2_implementation_autogen.h
index deba71c..bee578d 100644
--- a/gpu/command_buffer/client/gles2_implementation_autogen.h
+++ b/gpu/command_buffer/client/gles2_implementation_autogen.h
@@ -1056,6 +1056,8 @@ void SwapInterval(GLint interval) override;
void FlushDriverCachesCHROMIUM() override;
+GLuint GetLastFlushIdCHROMIUM() override;
+
void MatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat* m) override;
void MatrixLoadIdentityCHROMIUM(GLenum matrixMode) override;
diff --git a/gpu/command_buffer/client/gles2_interface_autogen.h b/gpu/command_buffer/client/gles2_interface_autogen.h
index 1020ce2..4ab4116c 100644
--- a/gpu/command_buffer/client/gles2_interface_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_autogen.h
@@ -781,6 +781,7 @@ virtual void ScheduleCALayerCHROMIUM(GLuint contents_texture_id,
virtual void CommitOverlayPlanesCHROMIUM() = 0;
virtual void SwapInterval(GLint interval) = 0;
virtual void FlushDriverCachesCHROMIUM() = 0;
+virtual GLuint GetLastFlushIdCHROMIUM() = 0;
virtual void MatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat* m) = 0;
virtual void MatrixLoadIdentityCHROMIUM(GLenum matrixMode) = 0;
virtual GLuint GenPathsCHROMIUM(GLsizei range) = 0;
diff --git a/gpu/command_buffer/client/gles2_interface_stub_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_autogen.h
index 50e39cd..734e02d 100644
--- a/gpu/command_buffer/client/gles2_interface_stub_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_stub_autogen.h
@@ -758,6 +758,7 @@ void ScheduleCALayerCHROMIUM(GLuint contents_texture_id,
void CommitOverlayPlanesCHROMIUM() override;
void SwapInterval(GLint interval) override;
void FlushDriverCachesCHROMIUM() override;
+GLuint GetLastFlushIdCHROMIUM() override;
void MatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat* m) override;
void MatrixLoadIdentityCHROMIUM(GLenum matrixMode) override;
GLuint GenPathsCHROMIUM(GLsizei range) 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 5ac7eba..eeeafb3 100644
--- a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
@@ -1037,6 +1037,9 @@ void GLES2InterfaceStub::ScheduleCALayerCHROMIUM(
void GLES2InterfaceStub::CommitOverlayPlanesCHROMIUM() {}
void GLES2InterfaceStub::SwapInterval(GLint /* interval */) {}
void GLES2InterfaceStub::FlushDriverCachesCHROMIUM() {}
+GLuint GLES2InterfaceStub::GetLastFlushIdCHROMIUM() {
+ return 0;
+}
void GLES2InterfaceStub::MatrixLoadfCHROMIUM(GLenum /* matrixMode */,
const GLfloat* /* m */) {}
void GLES2InterfaceStub::MatrixLoadIdentityCHROMIUM(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 ad35a36..d967962 100644
--- a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
+++ b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
@@ -758,6 +758,7 @@ void ScheduleCALayerCHROMIUM(GLuint contents_texture_id,
void CommitOverlayPlanesCHROMIUM() override;
void SwapInterval(GLint interval) override;
void FlushDriverCachesCHROMIUM() override;
+GLuint GetLastFlushIdCHROMIUM() override;
void MatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat* m) override;
void MatrixLoadIdentityCHROMIUM(GLenum matrixMode) override;
GLuint GenPathsCHROMIUM(GLsizei range) 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 5f8e3ca..eb42f3c 100644
--- a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
+++ b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
@@ -2225,6 +2225,11 @@ void GLES2TraceImplementation::FlushDriverCachesCHROMIUM() {
gl_->FlushDriverCachesCHROMIUM();
}
+GLuint GLES2TraceImplementation::GetLastFlushIdCHROMIUM() {
+ TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetLastFlushIdCHROMIUM");
+ return gl_->GetLastFlushIdCHROMIUM();
+}
+
void GLES2TraceImplementation::MatrixLoadfCHROMIUM(GLenum matrixMode,
const GLfloat* m) {
TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::MatrixLoadfCHROMIUM");
diff --git a/gpu/command_buffer/cmd_buffer_functions.txt b/gpu/command_buffer/cmd_buffer_functions.txt
index 119f3f2..3f03661 100644
--- a/gpu/command_buffer/cmd_buffer_functions.txt
+++ b/gpu/command_buffer/cmd_buffer_functions.txt
@@ -316,6 +316,7 @@ GL_APICALL void GL_APIENTRY glScheduleCALayerCHROMIUM (GLuint contents_t
GL_APICALL void GL_APIENTRY glCommitOverlayPlanesCHROMIUM (void);
GL_APICALL void GL_APIENTRY glSwapInterval (GLint interval);
GL_APICALL void GL_APIENTRY glFlushDriverCachesCHROMIUM (void);
+GL_APICALL GLuint GL_APIENTRY glGetLastFlushIdCHROMIUM (void);
// Extension CHROMIUM_path_rendering.
GL_APICALL void GL_APIENTRY glMatrixLoadfCHROMIUM (GLenumMatrixMode matrixMode, const GLfloat* m);