Commit 370c8bc2 authored by Sunny Sachanandani's avatar Sunny Sachanandani Committed by Commit Bot

Use GL_COMMANDS_ISSUED_CHROMIUM query for shared memory GpuMemoryBuffers

GL_COMMANDS_ISSUED_CHROMIUM is sufficient for shared memory
GpuMemoryBuffers because they're uploaded using glTexImage2D (see
GLImageMemory::CopyTexImage).

This should reduce the number of idle wakeups in the GPU process, and
reduce the CPU time spent on such queries which is quite high on
Windows.

Bug: 830084, 622491
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I8111b3d7f12abbf900383d45e2a74394848e83fd
Reviewed-on: https://chromium-review.googlesource.com/1189126
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: default avatarEric Karl <ericrk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#587695}
parent 22b92b16
......@@ -434,17 +434,32 @@ gpu::SyncToken OneCopyRasterBufferProvider::CopyOnWorkerThread(
// TODO(vmiura): Need a way to ensure we don't hold onto bindings?
// ri->BindTexture(image_target, 0);
GLenum query_target = GL_NONE;
if (worker_context_provider_->ContextCapabilities().sync_query) {
if (!staging_buffer->query_id)
ri->GenQueriesEXT(1, &staging_buffer->query_id);
// GL_COMMANDS_COMPLETED_CHROMIUM is used by default because native
// GpuMemoryBuffers can be accessed by the GPU after commands are issued
// until GPU reads are done.
query_target = GL_COMMANDS_COMPLETED_CHROMIUM;
#if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
// TODO(reveman): This avoids a performance problem on ARM ChromeOS
// devices. crbug.com/580166
ri->BeginQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM, staging_buffer->query_id);
#else
ri->BeginQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM, staging_buffer->query_id);
query_target = GL_COMMANDS_ISSUED_CHROMIUM;
#endif
// GL_COMMANDS_ISSUED_CHROMIUM is sufficient for shared memory
// GpuMemoryBuffers because they're uploaded using glTexImage2D (see
// gl::GLImageMemory::CopyTexImage).
const auto* buffer = staging_buffer->gpu_memory_buffer.get();
if (buffer &&
buffer->GetType() == gfx::GpuMemoryBufferType::SHARED_MEMORY_BUFFER) {
query_target = GL_COMMANDS_ISSUED_CHROMIUM;
}
ri->BeginQueryEXT(query_target, staging_buffer->query_id);
}
// Since compressed texture's cannot be pre-allocated we might have an
......@@ -481,13 +496,8 @@ gpu::SyncToken OneCopyRasterBufferProvider::CopyOnWorkerThread(
}
}
if (worker_context_provider_->ContextCapabilities().sync_query) {
#if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
ri->EndQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM);
#else
ri->EndQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM);
#endif
}
if (query_target != GL_NONE)
ri->EndQueryEXT(query_target);
ri->DeleteTextures(1, &mailbox_texture_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment