diff options
Diffstat (limited to 'gpu/command_buffer/service')
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder.cc | 4 | ||||
-rw-r--r-- | gpu/command_buffer/service/image_manager.cc | 9 | ||||
-rw-r--r-- | gpu/command_buffer/service/image_manager.h | 4 |
3 files changed, 16 insertions, 1 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 0af257a..e3fcd46 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -2482,6 +2482,10 @@ bool GLES2DecoderImpl::Initialize( context_->SetUnbindFboOnMakeCurrent(); } + if (feature_info_->workarounds().release_image_after_use) { + image_manager()->SetReleaseAfterUse(); + } + // Only compositor contexts are known to use only the subset of GL // that can be safely migrated between the iGPU and the dGPU. Mark // those contexts as safe to forcibly transition between the GPUs. diff --git a/gpu/command_buffer/service/image_manager.cc b/gpu/command_buffer/service/image_manager.cc index a09af15..f39eba2 100644 --- a/gpu/command_buffer/service/image_manager.cc +++ b/gpu/command_buffer/service/image_manager.cc @@ -9,7 +9,7 @@ namespace gpu { namespace gles2 { -ImageManager::ImageManager() { +ImageManager::ImageManager() : release_after_use_(false) { } ImageManager::~ImageManager() { @@ -37,6 +37,9 @@ bool ImageManager::RegisterGpuMemoryBuffer(int32 id, if (!gl_image) return false; + if (release_after_use_) + gl_image->SetReleaseAfterUse(); + AddImage(gl_image.get(), id); return true; } @@ -61,5 +64,9 @@ gfx::GLImage* ImageManager::LookupImage(int32 service_id) { return NULL; } +void ImageManager::SetReleaseAfterUse() { + release_after_use_ = true; +} + } // namespace gles2 } // namespace gpu diff --git a/gpu/command_buffer/service/image_manager.h b/gpu/command_buffer/service/image_manager.h index a125ae8..51e006d 100644 --- a/gpu/command_buffer/service/image_manager.h +++ b/gpu/command_buffer/service/image_manager.h @@ -37,6 +37,9 @@ class GPU_EXPORT ImageManager void RemoveImage(int32 service_id); gfx::GLImage* LookupImage(int32 service_id); + // For Android specific workaround. + void SetReleaseAfterUse(); + private: friend class base::RefCounted<ImageManager>; @@ -44,6 +47,7 @@ class GPU_EXPORT ImageManager typedef base::hash_map<uint32, scoped_refptr<gfx::GLImage> > GLImageMap; GLImageMap gl_images_; + bool release_after_use_; DISALLOW_COPY_AND_ASSIGN(ImageManager); }; |