summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndras Becsi <andras.becsi@digia.com>2014-11-06 12:38:31 +0100
committerAndras Becsi <andras.becsi@digia.com>2014-11-06 15:17:00 +0100
commit577cd47e54bb88c81b7a5b5a6d658d8d61b2c747 (patch)
tree7a6a251bd91d6a698a22aa209dd2382af17a31f0
parentad518d952412a2c1a7268c5d679e1040cce7559c (diff)
<chromium> FIXUP Convert sync points to GL fence syncs.v5.4.0
GpuCommandBufferStub::OnRetireSyncPoint is also called as a result of shutdown destruction where there is a race condition between the ramp-down of the GLContext and the DestroyGLFence() and GLFence::CreateWithoutFlush() calls. This would result in sporadic shutdown crashes or asserts when a page is closed while browsing WebGL content like fishgl.com. Avoid the additional calls if there is no current context. Task-number: QTBUG-42295 Change-Id: I5aed0df7adca9c95eda71925399d39fd770fffa1 Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
-rw-r--r--chromium/content/common/gpu/gpu_command_buffer_stub.cc29
1 files changed, 16 insertions, 13 deletions
diff --git a/chromium/content/common/gpu/gpu_command_buffer_stub.cc b/chromium/content/common/gpu/gpu_command_buffer_stub.cc
index 84d611a8ce2..61c96156383 100644
--- a/chromium/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/chromium/content/common/gpu/gpu_command_buffer_stub.cc
@@ -852,19 +852,22 @@ void GpuCommandBufferStub::OnRetireSyncPoint(uint32 sync_point) {
GpuChannelManager* manager = channel_->gpu_channel_manager();
#if defined(TOOLKIT_QT)
- // Only keep the last fence alive to keep its temporary ownership in GpuCommandBufferStub
- // simple in case where Qt would not pick this fence to eventually destroy it.
- DestroyGLFence(manager->sync_point_gl_fences_, last_fence_sync_point_);
- // We submitted all resource-producing GL commands, convert the logical sync point into a GL fence
- // to allow Qt's GL context to wait for the results of commands submitted in this context using the
- // sync point as reference.
- scoped_ptr<gfx::GLFence> fence = scoped_ptr<gfx::GLFence>(gfx::GLFence::CreateWithoutFlush());
- if (fence)
- manager->sync_point_gl_fences_.insert(std::make_pair(sync_point, fence.release()));
- // Flush regardless of the success of the fence creation to at least make sure that commands
- // producing our textures are in the pipe before the scene graph inserts its own on the other thread.
- glFlush();
- last_fence_sync_point_ = sync_point;
+ bool has_current_context = !!gfx::GLContext::GetCurrent();
+ if (has_current_context) {
+ // Only keep the last fence alive to keep its temporary ownership in GpuCommandBufferStub
+ // simple in case where Qt would not pick this fence to eventually destroy it.
+ DestroyGLFence(manager->sync_point_gl_fences_, last_fence_sync_point_);
+ // We submitted all resource-producing GL commands, convert the logical sync point into a GL fence
+ // to allow Qt's GL context to wait for the results of commands submitted in this context using the
+ // sync point as reference.
+ scoped_ptr<gfx::GLFence> fence = scoped_ptr<gfx::GLFence>(gfx::GLFence::CreateWithoutFlush());
+ if (fence)
+ manager->sync_point_gl_fences_.insert(std::make_pair(sync_point, fence.release()));
+ // Flush regardless of the success of the fence creation to at least make sure that commands
+ // producing our textures are in the pipe before the scene graph inserts its own on the other thread.
+ glFlush();
+ last_fence_sync_point_ = sync_point;
+ }
#endif
manager->sync_point_manager()->RetireSyncPoint(sync_point);