summaryrefslogtreecommitdiffstats
path: root/src/util
Commit message (Collapse)AuthorAgeFilesLines
* st/mesa: pin driver threads to a specific L3 cache on AMD Zen (v2)Marek Olšák2018-09-071-0/+57
| | | | | | v2: use set_context_param Reviewed-by: Brian Paul <[email protected]>
* move u_math to src/utilDylan Baker2018-09-074-0/+893
| | | | | | | | | | | | | | | Currently we have two sets of functions for bit counts, one in gallium and one in core mesa. The ones in core mesa are header only in many cases, since they reduce to "#define _mesa_bitcount popcount", but they provide a fallback implementation. This is important because 32bit msvc doesn't have popcountll, just popcount; so when nir (for example) includes the core mesa header it doesn't (and shouldn't) link with core mesa. To fix this we'll promote the version out of gallium util, then replace the core mesa uses with the util version, since nir (and other non-core mesa users) can and do link with mesautils. Acked-by: Eric Engestrom <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa/util: add missing va_end() after va_copy()Andrii Simiklit2018-09-061-0/+1
| | | | | | | | | | | MSDN: "va_end must be called on each argument list that's initialized with va_start or va_copy before the function returns." Reviewed-by: Eric Engestrom <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107810 Fixes: c6267ebd6c8a "gallium/util: Stop bundling our snprintf implementation." Signed-off-by: Andrii Simiklit <[email protected]>
* mesa/util: don't ignore NULL returned from 'malloc'Andrii Simiklit2018-09-061-1/+1
| | | | | | | | | | We should exit from the function 'util_vasprintf' with error code -1 for case where 'malloc' returns NULL Reviewed-by: Eric Engestrom <[email protected]> Fixes: 864148d69e1e "util: add util_vasprintf() for Windows (v2)" Signed-off-by: Andrii Simiklit <[email protected]>
* mesa/util: don't use the same 'va_list' instance twiceAndrii Simiklit2018-09-061-1/+1
| | | | | | | | The first usage of the 'va_list' instance could change it. Reviewed-by: Eric Engestrom <[email protected]> Fixes: 864148d69e1e "util: add util_vasprintf() for Windows (v2)" Signed-off-by: Andrii Simiklit <[email protected]>
* meson: consolidate langs listsEric Engestrom2018-09-061-3/+9
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* st/mesa, gallium: add a workaround for No Mans SkyTimothy Arceri2018-08-302-0/+6
| | | | | | | | The spec seems clear this is not allowed but the Nvidia binary forces apps to add layout qualifiers so this works around the issue for No Mans Sky until the CTS can be sorted out. Reviewed-by: Marek Olšák <[email protected]>
* radeonsi: enable radeonsi_zerovram for No Mans SkyTimothy Arceri2018-08-301-0/+3
| | | | Reviewed-by: Marek Olšák <[email protected]>
* radeonsi: add radeonsi_zerovram driconfig optionTimothy Arceri2018-08-301-0/+5
| | | | | | | More and more games seem to require this so lets make it a config option. Reviewed-by: Marek Olšák <[email protected]>
* meson: Actually load translation filesDylan Baker2018-08-281-1/+4
| | | | | | | | | Currently we run the script but don't actually load any files, even in a tarball where they exist. Fixes: 3218056e0eb375eeda470058d06add1532acd6d4 ("meson: Build i965 and dri stack") Reviewed-by: Eric Engestrom <[email protected]>
* Revert "configure: allow building with python3"Emil Velikov2018-08-242-2/+2
| | | | | | | | | | | | | | This reverts commit ae7898dfdbe5c8dab7d11c71862353f1ae43feb0. Turns out the python scripts are _not_ fully python 3 compatible. As Ilia reported using get_xmlpool.py with LANG=C produces some weird output - see the link for details. Even though the issue was spotted with the autoconf build, it exposes a genuine problem with the script (and lack of lang handling of the meson build.) https://lists.freedesktop.org/archives/mesa-dev/2018-August/203508.html
* configure: allow building with python3Emil Velikov2018-08-232-2/+2
| | | | | | | | | | | | Pretty much all of the scripts are python2+3 compatible. Check and allow using python3, while adjusting the PYTHON2 refs. Note: - python3.4 is used as it's the earliest supported version - python3 chosen prior to python2 Signed-off-by: Emil Velikov <[email protected]> Acked-by: Eric Engestrom <[email protected]>
* util/dynarray: add a clone functionCaio Marcelo de Oliveira Filho2018-08-221-0/+9
| | | | | | | v2: Fix mem_ctx parameter type. (Thomas) Reviewed-by: Thomas Helland <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* util: rb_tree: add safe iteratorsLionel Landwerlin2018-08-221-0/+58
| | | | | | | | v2: Add helper to make iterators more readable (Rafael) Fix rev iterator bug (Rafael) Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Rafael Antognolli <[email protected]>
* util/xmlpool: make indentation coherentEric Engestrom2018-08-211-6/+6
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* mesa: move legacy hyperz option from dri configTimothy Arceri2018-08-217-31/+0
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: remove unused dri config option disable_shader_bit_encodingTimothy Arceri2018-08-217-29/+0
| | | | | | | This was added as a workaround for Heaven 3.0 but was later removed by 5ead448719f3 to allow Heaven 4.0 to work correctly. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: drop legacy no_rast dri optionTimothy Arceri2018-08-217-29/+0
| | | | | | Add enviroment var overrides to legacy drivers instead. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: move legacy dri config option texture_unitsTimothy Arceri2018-08-207-29/+0
| | | | Reviewed-by: Ian Romanick <[email protected]>
* mesa: remove unused dri config option texture_heapsTimothy Arceri2018-08-207-108/+0
| | | | | | | This seems to have only been used by DRI1 drivers which were removed with e4344161bde2. Reviewed-by: Ian Romanick <[email protected]>
* mesa: move legacy dri config option texture_blend_qualityTimothy Arceri2018-08-207-40/+0
| | | | Reviewed-by: Ian Romanick <[email protected]>
* util: remove unused S3TC translation for dri configTimothy Arceri2018-08-206-39/+0
| | | | Reviewed-by: Ian Romanick <[email protected]>
* mesa: remove dri configs unused software-fallback optionsTimothy Arceri2018-08-207-62/+0
| | | | | | | These seems to have only been used by DRI1 drivers which were removed with e4344161bde2. Reviewed-by: Ian Romanick <[email protected]>
* mesa: remove unused dri config option excess_mipmapTimothy Arceri2018-08-201-5/+0
| | | | | | | This seems to have only been used by DRI1 drivers which were removed with e4344161bde2. Reviewed-by: Ian Romanick <[email protected]>
* mesa: remove unused dri config option performance_boxesTimothy Arceri2018-08-207-29/+0
| | | | | | | This seems to have only been used by DRI1 drivers which were removed with e4344161bde2. Reviewed-by: Ian Romanick <[email protected]>
* util: mark s as MAYBE_UNUSED in _mesa_half_to_unorm8Kai Wasserbäch2018-08-181-1/+2
| | | | | | | | | | | | | Only used, when asserts are enabled. Fixes an unused-variable warning with gcc-8: ../../../src/util/half_float.c: In function '_mesa_half_to_unorm8': ../../../src/util/half_float.c:189:14: warning: unused variable 's' [-Wunused-variable] const int s = (val >> 15) & 0x1; ^ Signed-off-by: Kai Wasserbäch <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* util: add drirc workarounds for RAGETimothy Arceri2018-08-181-0/+8
| | | | | This allows the game to run on wine (tested on radeonsi where we have compat profile support).
* util: better handle program names from wineTimothy Arceri2018-08-181-5/+12
| | | | | | | | | | | | For some reason wine will sometimes give us a windows style path for an application. For example when running the 64bit version of Rage wine gives a Unix style path, but when running the 32bit version is gives a windows style path. If we detect no '/' in the path at all it should be safe to assume we have a wine application and instead look for a '\'. Reviewed-by: Eric Engestrom <[email protected]>
* loader: add dri_driver option to override dri driver to loadQiang Yu2018-08-171-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | drirc implementation of MESA_LOADER_DRIVER_OVERRIDE which can be used to override dri driver to load. Usage: override dri driver for device with spec kernel driver name: <device kernel_driver="kernel_driver_name"> <option name="dri_driver" value="new_dri_driver" /> </device> or <device driver="loader" kernel_driver="kernel_driver_name"> <option name="dri_driver" value="new_dri_driver" /> </device> v2: add kernel_driver device attribute to specify kernel driver name instead of reuse driver attribute v3: seperate loader_get_kernel_driver_name into another patch seperate add kernel_driver attribute into another patch Suggested-by: Michel Dänzer <[email protected]> Signed-off-by: Qiang Yu <[email protected]> Acked-by: Michel Dänzer <[email protected]> Reviewed-by: Emil Velikov <[email protected]> [v4 Emil: add HAVE_LIBDRM guard around __driConfigOptionsLoader and loader_get_dri_config_driver] Signed-off-by: Emil Velikov <[email protected]>
* xmlconfig: add kernel_driver device attributeQiang Yu2018-08-172-5/+12
| | | | | | | | | This attribute can be used by loader to apply different option to device use specific kernel driver. Signed-off-by: Qiang Yu <[email protected]> Acked-by: Michel Dänzer <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* driconf: move ${sysconfdir}/drirc to ${datadir}/drirc.d/00-mesa-defaults.confQiang Yu2018-08-173-3/+4
| | | | | | | | | ${sysconfdir} is for store admin config files, so move this mesa default config file to ${datadir}/drirc.d. Signed-off-by: Qiang Yu <[email protected]> Acked-by: Michel Dänzer <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* xmlconfig: read more config files from drirc.d/Qiang Yu2018-08-173-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | Driver and application can put their drirc files in ${datadir}/drirc.d/ with name xxx.conf. Config files will be read and applied in file name alphabetic order. So there are three places for drirc listed in order: 1. /usr/share/drirc.d/ 2. /etc/drirc 3. ~/.drirc v4: fix meson build v3: 1. seperate driParseConfigFiles refine into another patch 2. fix entries[i] mem leak v2: drop /etc/drirc.d Signed-off-by: Qiang Yu <[email protected]> Acked-by: Michel Dänzer <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* xmlconfig: refine driParseConfigFiles to use parseOneConfigFileEmil Velikov2018-08-171-34/+29
| | | | | | | | | | Also prepare for the usage of following parseConfigDir patch. Signed-off-by: Qiang Yu <[email protected]> Acked-by: Michel Dänzer <[email protected]> Reviewed-by: Emil Velikov <[email protected]> [Emil: add #include <limits.h>] Signed-off-by: Emil Velikov <[email protected]>
* python: Open the template as text, with an explicit encodingMathieu Bridon2018-08-171-3/+2
| | | | | | | | | | | | | | | | | | | In commit bd27203f4d808763ac24ac94eb677cacf3e7cb99 we changed this to open in binary mode, to then explicitly decode the lines with the right encoding. Unfortunately, that broke the build on Windows, where the template file can have '\r\n' as line terminators: opening in binary mode would keep those terminators and break the regexp. We need to go back to text mode, where the "universal newlines" mode takes care of this. However, to fix the initial issue, let's specify the encoding explicitly when opening the file, and make sure it is open in text mode, so we only get unicode strings. Reviewed-by: Jose Fonseca <jfonseca@vmware>
* python: Help Python 2 print the lineMathieu Bridon2018-08-171-0/+5
| | | | Reviewed-by: Jose Fonseca <jfonseca@vmware>
* meson: Build with Python 3Mathieu Bridon2018-08-102-2/+2
| | | | | | | | | | | | Now that all the build scripts are compatible with both Python 2 and 3, we can flip the switch and tell Meson to use the latter. Since Meson already depends on Python 3 anyway, this means we don't need two different Python stacks to build Mesa. Signed-off-by: Mathieu Bridon <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* python: Rework bytes/unicode string handlingMathieu Bridon2018-08-101-10/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In both Python 2 and 3, opening a file without specifying the mode will open it for reading in text mode ('r'). On Python 2, the read() method of a file object opened in mode 'r' will return byte strings, while on Python 3 it will return unicode strings. Explicitly specifying the binary mode ('rb') then decoding the byte string means we always handle unicode strings on both Python 2 and 3. Which in turns means all re.match(line) will return unicode strings as well. If we also make expandCString return unicode strings, we don't need the call to the unicode() constructor any more. We were using the ugettext() method because it always returns unicode strings in Python 2, contrarily to the gettext() one which returns byte strings. The ugettext() method doesn't exist on Python 3, so we must use the right method on each version of Python. The last hurdles are that Python 3 doesn't let us concatenate unicode and byte strings directly, and that Python 2's stdout wants encoded byte strings while Python 3's want unicode strings. With these changes, the script gives the same output on both Python 2 and 3. Signed-off-by: Mathieu Bridon <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* 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]>