diff options
author | backer@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-25 14:47:32 +0000 |
---|---|---|
committer | backer@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-25 14:47:32 +0000 |
commit | 5a9299c645bfa4fcbbc3b3106af2837e2b9f7ec1 (patch) | |
tree | 3a1fba0dfd544e6d0dbbebaef594dce16a8afc6e /gpu/command_buffer/service/gpu_scheduler_linux.cc | |
parent | 05f0f84db4862d970c79839450be35d67ce7d052 (diff) | |
download | chromium_src-5a9299c645bfa4fcbbc3b3106af2837e2b9f7ec1.zip chromium_src-5a9299c645bfa4fcbbc3b3106af2837e2b9f7ec1.tar.gz chromium_src-5a9299c645bfa4fcbbc3b3106af2837e2b9f7ec1.tar.bz2 |
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
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90511 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/service/gpu_scheduler_linux.cc')
-rw-r--r-- | gpu/command_buffer/service/gpu_scheduler_linux.cc | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/gpu/command_buffer/service/gpu_scheduler_linux.cc b/gpu/command_buffer/service/gpu_scheduler_linux.cc index 6adaba6..1c6c8e9 100644 --- a/gpu/command_buffer/service/gpu_scheduler_linux.cc +++ b/gpu/command_buffer/service/gpu_scheduler_linux.cc @@ -7,6 +7,13 @@ #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 { @@ -20,10 +27,14 @@ 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"; @@ -53,9 +64,75 @@ 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 |