summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authorkbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-04 17:46:23 +0000
committerkbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-04 17:46:23 +0000
commit77e74dbed3b57987515c260b651b72cec15825dc (patch)
tree66685b53d127093075f720f99fbb0869ab74c01d /chrome/common
parent1ad13a2d0dd8d03b50e6fbadd6a26ea72712d2d9 (diff)
downloadchromium_src-77e74dbed3b57987515c260b651b72cec15825dc.zip
chromium_src-77e74dbed3b57987515c260b651b72cec15825dc.tar.gz
chromium_src-77e74dbed3b57987515c260b651b72cec15825dc.tar.bz2
Initial port of accelerated compositor to Mac OS X 10.6. Reused
infrastructure added for Pepper 3D and Core Animation plugins to render the compositor's output. The implementation allocates a fake "plugin window handle" on the browser side which is the "root" handle, containing the compositor's output, and which, if present, is drawn before any other accelerated plugin instances. Added messages from GPU process to browser process for handling window resizing and presentation of output. Added support to GGL for "view" contexts on Mac OS X, used only for the accelerated compositor, and requiring explicit resize notifications. The remainder of this port will go into the WebKit repository under https://bugs.webkit.org/show_bug.cgi?id=43398 after this for dependency reasons. Tested manually with CSS 3D and WebGL demos. Several stability and correctness issues remain and will be addressed in following CLs; however, the current code works for the majority of basic use cases including switching between accelerated compositing on and off, and scrolling of content. BUG=38969 TEST=none Review URL: http://codereview.chromium.org/3067026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54923 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/gpu_messages.h61
-rw-r--r--chrome/common/gpu_messages_internal.h33
-rw-r--r--chrome/common/render_messages_internal.h8
3 files changed, 97 insertions, 5 deletions
diff --git a/chrome/common/gpu_messages.h b/chrome/common/gpu_messages.h
index 508c599..1ff1741 100644
--- a/chrome/common/gpu_messages.h
+++ b/chrome/common/gpu_messages.h
@@ -18,7 +18,68 @@
#include "gfx/size.h"
#include "gpu/command_buffer/common/command_buffer.h"
+#if defined(OS_MACOSX)
+// Parameters for the GpuHostMsg_AcceleratedSurfaceSetIOSurface
+// message, which has too many parameters to be sent with the
+// predefined IPC macros.
+struct GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params {
+ int32 renderer_id;
+ int32 render_view_id;
+ gfx::PluginWindowHandle window;
+ int32 width;
+ int32 height;
+ uint64 identifier;
+
+ GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params()
+ : renderer_id(0),
+ render_view_id(0),
+ window(NULL),
+ width(0),
+ height(0),
+ identifier(0) {
+ }
+};
+#endif
+
namespace IPC {
+#if defined(OS_MACOSX)
+template <>
+struct ParamTraits<GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params> {
+ typedef GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.renderer_id);
+ WriteParam(m, p.render_view_id);
+ WriteParam(m, p.window);
+ WriteParam(m, p.width);
+ WriteParam(m, p.height);
+ WriteParam(m, p.identifier);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ return ReadParam(m, iter, &p->renderer_id) &&
+ ReadParam(m, iter, &p->render_view_id) &&
+ ReadParam(m, iter, &p->window) &&
+ ReadParam(m, iter, &p->width) &&
+ ReadParam(m, iter, &p->height) &&
+ ReadParam(m, iter, &p->identifier);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"(");
+ LogParam(p.renderer_id, l);
+ l->append(L", ");
+ LogParam(p.render_view_id, l);
+ l->append(L", ");
+ LogParam(p.window, l);
+ l->append(L", ");
+ LogParam(p.width, l);
+ l->append(L", ");
+ LogParam(p.height, l);
+ l->append(L", ");
+ LogParam(p.identifier, l);
+ l->append(L")");
+ }
+};
+#endif
+
template <>
struct ParamTraits<GPUInfo> {
typedef GPUInfo param_type;
diff --git a/chrome/common/gpu_messages_internal.h b/chrome/common/gpu_messages_internal.h
index fa9a83f..ac669aa 100644
--- a/chrome/common/gpu_messages_internal.h
+++ b/chrome/common/gpu_messages_internal.h
@@ -103,6 +103,22 @@ IPC_BEGIN_MESSAGES(GpuHost)
IPC_SYNC_MESSAGE_CONTROL1_1(GpuHostMsg_GetViewXID,
gfx::NativeViewId, /* view */
unsigned long /* xid */)
+#elif defined(OS_MACOSX)
+ // This message, used on Mac OS X 10.6 and later (where IOSurface is
+ // supported), is sent from the GPU process to the browser to indicate that a
+ // new backing store was allocated for the given "window" (fake
+ // PluginWindowHandle). The renderer ID and render view ID are needed in
+ // order to uniquely identify the RenderWidgetHostView on the browser side.
+ IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceSetIOSurface,
+ GpuHostMsg_AcceleratedSurfaceSetIOSurface_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.
+ IPC_MESSAGE_CONTROL3(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
+ int32, /* renderer_id */
+ int32, /* render_view_id */
+ gfx::PluginWindowHandle /* window */)
#endif
IPC_END_MESSAGES(GpuHost)
@@ -113,9 +129,12 @@ IPC_END_MESSAGES(GpuHost)
IPC_BEGIN_MESSAGES(GpuChannel)
// Tells the GPU process to create a new command buffer that renders directly
- // to a native view. A corresponding GpuCommandBufferStub is created.
- IPC_SYNC_MESSAGE_CONTROL1_1(GpuChannelMsg_CreateViewCommandBuffer,
+ // to a native view. The |render_view_id| is currently needed only on Mac OS
+ // X in order to identify the window on the browser side into which the
+ // rendering results go. A corresponding GpuCommandBufferStub is created.
+ IPC_SYNC_MESSAGE_CONTROL2_1(GpuChannelMsg_CreateViewCommandBuffer,
gfx::NativeViewId, /* view */
+ int32, /* render_view_id */
int32 /* route_id */)
// Tells the GPU process to create a new command buffer that renders to an
@@ -171,7 +190,8 @@ IPC_BEGIN_MESSAGES(GpuCommandBuffer)
int32 /* put_offset */)
// Return the current state of the command buffer following a request via
- // an AsyncGetState or AsyncFlush message.
+ // an AsyncGetState or AsyncFlush message. (This message is sent from the
+ // GPU process to the renderer process.)
IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_UpdateState,
gpu::CommandBuffer::State /* state */)
@@ -208,6 +228,13 @@ IPC_BEGIN_MESSAGES(GpuCommandBuffer)
// browser. This message is currently used only on 10.6 and later.
IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetWindowSize,
gfx::Size /* size */)
+
+ // This message is sent from the GPU process to the renderer process (and
+ // from there the browser process) that the buffers associated with the
+ // given "window" were swapped, which should cause the browser to redraw
+ // the various accelerated surfaces.
+ IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_AcceleratedSurfaceBuffersSwapped,
+ gfx::PluginWindowHandle /* window */)
#endif
IPC_END_MESSAGES(GpuCommandBuffer)
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 55f9037..89afec0 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -1994,9 +1994,13 @@ IPC_BEGIN_MESSAGES(ViewHost)
// PluginWindowHandle on the browser side which is used to identify
// the plugin to the browser later when backing store is allocated
// or reallocated. |opaque| indicates whether the plugin's output is
- // considered to be opaque, as opposed to translucent.
- IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_AllocateFakePluginWindowHandle,
+ // considered to be opaque, as opposed to translucent. This message
+ // is reused for rendering the accelerated compositor's output.
+ // |root| indicates whether the output is supposed to cover the
+ // entire window.
+ IPC_SYNC_MESSAGE_ROUTED2_1(ViewHostMsg_AllocateFakePluginWindowHandle,
bool /* opaque */,
+ bool /* root */,
gfx::PluginWindowHandle /* id */)
// Destroys a fake window handle previously allocated using