summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbacker@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-23 19:49:27 +0000
committerbacker@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-23 19:49:27 +0000
commit2368ad1bf19dfb6234502c3586454b1ac7deb0f6 (patch)
tree9735b939c28a35f3f8e99b2fd4c99320c34d7e9d
parentdad5753f242da16d8e72d8759303e35f320d8e95 (diff)
downloadchromium_src-2368ad1bf19dfb6234502c3586454b1ac7deb0f6.zip
chromium_src-2368ad1bf19dfb6234502c3586454b1ac7deb0f6.tar.gz
chromium_src-2368ad1bf19dfb6234502c3586454b1ac7deb0f6.tar.bz2
Plumb the partial swap though image transport.
Plumbs the partial swap through on platforms that support it (currently just Linux GLX). BUG=None TEST=None Review URL: http://codereview.chromium.org/8513013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111392 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/gpu/gpu_process_host_ui_shim.cc26
-rw-r--r--content/browser/gpu/gpu_process_host_ui_shim.h3
-rw-r--r--content/browser/renderer_host/render_widget_host.cc9
-rw-r--r--content/browser/renderer_host/render_widget_host.h3
-rw-r--r--content/browser/renderer_host/render_widget_host_view.h6
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura.cc38
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura.h3
-rw-r--r--content/browser/renderer_host/render_widget_host_view_gtk.cc6
-rw-r--r--content/browser/renderer_host/render_widget_host_view_gtk.h3
-rw-r--r--content/browser/renderer_host/render_widget_host_view_mac.h9
-rw-r--r--content/browser/renderer_host/render_widget_host_view_mac.mm32
-rw-r--r--content/browser/renderer_host/render_widget_host_view_win.cc6
-rw-r--r--content/browser/renderer_host/render_widget_host_view_win.h3
-rw-r--r--content/browser/renderer_host/test_render_view_host.cc5
-rw-r--r--content/browser/renderer_host/test_render_view_host.h7
-rw-r--r--content/common/gpu/gpu_messages.h30
-rw-r--r--content/common/gpu/image_transport_surface.cc22
-rw-r--r--content/common/gpu/image_transport_surface.h6
-rw-r--r--content/common/gpu/image_transport_surface_linux.cc67
-rw-r--r--content/common/gpu/image_transport_surface_mac.cc27
-rw-r--r--content/common/gpu/image_transport_surface_win.cc9
-rw-r--r--ui/gfx/gl/gl_surface.cc12
-rw-r--r--ui/gfx/gl/gl_surface.h2
23 files changed, 288 insertions, 46 deletions
diff --git a/content/browser/gpu/gpu_process_host_ui_shim.cc b/content/browser/gpu/gpu_process_host_ui_shim.cc
index 503a429..e7bda6d 100644
--- a/content/browser/gpu/gpu_process_host_ui_shim.cc
+++ b/content/browser/gpu/gpu_process_host_ui_shim.cc
@@ -174,6 +174,8 @@ bool GpuProcessHostUIShim::OnControlMessageReceived(
IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
OnAcceleratedSurfaceBuffersSwapped)
+ IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfacePostSubBuffer,
+ OnAcceleratedSurfacePostSubBuffer)
#if defined(TOOLKIT_USES_GTK) || defined(OS_WIN)
IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView)
@@ -340,6 +342,30 @@ void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped(
view->AcceleratedSurfaceBuffersSwapped(params, host_id_);
}
+void GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer(
+ const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) {
+ TRACE_EVENT0("renderer",
+ "GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer");
+
+ ScopedSendOnIOThread delayed_send(
+ host_id_,
+ new AcceleratedSurfaceMsg_PostSubBufferACK(params.route_id));
+
+ RenderViewHost* host = RenderViewHost::FromID(params.renderer_id,
+ params.render_view_id);
+ if (!host)
+ return;
+
+ RenderWidgetHostView* view = host->view();
+ if (!view)
+ return;
+
+ delayed_send.Cancel();
+
+ // View must send ACK message after next composite.
+ view->AcceleratedSurfacePostSubBuffer(params, host_id_);
+}
+
#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
void GpuProcessHostUIShim::OnAcceleratedSurfaceRelease(
diff --git a/content/browser/gpu/gpu_process_host_ui_shim.h b/content/browser/gpu/gpu_process_host_ui_shim.h
index d4f566f..b274bad 100644
--- a/content/browser/gpu/gpu_process_host_ui_shim.h
+++ b/content/browser/gpu/gpu_process_host_ui_shim.h
@@ -22,6 +22,7 @@
#include "content/common/message_router.h"
struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params;
+struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params;
struct GpuHostMsg_AcceleratedSurfaceNew_Params;
struct GpuHostMsg_AcceleratedSurfaceRelease_Params;
@@ -96,6 +97,8 @@ class GpuProcessHostUIShim
void OnAcceleratedSurfaceBuffersSwapped(
const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params);
+ void OnAcceleratedSurfacePostSubBuffer(
+ const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params);
#if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
void OnAcceleratedSurfaceNew(
diff --git a/content/browser/renderer_host/render_widget_host.cc b/content/browser/renderer_host/render_widget_host.cc
index 6da29ab..1eeb8e8 100644
--- a/content/browser/renderer_host/render_widget_host.cc
+++ b/content/browser/renderer_host/render_widget_host.cc
@@ -1479,9 +1479,18 @@ bool RenderWidgetHost::GotResponseToLockMouseRequest(bool allowed) {
}
#if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
+// static
void RenderWidgetHost::AcknowledgeSwapBuffers(int32 route_id, int gpu_host_id) {
GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id);
if (ui_shim)
ui_shim->Send(new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id));
}
+
+// static
+void RenderWidgetHost::AcknowledgePostSubBuffer(int32 route_id,
+ int gpu_host_id) {
+ GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id);
+ if (ui_shim)
+ ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id));
+}
#endif
diff --git a/content/browser/renderer_host/render_widget_host.h b/content/browser/renderer_host/render_widget_host.h
index 2ed1e50..71db8b7 100644
--- a/content/browser/renderer_host/render_widget_host.h
+++ b/content/browser/renderer_host/render_widget_host.h
@@ -443,7 +443,8 @@ class CONTENT_EXPORT RenderWidgetHost : public IPC::Channel::Listener,
#if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
// Called by the view in response to AcceleratedSurfaceBuffersSwapped.
- void AcknowledgeSwapBuffers(int32 route_id, int gpu_host_id);
+ static void AcknowledgeSwapBuffers(int32 route_id, int gpu_host_id);
+ static void AcknowledgePostSubBuffer(int32 route_id, int gpu_host_id);
#endif
protected:
diff --git a/content/browser/renderer_host/render_widget_host_view.h b/content/browser/renderer_host/render_widget_host_view.h
index 44a8427..6ed0974 100644
--- a/content/browser/renderer_host/render_widget_host_view.h
+++ b/content/browser/renderer_host/render_widget_host_view.h
@@ -27,6 +27,7 @@
#include "ui/gfx/surface/transport_dib.h"
struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params;
+struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params;
class BackingStore;
class RenderWidgetHost;
@@ -197,6 +198,11 @@ class RenderWidgetHostView {
virtual void AcceleratedSurfaceBuffersSwapped(
const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
int gpu_host_id) = 0;
+ // Similar to above, except |params.(x|y|width|height)| define the region
+ // of the surface that changed.
+ virtual void AcceleratedSurfacePostSubBuffer(
+ const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
+ int gpu_host_id) = 0;
#if defined(OS_MACOSX)
// Tells the view whether or not to accept first responder status. If |flag|
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 62b1d27e..3dbf572 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -277,8 +277,8 @@ void RenderWidgetHostViewAura::OnAcceleratedCompositingStateChange() {
}
void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped(
- const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
- int gpu_host_id) {
+ const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
+ int gpu_host_id) {
#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
window_->layer()->SetExternalTexture(
accelerated_surface_containers_[params.surface_id]->GetTexture());
@@ -287,14 +287,44 @@ void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped(
if (!window_->layer()->GetCompositor()) {
// We have no compositor, so we have no way to display the surface.
// Must still send the ACK.
- host_->AcknowledgeSwapBuffers(params.route_id, gpu_host_id);
+ RenderWidgetHost::AcknowledgeSwapBuffers(params.route_id, gpu_host_id);
} else {
window_->layer()->ScheduleDraw();
// Add sending an ACK to the list of things to do OnCompositingEnded
on_compositing_ended_callbacks_.push_back(
base::Bind(&RenderWidgetHost::AcknowledgeSwapBuffers,
- base::Unretained(host_), params.route_id, gpu_host_id));
+ params.route_id, gpu_host_id));
+ ui::Compositor* compositor = window_->layer()->GetCompositor();
+ if (!compositor->HasObserver(this))
+ compositor->AddObserver(this);
+ }
+#else
+ NOTREACHED();
+#endif
+}
+
+void RenderWidgetHostViewAura::AcceleratedSurfacePostSubBuffer(
+ const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
+ int gpu_host_id) {
+#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
+ window_->layer()->SetExternalTexture(
+ accelerated_surface_containers_[params.surface_id]->GetTexture());
+ glFlush();
+
+ if (!window_->layer()->GetCompositor()) {
+ // We have no compositor, so we have no way to display the surface
+ // Must still send the ACK
+ RenderWidgetHost::AcknowledgePostSubBuffer(params.route_id, gpu_host_id);
+ } else {
+ // TODO(backer): Plumb the damage rect to the ui compositor so that we
+ // can do a partial swap to display.
+ window_->layer()->ScheduleDraw();
+
+ // Add sending an ACK to the list of things to do OnCompositingEnded
+ on_compositing_ended_callbacks_.push_back(
+ base::Bind(&RenderWidgetHost::AcknowledgePostSubBuffer,
+ params.route_id, gpu_host_id));
ui::Compositor* compositor = window_->layer()->GetCompositor();
if (!compositor->HasObserver(this))
compositor->AddObserver(this);
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h
index 3bef8a3..3e256dc 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.h
+++ b/content/browser/renderer_host/render_widget_host_view_aura.h
@@ -74,6 +74,9 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
virtual void AcceleratedSurfaceBuffersSwapped(
const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
int gpu_host_id) OVERRIDE;
+ virtual void AcceleratedSurfacePostSubBuffer(
+ const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
+ int gpu_host_id) OVERRIDE;
#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
virtual void AcceleratedSurfaceNew(
int32 width,
diff --git a/content/browser/renderer_host/render_widget_host_view_gtk.cc b/content/browser/renderer_host/render_widget_host_view_gtk.cc
index 100c48a..b014f6a 100644
--- a/content/browser/renderer_host/render_widget_host_view_gtk.cc
+++ b/content/browser/renderer_host/render_widget_host_view_gtk.cc
@@ -1011,6 +1011,12 @@ void RenderWidgetHostViewGtk::AcceleratedSurfaceBuffersSwapped(
NOTREACHED();
}
+void RenderWidgetHostViewGtk::AcceleratedSurfacePostSubBuffer(
+ const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
+ int gpu_host_id) {
+ NOTREACHED();
+}
+
void RenderWidgetHostViewGtk::SetBackground(const SkBitmap& background) {
RenderWidgetHostView::SetBackground(background);
host_->Send(new ViewMsg_SetBackground(host_->routing_id(), background));
diff --git a/content/browser/renderer_host/render_widget_host_view_gtk.h b/content/browser/renderer_host/render_widget_host_view_gtk.h
index 39837e5..8eb1a29 100644
--- a/content/browser/renderer_host/render_widget_host_view_gtk.h
+++ b/content/browser/renderer_host/render_widget_host_view_gtk.h
@@ -98,6 +98,9 @@ class CONTENT_EXPORT RenderWidgetHostViewGtk : public RenderWidgetHostView,
virtual void AcceleratedSurfaceBuffersSwapped(
const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
int gpu_host_id) OVERRIDE;
+ virtual void AcceleratedSurfacePostSubBuffer(
+ const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
+ int gpu_host_id) OVERRIDE;
virtual void SetBackground(const SkBitmap& background) OVERRIDE;
virtual void CreatePluginContainer(gfx::PluginWindowHandle id) OVERRIDE;
virtual void DestroyPluginContainer(gfx::PluginWindowHandle id) OVERRIDE;
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.h b/content/browser/renderer_host/render_widget_host_view_mac.h
index 5726aa7..aad12de 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.h
+++ b/content/browser/renderer_host/render_widget_host_view_mac.h
@@ -260,6 +260,9 @@ class RenderWidgetHostViewMac : public RenderWidgetHostView {
virtual void AcceleratedSurfaceBuffersSwapped(
const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
int gpu_host_id) OVERRIDE;
+ virtual void AcceleratedSurfacePostSubBuffer(
+ const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
+ int gpu_host_id) OVERRIDE;
virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE;
virtual gfx::Rect GetRootWindowBounds() OVERRIDE;
virtual gfx::PluginWindowHandle GetCompositingSurface() OVERRIDE;
@@ -305,12 +308,6 @@ class RenderWidgetHostViewMac : public RenderWidgetHostView {
// should be called after the software backing store has been painted to.
void HandleDelayedGpuViewHiding();
- // This is called from the display link thread, and provides the GPU
- // process a notion of how quickly the browser is able to keep up with it.
- void AcknowledgeSwapBuffers(int renderer_id,
- int32 route_id,
- int gpu_host_id);
-
// These member variables should be private, but the associated ObjC class
// needs access to them and can't be made a friend.
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index 3300a41..46a5c4f6 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -884,13 +884,17 @@ void RenderWidgetHostViewMac::AcceleratedSurfaceBuffersSwapped(
[view drawView];
}
- if (params.renderer_id != 0 || params.route_id != 0) {
- AcknowledgeSwapBuffers(params.renderer_id,
- params.route_id,
- gpu_host_id);
+ if (params.route_id != 0) {
+ RenderWidgetHost::AcknowledgeSwapBuffers(params.route_id, gpu_host_id);
}
}
+void RenderWidgetHostViewMac::AcceleratedSurfacePostSubBuffer(
+ const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
+ int gpu_host_id) {
+ NOTIMPLEMENTED();
+}
+
void RenderWidgetHostViewMac::UpdateRootGpuViewVisibility(
bool show_gpu_widget) {
// Plugins are destroyed on page navigate. The compositor layer on the other
@@ -920,26 +924,6 @@ void RenderWidgetHostViewMac::HandleDelayedGpuViewHiding() {
}
}
-void RenderWidgetHostViewMac::AcknowledgeSwapBuffers(
- int renderer_id,
- int32 route_id,
- int gpu_host_id) {
- TRACE_EVENT0("gpu", "RenderWidgetHostViewMac::AcknowledgeSwapBuffers");
- // Called on the display link thread. Hand actual work off to the IO thread,
- // because |GpuProcessHost::Get()| can only be called there.
- // Currently, this is never called for plugins.
- if (render_widget_host_) {
- DCHECK_EQ(render_widget_host_->process()->GetID(), renderer_id);
- // |render_widget_host_->routing_id()| and |route_id| are usually not
- // equal: The former identifies the channel from the RWH in the browser
- // process to the corresponding render widget in the renderer process, while
- // the latter identifies the channel from the GpuCommandBufferStub in the
- // GPU process to the corresponding command buffer client in the renderer.
-
- render_widget_host_->AcknowledgeSwapBuffers(route_id, gpu_host_id);
- }
-}
-
void RenderWidgetHostViewMac::OnAcceleratedCompositingStateChange() {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
bool activated = GetRenderWidgetHost()->is_accelerated_compositing_active();
diff --git a/content/browser/renderer_host/render_widget_host_view_win.cc b/content/browser/renderer_host/render_widget_host_view_win.cc
index d8c85df..2eecc7f 100644
--- a/content/browser/renderer_host/render_widget_host_view_win.cc
+++ b/content/browser/renderer_host/render_widget_host_view_win.cc
@@ -2102,6 +2102,12 @@ void RenderWidgetHostViewWin::AcceleratedSurfaceBuffersSwapped(
acknowledge_task));
}
+void RenderWidgetHostViewWin::AcceleratedSurfacePostSubBuffer(
+ const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
+ int gpu_host_id) {
+ NOTREACHED();
+}
+
void RenderWidgetHostViewWin::SetAccessibilityFocus(int acc_obj_id) {
if (!render_widget_host_)
return;
diff --git a/content/browser/renderer_host/render_widget_host_view_win.h b/content/browser/renderer_host/render_widget_host_view_win.h
index b55e7cc..d0fa783 100644
--- a/content/browser/renderer_host/render_widget_host_view_win.h
+++ b/content/browser/renderer_host/render_widget_host_view_win.h
@@ -205,6 +205,9 @@ class RenderWidgetHostViewWin
virtual void AcceleratedSurfaceBuffersSwapped(
const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
int gpu_host_id) OVERRIDE;
+ virtual void AcceleratedSurfacePostSubBuffer(
+ const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
+ int gpu_host_id) OVERRIDE;
virtual void OnAccessibilityNotifications(
const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params
) OVERRIDE;
diff --git a/content/browser/renderer_host/test_render_view_host.cc b/content/browser/renderer_host/test_render_view_host.cc
index 0524288..9647381 100644
--- a/content/browser/renderer_host/test_render_view_host.cc
+++ b/content/browser/renderer_host/test_render_view_host.cc
@@ -184,6 +184,11 @@ void TestRenderWidgetHostView::AcceleratedSurfaceBuffersSwapped(
int gpu_host_id) {
}
+void TestRenderWidgetHostView::AcceleratedSurfacePostSubBuffer(
+ const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
+ int gpu_host_id) {
+}
+
#if defined(OS_MACOSX)
gfx::Rect TestRenderWidgetHostView::GetViewCocoaBounds() const {
diff --git a/content/browser/renderer_host/test_render_view_host.h b/content/browser/renderer_host/test_render_view_host.h
index 8e1462b..ebfe62f 100644
--- a/content/browser/renderer_host/test_render_view_host.h
+++ b/content/browser/renderer_host/test_render_view_host.h
@@ -92,6 +92,9 @@ class TestRenderWidgetHostView : public RenderWidgetHostView {
virtual void AcceleratedSurfaceBuffersSwapped(
const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
int gpu_host_id) OVERRIDE;
+ virtual void AcceleratedSurfacePostSubBuffer(
+ const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
+ int gpu_host_id) OVERRIDE;
#if defined(OS_MACOSX)
virtual void SetTakesFocusOnlyOnMouseDown(bool flag) OVERRIDE {}
virtual gfx::Rect GetViewCocoaBounds() const OVERRIDE;
@@ -136,10 +139,6 @@ class TestRenderWidgetHostView : public RenderWidgetHostView {
virtual void AcceleratedSurfaceNew(
int32 width, int32 height, uint64* surface_id,
TransportDIB::Handle* surface_handle) { }
- virtual void AcceleratedSurfaceBuffersSwapped(
- uint64 surface_id,
- int32 route_id,
- int gpu_host_id) OVERRIDE {}
virtual void AcceleratedSurfaceRelease(uint64 surface_id) { }
#endif
diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h
index 8c99041..e5cab60 100644
--- a/content/common/gpu/gpu_messages.h
+++ b/content/common/gpu/gpu_messages.h
@@ -58,6 +58,20 @@ IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params)
#endif
IPC_STRUCT_END()
+IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params)
+ IPC_STRUCT_MEMBER(int32, renderer_id)
+ IPC_STRUCT_MEMBER(int32, render_view_id)
+ IPC_STRUCT_MEMBER(uint64, surface_id)
+ IPC_STRUCT_MEMBER(int32, route_id)
+ IPC_STRUCT_MEMBER(int, x)
+ IPC_STRUCT_MEMBER(int, y)
+ IPC_STRUCT_MEMBER(int, width)
+ IPC_STRUCT_MEMBER(int, height)
+#if defined(OS_MACOSX)
+ IPC_STRUCT_MEMBER(gfx::PluginWindowHandle, window)
+#endif
+IPC_STRUCT_END()
+
IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceRelease_Params)
IPC_STRUCT_MEMBER(int32, renderer_id)
IPC_STRUCT_MEMBER(int32, render_view_id)
@@ -151,9 +165,13 @@ IPC_MESSAGE_ROUTED2(AcceleratedSurfaceMsg_NewACK,
TransportDIB::Handle /* shared memory buffer */)
// Tells the GPU process that the browser process handled the swap
-// buffers request with the given number.
+// buffers request.
IPC_MESSAGE_ROUTED0(AcceleratedSurfaceMsg_BuffersSwappedACK)
+// Tells the GPU process that the browser process handled the
+// PostSubBuffer command.
+IPC_MESSAGE_ROUTED0(AcceleratedSurfaceMsg_PostSubBufferACK)
+
// Tells the GPU process to remove all contexts.
IPC_MESSAGE_CONTROL0(GpuMsg_Clean)
@@ -223,12 +241,16 @@ IPC_MESSAGE_CONTROL4(GpuHostMsg_ResizeView,
IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceNew,
GpuHostMsg_AcceleratedSurfaceNew_Params)
-// This message notifies the browser process that the renderer
-// swapped the buffers associated with the given "window", which
-// should cause the browser to redraw the compositor's contents.
+// Same as above with a rect of the part of the surface that changed.
IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params)
+// This message notifies the browser process that the renderer
+// swapped a portion of the buffers associated with the given "window", which
+// should cause the browser to redraw the compositor's contents.
+IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfacePostSubBuffer,
+ GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params)
+
// Tells the browser to release whatever resources are associated with
// the given surface. The browser must send an ACK once this operation
// is complete.
diff --git a/content/common/gpu/image_transport_surface.cc b/content/common/gpu/image_transport_surface.cc
index d0dfee1..94669cf 100644
--- a/content/common/gpu/image_transport_surface.cc
+++ b/content/common/gpu/image_transport_surface.cc
@@ -60,6 +60,8 @@ bool ImageTransportHelper::OnMessageReceived(const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP(ImageTransportHelper, message)
IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_BuffersSwappedACK,
OnBuffersSwappedACK)
+ IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_PostSubBufferACK,
+ OnPostSubBufferACK)
IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_NewACK,
OnNewSurfaceACK)
IPC_MESSAGE_HANDLER(AcceleratedSurfaceMsg_ResizeViewACK, OnResizeViewACK);
@@ -98,6 +100,17 @@ void ImageTransportHelper::SendAcceleratedSurfaceBuffersSwapped(
manager_->Send(new GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params));
}
+void ImageTransportHelper::SendAcceleratedSurfacePostSubBuffer(
+ GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params) {
+ params.renderer_id = renderer_id_;
+ params.render_view_id = render_view_id_;
+ params.route_id = route_id_;
+#if defined(OS_MACOSX)
+ params.window = handle_;
+#endif
+ manager_->Send(new GpuHostMsg_AcceleratedSurfacePostSubBuffer(params));
+}
+
void ImageTransportHelper::SendResizeView(const gfx::Size& size) {
manager_->Send(new GpuHostMsg_ResizeView(renderer_id_,
render_view_id_,
@@ -124,6 +137,10 @@ void ImageTransportHelper::OnBuffersSwappedACK() {
surface_->OnBuffersSwappedACK();
}
+void ImageTransportHelper::OnPostSubBufferACK() {
+ surface_->OnPostSubBufferACK();
+}
+
void ImageTransportHelper::OnNewSurfaceACK(
uint64 surface_id,
TransportDIB::Handle shm_handle) {
@@ -229,6 +246,11 @@ void PassThroughImageTransportSurface::OnNewSurfaceACK(
}
void PassThroughImageTransportSurface::OnBuffersSwappedACK() {
+ NOTREACHED();
+}
+
+void PassThroughImageTransportSurface::OnPostSubBufferACK() {
+ NOTREACHED();
}
void PassThroughImageTransportSurface::OnResizeViewACK() {
diff --git a/content/common/gpu/image_transport_surface.h b/content/common/gpu/image_transport_surface.h
index b791c6e..b58ff12c 100644
--- a/content/common/gpu/image_transport_surface.h
+++ b/content/common/gpu/image_transport_surface.h
@@ -22,6 +22,7 @@ class GpuChannelManager;
struct GpuHostMsg_AcceleratedSurfaceNew_Params;
struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params;
+struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params;
struct GpuHostMsg_AcceleratedSurfaceRelease_Params;
namespace gfx {
@@ -57,6 +58,7 @@ class ImageTransportSurface {
virtual void OnNewSurfaceACK(
uint64 surface_id, TransportDIB::Handle surface_handle) = 0;
virtual void OnBuffersSwappedACK() = 0;
+ virtual void OnPostSubBufferACK() = 0;
virtual void OnResizeViewACK() = 0;
virtual void OnResize(gfx::Size size) = 0;
@@ -94,6 +96,8 @@ class ImageTransportHelper : public IPC::Channel::Listener {
GpuHostMsg_AcceleratedSurfaceNew_Params params);
void SendAcceleratedSurfaceBuffersSwapped(
GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params);
+ void SendAcceleratedSurfacePostSubBuffer(
+ GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params);
void SendAcceleratedSurfaceRelease(
GpuHostMsg_AcceleratedSurfaceRelease_Params params);
void SendResizeView(const gfx::Size& size);
@@ -113,6 +117,7 @@ class ImageTransportHelper : public IPC::Channel::Listener {
// IPC::Message handlers.
void OnNewSurfaceACK(uint64 surface_id, TransportDIB::Handle surface_handle);
void OnBuffersSwappedACK();
+ void OnPostSubBufferACK();
void OnResizeViewACK();
// Backbuffer resize callback.
@@ -155,6 +160,7 @@ class PassThroughImageTransportSurface
virtual void OnNewSurfaceACK(
uint64 surface_id, TransportDIB::Handle surface_handle) OVERRIDE;
virtual void OnBuffersSwappedACK() OVERRIDE;
+ virtual void OnPostSubBufferACK() OVERRIDE;
virtual void OnResizeViewACK() OVERRIDE;
virtual void OnResize(gfx::Size size) OVERRIDE;
diff --git a/content/common/gpu/image_transport_surface_linux.cc b/content/common/gpu/image_transport_surface_linux.cc
index bcb1284..e106a9f 100644
--- a/content/common/gpu/image_transport_surface_linux.cc
+++ b/content/common/gpu/image_transport_surface_linux.cc
@@ -67,6 +67,8 @@ class EGLImageTransportSurface : public ImageTransportSurface,
virtual void Destroy() OVERRIDE;
virtual bool IsOffscreen() OVERRIDE;
virtual bool SwapBuffers() OVERRIDE;
+ virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE;
+ virtual std::string GetExtensions() OVERRIDE;
virtual gfx::Size GetSize() OVERRIDE;
virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE;
virtual unsigned int GetBackingFrameBufferObject() OVERRIDE;
@@ -77,6 +79,7 @@ class EGLImageTransportSurface : public ImageTransportSurface,
virtual void OnNewSurfaceACK(
uint64 surface_id, TransportDIB::Handle surface_handle) OVERRIDE;
virtual void OnBuffersSwappedACK() OVERRIDE;
+ virtual void OnPostSubBufferACK() OVERRIDE;
virtual void OnResizeViewACK() OVERRIDE;
virtual void OnResize(gfx::Size size) OVERRIDE;
@@ -111,6 +114,7 @@ class GLXImageTransportSurface : public ImageTransportSurface,
virtual bool Initialize() OVERRIDE;
virtual void Destroy() OVERRIDE;
virtual bool SwapBuffers() OVERRIDE;
+ virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE;
virtual gfx::Size GetSize() OVERRIDE;
virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE;
virtual void SetVisible(bool visible) OVERRIDE;
@@ -120,6 +124,7 @@ class GLXImageTransportSurface : public ImageTransportSurface,
virtual void OnNewSurfaceACK(
uint64 surface_id, TransportDIB::Handle surface_handle) OVERRIDE;
virtual void OnBuffersSwappedACK() OVERRIDE;
+ virtual void OnPostSubBufferACK() OVERRIDE;
virtual void OnResizeViewACK() OVERRIDE;
virtual void OnResize(gfx::Size size) OVERRIDE;
@@ -162,6 +167,8 @@ class OSMesaImageTransportSurface : public ImageTransportSurface,
virtual void Destroy() OVERRIDE;
virtual bool IsOffscreen() OVERRIDE;
virtual bool SwapBuffers() OVERRIDE;
+ virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE;
+ virtual std::string GetExtensions() OVERRIDE;
virtual gfx::Size GetSize() OVERRIDE;
protected:
@@ -169,6 +176,7 @@ class OSMesaImageTransportSurface : public ImageTransportSurface,
virtual void OnNewSurfaceACK(
uint64 surface_id, TransportDIB::Handle surface_handle) OVERRIDE;
virtual void OnBuffersSwappedACK() OVERRIDE;
+ virtual void OnPostSubBufferACK() OVERRIDE;
virtual void OnResizeViewACK() OVERRIDE;
virtual void OnResize(gfx::Size size) OVERRIDE;
@@ -363,6 +371,16 @@ bool EGLImageTransportSurface::SwapBuffers() {
return true;
}
+bool EGLImageTransportSurface::PostSubBuffer(
+ int x, int y, int width, int height) {
+ NOTREACHED();
+ return false;
+}
+
+std::string EGLImageTransportSurface::GetExtensions() {
+ return GLSurface::GetExtensions();
+}
+
gfx::Size EGLImageTransportSurface::GetSize() {
return back_surface_->size();
}
@@ -377,6 +395,9 @@ void EGLImageTransportSurface::OnBuffersSwappedACK() {
helper_->SetScheduled(true);
}
+void EGLImageTransportSurface::OnPostSubBufferACK() {
+ NOTREACHED();
+}
void EGLImageTransportSurface::OnResizeViewACK() {
NOTREACHED();
@@ -513,6 +534,34 @@ bool GLXImageTransportSurface::SwapBuffers() {
return true;
}
+bool GLXImageTransportSurface::PostSubBuffer(
+ int x, int y, int width, int height) {
+ gfx::NativeViewGLSurfaceGLX::PostSubBuffer(x, y, width, height);
+ glFlush();
+
+ if (needs_resize_) {
+ GpuHostMsg_AcceleratedSurfaceNew_Params params;
+ params.width = size_.width();
+ params.height = size_.height();
+ params.surface_id = window_;
+ helper_->SendAcceleratedSurfaceNew(params);
+ bound_ = true;
+ needs_resize_ = false;
+ }
+
+ GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params;
+ params.surface_id = window_;
+ params.x = x;
+ params.y = y;
+ params.width = width;
+ params.height = height;
+
+ helper_->SendAcceleratedSurfacePostSubBuffer(params);
+
+ helper_->SetScheduled(false);
+ return true;
+}
+
gfx::Size GLXImageTransportSurface::GetSize() {
return size_;
}
@@ -547,6 +596,10 @@ void GLXImageTransportSurface::OnBuffersSwappedACK() {
helper_->SetScheduled(true);
}
+void GLXImageTransportSurface::OnPostSubBufferACK() {
+ helper_->SetScheduled(true);
+}
+
void GLXImageTransportSurface::OnResizeViewACK() {
NOTREACHED();
}
@@ -648,10 +701,24 @@ bool OSMesaImageTransportSurface::SwapBuffers() {
return true;
}
+bool OSMesaImageTransportSurface::PostSubBuffer(
+ int x, int y, int width, int height) {
+ NOTREACHED();
+ return false;
+}
+
+std::string OSMesaImageTransportSurface::GetExtensions() {
+ return GLSurface::GetExtensions();
+}
+
void OSMesaImageTransportSurface::OnBuffersSwappedACK() {
helper_->SetScheduled(true);
}
+void OSMesaImageTransportSurface::OnPostSubBufferACK() {
+ NOTREACHED();
+}
+
gfx::Size OSMesaImageTransportSurface::GetSize() {
return size_;
}
diff --git a/content/common/gpu/image_transport_surface_mac.cc b/content/common/gpu/image_transport_surface_mac.cc
index 8449f81..b7d9676 100644
--- a/content/common/gpu/image_transport_surface_mac.cc
+++ b/content/common/gpu/image_transport_surface_mac.cc
@@ -34,6 +34,8 @@ class IOSurfaceImageTransportSurface : public gfx::PbufferGLSurfaceCGL,
virtual void Destroy() OVERRIDE;
virtual bool IsOffscreen() OVERRIDE;
virtual bool SwapBuffers() OVERRIDE;
+ virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE;
+ virtual std::string GetExtensions() OVERRIDE;
virtual gfx::Size GetSize() OVERRIDE;
virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE;
virtual unsigned int GetBackingFrameBufferObject() OVERRIDE;
@@ -43,6 +45,7 @@ class IOSurfaceImageTransportSurface : public gfx::PbufferGLSurfaceCGL,
virtual void OnNewSurfaceACK(uint64 surface_id,
TransportDIB::Handle shm_handle) OVERRIDE;
virtual void OnBuffersSwappedACK() OVERRIDE;
+ virtual void OnPostSubBufferACK() OVERRIDE;
virtual void OnResizeViewACK() OVERRIDE;
virtual void OnResize(gfx::Size size) OVERRIDE;
@@ -86,6 +89,7 @@ class TransportDIBImageTransportSurface : public gfx::PbufferGLSurfaceCGL,
virtual void Destroy() OVERRIDE;
virtual bool IsOffscreen() OVERRIDE;
virtual bool SwapBuffers() OVERRIDE;
+ virtual std::string GetExtensions() OVERRIDE;
virtual gfx::Size GetSize() OVERRIDE;
virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE;
virtual unsigned int GetBackingFrameBufferObject() OVERRIDE;
@@ -93,6 +97,7 @@ class TransportDIBImageTransportSurface : public gfx::PbufferGLSurfaceCGL,
protected:
// ImageTransportSurface implementation
virtual void OnBuffersSwappedACK() OVERRIDE;
+ virtual void OnPostSubBufferACK() OVERRIDE;
virtual void OnNewSurfaceACK(uint64 surface_id,
TransportDIB::Handle shm_handle) OVERRIDE;
virtual void OnResizeViewACK() OVERRIDE;
@@ -226,6 +231,16 @@ bool IOSurfaceImageTransportSurface::SwapBuffers() {
return true;
}
+bool IOSurfaceImageTransportSurface::PostSubBuffer(
+ int x, int y, int width, int height) {
+ NOTREACHED();
+ return false;
+}
+
+std::string IOSurfaceImageTransportSurface::GetExtensions() {
+ return gfx::GLSurface::GetExtensions();
+}
+
gfx::Size IOSurfaceImageTransportSurface::GetSize() {
return size_;
}
@@ -234,6 +249,10 @@ void IOSurfaceImageTransportSurface::OnBuffersSwappedACK() {
helper_->SetScheduled(true);
}
+void IOSurfaceImageTransportSurface::OnPostSubBufferACK() {
+ NOTREACHED();
+}
+
void IOSurfaceImageTransportSurface::OnNewSurfaceACK(
uint64 surface_id,
TransportDIB::Handle /* shm_handle */) {
@@ -432,6 +451,10 @@ bool TransportDIBImageTransportSurface::SwapBuffers() {
return true;
}
+std::string TransportDIBImageTransportSurface::GetExtensions() {
+ return gfx::GLSurface::GetExtensions();
+}
+
gfx::Size TransportDIBImageTransportSurface::GetSize() {
return size_;
}
@@ -440,6 +463,10 @@ void TransportDIBImageTransportSurface::OnBuffersSwappedACK() {
helper_->SetScheduled(true);
}
+void TransportDIBImageTransportSurface::OnPostSubBufferACK() {
+ NOTREACHED();
+}
+
void TransportDIBImageTransportSurface::OnNewSurfaceACK(
uint64 surface_id,
TransportDIB::Handle shm_handle) {
diff --git a/content/common/gpu/image_transport_surface_win.cc b/content/common/gpu/image_transport_surface_win.cc
index 91040fe..f3eb9d5a 100644
--- a/content/common/gpu/image_transport_surface_win.cc
+++ b/content/common/gpu/image_transport_surface_win.cc
@@ -43,6 +43,7 @@ class PbufferImageTransportSurface
virtual void OnNewSurfaceACK(uint64 surface_id,
TransportDIB::Handle shm_handle) OVERRIDE;
virtual void OnBuffersSwappedACK() OVERRIDE;
+ virtual void OnPostSubBufferACK() OVERRIDE;
virtual void OnResizeViewACK() OVERRIDE;
virtual void OnResize(gfx::Size size) OVERRIDE;
@@ -121,14 +122,18 @@ void PbufferImageTransportSurface::OnBuffersSwappedACK() {
helper_->SetScheduled(true);
}
+void PbufferImageTransportSurface::OnPostSubBufferACK() {
+ NOTREACHED();
+}
+
void PbufferImageTransportSurface::OnNewSurfaceACK(
uint64 surface_id,
TransportDIB::Handle shm_handle) {
- NOTIMPLEMENTED();
+ NOTREACHED();
}
void PbufferImageTransportSurface::OnResizeViewACK() {
- NOTIMPLEMENTED();
+ NOTREACHED();
}
void PbufferImageTransportSurface::OnResize(gfx::Size size) {
diff --git a/ui/gfx/gl/gl_surface.cc b/ui/gfx/gl/gl_surface.cc
index 9276d00..8329255 100644
--- a/ui/gfx/gl/gl_surface.cc
+++ b/ui/gfx/gl/gl_surface.cc
@@ -91,7 +91,9 @@ bool GLSurface::Resize(const gfx::Size& size) {
}
std::string GLSurface::GetExtensions() {
- DCHECK_EQ(GetCurrent(), this);
+ // Use of GLSurfaceAdapter class means that we can't compare
+ // GetCurrent() and this directly.
+ DCHECK_EQ(GetCurrent()->GetHandle(), GetHandle());
return std::string("");
}
@@ -164,6 +166,14 @@ bool GLSurfaceAdapter::SwapBuffers() {
return surface_->SwapBuffers();
}
+bool GLSurfaceAdapter::PostSubBuffer(int x, int y, int width, int height) {
+ return surface_->PostSubBuffer(x, y, width, height);
+}
+
+std::string GLSurfaceAdapter::GetExtensions() {
+ return surface_->GetExtensions();
+}
+
gfx::Size GLSurfaceAdapter::GetSize() {
return surface_->GetSize();
}
diff --git a/ui/gfx/gl/gl_surface.h b/ui/gfx/gl/gl_surface.h
index 8318368..e5b01b3 100644
--- a/ui/gfx/gl/gl_surface.h
+++ b/ui/gfx/gl/gl_surface.h
@@ -116,6 +116,8 @@ class GL_EXPORT GLSurfaceAdapter : public GLSurface {
virtual bool Resize(const gfx::Size& size) OVERRIDE;
virtual bool IsOffscreen() OVERRIDE;
virtual bool SwapBuffers() OVERRIDE;
+ virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE;
+ virtual std::string GetExtensions() OVERRIDE;
virtual gfx::Size GetSize() OVERRIDE;
virtual void* GetHandle() OVERRIDE;
virtual unsigned int GetBackingFrameBufferObject() OVERRIDE;