diff options
Diffstat (limited to 'content')
5 files changed, 83 insertions, 0 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_embedder_helper.cc b/content/browser/browser_plugin/browser_plugin_embedder_helper.cc index 30185e3..90e04e8 100644 --- a/content/browser/browser_plugin/browser_plugin_embedder_helper.cc +++ b/content/browser/browser_plugin/browser_plugin_embedder_helper.cc @@ -56,6 +56,8 @@ bool BrowserPluginEmbedderHelper::OnMessageReceived( IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetAutoSize, OnSetAutoSize) IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_PluginAtPositionResponse, OnPluginAtPositionResponse) + IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_BuffersSwappedACK, + OnSwapBuffersACK) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -129,6 +131,15 @@ void BrowserPluginEmbedderHelper::OnUpdateRectACK( resize_guest_params); } +void BrowserPluginEmbedderHelper::OnSwapBuffersACK(int route_id, + int gpu_host_id, + uint32 sync_point) { + RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, + gpu_host_id, + true, + sync_point); +} + void BrowserPluginEmbedderHelper::OnSetFocus(int instance_id, bool focused) { embedder_->SetFocus(instance_id, focused); } diff --git a/content/browser/browser_plugin/browser_plugin_embedder_helper.h b/content/browser/browser_plugin/browser_plugin_embedder_helper.h index 1b2919c..654441a 100644 --- a/content/browser/browser_plugin/browser_plugin_embedder_helper.h +++ b/content/browser/browser_plugin/browser_plugin_embedder_helper.h @@ -67,6 +67,7 @@ class BrowserPluginEmbedderHelper : public RenderViewHostObserver { int message_id, const BrowserPluginHostMsg_AutoSize_Params& auto_size_params, const BrowserPluginHostMsg_ResizeGuest_Params& resize_guest_params); + void OnSwapBuffersACK(int route_id, int gpu_host_id, uint32 sync_point); void OnHandleInputEvent(const IPC::SyncMessage& message, bool* handled); void OnSetFocus(int instance_id, bool focused); void OnPluginDestroyed(int instance_id); diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc index 4f8c036..435f73b 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.cc +++ b/content/browser/browser_plugin/browser_plugin_guest.cc @@ -335,6 +335,30 @@ int BrowserPluginGuest::embedder_routing_id() const { return embedder_web_contents_->GetRoutingID(); } +void BrowserPluginGuest::SetCompositingBufferData(int gpu_process_id, + uint32 client_id, + uint32 context_id, + uint32 texture_id_0, + uint32 texture_id_1, + uint32 sync_point) { + // This is the signal for having no context + if (texture_id_0 == 0) { + DCHECK(texture_id_1 == 0); + return; + } + + DCHECK(texture_id_1 != 0); + DCHECK(texture_id_0 != texture_id_1); + + surface_handle_ = gfx::GLSurfaceHandle(gfx::kNullPluginWindow, true); + surface_handle_.parent_gpu_process_id = gpu_process_id; + surface_handle_.parent_client_id = client_id; + surface_handle_.parent_context_id = context_id; + surface_handle_.parent_texture_id[0] = texture_id_0; + surface_handle_.parent_texture_id[1] = texture_id_1; + surface_handle_.sync_point = sync_point; +} + bool BrowserPluginGuest::InAutoSizeBounds(const gfx::Size& size) const { return size.width() <= max_auto_size_.width() && size.height() <= max_auto_size_.height(); diff --git a/content/browser/browser_plugin/browser_plugin_guest.h b/content/browser/browser_plugin/browser_plugin_guest.h index 04125da..662a884 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.h +++ b/content/browser/browser_plugin/browser_plugin_guest.h @@ -234,6 +234,13 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, #endif const gfx::Size& damage_view_size, float scale_factor); + // Overridden in tests. + virtual void SetCompositingBufferData(int gpu_process_id, + uint32 client_id, + uint32 context_id, + uint32 texture_id_0, + uint32 texture_id_1, + uint32 sync_point); gfx::Point GetScreenCoordinates(const gfx::Point& relative_position) const; @@ -297,6 +304,9 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, gfx::Size max_auto_size_; gfx::Size min_auto_size_; + // Hardware Accelerated Surface Params + gfx::GLSurfaceHandle surface_handle_; + DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); }; diff --git a/content/common/browser_plugin_messages.h b/content/common/browser_plugin_messages.h index b14d1b2..78e143d 100644 --- a/content/common/browser_plugin_messages.h +++ b/content/common/browser_plugin_messages.h @@ -63,6 +63,13 @@ IPC_STRUCT_BEGIN(BrowserPluginHostMsg_CreateGuest_Params) IPC_STRUCT_MEMBER(BrowserPluginHostMsg_AutoSize_Params, auto_size_params) IPC_STRUCT_MEMBER(BrowserPluginHostMsg_ResizeGuest_Params, resize_guest_params) + // Hardware Accelerated Surface Params + IPC_STRUCT_MEMBER(int, gpu_process_id) + IPC_STRUCT_MEMBER(uint32, client_id) + IPC_STRUCT_MEMBER(uint32, context_id) + IPC_STRUCT_MEMBER(uint32, texture_id_0) + IPC_STRUCT_MEMBER(uint32, texture_id_1) + IPC_STRUCT_MEMBER(uint32, sync_point) IPC_STRUCT_END() IPC_STRUCT_BEGIN(BrowserPluginMsg_LoadCommit_Params) @@ -192,6 +199,14 @@ IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_NavigateGuest, int /* instance_id*/, std::string /* src */) +// Acknowledge that we presented a HW buffer and provide a sync point +// to specify the location in the command stream when the compositor +// is no longer using it. +IPC_MESSAGE_ROUTED3(BrowserPluginHostMsg_BuffersSwappedACK, + int /* route_id */, + int /* gpu_host_id */, + uint32 /* sync_point */) + // When a BrowserPlugin has been removed from the embedder's DOM, it informs // the browser process to cleanup the guest. IPC_MESSAGE_ROUTED1(BrowserPluginHostMsg_PluginDestroyed, @@ -310,3 +325,25 @@ IPC_MESSAGE_ROUTED3(BrowserPluginMsg_UpdateRect, IPC_MESSAGE_ROUTED2(BrowserPluginMsg_PluginAtPositionRequest, int /* request_id */, gfx::Point /* position */) + +// Signal to the embedder that accelerated compositing was enabled +// in the guest renderer. +IPC_MESSAGE_ROUTED1(BrowserPluginMsg_AcceleratedCompositingEnabled, + int /* instance_id */) + +// Guest renders into an FBO with textures provided by the embedder. +// When HW accelerated buffers are swapped in the guest, the message +// is forwarded to the embedder to notify it of a new texture +// available for compositing. +IPC_MESSAGE_ROUTED4(BrowserPluginMsg_BuffersSwapped, + int /* instance_id */, + uint64 /* surface_handle */, + int /* route_id */, + int /* gpu_host_id */) + +// HW accelerated surface was created in the guest, forward this +// information to the embedder to update rendering parameters +// in the compositor. +IPC_MESSAGE_ROUTED2(BrowserPluginMsg_AcceleratedSurfaceNew, + int /* instance_id */, + gfx::Size /* size */) |