Skip to content

Commit

Permalink
Revert 90511 - Use pixmaps and EGLImages to transport image data betw…
Browse files Browse the repository at this point in the history
…een GPU process and browser. Behind a compile TOUCH_UI flag.

It uses the MAC OSX AcceleratedSurface IPCs to communicate between the GPU process and browser. The major difference between the OSX display path is that I send an ACK back after AcceleratedSurfaceSetIOSurface because the process of binding a texture to the pixmap may destroy the contents of the pixmap.

BUG=none
TEST=by hand on Linux (w/ and w/o TOUCH_UI), Windows, and Mac

Review URL: http://codereview.chromium.org/6987014

TBR=backer@chromium.org
Review URL: http://codereview.chromium.org/7261016

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90512 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
backer@chromium.org committed Jun 25, 2011
1 parent 5a9299c commit 1cf99aa
Show file tree
Hide file tree
Showing 26 changed files with 44 additions and 600 deletions.

This file was deleted.

31 changes: 0 additions & 31 deletions chrome/browser/renderer_host/accelerated_surface_container_touch.h

This file was deleted.

11 changes: 6 additions & 5 deletions chrome/browser/renderer_host/render_widget_host_view_views.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
#include "views/ime/input_method.h"
#include "views/widget/widget.h"

#if defined(TOUCH_UI)
#include "chrome/browser/renderer_host/accelerated_surface_container_touch.h"
#endif

static const int kMaxWindowWidth = 4000;
static const int kMaxWindowHeight = 4000;

Expand Down Expand Up @@ -570,7 +566,7 @@ views::View* RenderWidgetHostViewViews::GetOwnerViewOfTextInputClient() {
}

void RenderWidgetHostViewViews::OnPaint(gfx::Canvas* canvas) {
if (is_hidden_ || !host_ || host_->is_accelerated_compositing_active())
if (is_hidden_ || !host_)
return;

// Paint a "hole" in the canvas so that the render of the web page is on
Expand All @@ -580,6 +576,11 @@ void RenderWidgetHostViewViews::OnPaint(gfx::Canvas* canvas) {
bounds().width(), bounds().height(),
SkXfermode::kClear_Mode);

// Don't do any painting if the GPU process is rendering directly
// into the View.
if (host_->is_accelerated_compositing_active())
return;

#if defined(TOOLKIT_USES_GTK)
GdkWindow* window = GetInnerNativeView()->window;
#endif
Expand Down
15 changes: 1 addition & 14 deletions chrome/browser/renderer_host/render_widget_host_view_views.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <string>
#include <vector>

#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/time.h"
#include "content/browser/renderer_host/render_widget_host_view.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
Expand All @@ -25,7 +25,6 @@
namespace ui {
enum TouchStatus;
}
class AcceleratedSurfaceContainerTouch;
#endif

class RenderWidgetHost;
Expand Down Expand Up @@ -144,13 +143,6 @@ class RenderWidgetHostViewViews : public RenderWidgetHostView,
base::i18n::TextDirection direction) OVERRIDE;
virtual views::View* GetOwnerViewOfTextInputClient() OVERRIDE;

#if defined(TOUCH_UI)
virtual void AcceleratedSurfaceSetIOSurface(
int32 width, int32 height, uint64 surface_id) OVERRIDE;
virtual void AcceleratedSurfaceBuffersSwapped(uint64 surface_id) OVERRIDE;
virtual void AcceleratedSurfaceRelease(uint64 surface_id) OVERRIDE;
#endif

protected:
// Overridden from RenderWidgetHostView / views::View.
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
Expand Down Expand Up @@ -235,11 +227,6 @@ class RenderWidgetHostViewViews : public RenderWidgetHostView,
// Indicates if there is onging composition text.
bool has_composition_text_;

#if defined(TOUCH_UI)
std::map<uint64, scoped_refptr<AcceleratedSurfaceContainerTouch> >
accelerated_surface_containers_;
#endif

DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewViews);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "chrome/browser/renderer_host/render_widget_host_view_views.h"

#include "base/logging.h"
#include "chrome/browser/renderer_host/accelerated_surface_container_touch.h"
#include "content/browser/renderer_host/render_widget_host.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFactory.h"

Expand Down Expand Up @@ -188,26 +187,3 @@ RenderWidgetHostView*
return reinterpret_cast<RenderWidgetHostView*>(user_data);
}

void RenderWidgetHostViewViews::AcceleratedSurfaceSetIOSurface(
int32 width, int32 height, uint64 surface_id) {
// TODO(backer): Currently NO-OPed. Should eventually be something like:

// context_->MakeCurrent(surface_.get());
// accelerated_surface_containers_[surface_id] =
// new AcceleratedSurfaceContainer(surface_id);
// glFlush();
}

