summaryrefslogtreecommitdiffstats
path: root/src/util
Commit message (Collapse)AuthorAgeFilesLines
* meson/util: Don't run string_buffer tests on mingwDylan Baker2019-10-101-1/+4
| | | | | | | They succeed with MSVC but not with MinGW. I don't understand why they fail. Acked-by: Kristian H. Kristensen <[email protected]>
* meson: only build timspec test if timespec is availableDylan Baker2019-10-101-1/+3
| | | | | Reviewed-by: Eric Engestrom <[email protected]> Acked-by: Kristian H. Kristensen <[email protected]>
* meson: don't build or run mesa-sha1 test on windowsDylan Baker2019-10-101-11/+14
| | | | | | | | | It crashes hard (pop-up window and all). v2: - Change comment to FIXME Reviewed-by: Eric Engestrom <[email protected]> Acked-by: Kristian H. Kristensen <[email protected]>
* meson: Add msvc compat args to util/testsDylan Baker2019-10-101-0/+1
| | | | | | | To keep this building with msvc Acked-by: Eric Engestrom <[email protected]> Acked-by: Kristian H. Kristensen <[email protected]>
* util/xmlconfig: include strndup.h for windowsDylan Baker2019-10-101-0/+1
| | | | | Reviewed-by: Eric Engestrom <[email protected]> Acked-by: Kristian H. Kristensen <[email protected]>
* util: use _WIN32 instead of WIN32Dylan Baker2019-10-101-1/+1
| | | | | | | | MinGW defines only _WIN32, but doesn't have fcntl, so we need to use the windows path. Reviewed-by: Erik Faye-Lund <[email protected]> Acked-by: Kristian H. Kristensen <[email protected]>
* util: fix to detect NetBSD properlyOBATA Akio2019-10-091-3/+6
| | | | | | | | <sys/param.h> is required for NetBSD version detection, and __NetBSD__ must be used to detect even on older releases. Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* util: simplify BSD includesJan Beich2019-10-091-7/+2
| | | | | Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Jan Beich <[email protected]>
* util: detect AltiVec at runtime on BSDsJan Beich2019-10-091-4/+23
| | | | | Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Jan Beich <[email protected]>
* util: skip AltiVec detection if built with -maltivecJan Beich2019-10-091-1/+9
| | | | | | | Helps platforms where runtime detection isn't implemented. Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Jan Beich <[email protected]>
* util: detect NEON at runtime on FreeBSDJan Beich2019-10-091-0/+9
| | | | | Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Jan Beich <[email protected]>
* util: skip NEON detection if built with -mfpu=neonJan Beich2019-10-091-1/+3
| | | | | | | Helps platforms where runtime detection isn't implemented. Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Jan Beich <[email protected]>
* drirc: enable vk_x11_override_min_image_count for DOOMSamuel Pitoiset2019-10-091-0/+5
| | | | | | | | | | DOOM fails to handle more images than expected when the adaptative sync mode is enabled. Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1902 Cc: 19.2 <[email protected]> Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* radeonsi: enable zerovram for Rocket LeagueClément Guérin2019-10-081-0/+3
| | | | | | | | | Fixes corruption on game startup. Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1888 Cc: 19.1 19.2 <[email protected]> Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]>
* util/rb_tree: Stop relying on &iter->field != NULLJason Ekstrand2019-09-261-41/+28
| | | | | | | | | | | | The old version of the iterators relies on a &iter->field != NULL check which works fine on older GCC but newer GCC versions and clang have optimizations that break if you do pointer math on a null pointer. The correct solution to this is to do the null comparisons before we do any sort of &iter->field or use rb_node_data to do the reverse operation. Acked-by: Michel Dänzer <[email protected]> Tested-by: Michel Dänzer <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
* util/rb_tree: Also test _safe iteratorsJason Ekstrand2019-09-261-0/+42
| | | | | | Acked-by: Michel Dänzer <[email protected]> Tested-by: Michel Dänzer <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
* util/rb_tree: Replace useless ifs with assertsJason Ekstrand2019-09-231-2/+2
| | | | Reviewed-by: Ian Romanick <[email protected]>
* util/rb_tree: Reverse the order of comparison functionsJason Ekstrand2019-09-202-7/+7
| | | | | | | | | | | The new order matches that of the comparison functions accepted by the C standard library qsort() functions. Being consistent with qsort will hopefully help avoid developer confusion. The only current user of the red-black tree is aub_mem.c which is pretty easy to fix up. Reviewed-by: Lionel Landwerlin <[email protected]>
* util/rb_tree: Add the unit testsJason Ekstrand2019-09-202-0/+199
| | | | | | | When I wrote the red-black tree implementation, I wrote tests for it but they never got imported into mesa. Reviewed-by: Lionel Landwerlin <[email protected]>
* Move blob from compiler/ to util/Jason Ekstrand2019-09-195-0/+1094
| | | | | | | | There's nothing whatsoever compiler-specific about it other than that's currently where it's used. Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
* util/disk_cache: make use of the total job size limiting featureTimothy Arceri2019-09-191-1/+1
| | | | | | | | | | | This makes use of the total job size limiting feature added in the previous patch. The idea is to avoid an excessive build up in memory use due to the use of both the UTIL_QUEUE_INIT_RESIZE_IF_FULL and UTIL_QUEUE_INIT_USE_MINIMUM_PRIORITY flags. Reviewed-by: Marek Olšák <[email protected]>
* util/u_queue: track job size and limit the size of queue growthTimothy Arceri2019-09-193-5/+19
| | | | | | | | | | | | | | | | | | | | | When both UTIL_QUEUE_INIT_RESIZE_IF_FULL and UTIL_QUEUE_INIT_USE_MINIMUM_PRIORITY are set, we can get into a situation where the queue never executes and grows to a huge size due to all other threads being busy. This is the case with the shader cache when attempting to compile a huge number of shaders up front. If all threads are busy compiling shaders the cache queues memory use can climb into the many GBs very fast. The use of these two flags with the shader cache is intended to allow shaders compiled at runtime to be compiled as fast as possible. To avoid huge memory use but still allow the queue to perform optimally in the run time compilation case, we now add the ability to track memory consumed by the jobs in the queue and limit it to a hardcoded 256MB which should be more than enough. Reviewed-by: Marek Olšák <[email protected]>
* util/disk_cache: bump thread count assigned to disk cache queueTimothy Arceri2019-09-191-3/+7
| | | | | | | | | | | | | | | Since we set the UTIL_QUEUE_INIT_USE_MINIMUM_PRIORITY flag this should have little impact on low core systems. However just about all modern CPUs currently available that run Mesa have *at least* 4 cores. For these CPUs allowing more threads can result in the queue being processed faster and avoid excessive memory use due to a backlog of cache entrys building up in the queue. This change helps avoid a huge build up of cache entrys in the queue due to using both the UTIL_QUEUE_INIT_USE_MINIMUM_PRIORITY and UTIL_QUEUE_INIT_RESIZE_IF_FULL flags. Reviewed-by: Marek Olšák <[email protected]>
* util: add fp64 -> fp32 conversion support for RTNE and RTZ rounding modesSamuel Iglesias Gonsálvez2019-09-174-0/+95
| | | | | | | | | | | | | | | | | | | | | | In order to be coherent with the pre-existent API for half floats, this new API for double is the one meant to be used when doing double to float conversions. It is no more than a wrapper for the softfloat.h API but we meant to keep that one private. v2: - Fix bug in _mesa_double_to_float_rtz() in the inf/nan detection using the exponent value. v3: - Replace custom f64 -> f32 implementations with the softfloat one (Andres). v4: - Added API usage clarifying comments (Caio). Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Signed-off-by: Andres Gomez <[email protected]> Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
* util: add float to float16 conversions with RTZ and RTNESamuel Iglesias Gonsálvez2019-09-172-0/+22
| | | | | | | | | | | | | | | | | | In order to be coherent with the pre-existent functions, this new API is the one meant to be used when doing half float to float conversions. It is no more than a wrapper for the softfloat.h API but we meant to keep that one private. v2: - Replace custom f32 -> f16 RTZ implementation with the softfloat one (Andres). v3: - Added API usage clarifying comments (Caio). Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Signed-off-by: Andres Gomez <[email protected]> Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
* util: add softfloat functions to operate with doubles and floatsSamuel Iglesias Gonsálvez2019-09-174-0/+1544
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Implemented fadd, fsub, fmul and ffma for doubles and ffma for floats, rounding to zero, using a modified implementation from Berkely Softfloat 3e Library. Their implementation correctness has been checked with the Berkeley TestFloat Release 3e tool for x86_64. v2: - Reuse util_last_bit64() in _mesa_count_leading_zeros64() implementation (Connor). v3: - Add a specific ffma for floats version (Connor). - Implement the ffma for doubles version (Andres). - Lots of fixes in fadd, fsub and fmul (Andres). - Improved documentation (Andres). v4: - Added f64 -> f32 conversion function (Andres). - Added f32 -> f16 RTZ conversion function (Andres). Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Signed-off-by: Andres Gomez <[email protected]> Tested-by: Andres Gomez <[email protected]> Acked-by: Caio Marcelo de Oliveira Filho <[email protected]>
* Fix timespec_from_nsec test for 32-bit time_tJon Turney2019-09-171-1/+1
| | | | | | | | | Since struct timespec's tv_sec member is of type time_t, adjust the expected value to allow for the truncation which will occur with 32-bit time_t. Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Adam Jackson <[email protected]>
* drirc: include unreal engine version 0 to 23Lionel Landwerlin2019-09-161-1/+1
| | | | | | | | | This was meant to include up to version 23. Signed-off-by: Lionel Landwerlin <[email protected]> Fixes: 0616b7ac90 ("vulkan: add vk_x11_strict_image_count option") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111522 Reviewed-by: Eric Engestrom <[email protected]>
* util/xmlconfig: fix regexp compile failure checkLionel Landwerlin2019-09-161-1/+1
| | | | | | | | This is embarrasing... Signed-off-by: Lionel Landwerlin <[email protected]> Fixes: 04dc6074cf ("driconfig: add a new engine name/version parameter") Reviewed-by: Eric Engestrom <[email protected]>
* vulkan: add vk_x11_strict_image_count optionLionel Landwerlin2019-09-152-0/+14
| | | | | | | | | | | | | | | | | | This option strictly allocate the minImageCount given by the application at swapchain creation. This works around application that do not deal with the fact that the implementation allocates more images than the minimum specified. v2: Add values in default drirc (Bas) v3: specify engine name/version (Lionel) Signed-off-by: Lionel Landwerlin <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111522 Reviewed-by: Bas Nieuwenhuizen <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Cc: 19.2 <[email protected]>
* driconfig: add a new engine name/version parameterLionel Landwerlin2019-09-153-7/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Vulkan applications can register with the following structure : typedef struct VkApplicationInfo { VkStructureType sType; const void* pNext; const char* pApplicationName; uint32_t applicationVersion; const char* pEngineName; uint32_t engineVersion; uint32_t apiVersion; } VkApplicationInfo; This enables the Vulkan implementations to apply workarounds based off matching this description. Here we add a new parameter for matching the driconfig options with the following : <device driver="anv"> <application engine_name_match="MyOwnEngine.*" engine_versions="10:12,40:42"> <option name="blaaah" value="true" /> </application> </device> v2: switch engine name match to use regexps v3: Verify that the regexec returns REG_NOMATCH for match failure (Eric) v4: Add missing bit that went to the following commit (Eric) Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]> Cc: 19.2 <[email protected]>
* meson: don't try to generate i18n translations on windowsDylan Baker2019-09-101-2/+4
| | | | Reviewed-by: Eric Engestrom <[email protected]>
* android: fix linking issues with liblogTapani Pälli2019-09-071-0/+2
| | | | | | | | Fixes Android build errors observed in Intel CI. Fixes: f9f7cbc1aa3 "util: android logging support" Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Rob Clark <[email protected]>
* drirc: override minImageCount=2 for gfxbenchEric Engestrom2019-09-061-0/+4
| | | | | | | | | Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110765 Fixes: 4689e98fe884d9412b72 ("vulkan/wsi: Set X11 minImageCount to 3.") Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]> Tested-by: Eero Tamminen <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
* wsi: add minImageCount overrideEric Engestrom2019-09-061-0/+5
| | | | | | | Cc: [email protected] Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]> (v1) Reviewed-by: Lionel Landwerlin <[email protected]>
* util: include u_endian.h in u_math.hRhys Perry2019-09-061-0/+1
| | | | | | | | | | | | u_endian.h needs to be included, otherwise PIPE_ARCH_BIG_ENDIAN might not be defined on big-endian architectures and the endian conversion macros will be incorrect. I don't think anything is broken because of this, I just noticed this when looking at the file. Signed-off-by: Rhys Perry <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* util: android logging supportRob Clark2019-09-062-2/+21
| | | | | | | | | In particular, it would be nice for failed debug_assert() msgs to show up in logcat. Signed-off-by: Rob Clark <[email protected]> Kristian H. Kristensen <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* util/os_file: fix double-close()Eric Engestrom2019-09-041-1/+0
| | | | | | Fixes: 955c63d3643f30d7db0c ("util/os_file: resize buffer to what was actually needed") Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* util: only allow _BitScanReverse64 on 64-bit cpusErik Faye-Lund2019-09-022-3/+3
| | | | | | | | | While the documentation for _BitScanReverse64 on MSDN says that it's available on ARM, this isn't true. It's only available on ARM64. So let's match reality. Signed-off-by: Erik Faye-Lund <[email protected]> Acked-by: Matt Turner <[email protected]>
* util: do not assume MSVC implies SSEErik Faye-Lund2019-09-021-4/+3
| | | | | | | This is not true for MSVC on ARM. Signed-off-by: Erik Faye-Lund <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* util: fix SSE-version needed for double opcodesErik Faye-Lund2019-09-021-1/+1
| | | | | | | | | This code generates CVTSD2SI, which requires SSE2. So let's fix the required SSE-version. Signed-off-by: Erik Faye-Lund <[email protected]> Fixes: 5de29ae (util: try to use SSE instructions with MSVC and 32-bit gcc) Reviewed-by: Matt Turner <[email protected]>
* util: Define strchrnul on macOS.Vinson Lee2019-08-311-1/+1
| | | | | | | | | | | strchrnul is not available on macOS. pipe_loader.c:141:14: error: implicit declaration of function 'strchrnul' is invalid in C99 [-Werror,-Wimplicit-function-declaration] next = strchrnul(library_paths, ':'); ^ Signed-off-by: Vinson Lee <[email protected]> Acked-by: Eric Engestrom <[email protected]>
* util: Add unreachable() definition for clang compiler.Krzysztof Raszkowski2019-08-301-1/+1
| | | | | | | Without unreachable() definition clang throw return-type error in many places in mesa code. Reviewed-by: Eric Engestrom <[email protected]>
* util: Prevent strcasecmp macro redefinion.Jose Fonseca2019-08-281-0/+3
| | | | | | | | MinGW headers already define it. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]> Acked-by: Eric Engestrom <[email protected]>
* util: Prevent implicit declaration of function getenv.Jose Fonseca2019-08-281-0/+1
| | | | | | | | With MinGW cross compilation. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]> Acked-by: Eric Engestrom <[email protected]>
* util: Add a _mesa_i64roundevenf() helper.Kenneth Graunke2019-08-271-0/+16
| | | | | | | | | This always returns a int64_t, translating to _mesa_lroundevenf on systems where long is 64-bit, and llrintf where "long long" is needed. Fixes: 594fc0f8595 ("mesa: Replace F_TO_I() with _mesa_lroundevenf().") Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* util: add auxv based PowerPC AltiVec/VSX detectionDaniel Kolesa2019-08-271-4/+25
| | | | | | | | | | | | At least on Linux, we can use the ELF auxiliary vector to detect the presence of AltiVec, VSX and other CPU features without having to go through handling SIGILL, which has various problems of its own. A similar thing is already being done for ARM to detect NEON. Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Daniel Kolesa <[email protected]>
* util: fix compilation on macosLionel Landwerlin2019-08-231-1/+1
| | | | | | | | | | timespec_get() is not available on macos, we need to pull in the include/c11/threads_posix.h helper. Signed-off-by: Lionel Landwerlin <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103674 Fixes: e2d761de03 ("util: drop final reference to p_compiler.h") Reviewed-by: Eric Engestrom <[email protected]>
* util/timespec: use unsigned 64 bit integers for nsec valuesLionel Landwerlin2019-08-222-35/+18
| | | | | | | | | | | | | | | We added this utility for vulkan where all timeouts are given as uint64_t values. We can switch from signed to unsigned as this is the only user and if we ever deal with signed integers somewhere else we'll have to be careful to use the corresponding timespec_(add|sub)_msec and always pass absolute values. v2: Forgot to drop the test calling add_nsec() with a negative number Signed-off-by: Lionel Landwerlin <[email protected]> Reported-by: Juan A. Suarez Romero <[email protected]> Fixes: d2d70c3bb5 ("util: add a timespec helper") Acked-by: Daniel Stone <[email protected]>
* util: fix os_create_anonymous_file on androidTapani Pälli2019-08-221-4/+5
| | | | | | | | Commit fixes current crashes with Vulkan applications on Android. Fixes: c0376a123418 "util: add anon_file.h for all memfd/temp file usage" Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>