aboutsummaryrefslogtreecommitdiffstats
path: root/src/util
Commit message (Collapse)AuthorAgeFilesLines
* android: Fix u_format_table.c being generated twiceRobert Foss2019-12-311-4/+1
| | | | | | | | | | | | | Two competing rules for defining u_format_table.c exists, which is an error. Additionally the more general rule lacks the inclusion of format/u_format.csv. Fixes: 882ca6dfb0 ("util: Move gallium's PIPE_FORMAT utils to /util/format/") Signed-off-by: Robert Foss <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* u_format: move format tests to util/tests/Eric Engestrom2019-12-273-1/+896
| | | | | | Suggested-by: Eric Anholt <[email protected]> Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* util/format: add trivial srgb<->linear conversion testEric Engestrom2019-12-273-0/+53
| | | | | | | | | This would've caught 8829f9ccb0267d113283 ("u_format: add ETC2 to util_format_srgb/util_format_linear"). Suggested-by: Eric Anholt <[email protected]> Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* util/format: add PIPE_FORMAT_ASTC_*x*x*_SRGB to util_format_{srgb,linear}()Eric Engestrom2019-12-271-0/+40
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* util/format: remove left-over util_format_description_table declarationEric Engestrom2019-12-271-4/+0
| | | | | | Fixes: 3c45c4bc44310c1af4f0 ("util: Cope with the fact that formats in u_format.csv are not ordered.") Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* util/format: add missing vulkan formatsJonathan Marek2019-12-192-2/+27
| | | | | | | | | Add some missing vulkan formats to util/format, this solves all the missing pipe format cases for the formats that turnip supports. Signed-off-by: Jonathan Marek <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3170>
* utils/os_socket: Define ssize_t on windows.Rafael Antognolli2019-12-161-0/+4
| | | | | | Fixes: ef5266ebd50 ("util/os_socket: Add socket related functions.") Reviewed-by: Roland Scheidegger <[email protected]>
* drirc: Final Fantasy VIII: Remastered needs allow_higher_compat_versionKenneth Graunke2019-12-131-0/+4
| | | | | | | | | | This gets it running on i965 with Mesa master. (The game won't start without GL 3.3 compatibility, but uses 1.20 with GL_EXT_gpu_shader4 for shaders.) Reviewed-by: Marek Olšák <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3076> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3076>
* util/os_socket: Add socket related functions.Rafael Antognolli2019-12-134-0/+158
| | | | | | | | v3: - Add os_socket.c/h into Makefile.sources (Lionel) - Add empty non-linux implementation to public functions. Reviewed-by: Lionel Landwerlin <[email protected]>
* util/simple_mtx: don't set the canary when it can't be checkedEric Engestrom2019-12-131-1/+3
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* util/u_thread: Restrict u_thread_get_time_nano on macOS.Vinson Lee2019-12-101-1/+1
| | | | | | | | | | | | | macOS does not have pthread_getcpuclockid. src/util/u_thread.h:156:4: error: implicit declaration of function 'pthread_getcpuclockid' is invalid in C99 [-Werror,-Wimplicit-function-declaration] pthread_getcpuclockid(thread, &cid); ^ Fixes: 4913215d145e ("util/u_thread: don't restrict u_thread_get_time_nano() to __linux__") Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2171 Signed-off-by: Vinson Lee <[email protected]> Acked-by: Eric Engestrom <[email protected]>
* util: Detect use-after-destroy in simple_mtxKenneth Graunke2019-12-101-1/+10
| | | | | | | | | | | | | | This makes simple_mtx_destroy set the counter to an invalid canary value and then makes lock/unlock assert that the value is legal. That way, calling lock/unlock after destroy will assert fail, rather than deadlocking or potentially even working. This has caught real deadlocks in dEQP multithreaded tests (in st/mesa shader variant zombie list handling), which have since been fixed. Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* drirc: set allow_higher_compat_version for Faster Than LightGurchetan Singh2019-12-091-1/+9
| | | | | | | | | | | | With 781a78 ("mesa: enable ARB_direct_state_access in compat for GL3.1+), it's possible to have DSA with GL3.1+. FTL creates a GL3.1 compat context, but fails the _mesa_has_geometry_shaders(..) check in frame_buffer_texture. Bump the compat version to pass the check. Reviewed-by: Marek Olšák <[email protected]>
* util/atomic: Fix p_atomic_add for unlocked and msvc pathsRoland Scheidegger2019-12-091-2/+2
| | | | | | | | | | | Braces mismatch (flagged by CI, untested). Fixes: 385d13f26d2 "util/atomic: Add a _return variant of p_atomic_add" Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Dylan Baker <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* util/atomic: Add p_atomic_add_return for the unlocked pathJason Ekstrand2019-12-051-1/+1
| | | | | Fixes: 385d13f26d2 "util/atomic: Add a _return variant of p_atomic_add" Reviewed-by: Ilia Mirkin <[email protected]>
* util/vma: Add a function to allocate a particular address rangeJason Ekstrand2019-12-052-0/+41
| | | | | | | | | | | This new function lets you request to remove a specific address range from the allocator. It returns true on success and leaves the allocator unmodified and returns false on failure. It doesn't need to return an offset because, if it succeeds, the offset passed in is the allocated offset. Reviewed-by: Ivan Briano <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
* util/vma: Factor out the hole splitting part of util_vma_heap_allocJason Ekstrand2019-12-051-43/+48
| | | | | Reviewed-by: Ivan Briano <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
* util/atomic: Add a _return variant of p_atomic_addJason Ekstrand2019-12-051-2/+15
| | | | | Reviewed-by: Ivan Briano <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
* util/u_thread: don't restrict u_thread_get_time_nano() to __linux__Jonathan Gray2019-12-021-1/+1
| | | | | | | | pthread_getcpuclockid() and clock_gettime() are also available on at least OpenBSD, FreeBSD, NetBSD, DragonFly, Cygwin. Signed-off-by: Jonathan Gray <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
* util/futex: use futex syscall on OpenBSDJonathan Gray2019-12-021-0/+18
| | | | | | | Make use of the futex syscall added in OpenBSD 6.2. Signed-off-by: Jonathan Gray <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
* mesa/main/util: moving gallium u_mm to util, remove main/mmAlejandro Piñeiro2019-12-024-0/+393
| | | | | | | | | | | | | | | | | | | | Right now there are two copies of mm: * mesa/main/mm.[ch] * gallium/auxiliary/util/u_mm.[ch] At some point they splitted, and from the commit message it was not clear why it was not possible to have only one copy at a common place. Taking into account that was several years ago, Im assuming that it was not possible then. This change would allow to have one copy of the same code, and also being able to use that code out of mesa/main or gallium, if needed. This commit moves u_mm and removes mm, as u_mm has slightly more changes. Reviewed-by: Jose Fonseca <[email protected]>
* st/mesa: Add GL_TDFX_texture_compression_FXT1 supportKenneth Graunke2019-12-011-0/+1
| | | | | | | | | | | | | Eric recently added PIPE_FORMAT_FXT1_RGB[A] as part of his format unification work. This was really most of the work of implementing the extension. We just need to handle it in a couple of places and expose the extension. v2: Reject the new formats in llvmpipe_is_format_supported to prevent crashes because it doesn't know how to handle the new formats. Reviewed-by: Marek Olšák <[email protected]> [v1] Reviewed-by: Eric Anholt <[email protected]> [v1]
* util/driconfig: print ATTENTION if MESA_DEBUG=silent is not setMarek Olšák2019-11-281-7/+22
| | | | | | unix-bytebenchmark refuses to run if the driver prints ATTENTION to stderr. Acked-by: Eric Engestrom <[email protected]>
* drirc: Set vs_position_always_invariant for Shadow of Mordor on IntelKenneth Graunke2019-11-271-0/+10
| | | | | | | | | | | | | | | | | | | | | | When drawing the main character in Shadow of Mordor, the game appears to draw Talion with one vertex shader, and the Wraith with another. If the compiler optimizes those in different ways which lead to slight imprecisions, then the resulting positions may not line up, leading to Z-fighting occurring as the game decides which of the two are in front. brw_nir_opt_peephole_ffma looks at usages of multiply adds across the entire shader, and may make different decisions between the two, leading to such imprecisions and Z-fighting. This started happening recently after a NIR change to eliminate unnecessary MOVs (7025dbe7), but that change simply exposed the existing problem. Improves performance on Skylake GT4e by 1.22945% +/- 0.398672% (n=3), likely due to the fixed rendering. Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1985 Fixes: 7025dbe794b ("nir: Skip emitting no-op movs from the builder.") Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* driconf, glsl: Add a vs_position_always_invariant optionKenneth Graunke2019-11-271-0/+5
| | | | | | | | | | | | | | | | | | | | Many applications use multi-pass rendering and require their vertex shader position to be computed the same way each time. Optimizations may consider, say, fusing a multiply-add based on global usage of an expression in a shader. But a second shader with the same expression may have different code, causing that optimization to make the other choice the second time around. The correct solution is for applications to mark their VS outputs 'invariant', indicating they need multiple shaders to compute that output in the same manner. However, most applications fail to do so. So, we add a new driconf option - vs_position_always_invariant - which forces the gl_Position output in vertex shaders to be marked invariant. Fixes: 7025dbe794b ("nir: Skip emitting no-op movs from the builder.") Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* drirc: Add glsl_zero_init workaround for GpuTestDanylo Piliaiev2019-11-251-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | GiMark benchmark from GpuTest has such code in VS: out vec4 lightDir0; out vec4 lightDir1; ... lightDir0.xyz = lp0 - vVertex.xyz; lightDir1.xyz = lp1 - vVertex.xyz; In FS: float distSqr = dot(lightDir0, lightDir0); So due to the usage of uninitialized .w channel in the dot product, distSqr may become undefined which results in many black dots in the test on Iris. In https://www.geeks3d.com/forums/index.php/topic,6242.0.html developer stated that this benchmark most likely won't be updated. Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1919 Signed-off-by: Danylo Piliaiev <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* disk_cache_get_function_timestamp: check for dladdrMichel Zou2019-11-231-1/+1
| | | | | | instead of dlopen Reviewed-by: Eric Engestrom <[email protected]>
* util/blob: add 8-bit and 16-bit reads and writesMarek Olšák2019-11-232-72/+71
| | | | Reviewed-by: Connor Abbott <[email protected]>
* drirc: Enable glthread for dolphin/citra/yuzu.Markus Wick2019-11-221-0/+11
| | | | | | | | | | | | | | | | | Dolphin: 75 fps -> 88 fps - Super Mario Galaxy Citra: 81 fps -> 91 fps - A Link Between Worlds Yuzu: 21 fps -> 27 fps - Super Mario Odyssey Dolphin still has many syncs because of glFenceSync and glClientWaitSync. Moving them to the dispatcher thread might yield another speedup. Yuzu uses a compatible profile by default. This benchmark used the variable MESA_GL_VERSION_OVERRIDE=4.5FC to overwrite this behavior. This profilation was done on a mobile i7-8550U CPU with i965. Signed-off-by: Markus Wick <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* mesa: enable glthread for 7 Days To DieMarek Olšák2019-11-181-0/+8
| | | | Reviewed-by: Timothy Arceri <[email protected]>
* radeonsi: enable mesa_glthread for GfxBenchPierre-Eric Pelloux-Prayer2019-11-181-0/+4
| | | | | | It improves offscreen tests performance. Reviewed-by: Marek Olšák <[email protected]>
* android: util/format: fix include path listMauro Rossi2019-11-161-1/+2
| | | | | | | | | | | | To avoid following building error: out/target/product/x86_64/obj_x86/STATIC_LIBRARIES/libmesa_util_intermediates/format/u_format_table.c:30:10: fatal error: 'u_format.h' file not found ^~~~~~~~~~~~ 1 error generated. Fixes: 882ca6d ("util: Move gallium's PIPE_FORMAT utils to /util/format/") Signed-off-by: Mauro Rossi <[email protected]>
* util: Move gallium's PIPE_FORMAT utils to /util/format/Eric Anholt2019-11-1429-1/+11289
| | | | | | | | | | | | | | | To make PIPE_FORMATs usable from non-gallium parts of Mesa, I want to move their helpers out of gallium. Since u_format used util_copy_rect(), I moved that in there, too. I've put it in a separate directory in util/ because it's a big chunk of related code, and it's not clear to me whether we might want it as a separate library from libmesa_util at some point. Closes: #1905 Acked-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]>
* util/android: fix android build errorsTapani Pälli2019-11-131-1/+1
| | | | | | | Fixes: 9020f519 ("util/u_endian: Add error checks") Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2078 Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
* st/mesa: fix Sanctuary and Tropics by disabling ARB_gpu_shader5 for themMarek Olšák2019-11-112-0/+7
| | | | | | | They use the "sample" keyword as a variable name. Cc: 19.2 19.3 <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* util: Use ZSTD for shader cache if possibleDylan Baker2019-11-112-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows ZSTD instead of ZLIB to be used for compressing the shader cache. On a 72 core system emulating skl with a full shader-db (with i965): ZSTD: 1915.10s user 229.27s system 5150% cpu 41.632 total (cold cache) 225.40s user 10.87s system 3810% cpu 6.201 total (warm cache) 154M (235M on disk) ZLIB: 2231.33s user 194.24s system 1899% cpu 2:07.72 total (cold cache) 229.15s user 10.63s system 3906% cpu 6.139 total (warm cache) 163M (244M on disk) Tim Arceri sees (8 core ryzen and a full shader-db): ZSTD: 2505.22 user 40.50 system 3:18.73 elapsed 1280% CPU (cold cache) 418.71 user 14.93 system 0:46.53 elapsed 931% CPU (warm cache) 454.3 MB (681.7 MB on disk) ZLIB: 3069.83 user 40.02 system 4:20.13 elapsed 1195% CPU (cold cache) 425.50 user 15.17 system 0:46.80 elapsed 941% CPU (warm cache) 470.3 MB (701.4 MB on disk) Reviewed-by: Eric Engestrom <[email protected]> (v1) Reviewed-by: Eric Anholt <[email protected]>
* util: add blob_finish_get_bufferMarek Olšák2019-11-082-0/+14
| | | | Reviewed-by: Timothy Arceri <[email protected]>
* util/u_endian: Add error checksDylan Baker2019-11-051-0/+6
| | | | As suggested by Eric Engestrom and Michel Dänzer.
* util: rename PIPE_ARCH_*_ENDIAN to UTIL_ARCH_*_ENDIANDylan Baker2019-11-053-22/+22
| | | | | | | | | | | As requested by Tim. This was generated with: grep 'PIPE_ARCH_.*_ENDIAN' -rIl | xargs sed -ie 's@PIPE_ARCH_\(.*\)_ENDIAN@UTIL_ARCH_\1_ENDIAN@'g v2: - add this patch Reviewed-by: Eric Engestrom <[email protected]>
* util/u_endian: set PIPE_ARCH_*_ENDIAN to 1Dylan Baker2019-11-053-12/+21
| | | | | | | | | | | | This will allow it to be used as a drop in replacement for _mesa_little_endian in a number of cases. v2: - Always define PIPE_ARCH_LITTLE_ENDIAN and PIPE_ARCH_BIG_ENDIAN, define the one that reflects the host system to 1 and the other to 0 - replace all uses of #ifdef, #ifndef, and #if defined() with #if and #if ! with PIPE_ARCH_*_ENDIAN Reviewed-by: Eric Engestrom <[email protected]>
* util/u_endian: Use _WIN32 instead of _MSC_VERDylan Baker2019-11-051-1/+1
| | | | | | | | | _WIN32 is defined by basically all windows compilers (MSVC, ICL, MinGW), wereas _MSC_VER is not defined by MinGW. Without this change MinGW falls through and doesn't define PIPE_ARCH at all, and is caught by some extra code in gallium. Reviewed-by: Eric Engestrom <[email protected]>
* meson: move idep_xmlconfig_headers to xmlpool/Eric Engestrom2019-10-312-6/+6
| | | | | | | | That's where `xmlpool_options_h` is defined, and this way we can make sure nobody starts making use of it in the future :) Signed-off-by: Eric Engestrom <[email protected]> Acked-by: Dylan Baker <[email protected]>
* meson: split out idep_xmlconfig_headers from idep_xmlconfigEric Engestrom2019-10-311-2/+5
| | | | | | | A bunch of components need the former but not the latter. Signed-off-by: Eric Engestrom <[email protected]> Acked-by: Dylan Baker <[email protected]>
* util: Add a free list structure for use with util_sparse_arrayJason Ekstrand2019-10-312-0/+137
| | | | Reviewed-by: Lionel Landwerlin <[email protected]>
* util: Add a util_sparse_array data structureJason Ekstrand2019-10-316-0/+399
| | | | Reviewed-by: Lionel Landwerlin <[email protected]>
* util: remove LIST_IS_EMPTY macroTimothy Arceri2019-10-281-3/+0
| | | | | | | Just use the inlined function directly. The new function was introduced in addcf410. Reviewed-by: Eric Engestrom <[email protected]>
* util: rename list_empty() to list_is_empty()Timothy Arceri2019-10-281-5/+5
| | | | | | | This makes it clear that it's a boolean test and not an action (eg. "empty the list"). Reviewed-by: Eric Engestrom <[email protected]>
* util: remove LIST_DEL macroTimothy Arceri2019-10-282-3/+1
| | | | | | | Just use the inlined function directly. The macro was replaced with the function in ebe304fa540f. Reviewed-by: Eric Engestrom <[email protected]>
* util: remove LIST_DELINIT macroTimothy Arceri2019-10-281-1/+0
| | | | | | | Just use the inlined function directly. The macro was replaced with the function in ebe304fa540f. Reviewed-by: Eric Engestrom <[email protected]>
* util: remove LIST_REPLACE macroTimothy Arceri2019-10-281-1/+0
| | | | | | | Just use the inlined function directly. The macro was replaced with the function in ebe304fa540f. Reviewed-by: Eric Engestrom <[email protected]>