Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2075)

Unified Diff: cc/resources/resource_provider.cc

Issue 1071273002: NotForReview: Implement zero/one-copy texture for ozone freon using Intel DRM Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/resources/resource_provider.cc
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc
index 5428c940150edecf78004c6f99223d5b9b18d474..dc1dcd4ce30ffc05e38852a42ec64da0df76876c 100644
--- a/cc/resources/resource_provider.cc
+++ b/cc/resources/resource_provider.cc
@@ -701,6 +701,10 @@ void ResourceProvider::DeleteResourceInternal(ResourceMap::iterator it,
resource->pixels = NULL;
}
if (resource->gpu_memory_buffer) {
+ // TODO(dshwang): It can fix glitch and crash bugs for Ozone GBM
+ // I guess the root reason is originated from kernel bug, but it
+ // demonstrates it's possible to workaround in chromium.
+ // ContextGL()->Finish();
dshwang 2015/04/09 19:12:26 This glFinish almost fix the glitch bug. So I try
DCHECK(resource->origin == Resource::INTERNAL);
delete resource->gpu_memory_buffer;
resource->gpu_memory_buffer = NULL;
@@ -1077,13 +1081,6 @@ ResourceProvider::ScopedWriteLockGpuMemoryBuffer::
GLES2Interface* gl = resource_provider_->ContextGL();
DCHECK(gl);
-#if defined(OS_CHROMEOS)
- // TODO(reveman): GL_COMMANDS_ISSUED_CHROMIUM is used for synchronization
- // on ChromeOS to avoid some performance issues. This only works with
- // shared memory backed buffers. crbug.com/436314
- DCHECK_EQ(gpu_memory_buffer_->GetHandle().type, gfx::SHARED_MEMORY_BUFFER);
-#endif
-
resource_->image_id = gl->CreateImageCHROMIUM(
gpu_memory_buffer_->AsClientBuffer(), size_.width(), size_.height(),
GLInternalFormat(resource_->format));
@@ -2066,15 +2063,17 @@ void ResourceProvider::CopyResource(ResourceId source_id, ResourceId dest_id) {
if (!source_resource->gl_read_lock_query_id)
gl->GenQueriesEXT(1, &source_resource->gl_read_lock_query_id);
#if defined(OS_CHROMEOS)
- // TODO(reveman): This avoids a performance problem on some ChromeOS
- // devices. This needs to be removed to support native GpuMemoryBuffer
- // implementations. crbug.com/436314
- gl->BeginQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM,
- source_resource->gl_read_lock_query_id);
-#else
+ // TODO(reveman): GL_COMMANDS_ISSUED_CHROMIUM is used for synchronization
reveman 2015/04/13 00:46:13 We'll need to fix this TODO instead.
dshwang 2015/04/14 13:15:55 It's Exynos 5 workaround. Even if vgem one-copy is
+ // on ChromeOS to avoid some performance issues. This only works with
+ // shared memory backed buffers. crbug.com/436314
+ if (source_resource->gpu_memory_buffer->GetHandle().type ==
+ gfx::SHARED_MEMORY_BUFFER)
+ gl->BeginQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM,
+ source_resource->gl_read_lock_query_id);
+ else
+#endif
gl->BeginQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM,
source_resource->gl_read_lock_query_id);
-#endif
}
DCHECK(!dest_resource->image_id);
dest_resource->allocated = true;
@@ -2084,10 +2083,12 @@ void ResourceProvider::CopyResource(ResourceId source_id, ResourceId dest_id) {
// End query and create a read lock fence that will prevent access to
// source resource until CopySubTextureCHROMIUM command has completed.
#if defined(OS_CHROMEOS)
- gl->EndQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM);
-#else
- gl->EndQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM);
+ if (source_resource->gpu_memory_buffer->GetHandle().type ==
+ gfx::SHARED_MEMORY_BUFFER)
+ gl->EndQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM);
+ else
#endif
+ gl->EndQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM);
source_resource->read_lock_fence = make_scoped_refptr(
new CopyTextureFence(gl, source_resource->gl_read_lock_query_id));
} else {

Powered by Google App Engine
This is Rietveld 408576698