summaryrefslogtreecommitdiffstats
path: root/webkit/common
diff options
context:
space:
mode:
authorzmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-13 20:56:30 +0000
committerzmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-13 20:56:30 +0000
commitcc6d8c3ef05450fd8139169f0edf14425e635947 (patch)
tree5eb684aba894765e4603029ffc922d0764109e15 /webkit/common
parentf1e0789a18dcf35b06fe83370596a662297641e3 (diff)
downloadchromium_src-cc6d8c3ef05450fd8139169f0edf14425e635947.zip
chromium_src-cc6d8c3ef05450fd8139169f0edf14425e635947.tar.gz
chromium_src-cc6d8c3ef05450fd8139169f0edf14425e635947.tar.bz2
Add a flush ID for graphics contexts.
We use a global ID assigning system, and whenever a flush/finish happens, we increase the global ID, and assign it to the related context. This will give a rough indication of the context usage along time line. BUG=290482 TEST=webgl conformance test: rendering/multisample-corruption.html R=kbr@chromium.org, piman@chromium.org Review URL: https://codereview.chromium.org/23995006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223120 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/common')
-rw-r--r--webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc37
-rw-r--r--webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h5
2 files changed, 36 insertions, 6 deletions
diff --git a/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc b/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
index 6ef1a7f..b86868e 100644
--- a/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
+++ b/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
@@ -13,6 +13,7 @@
#include <string>
+#include "base/atomicops.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/callback.h"
@@ -45,6 +46,14 @@ void OnSignalSyncPoint(
callback->onSyncPointReached();
}
+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);
+}
+
// Singleton used to initialize and terminate the gles2 library.
class GLES2Initializer {
public:
@@ -119,7 +128,8 @@ WebGraphicsContext3DInProcessCommandBufferImpl::
context_lost_reason_(GL_NO_ERROR),
attributes_(attributes),
cached_width_(0),
- cached_height_(0) {
+ cached_height_(0),
+ flush_id_(0) {
}
WebGraphicsContext3DInProcessCommandBufferImpl::
@@ -209,6 +219,10 @@ bool WebGraphicsContext3DInProcessCommandBufferImpl::makeContextCurrent() {
return context_ && !isContextLost();
}
+uint32_t WebGraphicsContext3DInProcessCommandBufferImpl::getLastFlushID() {
+ return flush_id_;
+}
+
void WebGraphicsContext3DInProcessCommandBufferImpl::ClearContext() {
// NOTE: Comment in the line below to check for code that is not calling
// eglMakeCurrent where appropriate. The issue is code using
@@ -572,9 +586,15 @@ DELEGATE_TO_GL_1(enable, Enable, WGC3Denum)
DELEGATE_TO_GL_1(enableVertexAttribArray, EnableVertexAttribArray,
WGC3Duint)
-DELEGATE_TO_GL(finish, Finish)
+void WebGraphicsContext3DInProcessCommandBufferImpl::finish() {
+ flush_id_ = GenFlushID();
+ gl_->Finish();
+}
-DELEGATE_TO_GL(flush, Flush)
+void WebGraphicsContext3DInProcessCommandBufferImpl::flush() {
+ flush_id_ = GenFlushID();
+ gl_->Flush();
+}
DELEGATE_TO_GL_4(framebufferRenderbuffer, FramebufferRenderbuffer,
WGC3Denum, WGC3Denum, WGC3Denum, WebGLId)
@@ -1160,8 +1180,15 @@ DELEGATE_TO_GL_1(unmapImageCHROMIUM, UnmapImageCHROMIUM, WGC3Duint);
DELEGATE_TO_GL_3(bindUniformLocationCHROMIUM, BindUniformLocationCHROMIUM,
WebGLId, WGC3Dint, const WGC3Dchar*)
-DELEGATE_TO_GL(shallowFlushCHROMIUM, ShallowFlushCHROMIUM)
-DELEGATE_TO_GL(shallowFinishCHROMIUM, ShallowFinishCHROMIUM)
+void WebGraphicsContext3DInProcessCommandBufferImpl::shallowFlushCHROMIUM() {
+ flush_id_ = GenFlushID();
+ gl_->ShallowFlushCHROMIUM();
+}
+
+void WebGraphicsContext3DInProcessCommandBufferImpl::shallowFinishCHROMIUM() {
+ flush_id_ = GenFlushID();
+ gl_->ShallowFinishCHROMIUM();
+}
DELEGATE_TO_GL_1(genMailboxCHROMIUM, GenMailboxCHROMIUM, WGC3Dbyte*)
DELEGATE_TO_GL_2(produceTextureCHROMIUM, ProduceTextureCHROMIUM,
diff --git a/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h b/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h
index d763e14..f66e417 100644
--- a/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h
+++ b/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h
@@ -74,6 +74,8 @@ class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl
// WebGraphicsContext3D methods
virtual bool makeContextCurrent();
+ virtual uint32_t getLastFlushID();
+
virtual int width();
virtual int height();
@@ -568,7 +570,6 @@ class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl
// instead of going through WebGraphicsContext3D.
void ClearContext();
-
bool is_offscreen_;
// Only used when not offscreen.
gfx::AcceleratedWidget window_;
@@ -589,6 +590,8 @@ class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl
// Errors raised by synthesizeGLError().
std::vector<WGC3Denum> synthetic_errors_;
+
+ uint32_t flush_id_;
};
} // namespace gpu