Commit e3224f1b authored by alexst@chromium.org's avatar alexst@chromium.org

Messages needed for webview compositor communication.

Browser needs to communicate with the embedder when 
the guest renderer swaps hardware buffers.
Embedder needs to provide textures for the guest to render into.

BUG=143429


Review URL: https://chromiumcodereview.appspot.com/11364133

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170575 0039d316-1c4b-4281-b951-d872f2087c98
parent 4938a16a
...@@ -56,6 +56,8 @@ bool BrowserPluginEmbedderHelper::OnMessageReceived( ...@@ -56,6 +56,8 @@ bool BrowserPluginEmbedderHelper::OnMessageReceived(
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetAutoSize, OnSetAutoSize) IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetAutoSize, OnSetAutoSize)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_PluginAtPositionResponse, IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_PluginAtPositionResponse,
OnPluginAtPositionResponse) OnPluginAtPositionResponse)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_BuffersSwappedACK,
OnSwapBuffersACK)
IPC_MESSAGE_UNHANDLED(handled = false) IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP() IPC_END_MESSAGE_MAP()
return handled; return handled;
...@@ -129,6 +131,15 @@ void BrowserPluginEmbedderHelper::OnUpdateRectACK( ...@@ -129,6 +131,15 @@ void BrowserPluginEmbedderHelper::OnUpdateRectACK(
resize_guest_params); 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) { void BrowserPluginEmbedderHelper::OnSetFocus(int instance_id, bool focused) {
embedder_->SetFocus(instance_id, focused); embedder_->SetFocus(instance_id, focused);
} }
......
...@@ -67,6 +67,7 @@ class BrowserPluginEmbedderHelper : public RenderViewHostObserver { ...@@ -67,6 +67,7 @@ class BrowserPluginEmbedderHelper : public RenderViewHostObserver {
int message_id, int message_id,
const BrowserPluginHostMsg_AutoSize_Params& auto_size_params, const BrowserPluginHostMsg_AutoSize_Params& auto_size_params,
const BrowserPluginHostMsg_ResizeGuest_Params& resize_guest_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 OnHandleInputEvent(const IPC::SyncMessage& message, bool* handled);
void OnSetFocus(int instance_id, bool focused); void OnSetFocus(int instance_id, bool focused);
void OnPluginDestroyed(int instance_id); void OnPluginDestroyed(int instance_id);
......
...@@ -335,6 +335,30 @@ int BrowserPluginGuest::embedder_routing_id() const { ...@@ -335,6 +335,30 @@ int BrowserPluginGuest::embedder_routing_id() const {
return embedder_web_contents_->GetRoutingID(); 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 { bool BrowserPluginGuest::InAutoSizeBounds(const gfx::Size& size) const {
return size.width() <= max_auto_size_.width() && return size.width() <= max_auto_size_.width() &&
size.height() <= max_auto_size_.height(); size.height() <= max_auto_size_.height();
......
...@@ -234,6 +234,13 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, ...@@ -234,6 +234,13 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver,
#endif #endif
const gfx::Size& damage_view_size, const gfx::Size& damage_view_size,
float scale_factor); 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; gfx::Point GetScreenCoordinates(const gfx::Point& relative_position) const;
...@@ -297,6 +304,9 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, ...@@ -297,6 +304,9 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver,
gfx::Size max_auto_size_; gfx::Size max_auto_size_;
gfx::Size min_auto_size_; gfx::Size min_auto_size_;
// Hardware Accelerated Surface Params
gfx::GLSurfaceHandle surface_handle_;
DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest);
}; };
......
...@@ -63,6 +63,13 @@ IPC_STRUCT_BEGIN(BrowserPluginHostMsg_CreateGuest_Params) ...@@ -63,6 +63,13 @@ IPC_STRUCT_BEGIN(BrowserPluginHostMsg_CreateGuest_Params)
IPC_STRUCT_MEMBER(BrowserPluginHostMsg_AutoSize_Params, auto_size_params) IPC_STRUCT_MEMBER(BrowserPluginHostMsg_AutoSize_Params, auto_size_params)
IPC_STRUCT_MEMBER(BrowserPluginHostMsg_ResizeGuest_Params, IPC_STRUCT_MEMBER(BrowserPluginHostMsg_ResizeGuest_Params,
resize_guest_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_END()
IPC_STRUCT_BEGIN(BrowserPluginMsg_LoadCommit_Params) IPC_STRUCT_BEGIN(BrowserPluginMsg_LoadCommit_Params)
...@@ -192,6 +199,14 @@ IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_NavigateGuest, ...@@ -192,6 +199,14 @@ IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_NavigateGuest,
int /* instance_id*/, int /* instance_id*/,
std::string /* src */) 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 // When a BrowserPlugin has been removed from the embedder's DOM, it informs
// the browser process to cleanup the guest. // the browser process to cleanup the guest.
IPC_MESSAGE_ROUTED1(BrowserPluginHostMsg_PluginDestroyed, IPC_MESSAGE_ROUTED1(BrowserPluginHostMsg_PluginDestroyed,
...@@ -310,3 +325,25 @@ IPC_MESSAGE_ROUTED3(BrowserPluginMsg_UpdateRect, ...@@ -310,3 +325,25 @@ IPC_MESSAGE_ROUTED3(BrowserPluginMsg_UpdateRect,
IPC_MESSAGE_ROUTED2(BrowserPluginMsg_PluginAtPositionRequest, IPC_MESSAGE_ROUTED2(BrowserPluginMsg_PluginAtPositionRequest,
int /* request_id */, int /* request_id */,
gfx::Point /* position */) 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 */)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment