Timothy Arceri
593ef166ae
disk_cache: create new helper for writing cache items to disk
...
This pulls out the cache item writing code from cache_put() into
a new helper. In this patch we also move various functions called
by this code into the new disk_cache_os.c file.
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6197 >
2020-09-11 06:03:58 +00:00
Timothy Arceri
b4a3a80403
disk_cache: move evict_lru_item() to an OS specific helper
...
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6197 >
2020-09-11 06:03:58 +00:00
Timothy Arceri
e1236470dc
disk_cache: move munmap into an OS specific helper
...
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6197 >
2020-09-11 06:03:58 +00:00
Timothy Arceri
889356e731
disk_cache: move index mmap into OS specific helper
...
This will make windows support easier to add in future.
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6197 >
2020-09-11 06:03:58 +00:00
Timothy Arceri
62c4339118
disk_cache: add disk_cache_enabled() helper
...
This will make windows support easier to add in future.
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6197 >
2020-09-11 06:03:58 +00:00
Timothy Arceri
4339ecde35
disk_cache: move cache dir generation into OS specific helper file
...
This will make windows support easier to add in future. To avoid code
churn this temporarily duplicates the mkdir_if_needed() function, we
will delete the duplicate in a following patch.
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6197 >
2020-09-11 06:03:58 +00:00
Pierre-Eric Pelloux-Prayer
265a3b9624
driconf: add option to reuse GL names
...
Fix apps expecting name recycling.
https://gitlab.freedesktop.org/mesa/mesa/-/issues/3144 is an example
of such issue, SPECviewperf13 has this problem too.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6600 >
2020-09-10 09:09:34 +02:00
Pierre-Eric Pelloux-Prayer
553d371933
util/idalloc: add lowest_free_idx to avoid iterating from 0
...
lowest_free_idx is a conservative estimation of the lowest index
where a free id can be found.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6600 >
2020-09-10 09:07:11 +02:00
Pierre-Eric Pelloux-Prayer
e808d38299
util/idalloc: add util_idalloc_reserve
...
Can be used to mark an id as used (if it was reclaimed without using
util_idalloc_alloc).
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6600 >
2020-09-10 09:07:11 +02:00
Pierre-Eric Pelloux-Prayer
87ef970ee6
mesa: move u_idalloc from gallium/aux/util to util
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6600 >
2020-09-10 09:07:03 +02:00
Nanley Chery
c3c99f4571
st/mesa: Don't map all P01X DRM formats to P016
...
Allow gallium drivers to distinguish between the P010, P012, and P016
DRM formats.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6486 >
2020-09-09 20:02:03 +00:00
Bas Nieuwenhuizen
cf2eebdf4f
radv,gallium: Add driconf option to reduce advertised VRAM size.
...
To help debugging games that actually do active memory budget
management.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6641 >
2020-09-08 23:59:35 +00:00
Bas Nieuwenhuizen
9b3491870f
radeonsi: Work around Wasteland 2 bug.
...
Confirmed by an user on AMD HW that this driconf flag works
around the issue.
Gitlab: https://gitlab.freedesktop.org/mesa/mesa/-/issues/1535
CC: mesa-stable
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6637 >
2020-09-07 19:41:56 +00:00
Mauro Rossi
be2818387d
android: util: fix missing include path
...
Fixes the following building error:
external/mesa/src/util/format/u_format_bptc.c:28:10:
fatal error: 'u_format_pack.h' file not found
^~~~~~~~~~~~~~~~~
1 error generated.
Fixes: 8d38b2578 ("util: Explicitly call the unpack functions from inside bptc pack/unpack.")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6619 >
2020-09-06 20:42:56 +02:00
Pierre-Eric Pelloux-Prayer
a1c2bd6ce8
radeonsi: use radeonsi_clamp_div_by_zero for SPECviewperf13, Road Redemption
...
Fixes SPECviewperf 13 creo rendering.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2639
Cc: mesa-stable
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6259 >
2020-09-02 11:53:16 +02:00
Jonathan Gray
b30bd6fe5f
util/os_misc: os_get_available_system_memory() for OpenBSD
...
Return the smallest value of available non-kernel physical memory and
the static per process data size limit as the amount of available
system memory on OpenBSD.
Fixes: b80930a6fe ("anv: add support for VK_EXT_memory_budget")
Signed-off-by: Jonathan Gray <jsg@jsg.id.au >
Acked-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6517 >
2020-09-02 12:15:07 +10:00
Jonathan Gray
033dcb2978
util/os_misc: add os_get_available_system_memory()
...
Add os_get_available_system_memory() derived from
src/intel/vulkan/anv_device.c get_available_system_memory()
Fixes: b80930a6fe ("anv: add support for VK_EXT_memory_budget")
Signed-off-by: Jonathan Gray <jsg@jsg.id.au >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6517 >
2020-09-02 12:14:56 +10:00
Karol Herbst
76a1fb3b42
util: add helpers to define bitwise operators on enums for C++
...
Signed-off-by: Karol Herbst <kherbst@redhat.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6520 >
2020-09-01 17:45:08 +00:00
Jonathan Gray
55765f80b9
util/u_thread: include pthread_np.h if found
...
Required for pthread_set_name_np() on OpenBSD as there is no
pthread_setaffinity_np() to define PTHREAD_SETAFFINITY_IN_NP_HEADER.
Fixes: dcf9d91a80 ("util: Handle differences in pthread_setname_np")
Signed-off-by: Jonathan Gray <jsg@jsg.id.au >
Reviewed-by: Eric Engestrom <eric@engestrom.ch >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5630 >
2020-08-31 09:14:57 +00:00
Jonathan Gray
c66c5b38e0
util: futex fixes for OpenBSD
...
Fix absolute to relative timeout computation.
Add sanity checks to futex_wait()
- handle the NULL timeout pointer case
- avoid negative cases.
From Matthieu Herrb and Scott Cheloha.
Fixes: c91997b6c4 ("util/futex: use futex syscall on OpenBSD")
Signed-off-by: Jonathan Gray <jsg@jsg.id.au >
Acked-by: Eric Engestrom <eric@engestrom.ch >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5630 >
2020-08-31 09:14:57 +00:00
Jonathan Gray
6e9c0661f8
util/anon_file: add OpenBSD shm_mkstemp() path
...
memfd_create() is a linux syscall replace the use of it with
shm_mkstemp() on OpenBSD.
unconditionally include stdlib.h for mkstemp()/mkostemp()
Fixes: c0376a1234 ("util: add anon_file.h for all memfd/temp file usage")
Signed-off-by: Jonathan Gray <jsg@jsg.id.au >
Reviewed-by: Eric Engestrom <eric@engestrom.ch >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5630 >
2020-08-31 09:14:57 +00:00
Jonathan Gray
7eab6845e9
util: unbreak endian detection on OpenBSD
...
Since cbee1bfb34 endian.h is unconditionally
used if available.
glibc has byte order defines with two leading underscores. OpenBSD
has private defines with a single leading underscore in machine/endian.h
and public defines in endian.h with no underscore.
The code under the endian.h block did not check if symbols were
defined before equating them so '#if __BYTE_ORDER == __LITTLE_ENDIAN'
would turn into '#if 0 == 0' which is always true.
Fixes: cbee1bfb34 ("meson/configure: detect endian.h instead of trying to guess when it's available")
Signed-off-by: Jonathan Gray <jsg@jsg.id.au >
Reviewed-by: Eric Engestrom <eric@engestrom.ch >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5630 >
2020-08-31 09:14:57 +00:00
Lepton Wu
a4c708dd24
util/ralloc: fix ralloc alignment.
...
On some malloc implementation, malloc doesn't always align to 16
bytes even on 64 bits system. To make sure ralloc_header always
starts at the wanted alignment, just force the size to be aligned at
the alignment of ralloc_header. This fixes crashed on instruction
like "movaps %xmm0,0x10(%rax)" which requires aligned memory access.
Signed-off-by: Lepton Wu <lepton@chromium.org >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6314 >
2020-08-21 18:22:21 +00:00
Rhys Perry
391eeb7443
util: add a alignof() macro
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6206 >
2020-08-20 10:52:19 +00:00
Eric Anholt
8d38b25788
util: Explicitly call the unpack functions from inside bptc pack/unpack.
...
We were calling the table-based unpack functions from inside the pack and
unpack table's methods, so if anything included these pack functions (such
as a call to a table-based pack function), you'd pull in all of unpack as
well.
By calling them explicitly, we save some overhead in these functions
(switch statement, address math on the zero x,y arguments) anyway.
Reviewed-by: Jonathan Marek <jonathan@marek.ca >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6307 >
2020-08-20 05:03:16 +00:00
Eric Anholt
edf0aeb3cd
util: Expose rgba unpack/fetch functions as external functions as well.
...
Like we just did for pack functions for freedreno, it will be useful to be
able to pick out a specific rgba unpack function instead of going through
the table.
Reviewed-by: Jonathan Marek <jonathan@marek.ca >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6307 >
2020-08-20 05:03:16 +00:00
Bas Nieuwenhuizen
0067f89920
radv: Override the uniform buffer offset alignment for World War Z.
...
Game does the equivalent of a
ALIGN(..., minUniformBufferOffsetAlignment >> 4)
which breaks when said alignment is <16 with a SIGFPE.
CC: <mesa-stable@lists.freedesktop.org >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6120 >
2020-08-18 20:31:15 +02:00
Bas Nieuwenhuizen
a1d4721e21
driconf: Support selection by Vulkan applicationName.
...
This adds applicationName + version through like engineName.
Rationale: A game (World War Z) includes the store name in the
executable name, so has multiple executable names.
CC: <mesa-stable@lists.freedesktop.org >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6120 >
2020-08-18 20:31:07 +02:00
Dave Airlie
5a9eba4acd
util/format: add some ZS helpers for vallium
...
The vallium layer has a requirement to insert and extra the 24-bit
unorm value as a unorm value (not as a float etc). Add helpers
to facilitate that.
Reviewed-by: Roland Scheidegger <sroland@vmware.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6082 >
2020-08-17 14:30:50 +10:00
Eric Anholt
5b8d67cb64
util: Move fetch_rgba to a separate function table.
...
Only llvmpipe and translate_generic use it, and only in fallbacks, so if
you're not building that then let's not bloat our binaries with it.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6305 >
2020-08-16 21:25:14 +00:00
Eric Anholt
9cc84369b7
util: Mark the format description getter functions as const.
...
This lets the compiler CSE calls to them on the same format. This is
particularly relevant for the description table lookup calls, which other
inlines might do internally.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6305 >
2020-08-16 21:25:14 +00:00
Eric Anholt
35b22b5da0
util: Make all 3 fetch_rgba functions occupy the same function slot.
...
A single format either had the float, the sint, or the uint version.
Making the dst be void * lets us store them in the same slot and not have
logic in the callers to call the right one.
-6kb on gallium drivers
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6305 >
2020-08-16 21:25:14 +00:00
Eric Anholt
80babbbf7e
uitl: Add R1_UNORM to the list of noaccess (no pack/unpack) formats.
...
The functions were just stubs, if you called them you would be terribly
disappointed.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6305 >
2020-08-16 21:25:14 +00:00
Mauro Rossi
aa8661141a
android: util/format: fix generated sources rules
...
Changes are necessary after commit 84ed2d098
("util/format: expose generated format packing functions through a header")
because script for format/u_format_pack.h has different commandline
compared to existing pattern
Generated sources rules are ported from meson
Fixes: 84ed2d098 ("util/format: expose generated format packing functions through a header")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com >
Reviewed-by: Eric Engestrom <eric@engestrom.ch >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6319 >
2020-08-14 23:29:51 +02:00
Karol Herbst
16f858968f
util/set: add _mesa_set_intersects
...
v2 (Jason Ekstrand): add asserts and iterate over smaller set
Signed-off-by: Karol Herbst <kherbst@redhat.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2401 >
2020-08-14 20:35:36 +00:00
Jesse Natalie
65d7172d17
util/macros: Add ATTRIBUTE_NOINLINE definition for MSVC
...
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6303 >
2020-08-13 23:18:36 +00:00
Jesse Natalie
58af31186a
u_debug_stack_test: Fix MSVC compiling by using ATTRIBUTE_NOINLINE
...
Fixes: d0d14f3f ("util: Add unit test for stack backtrace caputure")
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6303 >
2020-08-13 23:18:36 +00:00
Jonathan Marek
84ed2d0980
util/format: expose generated format packing functions through a header
...
Some of the generated functions can be useful without going through the
format table (filling border color struct in turnip). By not calling these
functions through the format table, we should eventually be able to garbage
collect the unused packing functions, and also allows LTOs to happen.
Signed-off-by: Jonathan Marek <jonathan@marek.ca >
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6093 >
2020-08-13 16:54:06 +00:00
Eric Anholt
33e69203d2
util: Fix up indentation in the generated format tables code.
...
I did this as a separate commit to make the previous one more reviewable.
Acked-by: Matt Turner <mattst88@gmail.com >
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5826 >
2020-08-12 14:22:24 -07:00
Eric Anholt
9fd0f455af
util: Change a codegenned switch statement to a nice little table.
...
This saves us 13 to 35kb on release drivers in my builds.
Acked-by: Matt Turner <mattst88@gmail.com >
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5826 >
2020-08-12 14:22:24 -07:00
Eric Anholt
4064a6cd20
util: Split the pack/unpack functions out of the format desc.
...
This gives the compiler a chance to GC pack/unpack functions separate from
the format descriptions. For drivers that use everything, this is
+10-20kb, while for libvulkan_intel it's -1.3MB.
Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1048434
Acked-by: Matt Turner <mattst88@gmail.com >
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5826 >
2020-08-12 13:13:39 -07:00
Vinson Lee
96cfc684e6
util: Fix memory leaks in unit test.
...
Fix warnings reported by Coverity Scan.
Resource leak (RESOURCE_LEAK)
leaked_storage: Variable bt1 going out of scope leaks the storage
it points to.
leaked_storage: Variable bt2 going out of scope leaks the storage
it points to.
Fixes: d0d14f3f64 ("util: Add unit test for stack backtrace caputure")
Signed-off-by: Vinson Lee <vlee@freedesktop.org >
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6246 >
2020-08-11 14:11:01 -07:00
Eric Engestrom
7fbadfc385
driconf: fix force_gl_vendor description
...
The option is not a toggle to "allow GPU vendor to be overridden", it
*is* the override.
Fixes: dca119f12c ("mesa/gallium: add dric option to allow overriding GL vendor string")
Signed-off-by: Eric Engestrom <eric@engestrom.ch >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6207 >
2020-08-08 14:26:08 +00:00
Vinson Lee
2e665458a9
util: Fix SCons build.
...
Fixes: 848e7b947d ("util: Move stack debug functions to src/util")
Signed-off-by: Vinson Lee <vlee@freedesktop.org >
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6199 >
2020-08-05 22:55:06 -07:00
Kristian H. Kristensen
5ae7098eba
gallium/android: Rewrite backtrace helper for android
...
The previous implementation kept a hashtable of a Backtrace object per
thread. debug_backtrace_capture is supposed to store a backtrace in
the passed in debug_stack_frame array, but instead overwrote the
per-thread Backtrace object.
This new version works more like the libunwind based capture. We hash
the file and symbol names and store pointers in the debug_stack_frame
struct. This way debug_backtrace_capture doesn't overwrite previous
captures or allocate memory that needs to be freed.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6112 >
2020-08-05 18:08:06 +00:00
Kristian H. Kristensen
d0d14f3f64
util: Add unit test for stack backtrace caputure
...
First test never fails, but exercises the code and is useful for
manual inspection. Second test exposes the android implementation
bug.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6112 >
2020-08-05 18:08:06 +00:00
Kristian H. Kristensen
848e7b947d
util: Move stack debug functions to src/util
...
Reviewed-by: Eric Engestrom <eric@engestrom.ch >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6112 >
2020-08-05 18:08:06 +00:00
Marcin Ślusarz
28f2585365
util/format: initialize non-important components to 0
...
Avoids copying random garbage from the stack.
Found by Coverity.
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6067 >
2020-07-30 10:41:00 +00:00
Marcin Ślusarz
f13042ec7e
util: fix possible buffer overflow in util_get_process_exec_path
...
Found by Coverity.
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com >
Fixes: f8f1413070 ("util/u_process: add util_get_process_exec_path")
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6067 >
2020-07-30 10:41:00 +00:00
Marcin Ślusarz
eac0ba7fc1
util: fix possible fd leaks in os_socket_listen_abstract
...
Found by Coverity.
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com >
Fixes: ef5266ebd5 ("util/os_socket: Add socket related functions.")
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6067 >
2020-07-30 10:41:00 +00:00