aboutsummaryrefslogtreecommitdiffstats
path: root/src/util
Commit message (Collapse)AuthorAgeFilesLines
* util/ralloc: fix ralloc alignment on Win64Jesse Natalie2020-04-211-0/+4
| | | | | Acked-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4648>
* remove final imports.h and imports.c bitsDylan Baker2020-04-215-135/+2
| | | | | | | | | | | This moves the fi_types to a new mesa_private.h and removes the imports.c file. The vast majority of this patch is just removing pound includes of imports.h and fixing up the recursive includes. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* mesa|mapi: replace _mesa_[v]snprintf with [v]snprintfDylan Baker2020-04-212-47/+1
| | | | | | | | | | MSVC 2015 and newer has perfectly valid snprintf and vsnprintf implementations, let's just use those. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* replace imports memory functions with utils memory functionsDylan Baker2020-04-212-161/+0
| | | | | | | Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* util: Add an aligned realloc functionDylan Baker2020-04-214-17/+40
| | | | | | | | | | Mesa has one of these in imports.h, so u_memory needs one as well. This is the version from mesa ported. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* replace malloc macros in imports.h with u_memory.h versionsDylan Baker2020-04-212-1/+1
| | | | | | | Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* Replace IS_INF_OR_NAN with util_is_inf_or_nanDylan Baker2020-04-211-22/+0
| | | | | | | Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* move windows strtok_r define to u_stringDylan Baker2020-04-212-4/+4
| | | | | | | | | | | This makes more sense for it, it's only used in the glsl compiler currently, so we could probably move it there, but this seems fine for a header only #define. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* replace IROUND with util functionsDylan Baker2020-04-212-17/+1
| | | | | | | | | | | | This adds two new util functions to rounding.h, _mesa_iroundf and mesa_lround, which are just wrappers around roundf and round, that cast to int and long int respectively. This is possible since mesa recently dropped support for VC2013, since 2015 and 2017 support roundf. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* mesa/main: remove unused IROUNDDDylan Baker2020-04-211-8/+0
| | | | | | | Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* Replace IROUND_POS with _mesa_roundevenfDylan Baker2020-04-211-10/+0
| | | | | | | | | | | Which has the same behavior as long as you don't change the FPU rounding mode. Other code in mesa makes the same assumption so it should be safe to make that assumption more generally. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* replace IFLOOR with util_ifloorDylan Baker2020-04-211-31/+0
| | | | | | | | | which are exactly the same function with exactly the same implementation Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* u_math: add x86 optimized version of ifloorDylan Baker2020-04-211-0/+18
| | | | | | | | | | This is copied from the one in src/mesa/main/imports.h, which is the same otherwise. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* replace LOG2 with util_fast_log2Dylan Baker2020-04-211-30/+0
| | | | | | | | | | | The implementation is somewhat different, although if you go back in time far enough they're the same, but the one in u_math was changed a long time back to be faster. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* replace _mesa_logbase2 with util_logbase2Dylan Baker2020-04-211-20/+0
| | | | | | | Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* replace _mesa_next_pow_two_* with util_next_power_of_two_*Dylan Baker2020-04-211-52/+0
| | | | | | | | | | The 64 bit variant in imports.h isn't even used. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* replace _mesa_is_pow_two with util_is_power_of_two_*Dylan Baker2020-04-211-10/+0
| | | | | | | | | | | | | Mostly this uses util_is_power_of_two_or_zero, which has the same behavior as _mesa_is_pow_two when the input is zero. In cases where the value is known to be != 0 ahead of time I used the _nonzero variant as it may be faster on some platforms. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* util/sparse_free_list: manipulate node pointers using atomic primitivesLionel Landwerlin2020-04-181-4/+4
| | | | | | | | | | Probably doesn't fix anything but those should be accessed in an atomic way just like the head pointer. Signed-off-by: Lionel Landwerlin <[email protected]> Fixes: e4f01eca3b3cd1 ("util: Add a free list structure for use with util_sparse_array") Reviewed-by: Jason Ekstrand <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4613>
* util/sparse_array: don't stomp head's counter on pop operationsD Scott Phillips2020-04-171-2/+2
| | | | | | | | | | | By temporarily storing the new_head by a uint32_t, we wipe out the counter section of the head pointer. Fixes: e4f01eca ("util: Add a free list structure for use with util_sparse_array") Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Rafael Antognolli <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4612>
* util/tests: initialize variableErik Faye-Lund2020-04-161-1/+1
| | | | | | | | | This just silences a compiler-warning about a potentially uninitialized variable. It's not uninitialized, but it's a bit hard for the compiler to see. So let's just initialize it to zero. Reviewed-by: Brian Paul <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4577>
* Fix util/process test on CygwinJon Turney2020-04-151-0/+5
| | | | | | | | It seems meson returns the filename with extension for full_path(), even though Cygwin does it's best to pretend the file doesn't have that extension. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4514>
* util: move and adjust the vertex upload heuristic equation from u_vbufMarek Olšák2020-04-061-1/+19
| | | | | | | | | | This will also be used by glthread. The new equation is optimized for glthread. Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4466> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4466>
* util/xmlconfig: fix sha1 comparison codePierre-Eric Pelloux-Prayer2020-04-031-4/+5
| | | | | | | | Fixes: 8f48e7b1e99 ("util/xmlconfig: add new sha1 application attribute") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2730 Reviewed-by: Dave Airlie <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4426> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4426>
* driconf: whilelist more games for glthreadMarek Olšák2020-04-021-0/+35
| | | | | | Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4402> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4402>
* gallium/llvmpipe: add an optimised 32-bit memsetDave Airlie2020-04-013-0/+49
| | | | | | | | | | | | This might have other users beyond filling/clearing buffers, increase a fullscreen 4k gears from 68->74 fps on my Ryzen since gears is really just a clear benchmark, and this helps clearing. Reviewed-by: Marek Olšák <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4394> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4394>
* util: move ALIGN/ROUND_DOWN_TO to u_math.hRob Clark2020-03-311-0/+46
| | | | | | | | | These are less mesa specific than the rest of macros.h, and would be nice to use outside of mesa. Prep for next patch. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4381>
* util/u_queue: fix race in total_jobs_size accessRhys Perry2020-03-301-2/+2
| | | | | | | | Signed-off-by: Rhys Perry <[email protected]> Reviewed-by: Eric Anholt <[email protected]> CC: <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4335> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4335>
* meson: inline `inc_common`Eric Engestrom2020-03-2810-18/+18
| | | | | | | | | Let's make it clear what includes are being added everywhere, so that they can be cleaned up. Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4360>
* util: remove duplicated MALLOC_STRUCT and CALLOC_STRUCTMarek Olšák2020-03-271-12/+1
| | | | | | Reviewed-by: Timothy Arceri <[email protected] Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4324> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4324>
* util: don't include p_defines.h and u_pointer.h from galliumMarek Olšák2020-03-275-7/+21
| | | | | | | It's a mess, but this is what I arrived at. Reviewed-by: Timothy Arceri <[email protected] Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4324>
* util: stop including files from mesa/mainMarek Olšák2020-03-275-9/+27
| | | | | Reviewed-by: Timothy Arceri <[email protected] Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4324>
* Move compiler.h and imports.h/c from src/mesa/main into src/utilMarek Olšák2020-03-277-2/+636
| | | | | Reviewed-by: Timothy Arceri <[email protected] Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4324>
* util/test: Use MAX_PATH on WindowsDaniel Stone2020-03-271-0/+5
| | | | | | | | | | | | Windows provides MAX_PATH rather than PATH_MAX for the maximum allowable path length. This is not a limit on the length of filename which can exist on the filesystem, but a length on the length of path which can be passed to Win32 API calls. Signed-off-by: Daniel Stone <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Fixes: f8f1413070a ("util/u_process: add util_get_process_exec_path") Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4304>
* util: fix process_test pathPierre-Eric Pelloux-Prayer2020-03-271-3/+4
| | | | | | | | | | Make sure we only use winepath when needed. Reviewed-by: Daniel Stone <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Fixes: f8f1413070a ("util/u_process: add util_get_process_exec_path") Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2690 Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4304>
* mesa: allow out-of-order drawing to optimize immediate mode if it's safeMarek Olšák2020-03-261-0/+5
| | | | | | | | | This increases performance by 11-13% in Viewperf11/Catia - first scene. Set allow_draw_out_of_order=true to enable this. Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4152>
* util/u_process: Add util_get_process_exec_path for macOS.Vinson Lee2020-03-251-0/+9
| | | | | | | | | Fixes: f8f1413070ae ("util/u_process: add util_get_process_exec_path") Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2682 Signed-off-by: Vinson Lee <[email protected]> Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4313> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4313>
* gallium/util: Add back (and rename) util_float_to_half implementationRoland Scheidegger2020-03-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | This implementation was removed by 8b8af6d3 ("gallium/util: Switch util_float_to_half to _mesa_float_to_half()'s impl.") It was not actually broken, but _mesa_float_to_half() implements round-to-nearest-even, whereas util_float_to_half() implemented round-to-zero. So rename it appropriately. GL actually never cares about rounding (except a broken piglit test), however d3d10 very much does and requires RTZ for float to half conversion. Moreover, apparently at least radeon gpus actually always do RTZ when doing RT writes (and I'd suspect for shader image writes as well). Hence it seems appropriate to hook up this rtz function to the format instead. This will cause llvmpipe and softpipe to use rtz rounding for clears with half float formats, and softpipe would use rtz behavior for rt writes as well (llvmpipe has that hardcoded), not sure if "real" hw drivers hit this function for much. (For shader opcodes would still need to figure out what rounding to use appropriately, but this is a question for another day.) Note should probably unify with _mesa_float_to_float16_rtz. Unclear at this point which one is better, so just restore previous function here. Reviewed-by: Marek Olšák <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4312> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4312>
* util/u_process: fix Windows buildPierre-Eric Pelloux-Prayer2020-03-241-1/+2
| | | | | | | | | | Reported by Brian Paul. Fixes: f8f1413070a ("util/u_process: add util_get_process_exec_path") Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Daniel Stone <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4303> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4303>
* radeonsi: enable workarounds for YoYo engine based gamesPierre-Eric Pelloux-Prayer2020-03-241-0/+17
| | | | | | | | | | | | | | | | Without the radeonsi_sync_compile option the games crashes at startup. The engine seems to be using a custom global new operator and it doesn't plays well with multithreading it seems. Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1310 Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1271 Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1272 Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1288 Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2611 Reviewed-by: Marek Olšák <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4181> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4181>
* util/xmlconfig: add new sha1 application attributePierre-Eric Pelloux-Prayer2020-03-242-2/+30
| | | | | | | | | | This is useful to enable workarounds for applications with a generic name. For instance all games made with the YoYo game engine have the same executable name "runner". Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4181>
* util/u_process: add util_get_process_exec_pathPierre-Eric Pelloux-Prayer2020-03-244-0/+141
| | | | | Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4181>
* util/os_file: extend os_read_file to return the file sizePierre-Eric Pelloux-Prayer2020-03-242-3/+8
| | | | | Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4181>
* radeonsi: clarify the conditions when FLUSH_AND_INV_DB is neededPierre-Eric Pelloux-Prayer2020-03-241-3/+0
| | | | | | | | | | | | | | | | FLUSH_AND_INV_DB should be done when we're changing surface state registers of a bound depth target. When depth_clear_value changes, si_state will modify S_028038_ZRANGE_PRECISION so we need to flush the DB caches. Verified with the captures from bugs cited below. Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1283 Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1330 Reviewed-by: Marek Olšák <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4263> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4263>
* util/sparse_array: Stash the node level in the node pointerJason Ekstrand2020-03-202-60/+80
| | | | | | | | | | | | | | | | | This reworks the data structure a bit and, in my view, simplifies it. Instead of each node having a header which has the node level in it, we use the bottom 6 bits of the pointer for that. This requires us to allocate with the os_malloc/free_aligned helpers (which call into posix_memalign on Linux) but cache-line aligning our allocations is actually probably a good thing given that we're doing atomics on them. The primary advantages to doing this is that it changes the number of memory accesses per tree level from 2 to 1 when walking the tree because we no longer have to look at node->level. Reviewed-by: Lionel Landwerlin <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4228> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4228>
* meson,ci: Disable sparse_array tests on windowsJason Ekstrand2020-03-201-1/+4
| | | | | | | | | | | | As soon as I switch to using the allocation helpers in os_memory.h, these tests start blowing up on the Windows build in GitLab CI. As far as I can tell, the issue is something with the combination of the debug allocator in u_debug_memory.c and the mutex implementation in the version of Wine running in CI. The tests don't fail on real windows nor do they fail with newer versions of Wine. Reviewed-by: Lionel Landwerlin <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4228>
* util/sparse_array: Add a node_size_log2 temporaryJason Ekstrand2020-03-201-7/+8
| | | | | | | | | We use this value several times. It's probably best to encourage the compiler to only read it once. I have no proof that this actually makes any performance improvement whatsoever. Reviewed-by: Lionel Landwerlin <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4228>
* util/sparse_array: Finish the sparse_array in the testsJason Ekstrand2020-03-201-0/+2
| | | | | Reviewed-by: Lionel Landwerlin <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4228>
* util/blob: Add overwrite function for uint8Mark Menzynski2020-03-202-0/+24
| | | | | | | | | Overwrite function for this type was missing and I needed it for my project. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Karol Herbst <[email protected]> Signed-off-by: Mark Menzynski <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3903>
* driconf: enable glthread for "From The Depths"Marek Olšák2020-03-191-0/+4
| | | | | | | | 25% perf improvement Reviewed-by: Bas Nieuwenhuizen <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4254> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4254>
* radeonsi: enable glsl_zero_init for Curse of the Dead GodsPierre-Eric Pelloux-Prayer2020-03-191-0/+5
| | | | | | | | Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2598 Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4214> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4214>