diff options
author | reveman <reveman@chromium.org> | 2014-10-13 13:52:05 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-13 20:52:24 +0000 |
commit | 22dd9298e4365cfbc3662e98c3b387fe7f3ce6a3 (patch) | |
tree | dd30022f67c3a45551c67b2d5a1664364b3bf0c9 /mojo | |
parent | 6e402f141ae341c5df18ca81e892089c47fae54f (diff) | |
download | chromium_src-22dd9298e4365cfbc3662e98c3b387fe7f3ce6a3.zip chromium_src-22dd9298e4365cfbc3662e98c3b387fe7f3ce6a3.tar.gz chromium_src-22dd9298e4365cfbc3662e98c3b387fe7f3ce6a3.tar.bz2 |
gpu: Compositor management of GpuMemoryBuffer instances.
This is a refactor of the CHROMIUM_image extension that allows
the compositor to map/unmap GpuMemoryBuffers on worker threads
and potentially also allocate these buffers on worker threads.
CreateImageCHROMIUM now takes an opaque ClientBuffer as first
parameter. ClientBuffer is implementation specific and in the
case of chromium a gfx::GpuMemoryBuffer. Or more specifically
a content::GpuMemoryBufferImpl when used with the content layer.
This allows the compositor to allocate and use GpuMemoryBuffers
without a GLES2Interface.
A GpuMemoryBufferManager interface has been introduced. This
interface provides a mechanism for the compositor to allocate
GpuMemoryBuffer instances in the renderer and browser process.
BUG=418553
Review URL: https://codereview.chromium.org/634083002
Cr-Commit-Position: refs/heads/master@{#299360}
Diffstat (limited to 'mojo')
-rw-r--r-- | mojo/aura/surface_context_factory.cc | 4 | ||||
-rw-r--r-- | mojo/aura/surface_context_factory.h | 1 | ||||
-rw-r--r-- | mojo/gles2/command_buffer_client_impl.cc | 24 | ||||
-rw-r--r-- | mojo/gles2/command_buffer_client_impl.h | 15 | ||||
-rw-r--r-- | mojo/services/html_viewer/weblayertreeview_impl.cc | 2 | ||||
-rw-r--r-- | mojo/services/surfaces/surfaces_impl.cc | 2 |
6 files changed, 33 insertions, 15 deletions
diff --git a/mojo/aura/surface_context_factory.cc b/mojo/aura/surface_context_factory.cc index 9f1e77a..aa96401 100644 --- a/mojo/aura/surface_context_factory.cc +++ b/mojo/aura/surface_context_factory.cc @@ -52,6 +52,10 @@ cc::SharedBitmapManager* SurfaceContextFactory::GetSharedBitmapManager() { return nullptr; } +cc::GpuMemoryBufferManager* SurfaceContextFactory::GetGpuMemoryBufferManager() { + return nullptr; +} + base::MessageLoopProxy* SurfaceContextFactory::GetCompositorMessageLoop() { return nullptr; } diff --git a/mojo/aura/surface_context_factory.h b/mojo/aura/surface_context_factory.h index cc9aba3..8dd4721 100644 --- a/mojo/aura/surface_context_factory.h +++ b/mojo/aura/surface_context_factory.h @@ -31,6 +31,7 @@ class SurfaceContextFactory : public ui::ContextFactory { virtual void RemoveCompositor(ui::Compositor* compositor) override; virtual bool DoesCreateTestContexts() override; virtual cc::SharedBitmapManager* GetSharedBitmapManager() override; + virtual cc::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override; virtual base::MessageLoopProxy* GetCompositorMessageLoop() override; virtual scoped_ptr<cc::SurfaceIdAllocator> CreateSurfaceIdAllocator() override; diff --git a/mojo/gles2/command_buffer_client_impl.cc b/mojo/gles2/command_buffer_client_impl.cc index 5c317a0..a379020 100644 --- a/mojo/gles2/command_buffer_client_impl.cc +++ b/mojo/gles2/command_buffer_client_impl.cc @@ -191,20 +191,28 @@ gpu::Capabilities CommandBufferClientImpl::GetCapabilities() { return gpu::Capabilities(); } -gfx::GpuMemoryBuffer* CommandBufferClientImpl::CreateGpuMemoryBuffer( - size_t width, - size_t height, - unsigned internalformat, - unsigned usage, - int32* id) { +int32_t CommandBufferClientImpl::CreateImage(ClientBuffer buffer, + size_t width, + size_t height, + unsigned internalformat) { // TODO(piman) NOTIMPLEMENTED(); - return NULL; + return -1; } -void CommandBufferClientImpl::DestroyGpuMemoryBuffer(int32 id) { +void CommandBufferClientImpl::DestroyImage(int32 id) { + // TODO(piman) + NOTIMPLEMENTED(); +} + +int32_t CommandBufferClientImpl::CreateGpuMemoryBufferImage( + size_t width, + size_t height, + unsigned internalformat, + unsigned usage) { // TODO(piman) NOTIMPLEMENTED(); + return -1; } uint32 CommandBufferClientImpl::InsertSyncPoint() { diff --git a/mojo/gles2/command_buffer_client_impl.h b/mojo/gles2/command_buffer_client_impl.h index 65de5a7..5e6ffe1 100644 --- a/mojo/gles2/command_buffer_client_impl.h +++ b/mojo/gles2/command_buffer_client_impl.h @@ -54,12 +54,15 @@ class CommandBufferClientImpl : public CommandBufferClient, // gpu::GpuControl implementation: virtual gpu::Capabilities GetCapabilities() override; - virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer(size_t width, - size_t height, - unsigned internalformat, - unsigned usage, - int32* id) override; - virtual void DestroyGpuMemoryBuffer(int32 id) override; + virtual int32_t CreateImage(ClientBuffer buffer, + size_t width, + size_t height, + unsigned internalformat) override; + virtual void DestroyImage(int32_t id) override; + virtual int32_t CreateGpuMemoryBufferImage(size_t width, + size_t height, + unsigned internalformat, + unsigned usage) override; virtual uint32 InsertSyncPoint() override; virtual uint32 InsertFutureSyncPoint() override; virtual void RetireSyncPoint(uint32 sync_point) override; diff --git a/mojo/services/html_viewer/weblayertreeview_impl.cc b/mojo/services/html_viewer/weblayertreeview_impl.cc index 7429d47..3c7f251a 100644 --- a/mojo/services/html_viewer/weblayertreeview_impl.cc +++ b/mojo/services/html_viewer/weblayertreeview_impl.cc @@ -39,10 +39,12 @@ WebLayerTreeViewImpl::WebLayerTreeViewImpl( settings.layer_transforms_should_scale_layer_contents = true; cc::SharedBitmapManager* shared_bitmap_manager = NULL; + cc::GpuMemoryBufferManager* gpu_memory_buffer_manager = NULL; layer_tree_host_ = cc::LayerTreeHost::CreateThreaded(this, shared_bitmap_manager, + gpu_memory_buffer_manager, settings, base::MessageLoopProxy::current(), compositor_message_loop_proxy); diff --git a/mojo/services/surfaces/surfaces_impl.cc b/mojo/services/surfaces/surfaces_impl.cc index 1e6e070..e323c02 100644 --- a/mojo/services/surfaces/surfaces_impl.cc +++ b/mojo/services/surfaces/surfaces_impl.cc @@ -76,7 +76,7 @@ void SurfacesImpl::CreateGLES2BoundSurface(CommandBufferPtr gles2_client, return; } if (!display_) { - display_.reset(new cc::Display(this, manager_, NULL)); + display_.reset(new cc::Display(this, manager_, NULL, NULL)); client_->SetDisplay(display_.get()); display_->Initialize(make_scoped_ptr(new DirectOutputSurface( new ContextProviderMojo(command_buffer_handle_.Pass())))); |