aboutsummaryrefslogtreecommitdiffstats
path: root/src/util
Commit message (Collapse)AuthorAgeFilesLines
* util/os_file: always use the 'grow' mechanismEric Engestrom2019-05-161-42/+20
| | | | | | | | | | | | | Use fstat() only to pre-allocate a big enough buffer. This fixes a race where if the file grows between fstat() and read() we would be missing the end of the file, and if the file slims down read() would just fail. Fixes: 316964709e21286c2af5 "util: add os_read_file() helper" Reported-by: Jason Ekstrand <[email protected]> Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* util/ra: Assert nodes are in-bounds in add_node_interferenceJason Ekstrand2019-05-141-0/+1
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* util/ra: Don't destroy the graph in ra_allocate()Jason Ekstrand2019-05-141-76/+102
| | | | | | | | | | | | We want to be able to call ra_allocate() and, when it fails, mutate the graph and try again rather than re-building the graph from scratch. This commit moves all the scratch bits except the final register allocation (which is really an out value not scratch) into sub-structs named "tmp" to make it clear which things are scratch. It also adds bits to the ra_select() initialization loop to initialize things (since we can't trust rzalloc anymore) and copy q_test and forced_reg over. Reviewed-by: Eric Anholt <[email protected]>
* util/ra: Add a helper for resetting a node's interferenceJason Ekstrand2019-05-142-0/+37
| | | | Reviewed-by: Eric Anholt <[email protected]>
* util/ra: Add helpers for adding nodes to an interference graphJason Ekstrand2019-05-142-20/+72
| | | | Reviewed-by: Eric Anholt <[email protected]>
* util/ralloc: Add helpers for growing zero-initialized memoryJason Ekstrand2019-05-142-0/+87
| | | | | | | Unfortunately, we can't quite follow the standard C conventions for these because ralloc doesn't know the sizes of pointers. Reviewed-by: Eric Anholt <[email protected]>
* util/ra: Improve the performance of ra_simplifyJason Ekstrand2019-05-141-30/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The most expensive part of register allocation is the ra_simplify step which is a fixed-point algorithm with a worst-case complexity of O(n^2) which adds the registers to a stack which we then use later to do the actual allocation. This commit uses bit sets and changes the core loop of ra_simplify to first walk 32-node chunks and then walk each chunk. This lets us skip whole 32-node chunks in one go based on bit operations and compute the minimum q value potentially 32x as fast. Of course, the algorithm still has the same fundamental O(n^2) run-time but the constant is now much lower. In the nasty Aztec Ruins compute shader, this shaves a full four seconds off the 30s compile time for a release build of mesa. In a debug build (needed for accurate stack traces), perf says that ra_select takes 20% of runtime before this patch and only 5-6% of runtime after this patch. It also makes shader-db runs faster. Shader-db results on Kaby Lake: total instructions in shared programs: 15311100 -> 15311100 (0.00%) instructions in affected programs: 0 -> 0 helped: 0 HURT: 0 total cycles in shared programs: 355468050 -> 355468050 (0.00%) cycles in affected programs: 0 -> 0 helped: 0 HURT: 0 Total CPU time (seconds): 2602.37 -> 2524.31 (-3.00%) Reviewed-by: Eric Anholt <[email protected]>
* util/ra: Only update q_total if the reg is not assignedJason Ekstrand2019-05-141-1/+1
| | | | | | | | We only use q_total if the reg is not assigned so there's no point in updating it if the reg is not assigned. This has no known perf benefit but it will reduce churn in a future commit. Reviewed-by: Eric Anholt <[email protected]>
* util/ra: Only update best_optimistic_node if !progressJason Ekstrand2019-05-141-1/+5
| | | | | | | This shaves about half a second off the 30 second compile time of one of the compute shaders in Aztec ruins. Reviewed-by: Eric Anholt <[email protected]>
* util/ra: Make in_stack a bitset in the graphJason Ekstrand2019-05-141-18/+15
| | | | Reviewed-by: Eric Anholt <[email protected]>
* util/ra: Get rid of tabsJason Ekstrand2019-05-142-28/+28
| | | | Reviewed-by: Eric Anholt <[email protected]>
* v3d: Use driconf to expose non-MSAA texture limits for Xorg.Eric Anholt2019-05-132-1/+9
| | | | | | The V3D 4.2 HW has a limit to MSAA texture sizes of 4096. With non-MSAA, we can go up to 7680 (actually probably 8138, but that hasn't been validated by the HW team). Exposing 7680 in X11 will allow dual 4k displays.
* util/set: Add a helper to resize a setJason Ekstrand2019-05-132-0/+16
| | | | | | | | | Often times you don't know how big a set will be and you want the code to just grow it as needed. However, sometimes you do know and you can avoid a lot of rehashing if you just specify a size up-front. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Thomas Helland <[email protected]>
* util/set: Add a search_and_add functionJason Ekstrand2019-05-132-5/+31
| | | | | | | | | This function is identical to _mesa_set_add except that it takes an extra out parameter that lets the caller detect if a replacement happened. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Thomas Helland <[email protected]>
* radeonsi: add config entry for Counter-Strike Global OffensiveTimothy Arceri2019-05-071-0/+3
| | | | | | | | | This fixes rendering issues with gun scopes which is rather important. Cc: "19.0" "19.1" <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100239
* util/drirc: add workarounds for bugs in Doom 3: BFGTimothy Arceri2019-05-061-0/+5
| | | | | | | | This makes the game playable on radeonsi. Cc: "19.0" "19.1" <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110143
* tests/vma: fix build with MSVCDylan Baker2019-05-031-0/+8
| | | | Reviewed-by: Eric Anholt <[email protected]>
* util/tests: Use define instead of VLADylan Baker2019-05-035-20/+25
| | | | | | | To allow the this test to be built with MSVC, which doesn't support VLAs. Reviewed-by: Eric Anholt <[email protected]>
* util/bitset: fix bitset range mask calculations.Dave Airlie2019-05-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | The MASK macro is used in the RANGE macro, and it should return the pre-bitset word mask for the (b) value. i.e. BITSET_MASK(0) should be undefined since it's meaningless. BITSET_MASK(31) should give 0x7fffffff BITSET_MASK(32) should give 0xffffffff BITSET_MASK(33) should give 0x00000001 BITSET_MASK(64) should give 0xffffffff However then BITSET_RANGE ends up broken for cases where it's (b) value is the 0,32,64 value as in that case the lower mask would be 0 not 0xffffffff. This fixes the unit tests that I've added, and my code that uses bitsets. Reviewed-by: Jason Ekstrand <[email protected]> Fixes: bb38cadb1c5f2 "More GLSL code" Reviewed-by: Kristian H. Kristensen <[email protected]>
* util/tests: add basic unit tests for bitsetDave Airlie2019-05-032-0/+141
| | | | | | | The last test here currently fails as there is a bug in bitset.h Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* util/bitset: Return an actual bool from test macrosJason Ekstrand2019-05-021-2/+2
| | | | | | | | | I want to be able to do BITSET_TEST() != BITSET_TEST() and this isn't currently possible because BITSET_TEST() returns a random bit. Compare to zero to get an actual Boolean. Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* util: move #include out of #if linuxEric Engestrom2019-05-011-1/+1
| | | | | | | | | This #include is needed for `NULL`, which is used on all OSes, not just Linux. Reported-by: Juan A. Suarez Romero <[email protected]> Fixes: 316964709e21286c2af5 "util: add os_read_file() helper" Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Juan A. Suarez <[email protected]>
* st/nine: Control shader constant inlining with drircAxel Davy2019-04-301-0/+5
| | | | | | | Until we use async shader compilation for constant inlining, don't enable it unless user asks for it. Signed-off-by: Axel Davy <[email protected]>
* drirc: Add Gallium nine workaround for Rayman LegendsAxel Davy2019-04-301-0/+5
| | | | | | The game requires it to display many textures properly. Signed-off-by: Axel Davy <[email protected]>
* st/nine: Add drirc option to use data_internal for dynamic texturesAxel Davy2019-04-301-0/+5
| | | | | | | | | | | | | | dynamic textures seem to have predictable stride. This stride should be the same as for a ram buffer. It seems some game don't check the actual stride value, assuming it to be the expected one. Thus this workaround (protected by drirc option) is to use an intermediate ram buffer. Fixes Rayman Legends texture issues when enabled. Signed-off-by: Axel Davy <[email protected]>
* util: add os_read_file() helperEric Engestrom2019-04-304-0/+158
| | | | | | | | readN() taken from igt. os_read_file() inspired by igt_sysfs_get() Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* delete autotools .gitignore filesEric Engestrom2019-04-293-22/+0
| | | | | | | | One special case, `src/util/xmlpool/.gitignore` is not entirely deleted, as `xmlpool.pot` still gets generated (eg. by `ninja xmlpool-pot`). Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* radeonsi: add si_debug_options for convenient adding/removing of optionsNicolai Hähnle2019-04-252-15/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the definition of radeonsi_clear_db_cache_before_clear there, as well as radeonsi_enable_nir. This removes the AMD_DEBUG=nir option. We currently still have two places for options: the driconf machinery and AMD_DEBUG/R600_DEBUG. If we are to have a single place for options, then the driconf machinery should be preferred since it's more flexible. The only downside of the driconf machinery was that adding new options was quite inconvenient. With this change, a simple boolean option can be added with a single line of code, same as for AMD_DEBUG. One technical limitation of this particular implementation is that while almost all driconf features are available, the translation machinery doesn't pick up the description strings for options added in si_debvug_options. In practice, translations haven't been provided anyway, and this is intended for developer options, so I'm not too worried. It could always be added later if anybody really cares. v2: - use bool instead of uint8_t for options - si_debug_options.inc -> si_debug_options.h Reviewed-by: Marek Olšák <[email protected]>
* drirc: Add workaround for Epic Games LauncherDanylo Piliaiev2019-04-221-0/+4
| | | | | | | | | | | | Epic Games Launcher could be launched in opengl mode with "-opengl" option. It creates 4.4 opengl core context however it uses deprecated functionality e.g. default vertex buffer object. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110462 Signed-off-by: Danylo Piliaiev <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
* ralloc: Fully qualify non-virtual destructor callKristian H. Kristensen2019-04-191-1/+1
| | | | | | | | | | | | This suppresses warning about calling a non-virtual destructor in a non-final class with virtual functions: src/compiler/glsl/ast.h:53:4: warning: destructor called on non-final 'ast_node' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor] DECLARE_LINEAR_ZALLOC_CXX_OPERATORS(ast_node); Signed-off-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* drirc: add Spectacle, Falkon to a-sync blacklistgrmat2019-04-151-0/+6
| | | | | | Spectacle is the plasma screenshot utility Falkon is a KDE web browser that should succeed Konqueror
* drirc: add Waterfox to adaptive-sync blacklist davidbepo2019-04-151-0/+3
|
* drirc: add Budgie WM to adaptive-sync blacklistEl Christianito2019-04-151-0/+3
| | | | | | | Budgie Window Manager is an increasingly used alternative to GNOME and MATE. Default in Solus OS, also used in other distros. Signed-off-by: Marek Olšák <[email protected]>
* Delete autotoolsDylan Baker2019-04-157-425/+0
| | | | | | | | | | Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Acked-by: Marek Olšák <[email protected]> Acked-by: Jason Ekstrand <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Matt Turner <[email protected]>
* u_dynarray: add util_dynarray_grow_capQiang Yu2019-04-111-6/+17
| | | | | | | | | | | | | This is for the case that user only know a max size it wants to append to the array and enlarge the array capacity before writing into it. v2: - rename newsize to newcap - rename util_dynarray_enlarge to util_dynarray_grow_cap Signed-off-by: Qiang Yu <[email protected]> Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
* u_math: add ushort_to_float/float_to_ushortQiang Yu2019-04-111-0/+31
| | | | | | | | v2: - return 0 for NaN too Signed-off-by: Qiang Yu <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
* util/process: document memory leakEric Engestrom2019-04-041-0/+4
| | | | | | | | We consider it acceptable, but let's still document it in case people notice it and are not sure why it's there. Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* util/queue: add util_queue_adjust_num_threadsMarek Olšák2019-04-012-6/+52
| | | | | | for ARB_parallel_shader_compile Reviewed-by: Ian Romanick <[email protected]>
* util/queue: hold a lock when reading num_threads in util_queue_finishMarek Olšák2019-04-011-3/+3
| | | | Reviewed-by: Ian Romanick <[email protected]>
* util/queue: add ability to kill a subset of threadsMarek Olšák2019-04-012-21/+36
| | | | for ARB_parallel_shader_compile
* util/queue: move thread creation into a separate functionMarek Olšák2019-04-011-24/+32
| | | | Reviewed-by: Ian Romanick <[email protected]>
* util: no-op __builtin_types_compatible_p() for non-GCC compilersBrian Paul2019-03-291-0/+4
| | | | | | | | | | | | | | __builtin_types_compatible_p() is GCC-specific and breaks the MSVC build. This intrinsic has been in u_vector_foreach() for a long time, but that macro has only recently been used in code (nir/nir_opt_comparison_pre.c) that's built with MSVC. Fixes: 2cf59861a ("nir: Add partial redundancy elimination for compares") Reviewed-by: José Fonseca <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* util/disk_cache: close fd in the fallback pathEric Engestrom2019-03-281-4/+3
| | | | | | | | | There are multiple `goto path_fail` with an open fd, but none that go to `fail:` without going through `path_fail:` first, so let's just move the `close(fd)` there. Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>
* android: static link with libexpat with Android O+Kishore Kadiyala2019-03-251-0/+6
| | | | | | | | | | | | | In Android O, MESA needs to statically link libexpat so that it's in same VNDK namespace. v2: apply change also to anv driver (Tapani) v3: use += in anv change (Eric Engestrom) Change-Id: I82b0be5c817c21e734dfdf5bfb6a9aa1d414ab33 Signed-off-by: Kishore Kadiyala <[email protected]> Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* util: Add a drm_find_modifier helperAlyssa Rosenzweig2019-03-141-0/+55
| | | | | | | | | | | | | | This function is replicated across vc4/v3d/freedreno and is needed in Panfrost; let's make this shared code. v2: Supply generic util_array_contains_u64 version (Eric Engestrom). Add missing stdbool.h include (Eric Anholt). Mark inline (Christian Gmeiner). Signed-off-by: Alyssa Rosenzweig <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Rob Clark <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* util: Add a DAG datastructure.Eric Anholt2019-03-114-0/+222
| | | | | | I keep writing this for various schedulers. Acked-by: Timothy Arceri <[email protected]>
* util: #define PATH_MAX when undefined (eg. Hurd)Eric Engestrom2019-03-051-0/+4
| | | | | | | Cc: Timo Aaltonen <[email protected]> Cc: James Clarke <[email protected]> Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* util: emulate futex on FreeBSD using umtxGreg V2019-03-031-0/+34
| | | | | | Obtained from: FreeBSD ports Acked-by: Emil Velikov <[email protected]> Acked-by: Eric Engestrom <[email protected]>
* driconf: add DTD to allow the drirc xml (00-mesa-defaults.conf) to be validatedEric Engestrom2019-02-282-1/+28
| | | | | | | | This DTD can be used to validate the drirc xml: $ xmllint --noout --valid 00-mesa-defaults.conf Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* util/os_misc: Add check for PIPE_OS_HURDTimo Aaltonen2019-02-271-2/+2
| | | | | | | | Fix build on Hurd. Signed-off-by: Timo Aaltonen <[email protected]> Acked-by: Eric Engestrom <[email protected]> Acked-by: Emil Velikov <[email protected]>