aboutsummaryrefslogtreecommitdiffstats
path: root/src/util
Commit message (Collapse)AuthorAgeFilesLines
* 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]>
* i965: Add handling for fp16 configsKevin Strasser2019-08-211-0/+5
| | | | | | | | | | | | Expose configs when allow_fp16_configs has been enabled and DRI_LOADER_CAP_FP16 is set in the loader. Also, define a new dri configuration option so users can disable exposure of fp16 formats. Make fp16 opt-in for i965. Signed-off-by: Kevin Strasser <[email protected]> Reviewed-by: Adam Jackson <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* util: move bitcount to bitscan.hKevin Strasser2019-08-212-36/+32
| | | | | | | | | bitcount is free from the pipe header dependencies that make u_math.h hard to include by non-gallium specific code, so move it to bitscan.h. bitscan.h is included by u_math.h so existing references will continue working. Signed-off-by: Kevin Strasser <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* win32: unify strcasecmp definitionsErik Faye-Lund2019-08-151-0/+1
| | | | | | | | | There was two incompatible definitions of strcasecmp, which lead to a compiler warning. Let's clean this up by only leaving one of them, and using that one all the time. Signed-off-by: Erik Faye-Lund <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* util: drop final reference to p_compiler.hLionel Landwerlin2019-08-093-40/+38
| | | | | Signed-off-by: Lionel Landwerlin <[email protected]> Acked-by: Eric Engestrom <[email protected]>
* util: os_misc: drop p_compiler.h includeLionel Landwerlin2019-08-091-1/+2
| | | | | Signed-off-by: Lionel Landwerlin <[email protected]> Acked-by: Eric Engestrom <[email protected]>
* util: u_math: drop p_compiler.h includeLionel Landwerlin2019-08-092-25/+23
| | | | | | | This file was moved from gallium so drop depending on gallium headers. Signed-off-by: Lionel Landwerlin <[email protected]> Acked-by: Eric Engestrom <[email protected]>
* util: Revert "util: added missing headers in anon-file"Gurchetan Singh2019-08-091-2/+0
| | | | | | | | | | This reverts commit c73988300f943e185a50aaba015f2f114ffcb262. Reason: Made a fix for this, then saw @eric's change ("util/anon_file: add missing"), but some sequence of events I don't really remember caused this to get merged. So revert ;-) Reviewed-by: Eric Engestrom <[email protected]>
* util: Cygwin has linux-style pthread_setname_npJon Turney2019-08-091-1/+1
| | | | Fixes: dcf9d91a ("util: Handle differences in pthread_setname_np")
* util: added missing headers in anon-fileGurchetan Singh2019-08-081-0/+2
| | | | | | | | | | | | | | | | | | | | Otherwise I get: ../src/util/anon_file.c: In function ‘create_tmpfile_cloexec’: ../src/util/anon_file.c:75:9: error: implicit declaration of function ‘mkostemp’ [-Werror=implicit-function-declaration] fd = mkostemp(tmpname, O_CLOEXEC); ^~~~~~~~ ../src/util/anon_file.c:133:7: error: implicit declaration of function ‘asprintf’ [-Werror=implicit-function-declaration] asprintf(&name, "%s/mesa-shared-%s-XXXXXX", path, debug_name); ^~~~~~~~ ../src/util/anon_file.c:141:4: error: implicit declaration of function ‘free’ [-Werror=implicit-function-declaration] free(name) Fixes: c0376a ("util: add anon_file.h for all memfd/temp file usage")
* util/anon_file: const string paramEric Engestrom2019-08-082-2/+2
| | | | | | | Fixes: c0376a123418df0050dc ("util: add anon_file.h for all memfd/temp file usage") Signed-off-by: Eric Engestrom <[email protected]> Tested-by: Eric Anholt <[email protected]> Tested-by: Andreas Baierl <[email protected]>
* util/anon_file: drop unused #includeEric Engestrom2019-08-081-1/+0
| | | | | | Signed-off-by: Eric Engestrom <[email protected]> Tested-by: Eric Anholt <[email protected]> Tested-by: Andreas Baierl <[email protected]>
* util/anon_file: add missing #includeEric Engestrom2019-08-081-0/+3
| | | | | | | Fixes: c0376a123418df0050dc ("util: add anon_file.h for all memfd/temp file usage") Signed-off-by: Eric Engestrom <[email protected]> Tested-by: Eric Anholt <[email protected]> Tested-by: Andreas Baierl <[email protected]>
* util: fix cpuset support on FreeBSDGreg V2019-08-081-0/+7
| | | | Reviewed-by: Eric Engestrom <[email protected]>
* util/hash_table: Fix hashing in clears on 32-bitTomeu Vizoso2019-08-081-2/+12
| | | | | | | | | | | | | | | | | | | Some hash functions (eg. key_u64_hash) will attempt to dereference the key, causing an invalid access when passed DELETED_KEY_VALUE (0x1) or FREED_KEY_VALUE (0x0). When in 32-bit arch a 64-bit key value doesn't fit into a pointer, so hash_table_u64 internally use a pointer to a struct containing the 64-bit key value. Fix _mesa_hash_table_u64_clear() to handle the 32-bit case by creating a temporary hash_key_u64 to pass to the hash function. Signed-off-by: Tomeu Vizoso <[email protected]> Suggested-by: Caio Marcelo de Oliveira Filho <[email protected]> Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]> Cc: Samuel Pitoiset <[email protected]> Cc: Nicolai Hähnle <[email protected]>
* util: add anon_file.h for all memfd/temp file usageGreg V2019-08-074-0/+193
| | | | | | | | | Move the Weston os_create_anonymous_file code from egl/wayland into util, add support for Linux memfd and FreeBSD SHM_ANON, use that code in anv/aubinator instead of explicit memfd calls for portability. Acked-by: Lionel Landwerlin <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* util: fix mem leak of program pathEric Engestrom2019-08-071-7/+12
| | | | | | Fixes: 759b94038987bb983398 ("util: Get program name based on path when possible") Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* drirc: Add vendor workaround for Divinity: Original Sin EETimothy Arceri2019-08-071-0/+1
| | | | | Reviewed-by: Marek Olšák <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93551
* mesa/gallium: add dric option to allow overriding GL vendor stringTimothy Arceri2019-08-071-0/+5
| | | | | | | Will be used in the following patch. Reviewed-by: Marek Olšák <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93551
* drirc: Add discard workaround for Divinity: Original Sin EETimothy Arceri2019-08-051-0/+1
| | | | | | | | This adds an additional work around for the game to fix the blocky shadows as reported in bug 105282 Acked-by: Eric Engestrom <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105282
* introduce c11_compat.h to provide C11 things in C99Eric Engestrom2019-08-041-0/+1
| | | | | | | | Right now, all it does is provide the new standard `static_assert()` name. Fixes: fbf7c38da35afe7f1de0 ("egl/wayland: use bitset.h for `formats` bit set") Signed-off-by: Eric Engestrom <[email protected]> Tested-by: Bhushan Shah <[email protected]>
* util: fix pointer type on NetBSDEric Engestrom2019-08-031-1/+1
| | | | | | | | | | | NetBSD expects a `void *` argument [1] as the printf-style arguments to the formatting string, so we need to cast the `const` away. [1] https://netbsd.gw.com/cgi-bin/man-cgi?pthread_setname_np++NetBSD-current Suggested-by: Kamil Rytarowski <[email protected]> Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* meson: replace last uses of libxmlconfig with idep_xmlconfigEric Engestrom2019-08-031-2/+2
| | | | | | Signed-off-by: Eric Engestrom <[email protected]> Acked-by: Eric Anholt <[email protected]> Tested-by: Vinson Lee <[email protected]>
* meson: drop unused dep_{thread,dl}Eric Engestrom2019-08-035-5/+5
| | | | | | | | Unused as of last commit. Signed-off-by: Eric Engestrom <[email protected]> Acked-by: Eric Anholt <[email protected]> Tested-by: Vinson Lee <[email protected]>