Fix hang on nvidia hardware when deleting sync objects

When a sync object is deleted, the fence it is connected to must already
be signalled, or the driver will busy-wait forever.
Signal fences before deleting syncs to avoid this.

BUG: 343551
FIXED-IN: 5.3
REVIEW: 123090
icc-effect-5.14.5
Simeon Bird 2015-03-20 20:18:46 -04:00
parent bea55dc614
commit 1de1e80d50
1 changed files with 11 additions and 0 deletions

View File

@ -123,6 +123,17 @@ SyncObject::SyncObject()
SyncObject::~SyncObject()
{
// If glDeleteSync is called before the xcb fence is signalled
// the nvidia driver (the only one to implement GL_SYNC_X11_FENCE_EXT)
// deadlocks waiting for the fence to be signalled.
// To avoid this, make sure the fence is signalled before
// deleting the sync.
if (m_state == Resetting || m_state == Ready){
trigger();
// The flush is necessary!
// The trigger command needs to be sent to the X server.
xcb_flush(connection());
}
xcb_sync_destroy_fence(connection(), m_fence);
glDeleteSync(m_sync);