summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-20 17:39:11 +0000
committerboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-20 17:39:11 +0000
commitbbb936c4437ddaa82f8346d8c9c2a4c1308e7d20 (patch)
tree1a7cdede9006044700db2b85a61ba0e4194a760e /webkit
parentfdc86497adf143538f68948ea9627379e90f6ee8 (diff)
downloadchromium_src-bbb936c4437ddaa82f8346d8c9c2a4c1308e7d20.zip
chromium_src-bbb936c4437ddaa82f8346d8c9c2a4c1308e7d20.tar.gz
chromium_src-bbb936c4437ddaa82f8346d8c9c2a4c1308e7d20.tar.bz2
Add option to use GLContextVirtual in WGC3DIPCBI
BUG=230195 win_x64_rel busted. All other bots passed NOTRY=true Review URL: https://chromiumcodereview.appspot.com/14318004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195398 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc43
-rw-r--r--webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h4
2 files changed, 43 insertions, 4 deletions
diff --git a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
index ae12422..c63e855 100644
--- a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
+++ b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
@@ -31,8 +31,9 @@
#include "gpu/command_buffer/common/constants.h"
#include "gpu/command_buffer/service/command_buffer_service.h"
#include "gpu/command_buffer/service/context_group.h"
-#include "gpu/command_buffer/service/transfer_buffer_manager.h"
+#include "gpu/command_buffer/service/gl_context_virtual.h"
#include "gpu/command_buffer/service/gpu_scheduler.h"
+#include "gpu/command_buffer/service/transfer_buffer_manager.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_share_group.h"
#include "ui/gl/gl_surface.h"
@@ -241,6 +242,8 @@ static base::LazyInstance<
std::set<GLInProcessContext*> >
g_all_shared_contexts = LAZY_INSTANCE_INITIALIZER;
+static bool g_use_virtualized_gl_context = false;
+
namespace {
// Also calls DetachFromThread on all GLES2Decoders before the lock is released
@@ -478,9 +481,29 @@ bool GLInProcessContext::Initialize(
return false;
}
- context_ = gfx::GLContext::CreateGLContext(share_group.get(),
- surface_.get(),
- gpu_preference);
+ if (g_use_virtualized_gl_context) {
+ context_ = share_group->GetSharedContext();
+ if (!context_) {
+ context_ = gfx::GLContext::CreateGLContext(share_group.get(),
+ surface_.get(),
+ gpu_preference);
+ share_group->SetSharedContext(context_);
+ }
+
+ context_ = new ::gpu::GLContextVirtual(share_group.get(),
+ context_,
+ decoder_->AsWeakPtr());
+ if (context_->Initialize(surface_, gpu_preference)) {
+ VLOG(1) << "Created virtual GL context.";
+ } else {
+ context_ = NULL;
+ }
+ } else {
+ context_ = gfx::GLContext::CreateGLContext(share_group.get(),
+ surface_.get(),
+ gpu_preference);
+ }
+
if (!context_.get()) {
LOG(ERROR) << "Could not create GLContext.";
Destroy();
@@ -583,6 +606,18 @@ void GLInProcessContext::OnContextLost() {
context_lost_callback_.Run();
}
+// static
+void
+WebGraphicsContext3DInProcessCommandBufferImpl::EnableVirtualizedContext() {
+#if !defined(NDEBUG)
+ {
+ AutoLockAndDecoderDetachThread lock(g_decoder_lock.Get(),
+ g_all_shared_contexts.Get());
+ DCHECK(g_all_shared_contexts.Get().empty());
+ }
+#endif // !defined(NDEBUG)
+ g_use_virtualized_gl_context = true;
+}
// static
WebGraphicsContext3DInProcessCommandBufferImpl*
diff --git a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h
index 70313e5..e04e9e2 100644
--- a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h
+++ b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h
@@ -45,6 +45,10 @@ class GLInProcessContext;
class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl
: public NON_EXPORTED_BASE(WebKit::WebGraphicsContext3D) {
public:
+ // Must be called before any WebGraphicsContext3DInProcessCommandBufferImpl
+ // instances are created. Default value is false.
+ static void EnableVirtualizedContext();
+
static WebGraphicsContext3DInProcessCommandBufferImpl*
CreateViewContext(
const WebKit::WebGraphicsContext3D::Attributes& attributes,