void RenderWidgetHostViewViews::AcceleratedSurfaceBuffersSwapped(
uint64 surface_id) {
// TODO(backer): Currently NO-OPed. Will eventually tie into the
// browser compositor.
}

void RenderWidgetHostViewViews::AcceleratedSurfaceRelease(uint64 surface_id) {
// TODO(backer): Currently NO-OPed. Should eventually be something like:

// context_->MakeCurrent(surface_.get());
// accelerated_surface_containers_.erase(surface_id);
// glFlush();
}
8 changes: 0 additions & 8 deletions chrome/chrome_browser.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -1761,8 +1761,6 @@
'browser/remove_rows_table_model.h',
'browser/renderer_host/accelerated_plugin_view_mac.h',
'browser/renderer_host/accelerated_plugin_view_mac.mm',
'browser/renderer_host/accelerated_surface_container_touch.cc',
'browser/renderer_host/accelerated_surface_container_touch.h',
'browser/renderer_host/chrome_render_message_filter.cc',
'browser/renderer_host/chrome_render_message_filter.h',
'browser/renderer_host/chrome_render_view_host_observer.cc',
Expand Down Expand Up @@ -3699,9 +3697,6 @@
['exclude', '^browser/chromeos/login/touch_*'],
['exclude', '^browser/extensions/extension_input_ui_api.cc'],
['exclude', '^browser/extensions/extension_input_ui_api.h'],
['exclude', '^browser/renderer_host/accelerated_surface_container_touch.cc'],
['exclude', '^browser/renderer_host/accelerated_surface_container_touch.h'],
['exclude', '^browser/renderer_host/render_widget_host_view_views_touch.cc'],
['exclude', '^browser/renderer_host/render_widget_host_view_views_touch.cc'],
['exclude', '^browser/ui/touch/*'],
['exclude', '^browser/ui/views/tab_contents/tab_contents_container_views.cc'],
Expand All @@ -3711,9 +3706,6 @@
],
}],
['touchui==1', {
'dependencies': [
'../ui/gfx/gl/gl.gyp:gl',
],
'sources/': [
['include', '^browser/ui/touch/*'],
['exclude', '^browser/chromeos/frame/browser_non_client_frame_view_factory_chromeos.cc'],
Expand Down
45 changes: 2 additions & 43 deletions content/browser/gpu/gpu_process_host_ui_shim.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,12 @@ bool GpuProcessHostUIShim::OnControlMessageReceived(
OnLogMessage)
#if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN)
IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView)
#endif

#if defined(OS_MACOSX) || defined(TOUCH_UI)
#elif defined(OS_MACOSX)
IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSetIOSurface,
OnAcceleratedSurfaceSetIOSurface)
IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
OnAcceleratedSurfaceBuffersSwapped)
#endif

#if defined(TOUCH_UI)
IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceRelease,
OnAcceleratedSurfaceRelease)
#endif
IPC_MESSAGE_UNHANDLED_ERROR()
IPC_END_MESSAGE_MAP()

Expand Down Expand Up @@ -222,9 +215,7 @@ void GpuProcessHostUIShim::OnResizeView(int32 renderer_id,
Send(new GpuMsg_ResizeViewACK(renderer_id, command_buffer_route_id));
}

#endif

#if defined(OS_MACOSX) || defined(TOUCH_UI)
#elif defined(OS_MACOSX)

