summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc4
-rw-r--r--gpu/command_buffer/service/image_manager.cc9
-rw-r--r--gpu/command_buffer/service/image_manager.h4
-rw-r--r--gpu/config/gpu_driver_bug_list_json.cc16
-rw-r--r--gpu/config/gpu_driver_bug_workaround_type.h2
5 files changed, 33 insertions, 2 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);
};
diff --git a/gpu/config/gpu_driver_bug_list_json.cc b/gpu/config/gpu_driver_bug_list_json.cc
index 0eeda19..903680a 100644
--- a/gpu/config/gpu_driver_bug_list_json.cc
+++ b/gpu/config/gpu_driver_bug_list_json.cc
@@ -19,7 +19,7 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST(
{
"name": "gpu driver bug list",
// Please update the version number whenever you change this file.
- "version": "3.1",
+ "version": "3.2",
"entries": [
{
"id": 1,
@@ -678,6 +678,20 @@ const char kGpuDriverBugListJson[] = LONG_STRING_CONST(
"features": [
"wake_up_gpu_before_drawing"
]
+ },
+ {
+ "id": 50,
+ "description": "NVIDIA driver requires unbinding a GpuMemoryBuffer from the texture before mapping it to main memory",
+ "os": {
+ "type": "android"
+ },
+ "gl_vendor": {
+ "op": "beginwith",
+ "value": "NVIDIA"
+ },
+ "features": [
+ "release_image_after_use"
+ ]
}
]
}
diff --git a/gpu/config/gpu_driver_bug_workaround_type.h b/gpu/config/gpu_driver_bug_workaround_type.h
index 92a516cf..872793c 100644
--- a/gpu/config/gpu_driver_bug_workaround_type.h
+++ b/gpu/config/gpu_driver_bug_workaround_type.h
@@ -80,6 +80,8 @@
validate_multisample_buffer_allocation) \
GPU_OP(WAKE_UP_GPU_BEFORE_DRAWING, \
wake_up_gpu_before_drawing) \
+ GPU_OP(RELEASE_IMAGE_AFTER_USE, \
+ release_image_after_use) \
namespace gpu {