summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/hash.c
Commit message (Collapse)AuthorAgeFilesLines
* mesa: NULL check the pointer before trying to dereference itIan Romanick2013-04-121-2/+2
| | | | | | | | | | | | | | | | | | | Duh. Fixes issues identified by Klocwork analysis: Pointer 'table' returned from call to function 'calloc' at line 115 may be NULL and will be dereferenced at line 117. and Suspicious dereference of pointer 'table' before NULL check at line 119. NOTE: This is a candidate for the stable branches. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Convert the hash table for GL object ids to the open-addressing hash.Eric Anholt2012-11-121-258/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | The previous 1023-entry chaining hash table never resized, so it was very inefficient when there were many objects live. While one could have an even more efficient implementation than this (keep an array for genned names with packed IDs, or take advantage of the fact that key == hash or key == *(uint32_t *)data to store less data), this is fairly fast, and I want a nice replacement hash table for other parts of Mesa, too. It improves Minecraft performance 12.3% +/- 1.4% (n=9), dropping hash lookups from 8% of the profile to 0.5%. I also tested cairo-gl, which should be a pessimal workload for this hash table: around 247000 FBOs created and destroyed, only around 65 live at any time, and few lookups of them between creation and destruction. No statistically significant performance difference at n=76 (mean 20.3/20.4 seconds, sd 2.8/3.2 seconds). If I remove the >20 seconds outliers that appear to be due to thermal throttling, there's possibly a .97% +/- 0.31% performance win (n=61/59). The choice of cutoff for outliers feels a lot like cooking the data, but I've gone through this process 3 times for minor iterations of the code with the same conclusion each time. Reviewed-by: Brian Paul <[email protected]> Acked-by: Chad Versace <[email protected]> Acked-by: Kenneth Graunke <[email protected]> (v1)
* mesa: add _mesa_HashNumEntries() functionBrian Paul2012-01-111-0/+20
| | | | | Useful when debugging to find the number of texture objects, shader programs, etc.
* mesa: s/INLINE/inline/Brian Paul2011-10-011-1/+1
| | | | | | | INLINE is still seen in some files (some generated files, etc) but this is a good start. Acked-by: Kenneth Graunke <[email protected]>
* Drop GLcontext typedef and use struct gl_context insteadKristian Høgsberg2010-10-131-2/+2
|
* mesa: move/update hash function commentsBrian Paul2010-03-271-6/+11
| | | | (cherry picked from commit 535742d75f0096b22d1b8ff203ae561167af18f7)
* mesa: fix deadlock in _mesa_HashFindFreeKeyBlock()Brian Paul2010-03-271-6/+13
| | | | | Fixes fd.o bug 27340. (cherry picked from commit 8fe3b3f66ae57a1a6eca7f6dcb0455e14ad92075)
* Replace _mesa_malloc, _mesa_calloc and _mesa_free with plain libc versionsKristian Høgsberg2010-02-191-4/+4
|
* mesa: Lock mutex around _mesa_HashLookup linked list chase.Brian Paul2010-02-161-2/+5
| | | | | | | | | Remove const qualifier from _mesa_HashLookup() table parameter to avoid LOCK/UNLOCK warnings in the function body. Signed-off-by: Brian Paul <[email protected]> (cherry picked from commit 3094adb3caeb90124359db2356df3bf8ee94800a)
* mesa: Test for failed malloc in _mesa_HashInsert.Brian Paul2010-02-161-4/+6
| | | | | | Signed-off-by: Brian Paul <[email protected]> (cherry picked from commit 7c7247ddbf6e3f7f93e44c1cb52490044f1a2215)
* mesa: fix potential recursive locking deadlock in _mesa_HashWalk()Brian Paul2009-04-091-4/+14
| | | | If the walk callback called _mesa_HashRemove() we'd deadlock.
* mesa: Fix typo.José Fonseca2009-03-061-1/+1
| | | | Windows threads block if one over-unlocks them.
* Be more consistant with paths in #includes. Eventually, eliminate a bunch ↵Brian2007-07-041-1/+1
| | | | of -I flags.
* disable a new mem leak check until we're sure it's validBrian Paul2006-07-031-0/+2
|
* clean-upsBrian Paul2006-06-301-23/+26
|
* Added _mesa_HashDeleteAll() to delete all entries in a hash table with aBrian Paul2006-06-301-10/+74
| | | | | callback function. Added _mesa_HashWalk() to walk over all entries in a hash table with callback.
* don't compile debug code (bug 4242: rand undefined)Brian Paul2005-08-251-1/+5
|
* set table size to 1023 and use new HASH_FUNC() macroBrian Paul2005-04-101-5/+8
|
* Bug #2945: Fix math error that left half the hash buckets empty.Adam Jackson2005-04-091-1/+1
|
* Added _mesa_HashNextEntry() function to allow walking over all entriesBrian Paul2005-01-241-37/+121
| | | | | | in a hash table. Added _mesa_test_hash_functions() for unit testing. Updated comments, etc.
* Merge Jose's documentation and core Mesa changes from embedded branchKeith Whitwell2003-07-171-28/+65
|
* Removed all RCS / CVS tags (Id, Header, Date, etc.) from everything.Ian Romanick2003-06-051-1/+0
|
* Add mechanism to destroy mutexes. Important on OS's where mutex initializationKeith Whitwell2002-12-121-1/+2
| | | | allocates memory (like FreeBSD).
* Header file clean-up:Brian Paul2002-10-241-7/+2
| | | | | | | | 1. Remove all.h and PC_HEADER junk. 2. Rolled mem.c and mem.h into imports.c and imports.h 3. Include imports.h instead of mem.h Restore _mesa_create/initialize_context() to be like they were in 4.0.4 New wrappers for a few std C functions: _mesa_atoi(), _mesa_strstr(), etc.
* doxygen commentsBrian Paul2002-09-161-36/+49
|
* Applied Matt Sealey's patch to remove/isolate all stdio.h function calls.Brian Paul2002-06-291-7/+10
| | | | Instead of mstdio.[ch], use imports.[ch] to isolate these functions.
* init the hash table mutex in _mesa_NewHashTable (Won-Suk Chun)Brian Paul2001-11-021-2/+6
|
* Consistent copyright info (version number, date) across all files.Gareth Hughes2001-03-121-7/+7
|
* removed a few const keywords because of mutex callsBrian Paul2000-03-211-3/+3
|
* added more lockingBrian Paul2000-03-211-4/+12
|
* added mutexes for thread safetyBrian Paul2000-01-311-1/+13
|
* prefixed hash functions with _mesa_Brian Paul2000-01-241-22/+22
|
* start search at 1 in HashFindFreeKeyBlock()Brian Paul2000-01-041-4/+4
|
* first big check-in of new Mesa 3.3 codeBrian Paul1999-11-111-12/+5
|
* removed GL_ prefix from memory macrosBrian Paul1999-10-131-8/+7
|
* Fixed includes & added a few hooks for the DRI.kw-mesa-1Keith Whitwell1999-10-081-3/+4
|
* Initial revisionjtg1999-08-191-0/+295