summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-16 20:54:53 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-16 20:54:53 +0000
commit7196e011d46f597b406e43a1978fa9d846e747c4 (patch)
treeb13701827207e5a223c9a916bdd90d6ca892e6d8 /content
parentc59aa47960369c63ac773d5cf4b2d1052d4a69c3 (diff)
downloadchromium_src-7196e011d46f597b406e43a1978fa9d846e747c4.zip
chromium_src-7196e011d46f597b406e43a1978fa9d846e747c4.tar.gz
chromium_src-7196e011d46f597b406e43a1978fa9d846e747c4.tar.bz2
Automatically put all GL contexts associated with a particular GPU channel (and renderer process) in the same share group.
This is work towards allowing offscreen canvas contexts to be allocated before compositor view contexts are created. This is a problem because a canvas might be created before the window it will be displayed in exists. This does not fix the bug on its own. BUG=80703 Review URL: http://codereview.chromium.org/7104148 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89395 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/common/gpu/gpu_channel.cc1
-rw-r--r--content/common/gpu/gpu_channel.h8
-rw-r--r--content/common/gpu/gpu_command_buffer_stub.cc3
-rw-r--r--content/gpu/gpu_info_collector.cc4
4 files changed, 13 insertions, 3 deletions
diff --git a/content/common/gpu/gpu_channel.cc b/content/common/gpu/gpu_channel.cc
index dbb8e6a..0031602 100644
--- a/content/common/gpu/gpu_channel.cc
+++ b/content/common/gpu/gpu_channel.cc
@@ -33,6 +33,7 @@ GpuChannel::GpuChannel(GpuChannelManager* gpu_channel_manager,
renderer_id_(renderer_id),
renderer_process_(base::kNullProcessHandle),
renderer_pid_(base::kNullProcessId),
+ share_group_(new gfx::GLShareGroup),
watchdog_(watchdog) {
DCHECK(gpu_channel_manager);
DCHECK(renderer_id);
diff --git a/content/common/gpu/gpu_channel.h b/content/common/gpu/gpu_channel.h
index a7bf112..10b2315 100644
--- a/content/common/gpu/gpu_channel.h
+++ b/content/common/gpu/gpu_channel.h
@@ -11,6 +11,7 @@
#include <vector>
#include "base/id_map.h"
+#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/process.h"
#include "build/build_config.h"
@@ -19,6 +20,7 @@
#include "content/common/gpu/gpu_surface_stub.h"
#include "content/common/message_router.h"
#include "ipc/ipc_sync_channel.h"
+#include "ui/gfx/gl/gl_share_group.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/size.h"
@@ -84,6 +86,8 @@ class GpuChannel : public IPC::Channel::Listener,
void ViewResized(int32 command_buffer_route_id);
+ gfx::GLShareGroup* share_group() const { return share_group_.get(); }
+
#if defined(OS_MACOSX)
virtual void AcceleratedSurfaceBuffersSwapped(
int32 route_id, uint64 swap_buffers_count);
@@ -156,6 +160,10 @@ class GpuChannel : public IPC::Channel::Listener,
// Used to implement message routing functionality to CommandBuffer objects
MessageRouter router_;
+ // The share group that all contexts associated with a particular renderer
+ // process use.
+ scoped_refptr<gfx::GLShareGroup> share_group_;
+
#if defined(ENABLE_GPU)
typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap;
StubMap stubs_;
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc
index a677337..a88161d 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -144,7 +144,8 @@ void GpuCommandBufferStub::OnInitialize(
allowed_extensions_.c_str(),
requested_attribs_,
parent_processor,
- parent_texture_id_)) {
+ parent_texture_id_,
+ channel_->share_group())) {
command_buffer_->SetPutOffsetChangeCallback(
NewCallback(scheduler_.get(),
&gpu::GpuScheduler::PutChanged));
diff --git a/content/gpu/gpu_info_collector.cc b/content/gpu/gpu_info_collector.cc
index 2e4630b..93cd767 100644
--- a/content/gpu/gpu_info_collector.cc
+++ b/content/gpu/gpu_info_collector.cc
@@ -31,8 +31,8 @@ scoped_refptr<gfx::GLSurface> InitializeGLSurface() {
scoped_refptr<gfx::GLContext> InitializeGLContext(gfx::GLSurface* surface) {
- scoped_refptr<gfx::GLContext> context(gfx::GLContext::CreateGLContext(NULL,
- surface));
+ scoped_refptr<gfx::GLContext> context(
+ gfx::GLContext::CreateGLContext(NULL, surface));
if (!context.get()) {
LOG(ERROR) << "gfx::GLContext::CreateGLContext failed";
return NULL;