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
This commit is contained in:
parent
bea55dc614
commit
1de1e80d50
1 changed files with 11 additions and 0 deletions
|
@ -123,6 +123,17 @@ SyncObject::SyncObject()
|
||||||
|
|
||||||
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);
|
xcb_sync_destroy_fence(connection(), m_fence);
|
||||||
glDeleteSync(m_sync);
|
glDeleteSync(m_sync);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue