summaryrefslogtreecommitdiffstats
path: root/chrome/gpu
diff options
context:
space:
mode:
authorpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-01 01:06:32 +0000
committerpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-01 01:06:32 +0000
commit6ebf2fc952b8170971e37971e9d1362c64424e89 (patch)
treec5ec2454ecc2af8f302893de6c7bfea60b672791 /chrome/gpu
parent59a77daa557ef00a90742ece6994563bbdeddc73 (diff)
downloadchromium_src-6ebf2fc952b8170971e37971e9d1362c64424e89.zip
chromium_src-6ebf2fc952b8170971e37971e9d1362c64424e89.tar.gz
chromium_src-6ebf2fc952b8170971e37971e9d1362c64424e89.tar.bz2
linux: add accelerated compositing.
Similar to Windows, this doesn't handle exposes currently, nor WebGL. Other caveat: tearing off a tab causes trouble to the gpu process. Review URL: http://codereview.chromium.org/2886003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51324 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/gpu')
-rw-r--r--chrome/gpu/gpu_channel.cc13
-rw-r--r--chrome/gpu/gpu_command_buffer_stub.cc9
-rw-r--r--chrome/gpu/gpu_command_buffer_stub.h4
3 files changed, 16 insertions, 10 deletions
diff --git a/chrome/gpu/gpu_channel.cc b/chrome/gpu/gpu_channel.cc
index b775acf..c0470f7 100644
--- a/chrome/gpu/gpu_channel.cc
+++ b/chrome/gpu/gpu_channel.cc
@@ -137,6 +137,7 @@ void GpuChannel::OnCreateViewCommandBuffer(gfx::NativeViewId view_id,
#if defined(ENABLE_GPU)
+ gfx::PluginWindowHandle handle = NULL;
#if defined(OS_WIN)
gfx::NativeView view = gfx::NativeViewFromId(view_id);
@@ -146,17 +147,25 @@ void GpuChannel::OnCreateViewCommandBuffer(gfx::NativeViewId view_id,
GetProp(view, chrome::kChromiumRendererIdProperty));
if (view_renderer_id != renderer_id_)
return;
+ handle = view;
+#elif defined(OS_LINUX)
+ ChildThread* gpu_thread = ChildThread::current();
+ // Ask the browser for the view's XID.
+ // TODO(piman): This assumes that it doesn't change. It can change however
+ // when tearing off tabs. This needs a fix in the browser UI code. A possible
+ // alternative would be to add a socket/plug pair like with plugins but that
+ // has issues with events and focus.
+ gpu_thread->Send(new GpuHostMsg_GetViewXID(view_id, &handle));
#else
// TODO(apatrick): This needs to be something valid for mac and linux.
// Offscreen rendering will work on these platforms but not rendering to the
// window.
DCHECK_EQ(view_id, 0);
- gfx::NativeView view = 0;
#endif
*route_id = GenerateRouteID();
scoped_refptr<GpuCommandBufferStub> stub = new GpuCommandBufferStub(
- this, view, NULL, gfx::Size(), 0, *route_id);
+ this, handle, NULL, gfx::Size(), 0, *route_id);
router_.AddRoute(*route_id, stub);
stubs_[*route_id] = stub;
#endif // ENABLE_GPU
diff --git a/chrome/gpu/gpu_command_buffer_stub.cc b/chrome/gpu/gpu_command_buffer_stub.cc
index a95b4c1..ee9d937 100644
--- a/chrome/gpu/gpu_command_buffer_stub.cc
+++ b/chrome/gpu/gpu_command_buffer_stub.cc
@@ -14,13 +14,13 @@
using gpu::Buffer;
GpuCommandBufferStub::GpuCommandBufferStub(GpuChannel* channel,
- gfx::NativeView view,
+ gfx::PluginWindowHandle handle,
GpuCommandBufferStub* parent,
const gfx::Size& size,
uint32 parent_texture_id,
int32 route_id)
: channel_(channel),
- view_(view),
+ handle_(handle),
parent_(parent),
initial_size_(size),
parent_texture_id_(parent_texture_id),
@@ -73,11 +73,8 @@ void GpuCommandBufferStub::OnInitialize(
parent_ ? parent_->processor_.get() : NULL;
processor_.reset(new gpu::GPUProcessor(command_buffer_.get()));
// TODO(apatrick): The reinterpret_cast below is only valid on windows.
-#if !defined(OS_WIN)
- DCHECK_EQ(view_, static_cast<gfx::NativeView>(0));
-#endif
if (processor_->Initialize(
- reinterpret_cast<gfx::PluginWindowHandle>(view_),
+ handle_,
initial_size_,
parent_processor,
parent_texture_id_)) {
diff --git a/chrome/gpu/gpu_command_buffer_stub.h b/chrome/gpu/gpu_command_buffer_stub.h
index 7aaf68a..91d7029 100644
--- a/chrome/gpu/gpu_command_buffer_stub.h
+++ b/chrome/gpu/gpu_command_buffer_stub.h
@@ -24,7 +24,7 @@ class GpuCommandBufferStub
public base::RefCountedThreadSafe<GpuCommandBufferStub> {
public:
GpuCommandBufferStub(GpuChannel* channel,
- gfx::NativeView view,
+ gfx::PluginWindowHandle handle,
GpuCommandBufferStub* parent,
const gfx::Size& size,
uint32 parent_texture_id,
@@ -55,7 +55,7 @@ class GpuCommandBufferStub
void OnResizeOffscreenFrameBuffer(const gfx::Size& size);
scoped_refptr<GpuChannel> channel_;
- gfx::NativeView view_;
+ gfx::PluginWindowHandle handle_;
scoped_refptr<GpuCommandBufferStub> parent_;
gfx::Size initial_size_;
uint32 parent_texture_id_;