aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/syncobj.c
Commit message (Collapse)AuthorAgeFilesLines
* mesa: throw error if bufSize negative in GetSynciv on OpenGL ESTapani Pälli2016-10-101-0/+8
| | | | | | | | | | | | | | Fixes following dEQP tests: dEQP-GLES31.functional.debug.negative_coverage.callbacks.state.get_synciv dEQP-GLES31.functional.debug.negative_coverage.get_error.state.get_synciv dEQP-GLES31.functional.debug.negative_coverage.log.state.get_synciv v2: drop _mesa_is_gles check (Kenneth) Signed-off-by: Tapani Pälli <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98133 Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Fix locking of GLsync objects.Steinar H. Gunderson2016-02-051-37/+52
| | | | | | | | | | | | | | | | | | | | | | | | GLsync objects had a race condition when used from multiple threads (which is the main point of the extension, really); it could be validated as a sync object at the beginning of the function, and then deleted by another thread before use, causing crashes. Fix this by changing all casts from GLsync to struct gl_sync_object to a new function _mesa_get_and_ref_sync() that validates and increases the refcount. In a similar vein, validation itself uses _mesa_set_search(), which requires synchronization -- it was called without a mutex held, causing spurious error returns and other issues. Since _mesa_get_and_ref_sync() now takes the shared context mutex, this problem is also resolved. Fixes bug #92757, found while developing Nageru, my live video mixer (due for release at FOSDEM 2016). v2: Marek: silence warnings, fix declaration after code Signed-off-by: Steinar H. Gunderson <[email protected]> Cc: "11.0 11.1" <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
* util/hash_set: Rework the API to know about hashingJason Ekstrand2015-01-151-9/+3
| | | | | | | | | | | | | | | | | | | | | | | | Previously, the set API required the user to do all of the hashing of keys as it passed them in. Since the hashing function is intrinsically tied to the comparison function, it makes sense for the hash set to know about it. Also, it makes for a somewhat clumsy API as the user is constantly calling hashing functions many of which have long names. This is especially bad when the standard call looks something like _mesa_set_add(ht, _mesa_pointer_hash(key), key); In the above case, there is no reason why the hash set shouldn't do the hashing for you. We leave the option for you to do your own hashing if it's more efficient, but it's no longer needed. Also, if you do do your own hashing, the hash set will assert that your hash matches what it expects out of the hashing function. This should make it harder to mess up your hashing. This is analygous to 94303a0750 where we did this for hash_table Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* util: Move main/set to util/hash_setJason Ekstrand2015-01-151-1/+1
| | | | | Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* util: Move the open-addressing linear-probing hash_table to src/util.Kenneth Graunke2014-08-041-1/+1
| | | | | | | | | | | | | | | | | This hash table is used in core Mesa, the GLSL compiler, and the i965 driver, which makes it a good candidate for the new src/util module. It's much faster than program/hash_table.[ch] (see commit 6991c2922f5 for data), and José's u_hash_table.c has a comment saying Gallium should probably consider switching to a linear probing hash table at some point. So this seems like the best candidate for a shared data structure. Signed-off-by: Kenneth Graunke <[email protected]> v2 (Jason Ekstrand): Pick up another hash_table use and patch up scons Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* mesa: switch to c11 mutex functionsBrian Paul2014-03-031-7/+7
| | | | Reviewed-by: José Fonseca <[email protected]>
* mesa: check for bufSize > 0 in _mesa_GetSynciv()Brian Paul2013-10-011-1/+1
| | | | | | | | The spec doesn't say GL_INVALID_VALUE should be raised for bufSize <= 0. In any case, memcpy(len < 0) will lead to a crash, so don't allow it. CC: "9.2" <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: minor fix-ups for _mesa_validate_sync()Brian Paul2013-10-011-2/+10
| | | | | | Return bool instead of int. Const-qualify the syncObj. Add some comments. Reviewed-by: Ian Romanick <[email protected]>
* mesa: Ensure gl_sync_object is fully initialized.Vinson Lee2013-09-101-1/+1
| | | | | | | | | | | | 278372b47e4db8a022d57f60302eec74819e9341 added the uninitialized pointer field gl_sync_object:Label. A free of this pointer, added in commit 6d8dd59cf53d2f47b817d79204a52bb3a46e8c77, resulted in a crash. This patch fixes piglit ARB_sync regressions with swrast introduced by 6d8dd59cf53d2f47b817d79204a52bb3a46e8c77. Signed-off-by: Vinson Lee <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: make _mesa_validate_sync() non-staticTimothy Arceri2013-09-041-1/+1
| | | | | | Signed-off-by: Timothy Arceri <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: free object labels when deletingTimothy Arceri2013-09-041-0/+1
| | | | | | Signed-off-by: Timothy Arceri <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: remove #include "mfeatures.h" from numerous source filesBrian Paul2013-04-171-1/+0
| | | | | | None of the remaining FEATURE_x symbols in mfeatures.h are used anymore. Reviewed-by: Jordan Justen <[email protected]>
* mesa: Initially populate the display list with the exec list.Eric Anholt2013-01-211-14/+0
| | | | | | | | This cuts out a ton of code to make functions not set to a save_ variant match. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Drop manual checks for outside begin/end.Eric Anholt2013-01-211-3/+0
| | | | | | | | | | | We now have a separate dispatch table for begin/end that prevent these functions from being entered during that time. The ASSERT_OUTSIDE_BEGIN_END_WITH_RETVALs are left because I don't want to change any return values or introduce new error-only stubs at this point. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa syncobj: don't store a pointer to the set_entryJordan Justen2012-12-101-4/+10
| | | | | | | | | | | | The set_entry pointer can become invalid if the set table is re-hashed. This likely will fix https://bugs.freedesktop.org/show_bug.cgi?id=58012 (Regression since 56e95d3c) Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: validate that sync objects were created by mesaJordan Justen2012-12-061-8/+15
| | | | | | | | | | | | | | Previously, the user could send in a pointer that was not created by mesa. When we dereferenced that pointer, there would be an exception. Now we keep a set of pointers and verify that the pointer exists in that set before dereferencing it. Note: This fixes several crashing gles3conform tests. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* main/syncobj: return GL_INVALID_VALUE for invalid sync objectsJordan Justen2012-12-061-4/+4
| | | | | | | | Note: The GL/GLES3 web man pages don't seem to properly document glWaitSync's error when the sync object is invalid. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: fix uint64 printing in syncobj.cBrian Paul2012-12-031-1/+3
| | | | | | | | | To silence printf format warnings. v2: insert "0x" prefix Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* mesa: return INVALID_VALUE from WaitSync if timeout != GL_TIMEOUT_IGNOREDMatt Turner2012-11-151-5/+2
| | | | | | | This was added in version 22 of the GL_ARB_sync spec. Fixes gles3conform's sync_error_waitsync_timeout test. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: return INVALID_VALUE from WaitSync if flags != 0Matt Turner2012-11-151-1/+1
| | | | | | Fixes gles3conform's sync_error_waitsync_flags test. Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: return INVALID_VALUE from ClientWaitSync if flags contains an ↵Matt Turner2012-11-151-1/+1
| | | | | | | | unsupported flag Fixes gles3conform's sync_error_clientwaitsync_flags test. Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: remove FEATURE_ARB_sync define.Oliver McFadden2012-09-151-3/+0
| | | | | Signed-off-by: Oliver McFadden <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: don't wait in _mesa_ClientWaitSync if timeout is 0Vadim Girlin2012-09-011-2/+6
| | | | | | | | | | | | | | From ARB_sync spec: If the value of <timeout> is zero, then ClientWaitSync does not block, but simply tests the current state of <sync>. TIMEOUT_EXPIRED will be returned in this case if <sync> is not signaled, even though no actual wait was performed. Fixes random fails of the arb_sync-timeout-zero piglit test on r600g. Signed-off-by: Vadim Girlin <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: Directly include mfeatures.h in files that perform feature tests.Vinson Lee2011-01-071-0/+1
|
* mesa: Include mtypes.h in files that use gl_context struct.Vinson Lee2011-01-051-0/+1
| | | | | | Directly include mtypes.h if a file uses a gl_context struct. This allows future removal of headers that are not strictly necessary but indirectly include mtypes.h for a file.
* Drop GLcontext typedef and use struct gl_context insteadKristian Høgsberg2010-10-131-9/+9
|
* mesa: Less FEATURE_ARB_sync tests.Chia-I Wu2010-09-141-0/+15
| | | | | Add dummy static inline definitions to syncobj.h when FEATURE_ARB_sync is 0, and remove most FEATURE_ARB_sync tests.
* Replace _mesa_malloc, _mesa_calloc and _mesa_free with plain libc versionsKristian Høgsberg2010-02-191-1/+1
|
* Remove _mesa_memcpy in favor of plain memcpy.Kenneth Graunke2010-02-191-1/+1
| | | | This may break the SUNOS4 build, but it's no longer relevant.
* mesa: Fix calling conventions of sync object api callbacks.Michal Krol2009-09-071-6/+6
|
* mesa: rename gl_sync_object::Status to StatusFlagBrian Paul2009-09-031-5/+5
| | | | | There's a symbol collision with X11/Xlib.h #define Status int in the Mesa xlib code. This seems the simpliest way to work around this.
* Don't dereference function pointers in calls.Ian Romanick2009-09-031-7/+7
| | | | | | I'm apparently alone in prefering this calling convention, so I'll be a team player. :p Based on review comments by Brian Paul and Eric Anholt.
* Whitespace and include file clean-up.Ian Romanick2009-09-031-14/+0
| | | | Based on review comments by Brian Paul.
* Use MIN2 instead of open-coded versionIan Romanick2009-09-031-1/+2
| | | | Based on review comments by Brian Paul.
* ARB sync: Fix delete behavior and context destruction behaviorIan Romanick2009-09-031-23/+73
| | | | | | | I believe this resolves the outstanding issues WRT sync object deletetion. I have also added a large comment at the top of syncobj.c describing the expected memory management behavior. I'm still a little uncertain about the locking on ctx->Shared.
* ARB sync: Add support for GL_ARB_sync to swrastIan Romanick2009-09-031-0/+372
This isn't quite right yet. The delete behavior and the context clean-up needs some work.