summaryrefslogtreecommitdiffstats
path: root/src/util
Commit message (Collapse)AuthorAgeFilesLines
* disk_cache: assert if a cache entries keys don't match mesaTimothy Arceri2017-08-281-1/+3
| | | | | | | | | In ef42423e7be9 I enabled the check for release builds however we still want to assert in debug builds in case of collisions or just general bugs with the key building/compare code. Otherwise it will just fail silently effectively disabling the cache. Reviewed-by: Eduardo Lima Mitev <[email protected]>
* xmlconfig: use the portable __VA_ARGS__Emil Velikov2017-08-261-6/+6
| | | | | | | | | | | Follow the example used through mesa and use "..." + "__VA_ARGS__". The former tends to be more common and portable. v2: use ##__VA_ARGS__ (Eric) Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* util/disk_cache: write cache item metadata to diskTimothy Arceri2017-08-251-1/+87
| | | | Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: pass shader source keys to the disk cacheTimothy Arceri2017-08-252-5/+9
| | | | | | | We don't actually write them to disk here. That will happen in the following commit. Reviewed-by: Nicolai Hähnle <[email protected]>
* util/disk_cache: add struct cache_item_metadataTimothy Arceri2017-08-251-0/+20
| | | | | | | | | This will be used to store more information about the cache item in it's header. This information is intended for 3rd party and cache analysis use but can also be used for detecting the unlikely scenario of cache collisions. Reviewed-by: Nicolai Hähnle <[email protected]>
* disk_cache: enable limited hash collision detection in release buildsTimothy Arceri2017-08-251-16/+10
| | | | | | | It really doesn't cost us much and will stop strange crashes should the stars align. Reviewed-by: Nicolai Hähnle <[email protected]>
* util/disk_cache: rename mesa cache dir and introduce cache versioningTimothy Arceri2017-08-252-12/+38
| | | | | | | | | | | | | | | | | | Steam is already analysing cache items, unfortunatly we did not introduce a versioning mechanism for identifying structural changes to cache entries earlier so the only way to do so is to rename the cache directory. Since we are renaming it we take the opportunity to give the directory a more meaningful name. Adding a version field to the header of cache entries will help us to avoid having to rename the directory in future. Please note this is versioning for the internal structure of the entries as defined in disk_cache.{c,h} as opposed to the structure of the data provided to the disk cache by the GLSL compiler and the various driver backends. Reviewed-by: Nicolai Hähnle <[email protected]>
* anv: Move a comment that got left behind in the u_vector refactor.Eric Anholt2017-08-181-0/+9
|
* util: Fix build on old glibc.Eric Anholt2017-08-151-1/+3
| | | | | | | We need to link librt for u_thread.h's clock_gettime() call. Fixes: b822d9dd67b5 ("gallium/util: move u_queue.{c,h} to src/util") Reviewed-by: Matt Turner <[email protected]>
* util/ralloc: add ralloc_str_append() helperTimothy Arceri2017-08-112-0/+37
| | | | | | | | This function differs from ralloc_strcat() and ralloc_strncat() in that it does not do any strlen() calls which can become costly on large strings. Reviewed-by: Thomas Helland <[email protected]>
* util: Makefile.am: add merge_driinfo.py in extra distJuan A. Suarez Romero2017-08-041-0/+1
| | | | Reviewed-by: Emil Velikov <[email protected]>
* util: use cannonical form of ARRAY_SIZEEmil Velikov2017-08-021-1/+1
| | | | | | | Namely sizeof(foo)/sizeof((foo)[0]) Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* radeonsi: add enable_sisched driconf optionNicolai Hähnle2017-08-021-0/+9
| | | | Reviewed-by: Marek Olšák <[email protected]>
* util: add merge_driinfo.pyNicolai Hähnle2017-08-021-0/+222
| | | | | | | | This tool merges driinfo XML that is built using DRI_CONF_xxx macros. The intention is to merge together state-tracker options with driver-specific options. Acked-by: Marek Olšák <[email protected]>
* android: export intermediates from libmesa_utilTapani Pälli2017-08-021-0/+3
| | | | | | | | | | | | | | Fixes following build issues: In file included from vendor/intel/external/android_ia/mesa/src/mesa/drivers/dri/common/dri_util.c:45: vendor/intel/external/android_ia/mesa/src/util/xmlpool.h:103:10: fatal error: 'xmlpool/options.h' file not found ... In file included from vendor/intel/external/android_ia/mesa/src/mesa/drivers/dri/i965/intel_screen.c:44: vendor/intel/external/android_ia/mesa/src/util/xmlpool.h:103:10: fatal error: 'xmlpool/options.h' file not found Fixes: 601093f9 (xmlconfig: move into src/util) Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Chih-Wei Huang <[email protected]>
* Android: fix xmlconfig buildRob Herring2017-07-311-0/+3
| | | | | | | | | | | | Commit 601093f95ddf ("xmlconfig: move into src/util") broke the Android build due to missing libexpat dependency: external/mesa3d/src/util/xmlconfig.c:34:10: fatal error: 'expat.h' file not found Fixes: 601093f95ddf ("xmlconfig: move into src/util") Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Signed-off-by: Rob Herring <[email protected]>
* util/ra: fix memory leakEric Engestrom2017-07-311-0/+2
| | | | | | | | | CID: 1415909 Fixes: 7a34a0e8903249c41fae "ra: Add a callback for selecting a register from what's available." Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* Attempt to fix AppVeyor build, round 2Nicolai Hähnle2017-07-311-5/+7
|
* Attempt to fix the AppVeyor buildNicolai Hähnle2017-07-311-4/+0
|
* xmlconfig: move into src/utilNicolai Hähnle2017-07-3119-8/+4390
| | | | | | | | v2: attempt to fix Android build (Emil) v3: add missing include path Reviewed-by: Marek Olšák <[email protected]> (v1)
* ra: Add a callback for selecting a register from what's available.Eric Anholt2017-07-252-14/+82
| | | | | | | | | | | | | | | | VC4 has had a tension, similar to pre-Sandybridge Intel, where we want to use low-numbered registers (more parallelism on Intel, fewer delay slots on vc4), but in order to give instruction scheduling the most freedom to avoid delays we want to round-robin between registers of the same cost. Our two heuristics so far have chosen one end or the other of that tradeoff. The callback, instead, hands the driver the set of registers that are available, and the driver gets to make its own choice. This will be used in vc4 to round-robin between registers of the same cost, and might be used in the future for improving bank selection. Reviewed-by: Nicolai Hähnle <[email protected]>
* ra: Don't put a node in its own adjacency set.Eric Anholt2017-07-251-13/+10
| | | | | | | | All the paths looping over adjacency had guards against considering themselves (the non-obvious one was ra_any_neighbors_conflict(), which has in_stack set). Reviewed-by: Nicolai Hähnle <[email protected]>
* ra: Pull the body of a loop out to a helper function.Eric Anholt2017-07-251-12/+19
| | | | | | | I was going to indent this code another level, and decided it would be easier to read as a helper. Reviewed-by: Nicolai Hähnle <[email protected]>
* util: fix warning/error on 32bit buildTapani Pälli2017-07-251-2/+2
| | | | | | | | | Add uintptr_t cast to fix 'cast to pointer from integer of different size' warning on 32bit build (build error on Android M). Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Michel Dänzer <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]>
* util: Make CLAMP turn NaN into MIN.Kenneth Graunke2017-07-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous implementation of CLAMP() allowed NaN to pass through unscathed, by failing both comparisons. NaN isn't exactly a value between MIN and MAX, which can break the assumptions of many callers. This patch changes CLAMP to convert NaN to MIN, arbitrarily. Callers that need NaN to be handled in a specific manner should probably open code something, or use a macro specifically designed to do that. Section 2.3.4.1 of the OpenGL 4.5 spec says: "Any representable floating-point value is legal as input to a GL command that requires floating-point data. The result of providing a value that is not a floating-point number to such a command is unspecified, but must not lead to GL interruption or termination. In IEEE arithmetic, for example, providing a negative zero or a denormalized number to a GL command yields predictable results, while providing a NaN or an infinity yields unspecified results." While CLAMP may apply to more than just GL inputs, it seems reasonable to follow those rules, and allow MIN as an "unspecified result". This prevents assertion failures in i965 when running the games "XCOM: Enemy Unknown" and "XCOM: Enemy Within", which call glTexEnv(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, -nan(0x7ffff3)); presumably unintentionally. i965 clamps the LOD bias to be in range, and asserts that it's in the proper range when converting to fixed point. NaN is not, so it crashed. We'd like to at least avoid that. Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* util/u_queue: add an option to resize the queue when it's fullMarek Olšák2017-07-172-3/+36
| | | | | | | | | | | | | | | | | | | | Consider the following situation: mtx_lock(mutex); do_something(); util_queue_add_job(...); mtx_unlock(mutex); If the queue is full, util_queue_add_job will wait for a free slot. If the job which is currently being executed tries to lock the mutex, it will be stuck forever, because util_queue_add_job is stuck. The deadlock can be trivially resolved by increasing the queue size (reallocating the queue) in util_queue_add_job if the queue is full. Then util_queue_add_job becomes wait-free. radeonsi will use it. Reviewed-by: Nicolai Hähnle <[email protected]>
* util: Remove u_math from u_vectorDaniel Stone2017-07-142-1/+3
| | | | | | | | | | | u_vector.h doesn't actually use anything from u_math, but it does mean everyone has to pull in src/gallium/auxiliary/util includes. Just remove it, adding a <string.h> include to u_vector.c to cover memcpy. Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* gallium: use "ull" number suffix to keep the QtCreator parser happyMarek Olšák2017-07-101-1/+1
| | | | | | | It can't parse "llu". Reviewed-by: Thomas Helland <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* util/disk_cache: fix a commentNicolai Hähnle2017-07-031-1/+1
| | | | Reviewed-by: Timothy Arceri <[email protected]>
* mesa/glthread: add glthread "perf" counters and pass them to gallium HUDMarek Olšák2017-06-261-0/+14
| | | | | | | | | | | for HUD integration in following commits. This valuable profiling data will allow us to see on the HUD how well glthread is able to utilize parallelism. This is better than benchmarking, because you can see exactly what's happening and you don't have to be CPU-bound. u_threaded_context has the same counters. Reviewed-by: Timothy Arceri <[email protected]>
* util: move pipe_thread_is_self from gallium to src/utilMarek Olšák2017-06-261-0/+12
| | | | Reviewed-by: Timothy Arceri <[email protected]>
* mesa/util: add util_dynarray_clear() helperSamuel Pitoiset2017-06-181-0/+6
| | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* mesa/util: add a hash table wrapper which support 64-bit keysSamuel Pitoiset2017-06-142-0/+172
| | | | | | | | | Needed for bindless handles which are represented using 64-bit unsigned integers. All hash table implementations should be uniformized later on. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa/util: add new util_dynarray_delete_unordered helperSamuel Pitoiset2017-06-141-0/+14
| | | | | | | | This helper function will be used for managing dynamic arrays of resident texture/image handles. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* u_dynarray: fix coverity warning about ignoring return value from rerallocDave Airlie2017-06-131-1/+1
| | | | | | | | >>> Ignoring storage allocated by "reralloc_size(buf->mem_ctx, buf->data, buf->size)" leaks it. Reviewed-by: Thomas Helland<[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* util: make set's deleted_key_value declaration consistent with hash table oneVlad Golovkin2017-06-081-2/+2
| | | | | | | | | | | | | This also silences following clang warnings: no previous extern declaration for non-static variable 'deleted_key' [-Werror,-Wmissing-variable-declarations] const void *deleted_key = &deleted_key_value; ^ no previous extern declaration for non-static variable 'deleted_key_value' [-Werror,-Wmissing-variable-declarations] uint32_t deleted_key_value; ^ Reviewed-by: Nicolai Hähnle <[email protected]>
* util/u_queue: fix a use-before-initialization race for queue->threadsMarek Olšák2017-06-072-17/+14
| | | | Reviewed-by: Samuel Pitoiset <[email protected]>
* util: Add extern c to u_dynarray.hThomas Helland2017-06-071-0/+8
| | | | | Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* util: Port nir_array functionality to u_dynarrayThomas Helland2017-06-071-10/+37
| | | | | Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* util: Remove unused includes and convert to lower-case memory opsThomas Helland2017-06-071-15/+12
| | | | | | | | Also, prepare for the next commit by correcting some coding style changes. This should be all non-functional changes. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* util: Move u_dynarray to src/utilThomas Helland2017-06-072-0/+115
| | | | | | | This will be used as the basis for unification Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* util/u_queue: add an option to set the minimum thread priorityMarek Olšák2017-06-073-3/+24
| | | | Reviewed-by: Nicolai Hähnle <[email protected]>
* util/u_queue: add a way to remove a job when we just want to destroy itMarek Olšák2017-06-072-6/+49
| | | | Reviewed-by: Nicolai Hähnle <[email protected]>
* util/vulkan: Move Vulkan utilities to src/vulkan/utilAlex Smith2017-06-063-297/+1
| | | | | | | | | | | | | We have Vulkan utilities in both src/util and src/vulkan/util. The latter seems a more appropriate place for Vulkan-specific things, so move them there. v2: Android build system changes (from Tapani Pälli) Signed-off-by: Alex Smith <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Acked-by: Jason Ekstrand <[email protected]>
* util/rand_xor: add missing include statementsNicolas Dechesne2017-06-011-0/+1
| | | | | | | | | | | | | | Fixes for: src/util/rand_xor.c:60:13: error: implicit declaration of function 'open' [-Werror=implicit-function-declaration] int fd = open("/dev/urandom", O_RDONLY); ^~~~ src/util/rand_xor.c:60:34: error: 'O_RDONLY' undeclared (first use in this function) int fd = open("/dev/urandom", O_RDONLY); ^~~~~~~~ Signed-off-by: Nicolas Dechesne <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* mesa/util: fix arithmetic use of 'void *' in u_vector_foreachSamuel Pitoiset2017-05-311-1/+1
| | | | | | | | | | u_vector_foreach is currently only used by the Intel Vulkan driver but when this macro is used in mesa core, GCC reports a compile-time error. Probably because some compiler options are different. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* util: slab_destroy_child should check whether it's been initializedMarek Olšák2017-05-291-0/+3
| | | | | Reviewed-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* util: remove unneeded Android ifdef from ralloc.cRob Herring2017-05-251-5/+0
| | | | | | | | | SIZE_MAX has been defined in stdint.h on Android since 2013, so this ifdef is no longer needed. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Signed-off-by: Rob Herring <[email protected]>
* util/disk_cache: add new driver_flags param to cache keysTimothy Arceri2017-05-232-3/+11
| | | | | | | | | This will be used for things such as adding driver specific environment variables to the key. Allowing us to set environment vars that change the shader and not have the driver ignore them if it finds existing shaders in the cache. Reviewed-by: Eduardo Lima Mitev <[email protected]>
* ralloc: Use strnlen() inside of strncat()Vladislav Egorov2017-05-221-6/+1
| | | | | | | | | | | If the str is long or isn't null-terminated, strlen() could take a lot of time or even crash. I don't know why was it used in the first place, maybe for platforms without strnlen(), but strnlen() is already used inside of ralloc_strndup(), so this change should not additionally break anything. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>