aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo/vbo_minmax_index.c
Commit message (Collapse)AuthorAgeFilesLines
* mesa: Use atomics for buffer objects reference counts.Mathias Fröhlich2018-02-061-4/+4
| | | | | | | | | | | | | | | | | | | The mutex is currently used for reference counting and updating the minmax index cache. The change uses atomics directly for reference counting and the mutex for the minmax cache. This is safe since the reference count is not modified beside in _mesa_reference_buffer_object where atomics aim to be used. While using the minmax cache, the calling code holds a reference to the buffer object. Thus unreferencing or even referencing the buffer object does not need to be serialized with accessing the minmax cache. The change reduces the time _mesa_reference_buffer_object_ takes by about a factor of two when looking at perf results for some of my favorite use cases. Signed-off-by: Mathias Fröhlich <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: use simple mtx in core mesaTimothy Arceri2017-11-091-4/+4
| | | | | | | | | Results from x11perf -copywinwin10 on Eric's SKL: 4.33338% ± 0.905054% (n=40) Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Tested-by: Yogesh Marathe <[email protected]>
* vbo: fix build errors on androidTapani Pälli2017-09-051-1/+1
| | | | | | | | | | | | | incompatible pointer to integer conversion assigning to 'GLintptr' (aka 'int') from 'const char *' [-Werror,-Wint-conversion] offset = indices; ^ ~~~~~~~ Fixes: 2d93b462b4d ("vbo: fix offset in minmax cache key") Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Charmaine Lee <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* vbo: fix offset in minmax cache keyCharmaine Lee2017-08-301-3/+5
| | | | | | | | | | | | | Instead of saving primitive offset in the minmax cache key, save the actual buffer offset which is used in the cache lookup. Fixes rendering artifact seen with GoogleEarth when run with VMware driver. v2: Per Brian's comment, initialize offset to avoid compiler warning. Cc: [email protected] Reviewed-by: Brian Paul <[email protected]>
* mesa: replace _mesa_index_buffer::type with index_sizeMarek Olšák2017-04-221-17/+18
| | | | | | | This avoids repeated translations of the enum. Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* vbo: disable the minmax cache when the hit rate is lowNicolai Hähnle2016-02-031-2/+32
| | | | | | | | | | | | | | | | | | When applications stream their index buffers, the caches for those BOs become useless and add overhead, so we want to disable them. The tricky part is coming up with the right heuristic for *when* to disable them. The first question is which hit rate to aim for. Since I'm not aware of any interesting borderline applications that do something like "draw two or three times for each upload", I just kept it simple. The second question is how soon we should give up on the caching. Applications might have a warm-up phase where they fill a buffer gradually but then keep reusing it. For this reason, I count the number of indices that hit and miss (instead of the number of calls that hit or miss), since comparing that to the size of the buffer makes sense. Reviewed-by: Marek Olšák <[email protected]>
* mesa: add USAGE_DISABLE_MINMAX_CACHE flag to buffer UsageHistoryNicolai Hähnle2016-02-031-1/+2
| | | | Reviewed-by: Marek Olšák <[email protected]>
* vbo: cache/memoize the result of vbo_get_minmax_indices (v3)Nicolai Hähnle2016-02-031-0/+168
| | | | | | | | | | | | | | | | | | | | | | | | | Some games developers are unaware that an index buffer in a VBO still needs to be read by the CPU if some varying data comes from a user pointer (unless glDrawRangeElements and friends are used). This is particularly bad when they tell us that the index buffer should live in VRAM. This cache helps, e.g. lifting This War Of Mine (a particularly bad offender) from under 10fps to slightly over 20fps on a Carrizo. Note that there is nothing prohibiting a user from rendering from multiple threads simultaneously with the same index buffer, hence the locking. (The internal buffer map taken for the buffer still leads to a race, but at least the locks are a move in the right direction.) v2: disable the cache on USAGE_TEXTURE_BUFFER as well (Chris Forbes) v3: - use bool instead of GLboolean for MinMaxCacheDirty (Ian Romanick) - replace the sticky USAGE_PERSISTENT_WRITE_MAP bit by a direct AccessFlags check Reviewed-by: Chris Forbes <[email protected]> (v2) Reviewed-by: Marek Olšák <[email protected]>
* vbo: move vbo_get_minmax_indices into its own source fileNicolai Hähnle2016-02-031-0/+179
We will add more code for caching/memoization. Moving the existing code into its own file helps keep things modular. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Marek Olšák <[email protected]>