diff options
Diffstat (limited to 'content')
7 files changed, 51 insertions, 4 deletions
diff --git a/content/browser/android/system_ui_resource_manager_impl_unittest.cc b/content/browser/android/system_ui_resource_manager_impl_unittest.cc index 95a7e9b..65942b7 100644 --- a/content/browser/android/system_ui_resource_manager_impl_unittest.cc +++ b/content/browser/android/system_ui_resource_manager_impl_unittest.cc @@ -63,6 +63,8 @@ class MockUIResourceProvider : public content::UIResourceProvider { ui_resource_client_map_.erase(id); } + virtual bool SupportsETC1NonPowerOfTwo() const OVERRIDE { return true; } + void LayerTreeHostCleared() { has_layer_tree_host_ = false; UIResourceClientMap client_map = ui_resource_client_map_; diff --git a/content/browser/android/ui_resource_provider_impl.cc b/content/browser/android/ui_resource_provider_impl.cc index d26d42f..cd45d7c 100644 --- a/content/browser/android/ui_resource_provider_impl.cc +++ b/content/browser/android/ui_resource_provider_impl.cc @@ -11,7 +11,9 @@ namespace content { UIResourceProviderImpl::UIResourceProviderImpl() - : system_ui_resource_manager_(this), host_(NULL) { + : system_ui_resource_manager_(this), host_(NULL), + supports_etc1_npot_(false) { + } UIResourceProviderImpl::~UIResourceProviderImpl() { @@ -63,4 +65,8 @@ UIResourceProviderImpl::GetSystemUIResourceManager() { return system_ui_resource_manager_; } +bool UIResourceProviderImpl::SupportsETC1NonPowerOfTwo() const { + return supports_etc1_npot_; +} + } // namespace content diff --git a/content/browser/android/ui_resource_provider_impl.h b/content/browser/android/ui_resource_provider_impl.h index 57c9ab8..06affe8 100644 --- a/content/browser/android/ui_resource_provider_impl.h +++ b/content/browser/android/ui_resource_provider_impl.h @@ -34,12 +34,18 @@ class UIResourceProviderImpl : public UIResourceProvider { ui::SystemUIResourceManager& GetSystemUIResourceManager(); + void SetSupportsETC1NonPowerOfTwo(bool supports_etc1_npot) { + supports_etc1_npot_ = supports_etc1_npot; + } + virtual bool SupportsETC1NonPowerOfTwo() const OVERRIDE; + private: typedef base::hash_map<cc::UIResourceId, UIResourceClientAndroid*> UIResourceClientMap; UIResourceClientMap ui_resource_client_map_; SystemUIResourceManagerImpl system_ui_resource_manager_; cc::LayerTreeHost* host_; + bool supports_etc1_npot_; DISALLOW_COPY_AND_ASSIGN(UIResourceProviderImpl); }; diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc index 13b0735..b0c3aea 100644 --- a/content/browser/renderer_host/compositor_impl_android.cc +++ b/content/browser/renderer_host/compositor_impl_android.cc @@ -14,6 +14,7 @@ #include "base/containers/hash_tables.h" #include "base/lazy_instance.h" #include "base/logging.h" +#include "base/memory/weak_ptr.h" #include "base/single_thread_task_runner.h" #include "base/synchronization/lock.h" #include "base/threading/thread.h" @@ -56,9 +57,12 @@ const unsigned int kMaxSwapBuffers = 2U; class OutputSurfaceWithoutParent : public cc::OutputSurface { public: OutputSurfaceWithoutParent(const scoped_refptr< - content::ContextProviderCommandBuffer>& context_provider) + content::ContextProviderCommandBuffer>& context_provider, + base::WeakPtr<content::CompositorImpl> compositor_impl) : cc::OutputSurface(context_provider) { capabilities_.adjust_deadline_for_parent = false; + compositor_impl_ = compositor_impl; + main_thread_ = base::MessageLoopProxy::current(); } virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE { @@ -72,6 +76,22 @@ class OutputSurfaceWithoutParent : public cc::OutputSurface { OutputSurface::SwapBuffers(frame); } + + virtual bool BindToClient(cc::OutputSurfaceClient* client) OVERRIDE { + if (!OutputSurface::BindToClient(client)) + return false; + + main_thread_->PostTask( + FROM_HERE, + base::Bind(&content::CompositorImpl::PopulateGpuCapabilities, + compositor_impl_, + context_provider_->ContextCapabilities().gpu)); + + return true; + } + + scoped_refptr<base::MessageLoopProxy> main_thread_; + base::WeakPtr<content::CompositorImpl> compositor_impl_; }; class SurfaceTextureTrackerImpl : public gfx::SurfaceTextureTracker { @@ -552,8 +572,14 @@ scoped_ptr<cc::OutputSurface> CompositorImpl::CreateOutputSurface( return scoped_ptr<cc::OutputSurface>(); } - return scoped_ptr<cc::OutputSurface>( - new OutputSurfaceWithoutParent(context_provider)); + return scoped_ptr<cc::OutputSurface>(new OutputSurfaceWithoutParent( + context_provider, weak_factory_.GetWeakPtr())); +} + +void CompositorImpl::PopulateGpuCapabilities( + gpu::Capabilities gpu_capabilities) { + ui_resource_provider_.SetSupportsETC1NonPowerOfTwo( + gpu_capabilities.texture_format_etc1_npot); } void CompositorImpl::OnLostResources() { diff --git a/content/browser/renderer_host/compositor_impl_android.h b/content/browser/renderer_host/compositor_impl_android.h index e24d581..88f101b 100644 --- a/content/browser/renderer_host/compositor_impl_android.h +++ b/content/browser/renderer_host/compositor_impl_android.h @@ -15,7 +15,9 @@ #include "content/browser/android/ui_resource_provider_impl.h" #include "content/browser/renderer_host/image_transport_factory_android.h" #include "content/common/content_export.h" +#include "content/common/gpu/client/context_provider_command_buffer.h" #include "content/public/browser/android/compositor.h" +#include "gpu/command_buffer/common/capabilities.h" #include "third_party/khronos/GLES2/gl2.h" #include "ui/base/android/system_ui_resource_manager.h" #include "ui/base/android/window_android_compositor.h" @@ -54,6 +56,8 @@ class CONTENT_EXPORT CompositorImpl // Destroy all surface textures associated with |child_process_id|. static void DestroyAllSurfaceTextures(int child_process_id); + void PopulateGpuCapabilities(gpu::Capabilities gpu_capabilities); + private: // Compositor implementation. virtual void SetRootLayer(scoped_refptr<cc::Layer> root) OVERRIDE; diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h index a91bd1f..36b50d4 100644 --- a/content/common/gpu/gpu_messages.h +++ b/content/common/gpu/gpu_messages.h @@ -194,6 +194,7 @@ IPC_STRUCT_TRAITS_BEGIN(gpu::Capabilities) IPC_STRUCT_TRAITS_MEMBER(egl_image_external) IPC_STRUCT_TRAITS_MEMBER(texture_format_bgra8888) IPC_STRUCT_TRAITS_MEMBER(texture_format_etc1) + IPC_STRUCT_TRAITS_MEMBER(texture_format_etc1_npot) IPC_STRUCT_TRAITS_MEMBER(texture_rectangle) IPC_STRUCT_TRAITS_MEMBER(iosurface) IPC_STRUCT_TRAITS_MEMBER(texture_usage) diff --git a/content/public/browser/android/ui_resource_provider.h b/content/public/browser/android/ui_resource_provider.h index 38511e1..c764d1e 100644 --- a/content/public/browser/android/ui_resource_provider.h +++ b/content/public/browser/android/ui_resource_provider.h @@ -20,6 +20,8 @@ class CONTENT_EXPORT UIResourceProvider { UIResourceClientAndroid* client) = 0; virtual void DeleteUIResource(cc::UIResourceId resource_id) = 0; + + virtual bool SupportsETC1NonPowerOfTwo() const = 0; }; } // namespace content |