diff options
author | backer@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-25 14:55:40 +0000 |
---|---|---|
committer | backer@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-25 14:55:40 +0000 |
commit | 1cf99aa4097c941fbd3295eee277b40a947978df (patch) | |
tree | 1ea1af795f6e5214870ba5ff463316b558e2e0ad /gpu | |
parent | 5a9299c645bfa4fcbbc3b3106af2837e2b9f7ec1 (diff) | |
download | chromium_src-1cf99aa4097c941fbd3295eee277b40a947978df.zip chromium_src-1cf99aa4097c941fbd3295eee277b40a947978df.tar.gz chromium_src-1cf99aa4097c941fbd3295eee277b40a947978df.tar.bz2 |
Revert 90511 - Use pixmaps and EGLImages to transport image data between 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
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/command_buffer/common/gl_mock.h | 3 | ||||
-rw-r--r-- | gpu/command_buffer/service/gpu_scheduler.cc | 11 | ||||
-rw-r--r-- | gpu/command_buffer/service/gpu_scheduler.h | 51 | ||||
-rw-r--r-- | gpu/command_buffer/service/gpu_scheduler_linux.cc | 77 |
4 files changed, 16 insertions, 126 deletions
diff --git a/gpu/command_buffer/common/gl_mock.h b/gpu/command_buffer/common/gl_mock.h index 43e877b..b91cb5b 100644 --- a/gpu/command_buffer/common/gl_mock.h +++ b/gpu/command_buffer/common/gl_mock.h @@ -135,9 +135,6 @@ class MockGLInterface : public GLInterface { MOCK_METHOD4(DrawElements, void( GLenum mode, GLsizei count, GLenum type, const void* indices)); - MOCK_METHOD2(EGLImageTargetTexture2DOES, void( - GLenum target, GLeglImageOES image)); - MOCK_METHOD1(Enable, void(GLenum cap)); MOCK_METHOD1(EnableVertexAttribArray, void(GLuint index)); diff --git a/gpu/command_buffer/service/gpu_scheduler.cc b/gpu/command_buffer/service/gpu_scheduler.cc index a67fd3a..d4ac593 100644 --- a/gpu/command_buffer/service/gpu_scheduler.cc +++ b/gpu/command_buffer/service/gpu_scheduler.cc @@ -25,7 +25,7 @@ GpuScheduler::GpuScheduler(CommandBuffer* command_buffer, : command_buffer_(command_buffer), commands_per_update_(100), unscheduled_count_(0), -#if defined(OS_MACOSX) || defined(TOUCH_UI) +#if defined(OS_MACOSX) swap_buffers_count_(0), acknowledged_swap_buffers_count_(0), #endif @@ -46,7 +46,7 @@ GpuScheduler::GpuScheduler(CommandBuffer* command_buffer, : command_buffer_(command_buffer), commands_per_update_(commands_per_update), unscheduled_count_(0), -#if defined(OS_MACOSX) || defined(TOUCH_UI) +#if defined(OS_MACOSX) swap_buffers_count_(0), acknowledged_swap_buffers_count_(0), #endif @@ -139,7 +139,7 @@ bool GpuScheduler::SetParent(GpuScheduler* parent_scheduler, return decoder_->SetParent(NULL, 0); } -#if defined(OS_MACOSX) || defined(TOUCH_UI) +#if defined(OS_MACOSX) namespace { const unsigned int kMaxOutstandingSwapBuffersCallsPerOnscreenContext = 1; } @@ -178,11 +178,6 @@ void GpuScheduler::ProcessCommands() { #if defined(OS_MACOSX) bool do_rate_limiting = surface_.get() != NULL; -#elif defined(TOUCH_UI) - bool do_rate_limiting = back_surface_.get() != NULL; -#endif - -#if defined(OS_MACOSX) || defined(TOUCH_UI) // Don't swamp the browser process with SwapBuffers calls it can't handle. if (do_rate_limiting && swap_buffers_count_ - acknowledged_swap_buffers_count_ >= diff --git a/gpu/command_buffer/service/gpu_scheduler.h b/gpu/command_buffer/service/gpu_scheduler.h index a5d10ae..31b6a95 100644 --- a/gpu/command_buffer/service/gpu_scheduler.h +++ b/gpu/command_buffer/service/gpu_scheduler.h @@ -5,7 +5,6 @@ #ifndef GPU_COMMAND_BUFFER_SERVICE_GPU_SCHEDULER_H_ #define GPU_COMMAND_BUFFER_SERVICE_GPU_SCHEDULER_H_ -#include <map> #include <queue> #include <vector> @@ -24,8 +23,6 @@ #if defined(OS_MACOSX) #include "ui/gfx/surface/accelerated_surface_mac.h" -#elif defined(TOUCH_UI) -#include "ui/gfx/surface/accelerated_surface_linux.h" #endif namespace gfx { @@ -97,19 +94,6 @@ class GpuScheduler : public CommandBufferEngine { // Asynchronously resizes an offscreen frame buffer. void ResizeOffscreenFrameBuffer(const gfx::Size& size); -#if defined(OS_MACOSX) || defined(TOUCH_UI) - // To prevent the GPU process from overloading the browser process, - // we need to track the number of swap buffers calls issued and - // acknowledged per on-screen context, and keep the GPU from getting - // too far ahead of the browser. Note that this - // is also predicated on a flow control mechanism between the - // renderer and GPU processes. - uint64 swap_buffers_count() const; - uint64 acknowledged_swap_buffers_count() const; - void set_acknowledged_swap_buffers_count( - uint64 acknowledged_swap_buffers_count); -#endif - #if defined(OS_MACOSX) // Needed only on Mac OS X, which does not render into an on-screen // window and therefore requires the backing store to be resized @@ -123,23 +107,22 @@ class GpuScheduler : public CommandBufferEngine { virtual void SetTransportDIBAllocAndFree( Callback2<size_t, TransportDIB::Handle*>::Type* allocator, Callback1<TransportDIB::Id>::Type* deallocator); - // Returns the id of the current surface that is being rendered to - // (or 0 if no such surface has been created). + // Returns the id of the current IOSurface, or 0. virtual uint64 GetSurfaceId(); + // To prevent the GPU process from overloading the browser process, + // we need to track the number of swap buffers calls issued and + // acknowledged per on-screen (IOSurface-backed) context, and keep + // the GPU from getting too far ahead of the browser. Note that this + // is also predicated on a flow control mechanism between the + // renderer and GPU processes. + uint64 swap_buffers_count() const; + uint64 acknowledged_swap_buffers_count() const; + void set_acknowledged_swap_buffers_count( + uint64 acknowledged_swap_buffers_count); void DidDestroySurface(); #endif -#if defined(TOUCH_UI) - virtual void CreateBackSurface(const gfx::Size& size); - // Should not be back_surface_ or front_surface_. - virtual void ReleaseSurface(uint64 surface_id); - - // Returns the id of the surface (or 0 if no such surface has been created). - virtual uint64 GetBackSurfaceId(); - virtual uint64 GetFrontSurfaceId(); -#endif - // Sets a callback that is called when a glResizeCHROMIUM command // is processed. void SetResizeCallback(Callback1<gfx::Size>::Type* callback); @@ -200,18 +183,10 @@ class GpuScheduler : public CommandBufferEngine { scoped_ptr<Callback0::Type> scheduled_callback_; -#if defined(OS_MACOSX) || defined(TOUCH_UI) - uint64 swap_buffers_count_; - uint64 acknowledged_swap_buffers_count_; -#endif - #if defined(OS_MACOSX) scoped_ptr<AcceleratedSurface> surface_; -#elif defined(TOUCH_UI) - std::map<uint64, scoped_refptr<AcceleratedSurface> > - surfaces_; - scoped_refptr<AcceleratedSurface> back_surface_; - scoped_refptr<AcceleratedSurface> front_surface_; + uint64 swap_buffers_count_; + uint64 acknowledged_swap_buffers_count_; #endif ScopedRunnableMethodFactory<GpuScheduler> method_factory_; diff --git a/gpu/command_buffer/service/gpu_scheduler_linux.cc b/gpu/command_buffer/service/gpu_scheduler_linux.cc index 1c6c8e9..6adaba6 100644 --- a/gpu/command_buffer/service/gpu_scheduler_linux.cc +++ b/gpu/command_buffer/service/gpu_scheduler_linux.cc @@ -7,13 +7,6 @@ #include "ui/gfx/gl/gl_share_group.h" #include "ui/gfx/gl/gl_surface.h" -#if defined(TOUCH_UI) -#include "third_party/angle/include/EGL/egl.h" -#include "third_party/angle/include/EGL/eglext.h" -#include "ui/gfx/gl/gl_surface_egl.h" -#include "ui/gfx/gl/gl_bindings.h" -#endif - using ::base::SharedMemory; namespace gpu { @@ -27,14 +20,10 @@ bool GpuScheduler::Initialize( gfx::GLShareGroup* share_group) { // Create either a view or pbuffer based GLSurface. scoped_refptr<gfx::GLSurface> surface; -#if defined(TOUCH_UI) - surface = gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(1, 1)); -#else if (window) surface = gfx::GLSurface::CreateViewGLSurface(window); else surface = gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(1, 1)); -#endif if (!surface.get()) { LOG(ERROR) << "GpuScheduler::Initialize failed.\n"; @@ -64,75 +53,9 @@ void GpuScheduler::Destroy() { } void GpuScheduler::WillSwapBuffers() { -#if defined(TOUCH_UI) - front_surface_.swap(back_surface_); - DCHECK_NE(front_surface_.get(), static_cast<AcceleratedSurface*>(NULL)); - - gfx::Size expected_size = front_surface_->size(); - if (!back_surface_.get() || back_surface_->size() != expected_size) { - wrapped_resize_callback_->Run(expected_size); - } else { - glFramebufferTexture2DEXT(GL_FRAMEBUFFER, - GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, - back_surface_->texture(), - 0); - } - ++swap_buffers_count_; - glFlush(); -#endif if (wrapped_swap_buffers_callback_.get()) { wrapped_swap_buffers_callback_->Run(); } } -#if defined(TOUCH_UI) -uint64 GpuScheduler::GetBackSurfaceId() { - if (!back_surface_.get()) - return 0; - return back_surface_->pixmap(); -} - -uint64 GpuScheduler::GetFrontSurfaceId() { - if (!front_surface_.get()) - return 0; - return front_surface_->pixmap(); -} - -uint64 GpuScheduler::swap_buffers_count() const { - return swap_buffers_count_; -} - -uint64 GpuScheduler::acknowledged_swap_buffers_count() const { - return acknowledged_swap_buffers_count_; -} - -void GpuScheduler::set_acknowledged_swap_buffers_count( - uint64 acknowledged_swap_buffers_count) { - acknowledged_swap_buffers_count_ = acknowledged_swap_buffers_count; -} - -void GpuScheduler::CreateBackSurface(const gfx::Size& size) { - decoder()->ResizeOffscreenFrameBuffer(size); - decoder()->UpdateOffscreenFrameBufferSize(); - - back_surface_ = new AcceleratedSurface(size); - surfaces_[back_surface_->pixmap()] = back_surface_; - - glFramebufferTexture2DEXT(GL_FRAMEBUFFER, - GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, - back_surface_->texture(), - 0); - glFlush(); -} - -void GpuScheduler::ReleaseSurface(uint64 surface_id) { - DCHECK_NE(surfaces_[surface_id].get(), back_surface_.get()); - DCHECK_NE(surfaces_[surface_id].get(), front_surface_.get()); - surfaces_.erase(surface_id); -} - -#endif - } // namespace gpu |