summaryrefslogtreecommitdiffstats
path: root/src/util
Commit message (Collapse)AuthorAgeFilesLines
* util: Fix warning of invalid return valueChad Versace2016-04-151-1/+2
| | | | | | _mesa_libgcrypt_init() returns NULL, but its return type is void. Reviewed-by: Mark Janes <[email protected]>
* util/list: Add list splicing functionsJason Ekstrand2016-04-151-0/+22
| | | | | | | | | This adds functions for splicing one list into another. These have more-or-less the same API as the kernel list splicing functions. The implementation, however, was stolen from the Wayland list implementation. Reviewed-by: Mark Janes <[email protected]> Reviewed-by: Rob Clark <[email protected]>
* util: Fix race condition on libgcrypt initializationMark Janes2016-04-151-8/+11
| | | | | | | | | | | | | Fixes intermittent Vulkan CTS failures within the test groups: dEQP-VK.api.object_management.multithreaded_per_thread_device dEQP-VK.api.object_management.multithreaded_per_thread_resources dEQP-VK.api.object_management.multithreaded_shared_resources Signed-off-by: Mark Janes <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94904 Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* scons: Add a "check" target to run all unit tests.Jose Fonseca2016-04-141-5/+2
| | | | | | | | | Except: - u_cache_test -- too long - translate_test -- unreliable (it's probably testing corner cases that translate module doesn't care about.) Reviewed-by: Roland Scheidegger <[email protected]>
* util/bitset: Allow iterating over const bitsetsJason Ekstrand2016-03-241-1/+1
| | | | Reviewed-by: Jordan Justen <[email protected]>
* util/sha: do not wrap header inclusion in extern "C"Emil Velikov2016-03-091-2/+2
| | | | Signed-off-by: Emil Velikov <[email protected]>
* util: fix new gcc6 warningsRob Clark2016-02-181-1/+3
| | | | | | | | | src/util/hash_table.h:111:23: warning: ‘_mesa_fnv32_1a_offset_bias’ defined but not used [-Wunused-const-variable] static const uint32_t _mesa_fnv32_1a_offset_bias = 2166136261u; ^~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* util/u_atomic: Remove MSVC 2008 support.Jose Fonseca2016-02-121-59/+0
| | | | | | Spotted by Emil Velikov. Trivial.
* scons: Eliminate MSVC2008 compatibility.Jose Fonseca2016-02-111-1/+1
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
* configure: Eliminate MSVC2008 compatibility.Jose Fonseca2016-02-111-1/+1
| | | | | | | | | | | | | | | We no longer need to build any part of Mesa with Windows SDK 7.0.7600 or MSVC 2008. MSVC 2013 will be the oldest we support. In practice this means people are now free to declare variables in the middle of blocks, on the whole Mesa tree. Care should still be taken with variable length arrays and void pointer arithmetic. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]> Hella-acked-by: Ian Romanick <[email protected]>
* util/hash_table: add _mesa_hash_table_num_entriesNicolai Hähnle2016-02-031-0/+5
| | | | Reviewed-by: Marek Olšák <[email protected]>
* util/hash_table: add _mesa_hash_table_clear (v4)Nicolai Hähnle2016-02-034-0/+120
| | | | | | v4: coding style change (Matt Turner) Reviewed-by: Ian Romanick <[email protected]> (v3)
* util/hash_table: don't compare deleted entriesConnor Abbott2016-02-021-1/+2
| | | | | | | | | | | The equivalent of the last patch for the hash table. I'm not aware of any issues this fixes. v2: - use entry_is_deleted (Timothy) Reviewed-by: Timothy Arceri <[email protected]> Signed-off-by: Connor Abbott <[email protected]>
* util/set: don't compare against deleted entriesConnor Abbott2016-02-021-1/+2
| | | | | | | | | | | | | | | | | | When we delete entries in the hash set, we mark them "deleted" by setting their key to the deleted_key, which points to a dummy deleted_key_value. When searching for an entry, we normally skip over those, but set_add() had some code for searching for duplicate entries which forgot to skip over deleted entries. This led to a segfault inside the NIR vectorization pass, since its key comparison function interpreted the memory where deleted_key_value resides as a pointer and tried to dereference it. v2: - add better commit message (Timothy) - use entry_is_deleted (Timothy) Reviewed-by: Timothy Arceri <[email protected]> Signed-off-by: Connor Abbott <[email protected]>
* ralloc: Fix ralloc_adopt() to the old context's last child's parent.Kenneth Graunke2015-12-181-0/+1
| | | | | | | | | | | I was cleverly using one iteration to obtain a pointer to the last item in ralloc's singly list child list, while also setting parents. Unfortunately, I forgot to set the parent on that last item. Cc: "11.1 11.0 10.6" <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* util: fix comment typoGiuseppe Bilotta2015-12-041-1/+1
| | | | | | | | Undefining the NDEBUG is relevant for release build, as they are the ones that set it. [Emil Velikov: split from previous patch] Signed-off-by: Emil Velikov <[email protected]>
* Remove Sun CC specific code.Jose Fonseca2015-12-021-1/+1
| | | | | Reviewed-by: Matt Turner <[email protected]> Acked-by: Alan Coopersmith <[email protected]>
* util: Tiny optimisation for the linear→srgb conversionNeil Roberts2015-11-271-1/+1
| | | | | | When converting 0.0 it would be nice if it didn't do any arithmetic. Reviewed-by: Jason Ekstrand <[email protected]>
* util: Include assert.h in macros.h.Matt Turner2015-11-241-0/+2
|
* util: Include <stdbool.h> in debug.h.Matt Turner2015-11-241-0/+1
|
* util: move brw_env_var_as_boolean() to utilRob Clark2015-11-242-0/+27
| | | | | | | | Kind of a handy function. And I'll want it available outside of i965 for common nir-pass helpers. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* ralloc: Set *start in ralloc_vasprintf_rewrite_tail() if str is NULL.Matt Turner2015-11-121-0/+1
| | | | | | | We were leaving it undefined, even though we were writing a string to *str. Reviewed-by: Kenneth Graunke <[email protected]>
* util: Add list_is_singular() helper functionEduardo Lima Mitev2015-11-101-0/+8
| | | | | | Returns whether the list has exactly one element. Reviewed-by: Matt Turner <[email protected]>
* glsl: move half<->float convertion to utilRob Clark2015-10-163-0/+220
| | | | | | | | Needed in NIR too, so move out of mesa/main/imports.c Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Signed-off-by: Rob Clark <[email protected]>
* util: Move DRI parse_debug_string() to utilKristian Høgsberg Kristensen2015-10-083-0/+101
| | | | | | | | | | We want to use intel_debug.c in code that doesn't link to dri common. v2: Remove unnecessary stddef.h include (Topi), use util/debug.h in all DRI driver and remove driParseDebugString() (Iago). Reviewed-by: Topi Pohjolainen <[email protected]> Signed-off-by: Kristian Høgsberg Kristensen <[email protected]>
* util: use strnlen() in strndup() implementationsSamuel Iglesias Gonsalvez2015-09-302-8/+2
| | | | | | | | | If the string being copied is not NULL-terminated the result of strlen() is undefined. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Neil Roberts <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* util: Fix strndup prototype on C++.Jose Fonseca2015-09-292-1/+10
| | | | Trivial.
* util: implement strndup for WIN32Samuel Iglesias Gonsalvez2015-09-293-0/+83
| | | | | | | | | | | v2: - Add strndup.h to Makefile.sources (Emil) - Use calloc instead of malloc (Emil). - Check if allocation fails (Emil, Jose) - Add '#pragma once' and include stdlib.h to strndup.h (Jose) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92124 Reviewed-by: Jose Fonseca <[email protected]>
* util: automake: rework the format_srgb.c ruleEmil Velikov2015-09-091-2/+4
| | | | | | | | | | | | | | A handful of changes/cleanups paving the way to bmake support: - Remove optional $(srcdir)/ prefix for files in the prereq list. - Drop the space after the AM_V_GEN variable. - Using $< in a non-suffix rule is a GNU make idiom. - Use $(@D) over $(dir $@). The latter is a POSIX standard. v2: Cosmetic tweaks in the commit summary. Cc: 11.0 <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Matt Turner <[email protected]> (v1)
* util: make mesa-sha1.c completely empty when there are no SHA1 implsIlia Mirkin2015-09-071-2/+2
| | | | | | | | | | | My earlier attempt to fix this missed the fact that there was a #else clause that assumes that you have openssh. This moves the whole thing under #ifdef HAVE_SHA1 which should avoid this issue. Fixes: 13bfa5201 (util: always include sha1 into the build) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91898 Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* util: always include sha1 into the buildIlia Mirkin2015-09-063-8/+6
| | | | | | | | | SHA1 is now used in all builds when HAVE_SHA1 is defined. Adjust src to do the same thing, rather than predicating on shader cache. Fixes: 04e201d0c02 ("mesa: change 'SHADER_SUBST' facility to work with env variables") Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* util/ra: (trivial) fix c99 loop variable initializationRoland Scheidegger2015-08-191-7/+8
| | | | Fails with old msvc otherwise.
* util: (trivial) include c99_math.h in rounding.hRoland Scheidegger2015-08-191-2/+1
| | | | Needed for rint/rintf.
* util/ra: Make allocating conflict lists optionalJason Ekstrand2015-08-182-10/+19
| | | | | | | | | Since i965 is now using make_reg_conflicts_transitive and doesn't need q-value computations, they are disabled on i965. They are enabled everywhere else so that they get the old behavior. This reduces the time spent in eglInitialize() on BDW by around 10-15%. Reviewed-by: Eric Anholt <[email protected]>
* util/ra: Add a function for making all conflicts on a register transitiveJason Ekstrand2015-08-182-0/+24
| | | | Reviewed-by: Eric Anholt <[email protected]>
* util/bitset: Add a BITSET_FOREACH_SET macroJason Ekstrand2015-08-181-0/+36
| | | | Reviewed-by: Eric Anholt <[email protected]>
* ra: Delete the conflict lists in ra_set_finalizeJason Ekstrand2015-08-101-0/+5
| | | | | | | They are never used after the set is finalized so there's no reason to keep them around. Reviewed-by: Matt Turner <[email protected]>
* ra: Refactor ra_set_finalizeJason Ekstrand2015-08-101-26/+25
| | | | | | | All this commit does is change an early return to an if with an else clause. Reviewed-by: Matt Turner <[email protected]>
* util: Use LONG_MAX instead of LONG_BIT.Jose Fonseca2015-08-101-6/+7
| | | | | | | | | | | More portable. Based on Roland Scheidegger's idea. Tested with roundevent_test on Linux, MinGW, and MSVC. https://bugs.freedesktop.org/show_bug.cgi?id=91591 Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* scons: Build roundevent_test.Jose Fonseca2015-08-102-0/+9
| | | | Reviewed-by: Roland Scheidegger <[email protected]>
* util: Cope with LONG_BIT not being defined on Windows.Jose Fonseca2015-08-091-2/+6
| | | | | | | | | | | | Neither MSVC nor MinGW defines LONG_BIT. For MSVC this was not a problem as it doesn't define __x86_64__ macro (it's GCC specific.) However on Windows long type is guaranteed to be 32bits. Also add an #error, as GCC will just warn, not throw any error, when no value is returned. Trivial.
* util: Rename PURE to ATTRIBUTE_PURE.Jose Fonseca2015-08-091-2/+2
| | | | | | | | | To avoid collission with windows.h's PURE macro. We could consider eventually renaming to __pure, but that would require further care, so it's left to the future. Reviewed-by: Brian Paul <[email protected]>
* util: Use SSE intrinsics in _mesa_lroundeven{f,}.Matt Turner2015-08-041-0/+22
| | | | | | | | | | | | | | gcc actually generates this for us now that we use -fno-math-errno (which is weird, since lrintf()/lrint() don't set errno) but clang still does not. Presumably helps MSVC as well. Reduced .text size by 8.5k with gcc before -fno-math-errno. text data bss dec hex filename 4935850 195136 26192 5157178 4eb13a i965_dri.so before 4927225 195128 26192 5148545 4e8f81 i965_dri.so after Reviewed-by: Roland Scheidegger <[email protected]>
* mesa: Replace F_TO_I() with _mesa_lroundevenf().Matt Turner2015-08-031-0/+25
| | | | | | | | | | | I'm not sure what the true meaning of "The rounding mode may vary." is, but it is the case that the IROUND() path rounds differently than the other paths (and does it wrong, at that). Like _mesa_roundeven{f,}(), just add an use _mesa_lroundeven{f,}() that has known semantics. Reviewed-by: Roland Scheidegger <[email protected]>
* util: Avoid double promotion.Matt Turner2015-07-291-1/+1
| | | | Reviewed-by: Iago Toral Quiroga <[email protected]>
* mesa: Detect and provide macros for function attributes pure and const.Eric Anholt2015-07-171-0/+20
| | | | | | | | | | | | | These are really useful hints to the compiler in the absence of link-time optimization, and I'm going to use them in VC4. I've made the const attribute be ATTRIBUTE_CONST unlike other function attributes, because we have other things in the tree #defining CONST for their own unrelated purposes. v2: Alphabetize. Reviewed-by: Kenneth Graunke <[email protected]> (v1)
* util: Don't link to SHA1 library if shader-cache is disabled.Matt Turner2015-07-091-1/+1
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Add a MUST_CHECK macro for __attribute__((warn_unused_result)).Kenneth Graunke2015-07-061-0/+6
| | | | | | | | | In the kernel, this is called __must_check; all our attribute macros in Mesa appear to be uppercase, so I went with that. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Chris Wilson <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* mesa/main: free locale at exitErik Faye-Lund2015-06-292-0/+11
| | | | | | | | | In order to save a small leak if mesa is continously loaded and unloaded, let's free the locale when the shared object is unloaded. Signed-off-by: Erik Faye-Lund <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* util: port _mesa_strto[df] to CErik Faye-Lund2015-06-293-7/+12
| | | | | | | | | | | | | _mesa_strtod and _mesa_strtof are only used from the GLSL compiler and the ARB_[vertex|fragment]_program code, meaning that the locale doesn't need to be initialized before the first OpenGL context gets initialized. So let's use explicit initialization from the one-time init code instead of depending on a C++ compiler to initialize at image-load time. Signed-off-by: Erik Faye-Lund <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Brian Paul <[email protected]>