summaryrefslogtreecommitdiffstats
path: root/src/util
Commit message (Collapse)AuthorAgeFilesLines
* drirc: Allow extension midshader for Metro Reduxvadym.shovkoplias2018-08-091-0/+4
| | | | | | | | | This fixes both Metro 2033 Redux and Metro Last Light Redux Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99730 Signed-off-by: Eero Tamminen <[email protected]> Signed-off-by: Vadym Shovkoplias <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* util: Android.mk: Convert implicit rules to static pattern rulesDan Willemsen2018-08-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a partial cherry-pick from AOSP's mesa3d tree: https://android.googlesource.com/platform/external/mesa3d/+/a88dcf769eb00a4ffc7183a0396d881a28b5a29b%5E%21/ "We're deprecating make implicit rules, preferring static pattern rules, or just regular rules." Without this patch, the freedesktop/master branch won't build in the AOSP environment, and this patch corrects that, as tested on the Dragonboard 820c. The i965 portion of the patch this is based on collided badly, and I'm not sure how to best forward port it. However, so far we don't see build issues without that portion. Comments or feedback would be appreciated! Change-Id: Id6dfd0d018cbd665fa19d80c14abd5f75fa10b8a Cc: Rob Herring <[email protected]> Cc: Alistair Strachan <[email protected]> Cc: Marissa Wall <[email protected]> Cc: Sumit Semwal <[email protected]> Cc: Emil Velikov <[email protected]> Cc: Rob Clark <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Signed-off-by: John Stultz <[email protected]> Signed-off-by: Rob Herring <[email protected]>
* kutil/queue: use util_snprintf() in util_queue_initAndres Gomez2018-08-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | Instead of plain snprintf(). To fix the MSVC 2013 build: Compiling src\util\u_queue.c ... u_queue.c src\util\u_queue.c(325) : warning C4013: 'snprintf' undefined; assuming extern returning int ... mesautil.lib(u_queue.obj) : error LNK2001: unresolved external symbol _snprintf scons: building terminated because of errors. Fixes: b238e33bc9d ("kutil/queue: add a process name into a thread name") Cc: Marek Olšák <[email protected]> Cc: Brian Paul <[email protected]> Cc: Roland Scheidegger <[email protected]> Cc: Timothy Arceri <[email protected]> Cc: Eric Engestrom <[email protected]> Signed-off-by: Andres Gomez <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* util: move process.[ch] to u_process.[ch]Dylan Baker2018-08-016-7/+7
| | | | | | | | | | | | | On windows process.h is a system provided header, and it's required in include/c11/threads_win32.h. This header interferes with searching for that header, and results in windows build warnings with scons, but errors in meson which doesn't allow implicit function declarations. Just rename process to u_process, which follows the style of utils anyway. Fixes: 2e1e6511f76370870b5cde10caa9ca3b6d0dc65f ("util: extract get_process_name from xmlconfig.c") Signed-off-by: Dylan Baker <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* python: Use open(), not file()Mathieu Bridon2018-08-011-1/+3
| | | | | | | | | | | | The latter is a constructor for file objects, but when actually opening a file, using the former is more idiomatic. In addition, file() is not a builtin any more in Python 3, so this makes the script compatible with both Python 2 and Python 3. Signed-off-by: Mathieu Bridon <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* util: don't use __builtin_clz unconditionallyMarek Olšák2018-07-311-1/+11
| | | | | | This fixes the build if __builtin_clz is unsupported. Reviewed-by: Roland Scheidegger <[email protected]>
* mesa: add ASTC 2D LDR decoderMarek Olšák2018-07-312-0/+64
| | | | | | Tested-by: Mike Lothian <[email protected]> Tested-By: Gert Wollny <[email protected]> Tested-by: Dieter Nützel <[email protected]>
* util/list: Make some helpers take const listsJason Ekstrand2018-07-291-4/+4
| | | | | | | | They're all just querying things about the list and not mutating anything. Reviewed-by: Thomas Helland<[email protected]> Reviewed-by: Christian Gmeiner <[email protected]>
* python: Better check for keys in dictsMathieu Bridon2018-07-241-2/+2
| | | | | | | | | | | | Python 3 lost the dict.has_key() method. Instead it requires using the "in" operator. This is also compatible with Python 2. Signed-off-by: Mathieu Bridon <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* util/disk_cache: Fix disk_cache_get_function_timestamp with disabled cache.Bas Nieuwenhuizen2018-07-201-5/+3
| | | | | | | | | | radv always needs it, so just check the header instead. Also do not declare the function if the variable is not set, so we get a nice compile error instead of failing to open a device at runtime. Fixes: b87ef9e606a "util: fix MSVC build issue in disk_cache.h" Reviewed-by: Timothy Arceri <[email protected]>
* util/string_buffer: fix warning in testsCaio Marcelo de Oliveira Filho2018-07-181-3/+3
| | | | | | | | | | | | | | | | | And also specify the maximum size when writing to static buffers. The warning below refers to the case where "str5" could be larger than "str5 - str4", then the strcat would have overlapping dst and src. Compiler doesn't pick up the bound from the snprintf above, so we make clear the bounds of str5 by using strncat() instead of strcat(). ../../src/util/tests/string_buffer/string_buffer_test.cpp: In member function ‘virtual void string_buffer_string_buffer_tests_Test::TestBody()’: ../../src/util/tests/string_buffer/string_buffer_test.cpp:106:10: warning: ‘char* strcat(char*, const char*)’ accessing 81 or more bytes at offsets 48 and 128 may overlap 1 byte at offset 128 [-Wrestrict] strcat(str4, str5); ~~~~~~^~~~~~~~~~~~ Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Thomas Helland <[email protected]>
* util/hash_table: add helper to remove entry by keyCaio Marcelo de Oliveira Filho2018-07-136-1/+78
| | | | | | And the corresponding test case. Reviewed-by: Eric Anholt <[email protected]>
* util/set: helper to remove entry by keyCaio Marcelo de Oliveira Filho2018-07-123-0/+39
| | | | | | v2: Add unit test. (Eric Anholt) Reviewed-by: Eric Anholt <[email protected]>
* util/set: add a clone functionCaio Marcelo de Oliveira Filho2018-07-123-0/+58
| | | | | | v2: Add unit test. (Eric Anholt) Reviewed-by: Eric Anholt <[email protected]>
* util/set: add a basic unit testCaio Marcelo de Oliveira Filho2018-07-125-1/+130
| | | | Reviewed-by: Eric Anholt <[email protected]>
* util/rb_tree: Fix a compiler warningJason Ekstrand2018-07-121-1/+1
| | | | | | | Gcc 8 warns "cast to pointer from integer of different size" in 32-bit builds. Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
* python: Use the print functionMathieu Bridon2018-07-062-46/+40
| | | | | | | | | | | | In Python 2, `print` was a statement, but it became a function in Python 3. Using print functions everywhere makes the script compatible with Python versions >= 2.6, including Python 3. Signed-off-by: Mathieu Bridon <[email protected]> Acked-by: Eric Engestrom <[email protected]> Acked-by: Dylan Baker <[email protected]>
* vma/tests: Fix compilation if limits.h defines PAGE_SIZE (v2)Jon Turney2018-07-061-8/+8
| | | | | | | | | | per POSIX, limits.h may define PAGE_SIZE when the value is not indeterminate v2: just change the variable name, since there's no intended correlation here between this value and the machine's actual page size. Signed-off-by: Jon Turney <[email protected]> Reviewed-by: Scott D Phillips <[email protected]>
* util: u_queue: fix android build errorLionel Landwerlin2018-07-051-1/+1
| | | | | | | | | mesa/src/util/u_queue.c:242:15: error: address of array 'queue->name' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] Fixes: b238e33bc9d48b814370 "kutil/queue: add a process name into a thread name" Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* Util: fix msvc buildBenedikt Schemmer2018-07-051-1/+1
| | | | | | | | The MSVC preprocessor doesnt understand #warning Fixes: 2e1e6511f76 ("util: extract get_process_name from xmlconfig.c") Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* util: rb-tree: A simple, invasive, red-black treeJason Ekstrand2018-07-054-0/+694
| | | | | | | | | | | | | | | | | | | | | | | | This is a simple, invasive, liberally licensed red-black tree implementation. It's an invasive data structure similar to the Linux kernel linked-list where the intention is that you embed a rb_node struct the data structure you intend to put into the tree. The implementation is mostly based on the one in "Introduction to Algorithms", third edition, by Cormen, Leiserson, Rivest, and Stein. There were a few other key design points: * It's an invasive data structure similar to the [Linux kernel linked list]. * It uses NULL for leaves instead of a sentinel. This means a few algorithms differ a small bit from the ones in "Introduction to Algorithms". * All search operations are inlined so that the compiler can optimize away the function pointer call. Reviewed-by: Lionel Landwerlin <[email protected]>
* util/drirc: turn on force_glsl_extensions_warn for No Mans SkyTimothy Arceri2018-07-051-0/+4
| | | | | | | | | The game forgets to enable multiple extensions in its shaders, one of those extesions is EXT_texture_array. But enabling this config entry fixes at least one other rendering issue that enabling EXT_texture_array on its own doesn't fix. Reviewed-by: Marek Olšák <[email protected]>
* util/queue: remove leftover debug codeMarek Olšák2018-07-041-1/+0
|
* Shorten u_queue namesMarek Olšák2018-07-041-1/+1
| | | | | | | | There is a 15-character limit for thread names shared by the queue name and process name. Shorten the thread name to make space for the process name. Reviewed-by: Timothy Arceri <[email protected]>
* kutil/queue: add a process name into a thread nameMarek Olšák2018-07-042-3/+31
| | | | | | | v2: simplifications Reviewed-by: Timothy Arceri <[email protected]> (v1) Reviewed-by: Eric Engestrom <[email protected]> (v1)
* gallium/os: use util_get_process_name when possibleMarek Olšák2018-07-041-0/+2
| | | | | Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* util: extract get_process_name from xmlconfig.cMarek Olšák2018-07-045-84/+156
| | | | | Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* util/macros: Import ALIGN_POT from ralloc.cJason Ekstrand2018-07-024-10/+8
| | | | | | | | | | | v2 (Jason Ekstrand): - Rename y to pot_align (Brian) - Also use ALIGN_POT in build_id.c and slab.c (Brian) Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* util: add allow_glsl_relaxed_es to drirc for Google Earth VRTimothy Arceri2018-06-191-0/+1
| | | | Reviewed-by: Dave Airlie <[email protected]>
* mesa/util: add allow_glsl_relaxed_es driconfig overrideTimothy Arceri2018-06-191-0/+5
| | | | | | | | | | | | | | | This relaxes a number of ES shader restrictions allowing shaders to follow more desktop GLSL like rules. This initial implementation relaxes the following: - allows linking ES shaders with desktop shaders - allows mismatching precision qualifiers - always enables standard derivative builtins These relaxations allow Google Earth VR shaders to compile. Reviewed-by: Dave Airlie <[email protected]>
* util: add allow_glsl_builtin_const_expression to drirc for Google Earth VRTimothy Arceri2018-06-191-0/+4
| | | | Reviewed-by: Dave Airlie <[email protected]>
* mesa/util: add allow_glsl_builtin_const_expression driconf overrideTimothy Arceri2018-06-191-0/+5
| | | | | | | Google Earth VR shaders uses builtins in constant expressions with GLSL 1.10. That feature wasn't allowed until GLSL 1.20. Reviewed-by: Dave Airlie <[email protected]>
* util: manually extract the program name from program_invocation_nameTimothy Arceri2018-06-191-1/+10
| | | | | | | | | | | | | | | Glibc has the same code to get program_invocation_short_name. However for some reason the short name gets mangled for some wine apps. For example with Google Earth VR I get: program_invocation_name: "/home/tarceri/.local/share/Steam/steamapps/common/EarthVR/Earth.exe" program_invocation_short_name: "e" Acked-by: Eric Engestrom <[email protected]>
* util/bitset: include util/macro.hChristian Gmeiner2018-06-151-0/+1
| | | | | | | | | | BITSET_FFS(x) macro makes use of ARRAY_SIZE(x) macro which is defined in util/macro.h. Include it directy to make usage more straightforward. Fixes: 692bd4a1ab9 ("util: replace Elements() with ARRAY_SIZE()") Signed-off-by: Christian Gmeiner <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* util/tests/vma: Fix warning c++11-narrowingScott D Phillips2018-06-051-1/+1
| | | | | | Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106801 Fixes: 943fecc569 ("util: Add a randomized test for the virtual memory allocator") Reviewed-by: Dylan Baker <[email protected]>
* util: tests: vma test depends on C++11 supportScott D Phillips2018-06-051-2/+5
| | | | | | | Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106776 Fixes: 943fecc569 ("util: Add a randomized test for the virtual memory allocator") Tested-by: Vinson Lee <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* util: Add a randomized test for the virtual memory allocatorScott D Phillips2018-05-315-1/+315
| | | | | | | | | | | | | | | | | The test pseudo-randomly makes allocations and deallocations with the virtual memory allocator and checks that the results are consistent. Specifically, we test that: * no result from the allocator overlaps an already allocated range * allocated memory fulfills the stated alignment requirement * a failed result from the allocator could not have been fulfilled * memory freed to the allocator can later be allocated again v2: - fix if() in test() to actually run fill() v3: - add c++11 build flag (Jason) - test the full 64-bit range (Jason) Reviewed-by: Jason Ekstrand <[email protected]>
* util: Add a virtual memory allocatorJason Ekstrand2018-05-314-1/+292
| | | | | | | | | | | | | | | | | | | | | | This is simple linear-walk first-fit allocator roughly based on the allocator in the radeon winsys code. This allocator has two primary functional differences: 1) It cleanly returns 0 on allocation failure 2) It allocates addresses top-down instead of bottom-up. The second one is needed for Intel because high addresses (with bit 47 set) need to be canonicalized in order to work properly. If we allocate bottom-up, then high addresses will be very rare (if they ever happen). We'd rather always have high addresses so that the canonicalization code gets better testing. v2: - [scott-ph] remove _heap_validate() if NDEBUG is defined (Jordan) Reviewed-by: Scott D Phillips <[email protected]> Tested-by: Scott D Phillips <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* util/u_math: Implement a logbase2 function for unsigned longPierre Moreau2018-05-291-0/+11
| | | | | | | | | | v2 (Karol Herbst <[email protected]>): * removed unneeded ll * ll -> ull Signed-off-by: Karol Herbst <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* util/set: add a set_clear functionScott D Phillips2018-05-042-0/+26
| | | | | | | Clear a set back to the state of having zero entries. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* util/u_queue: fix a deadlock in util_queue_finishMarek Olšák2018-04-272-0/+10
| | | | | Cc: 18.0 18.1 <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* util/srgb: Add a float sRGB -> linear helperJason Ekstrand2018-04-241-0/+14
| | | | | Reviewed-by: Nanley Chery <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: include mtypes.h lessMarek Olšák2018-04-122-1/+1
| | | | | | | | | | - remove mtypes.h from most header files - add main/menums.h for often used definitions - remove main/core.h v2: fix radv build Reviewed-by: Brian Paul <[email protected]>
* util: Include bitscan.h directlyIan Romanick2018-03-291-1/+1
| | | | | | | | | | | | | | | Previously bitset.h would include u_math.h to get bitscan.h. u_math.h lives in src/gallium/auxiliary/util while both bitset.h and bitscan.h live in src/util. Having the one file directly include another file that lives in the same directory makes much more sense. As a side-effect, several files need to directly include standard header files that were previously indirectly included. v2: Fix build break in src/amd/common/ac_nir_to_llvm.c. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
* util: Optimize util_is_power_of_two_nonzeroIan Romanick2018-03-291-0/+17
| | | | | | Signed-off-by: Ian Romanick <[email protected]> Suggested-by: Matt Turner <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
* util: Use util_is_power_of_two_nonzero in u_vectorIan Romanick2018-03-291-2/+2
| | | | | | | | Previously size=0, element_size=0 would have been allowed. That combination can only lead to despair. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]>
* util: Add and use util_is_power_of_two_nonzeroIan Romanick2018-03-291-0/+11
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
* util: Move util_is_power_of_two to bitscan.h and rename to ↵Ian Romanick2018-03-292-2/+14
| | | | | | | | | | | util_is_power_of_two_or_zero The new name make the zero-input behavior more obvious. The next patch adds a new function with different zero-input behavior. Signed-off-by: Ian Romanick <[email protected]> Suggested-by: Matt Turner <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]>
* drirc: whitelist glthread for Medieval II: TW, Carnivores: DHR, Far Cry 2Marek Olšák2018-03-281-0/+15
|
* meson/configure: detect endian.h instead of trying to guess when it's availableEric Engestrom2018-03-231-1/+1
| | | | | | | | | | | Cc: Maxin B. John <[email protected]> Cc: Khem Raj <[email protected]> Cc: Rob Herring <[email protected]> Suggested-by: Jon Turney <[email protected]> Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Dylan Baker <[email protected]> Cc: <[email protected]>