void GpuProcessHostUIShim::OnAcceleratedSurfaceSetIOSurface(
const GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params& params) {
Expand All @@ -235,17 +226,10 @@ void GpuProcessHostUIShim::OnAcceleratedSurfaceSetIOSurface(
RenderWidgetHostView* view = host->view();
if (!view)
return;
#if defined(OS_MACOSX)
view->AcceleratedSurfaceSetIOSurface(params.window,
params.width,
params.height,
params.identifier);
#elif defined(TOUCH_UI)
view->AcceleratedSurfaceSetIOSurface(
params.width, params.height, params.identifier);
Send(new GpuMsg_AcceleratedSurfaceSetIOSurfaceACK(
params.renderer_id, params.route_id, params.identifier));
#endif
}

void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped(
Expand All @@ -259,7 +243,6 @@ void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped(
RenderWidgetHostView* view = host->view();
if (!view)
return;
#if defined (OS_MACOSX)
view->AcceleratedSurfaceBuffersSwapped(
// Parameters needed to swap the IOSurface.
params.window,
Expand All @@ -269,30 +252,6 @@ void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped(
params.route_id,
host_id_,
params.swap_buffers_count);
#elif defined(TOUCH_UI)
view->AcceleratedSurfaceBuffersSwapped(params.surface_id);
Send(new GpuMsg_AcceleratedSurfaceBuffersSwappedACK(
params.renderer_id, params.route_id, params.swap_buffers_count));
#endif
}

#endif

#if defined(TOUCH_UI)

void GpuProcessHostUIShim::OnAcceleratedSurfaceRelease(
const GpuHostMsg_AcceleratedSurfaceRelease_Params& params) {
RenderViewHost* host = RenderViewHost::FromID(params.renderer_id,
params.render_view_id);
if (!host)
return;
RenderWidgetHostView* view = host->view();
if (!view)
return;
view->AcceleratedSurfaceRelease(params.identifier);

Send(new GpuMsg_AcceleratedSurfaceReleaseACK(
params.renderer_id, params.route_id, params.identifier));
}

#endif
10 changes: 1 addition & 9 deletions content/browser/gpu/gpu_process_host_ui_shim.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class Size;
}

struct GPUCreateCommandBufferConfig;
struct GpuHostMsg_AcceleratedSurfaceRelease_Params;
struct GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params;
struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params;

Expand Down Expand Up @@ -98,20 +97,13 @@ class GpuProcessHostUIShim
int32 render_view_id,
int32 command_buffer_route_id,
gfx::Size size);
#endif

#if defined(OS_MACOSX) || defined(TOUCH_UI)
#elif defined(OS_MACOSX)
void OnAcceleratedSurfaceSetIOSurface(
const GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params& params);
void OnAcceleratedSurfaceBuffersSwapped(
const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params);
#endif

#if defined(TOUCH_UI)
void OnAcceleratedSurfaceRelease(
const GpuHostMsg_AcceleratedSurfaceRelease_Params& params);
#endif

// The serial number of the GpuProcessHost / GpuProcessHostUIShim pair.
int host_id_;
};
Expand Down
7 changes: 0 additions & 7 deletions content/browser/renderer_host/render_widget_host_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,6 @@ class RenderWidgetHostView {
virtual void GpuRenderingStateDidChange() = 0;
#endif

#if defined(TOUCH_UI)
virtual void AcceleratedSurfaceSetIOSurface(
int32 width, int32 height, uint64 surface_id) = 0;
virtual void AcceleratedSurfaceBuffersSwapped(uint64 surface_id) = 0;
virtual void AcceleratedSurfaceRelease(uint64 surface_id) = 0;
#endif

#if defined(TOOLKIT_USES_GTK)
virtual void CreatePluginContainer(gfx::PluginWindowHandle id) = 0;
virtual void DestroyPluginContainer(gfx::PluginWindowHandle id) = 0;
Expand Down
22 changes: 1 addition & 21 deletions content/common/gpu/gpu_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,35 +183,15 @@ GpuCommandBufferStub* GpuChannel::LookupCommandBuffer(int32 route_id) {
return stubs_.Lookup(route_id);
}

#if defined(TOUCH_UI)
void GpuChannel::AcceleratedSurfaceIOSurfaceSet(
int32 route_id, uint64 surface_id) {
GpuCommandBufferStub* stub = stubs_.Lookup(route_id);
if (stub == NULL)
return;
stub->AcceleratedSurfaceIOSurfaceSet(surface_id);
}

void GpuChannel::AcceleratedSurfaceReleased(
int32 route_id, uint64 surface_id) {
GpuCommandBufferStub* stub = stubs_.Lookup(route_id);
if (stub == NULL)
return;
stub->AcceleratedSurfaceReleased(surface_id);
}
#endif

#if defined(OS_MACOSX) || defined(TOUCH_UI)
#if defined(OS_MACOSX)
void GpuChannel::AcceleratedSurfaceBuffersSwapped(
int32 route_id, uint64 swap_buffers_count) {
GpuCommandBufferStub* stub = stubs_.Lookup(route_id);
if (stub == NULL)
return;
stub->AcceleratedSurfaceBuffersSwapped(swap_buffers_count);
}
#endif

#if defined(OS_MACOSX)
void GpuChannel::DestroyCommandBufferByViewId(int32 render_view_id) {
// This responds to a message from the browser process to destroy the command
// buffer when the window with a GpuScheduler is closed (see
Expand Down
12 changes: 1 addition & 11 deletions content/common/gpu/gpu_channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,9 @@ class GpuChannel : public IPC::Channel::Listener,

GpuCommandBufferStub* LookupCommandBuffer(int32 route_id);

#if defined(TOUCH_UI)
virtual void AcceleratedSurfaceIOSurfaceSet(
int32 route_id, uint64 surface_id);
virtual void AcceleratedSurfaceReleased(
int32 route_id, uint64 surface_id);
#endif

#if defined(OS_MACOSX) || defined(TOUCH_UI)
#if defined(OS_MACOSX)
virtual void AcceleratedSurfaceBuffersSwapped(
int32 route_id, uint64 swap_buffers_count);
#endif

#if defined(OS_MACOSX)
void DestroyCommandBufferByViewId(int32 render_view_id);
#endif

Expand Down
Loading

0 comments on commit 1cf99aa

Please sign in to comment.