https://bugs.freedesktop.org/show_bug.cgi?id=92757
Bug ID: 92757 Summary: GL_ARB_sync objects are not properly synchronized across threads Product: Mesa Version: 11.0 Hardware: All OS: All Status: NEW Severity: normal Priority: medium Component: Mesa core Assignee: mesa-dev@lists.freedesktop.org Reporter: sgunder...@bigfoot.com QA Contact: mesa-dev@lists.freedesktop.org Hi, I have a program which uses multiple threads, with separate but shared contexts. To synchronize data between them, I use fences (from GL_ARB_sync). I've had issues with that occasionally, perhaps every 50000th frame, or so, glWaitSync() would return GL_INVALID_OPERATION (0x501) on a sync object, even though it's supposed to be completely legal. Looking into src/mesa/main/syncobj.c sheds some light on what the issue might be. It seems many operations are not properly locked at all; in particular, _mesa_validate_sync() is repeatedly called without any locks held, yet looks into a hashtable in ctx->Shared (that is modified by other threads, although those threads hold the lock). Just adding a lock to _mesa_validate_sync() would seem not to be enough, though. In particular, you have functions like _mesa_ClientWaitSync() which does _mesa_validate_sync(), does some other work and only then calls _mesa_ref_sync_object(); another thread could have deleted the object between validation and ref. And finally, even within the ref/unref pair, there's checking of various state without any locking, which probably needs some thought to verify that it's actually fine if another thread should be modifying the sync object in the meantime. Perhaps the best thing to do would just be to lock ctx->Shared whenever dealing with a sync object, but one would have to make sure e.g. glClientWaitSync() doesn't sleep while keeping that lock. -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev