Commit Graph

1936 Commits

Author SHA1 Message Date
Dylan Baker 6a5863df82 util/glsl2spriv: make --vn required
I'm not 100% sure whether it's right to make --vn required, or to avoid
the static conversion, but this seems correct. Mypy (type checking
coming soon) points out that if --vn is None then the
convert_to_static_variable function will fail. Our one use of this sets
--vn, so there is no change there. Making --vn required
ensures that it will never be None, avoiding the problem.

Reviewed-by: Luis Felipe Strano Moraes <luis.strano@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19449>
2022-11-10 21:14:17 +00:00
Dylan Baker 4ffa8a9ac0 util/glsl2spirv: fix appending extra flags
The variable is called `extra`, but what's written is `extra - flags`,
and `flags` is undefined, so if the variable was ever passed there would
be an uncaught exception.

fixes: 9786d9ef2a

Reviewed-by: Luis Felipe Strano Moraes <luis.strano@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19449>
2022-11-10 21:14:17 +00:00
Dylan Baker 041d9ac3dc util/glsl2spirv: let argparse actually enforce the restrictions we've set
Reviewed-by: Luis Felipe Strano Moraes <luis.strano@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19449>
2022-11-10 21:14:17 +00:00
Dylan Baker f9df046436 util/glsl2spirv: drop inconsistent use of `io.open`
In Python 3 (the only python we support) `io.open` is an alias of the
builtin `open` function, so it's not getting us anything, and we're not
using it consistently.

Reviewed-by: Luis Felipe Strano Moraes <luis.strano@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19449>
2022-11-10 21:14:17 +00:00
Dylan Baker 76e3b482be util/glsl2spirv: fix type error in argument handling
args.Olib is set to `store_true`, which means it will always be `True`
or `False`, this means that the we always, unconditionally, add
`--keep-uncalled` to the command line.

fixes: 9786d9ef2a

Reviewed-by: Luis Felipe Strano Moraes <luis.strano@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19449>
2022-11-10 21:14:17 +00:00
Yonggang Luo 0b82281e3e util: Use include_directories('..') instead include_directories('.') for inc_util
So include util headers are always using util/ prefix in mesa code base
And prevent including files under src/util without util/ prefix

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19546>
2022-11-10 06:27:25 +00:00
Yonggang Luo e399dc3544 util: normalize include files under src/util/*.h with util/ prefix in mesa code base
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19546>
2022-11-10 06:27:25 +00:00
Yonggang Luo beea3548ce util: Move texcompress template files into util/format
Because these files are accessed in  util/format/u_format_*.c
To make sure util are self contained we need move these files

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19547>
2022-11-10 05:35:41 +00:00
Yonggang Luo f6ed016fe9 util: Replace the usage of ALIGN16 with alignas(16) and them remove ALIGN16 macro
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19565>
2022-11-10 05:04:12 +00:00
Yonggang Luo 38b2402b5f meson: Use deps_for_libmesa_util for idep_mesautil instead hand crafted list
Now the idep_mesautilc11 have no need reference when idep_mesautil is referenced

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Dylan Baker <dylan.c.baker@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19526>
2022-11-10 11:57:22 +08:00
Yonggang Luo 4d1a293e73 meson: Indent util/meson.build with 2 space
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Dylan Baker <dylan.c.baker@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19526>
2022-11-10 11:57:19 +08:00
Rob Clark a6e4f8d03f util/disk_cache: Add some blob cache traces
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19387>
2022-11-08 23:36:51 +00:00
Rob Clark d831fd40c8 util/disk_cache: Add compression in blob cb path
Android's implementation of the blob-cache get/put funcs do not
implement any compression.  And the default cache size is rather small,
at 2MB (!!) per app (although I assume everyone patches android to
increase the size limit).

We don't bother compressing the has_key/put_key path, since that path is
only storing a uint32_t.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19387>
2022-11-08 23:36:51 +00:00
Yonggang Luo 7fe5fec747 util: Remove os/os_thread.h and replace #include "os/os_thread.h" with #include "util/u_thread.h"
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19557>
2022-11-08 05:21:42 +00:00
Yonggang Luo 1129537e4c util: Move pipe_semaphore to u_thread.h and rename it to util_semaphore
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19557>
2022-11-08 05:21:42 +00:00
Yonggang Luo b732064f9e gallium/util: Remove the EMBEDDED_DEVICE macro because nobody use it
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7641

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Jose Fonseca <jfonseca@vmware.com>
Acked-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19552>
2022-11-08 02:37:20 +00:00
Yonggang Luo 7753e80219 util: Add multi-threaded test for util/u_debug.h and util/perf/u_trace.h
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18764>
2022-11-05 20:40:55 +00:00
Yonggang Luo 2c1c87f76f util: Fixes memory leak in __getProgramName
This is happened when multi-threading access to util_get_process_name

memory leak point:
Direct leak of 4097 byte(s) in 1 object(s) allocated from:
    #0 0x7f42888c0e8f in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f4288859d18 in __interceptor_realpath ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:3608
    #2 0x55a9c272e03d in __getProgramName ../src/util/u_process.c:75
    #3 0x55a9c272e03d in util_get_process_name ../src/util/u_process.c:197
    #4 0x55a9c2746da7 in util_queue_init ../src/util/u_queue.c:416
    #5 0x55a9c272c233 in queue_init ../src/util/perf/u_trace.c:403
    #6 0x55a9c272c233 in u_trace_context_init ../src/util/perf/u_trace.c:453
    #7 0x55a9c262eb54 in test_thread ../src/util/tests/perf/u_trace_test.cpp:14
    #8 0x55a9c275228b in impl_thrd_routine ../src/c11/impl/threads_posix.c:67

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18764>
2022-11-05 20:40:55 +00:00
Yonggang Luo 171c3c551a util: Fixes debug_get_option_* thread safety by set initialized=true after the value get
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18764>
2022-11-05 20:40:55 +00:00
Yonggang Luo e2c3739a3f util: It's not thread safe to set initialized=true before get the real GALLIUM_PRINT_OPTIONS
Even though initialized = true can make sure have no recursion, but that's may leading to
debug_get_option_should_print return false at the second thread, but the first thread
return true. These two threads should return the same value, even though this function is for
debug only, but it's better to getting it to be correct.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18764>
2022-11-05 20:40:55 +00:00
António Monteiro 55373642db util: remove unused enter debug exit loggers
Signed-off-by: António Monteiro <antonio.fmr.monteiro@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19428>
2022-11-04 23:20:02 +00:00
António Monteiro c7b70ca61a util: remove fifo class
Signed-off-by: António Monteiro <antonio.fmr.monteiro@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19428>
2022-11-04 23:20:02 +00:00
António Monteiro 0c0812cf6e util: remove unused debug_dump_enum_noprefix
Signed-off-by: António Monteiro <antonio.fmr.monteiro@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19428>
2022-11-04 23:20:02 +00:00
António Monteiro dc0de85fed util: remove unused debug_print_blob
Signed-off-by: António Monteiro <antonio.fmr.monteiro@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19428>
2022-11-04 23:20:02 +00:00
António Monteiro c43c640809 util: remove unused set_random_entry
Signed-off-by: António Monteiro <antonio.fmr.monteiro@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19428>
2022-11-04 23:20:02 +00:00
António Monteiro 0b6c0bfa09 util: remove unused half_to_unorm8
Signed-off-by: António Monteiro <antonio.fmr.monteiro@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19428>
2022-11-04 23:20:02 +00:00
Yonggang Luo cdc1abad7b util: include gles header instead of hand crafted macros
Now the glapi/glapi_dispatch.c are cleaned up because of this

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19509>
2022-11-04 19:28:19 +00:00
Yonggang Luo bfa3ce44a6 mesa: Move glheader.h from mesa/main/glheader.h to util/glheader.h
So it's can be accessed in broader places

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Brian Paul brianp@vmware.com
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19472>
2022-11-03 16:07:31 +00:00
Illia Abernikhin aa4ac5ff8b utils: Merge util/debug.* into util/u_debug.* and remove util/debug.*
Rename env_var_as_unsigned() -> debug_get_num_option(), because duplicate
Rename env_var_as_bool() -> debug_get_bool_option(), because duplicate

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7177

Signed-off-by: Illia Abernikhin <illia.abernikhin@globallogic.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19336>
2022-11-02 07:25:39 +00:00
Illia Abernikhin 0e47171abe utils: Move functions from debug.* to u_debug.*
Add unit tests for debug_get_bool_option and debug_get_num_option
Merge env_var_as_boolean and debug_get_bool_option and implement
 env_var_as_boolean with debug_get_bool_option in a stricter side.
Merge env_var_as_unsigned and debug_get_num_option and implement
 env_var_as_unsigned with debug_get_num_option in a stricter side.
Move debug_control, parse_debug_string, parse_enable_string,
 comma_separated_list_contains from debug.* to u_debug.*

Main changes:
os_get_option() is used instead of getenv() for env_var_as_boolean
 and env_var_as_unsigned;
also debug_get_bool_option() has logic like "true" always if not "false";
env_var_as_boolean() now uses different logic:
 if env variable is neither "true" nor "false" returns the default value,
 we left the second one; but if you want the behavior to be the same as in
 the old version of debug_get_bool_option() use dfault=true

Signed-off-by: Illia Abernikhin <illia.abernikhin@globallogic.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19336>
2022-11-02 07:25:39 +00:00
Mauro Rossi db946364df util: glsl2spirv.py: ensure '#endif' is printed in new line
Fixes the following building errors:

In file included from ../src/intel/vulkan/anv_pipeline_cache.c:34:
src/intel/vulkan/float64_spv.h:3316:3: error: expected identifier or '('
};#endif // FLOAT64_SPV_H
  ^
src/intel/vulkan/float64_spv.h:1:2: error: unterminated conditional directive
 ^
../src/intel/vulkan/anv_pipeline_cache.c:59:17: error: use of undeclared identifier 'anv_shader_bin_serialize'; did you mean 'anv_shader_bin_deserialize'?
   .serialize = anv_shader_bin_serialize,
                ^~~~~~~~~~~~~~~~~~~~~~~~
                anv_shader_bin_deserialize
../src/intel/vulkan/anv_pipeline_cache.c:41:1: note: 'anv_shader_bin_deserialize' declared here
anv_shader_bin_deserialize(struct vk_device *device,
^
../src/intel/vulkan/anv_pipeline_cache.c:59:17: error: incompatible pointer types initializing 'bool (*)(struct vk_pipeline_cache_object *, struct blob *)' with an expression of type 'struct vk_pipeline_cache_object *(struct vk_device *, const void *, size_t, struct blob_reader *)' (aka 'struct vk_pipeline_cache_object *(struct vk_device *, const void *, unsigned long, struct blob_reader *)') [-Werror,-Wincompatible-pointer-types]
   .serialize = anv_shader_bin_serialize,
                ^~~~~~~~~~~~~~~~~~~~~~~~
4 errors generated.

Fixes: 9786d9e ("util: Add glsl2spirv.py script")
Reviewed-by: Mykhailo Skorokhodov <mykhailo.skorokhodov@globallogic.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19394>
2022-10-30 14:14:21 +01:00
Mykhailo Skorokhodov b890ad7d5e drirc: Apply fp64_workaround_enabled to DOOM Eternal
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6847
Signed-off-by: Mykhailo Skorokhodov <mykhailo.skorokhodov@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18854>
2022-10-28 10:08:50 +00:00
Mykhailo Skorokhodov a954933f4f drirc: Add fp64_workaround_enabled option
Signed-off-by: Mykhailo Skorokhodov <mykhailo.skorokhodov@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18854>
2022-10-28 10:08:50 +00:00
Mykhailo Skorokhodov 9786d9ef2a util: Add glsl2spirv.py script
Signed-off-by: Mykhailo Skorokhodov <mykhailo.skorokhodov@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18854>
2022-10-28 10:08:50 +00:00
Yonggang Luo a37e3b7199 util: #include "c11/threads.h" instead of #include "util/u_cpu_detect.h" u_format.c
As it does not access any symbols in util/u_cpu_detect.h but accessed symbols in "c11/threads.h"

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19266>
2022-10-25 11:06:05 +00:00
Yonggang Luo cf44028c02 util: Move UTIL_MAX_CPUS from u_thread.h to u_cpu_detect.h
UTIL_MAX_CPUS is not used by u_thread.* anymore after commit
"util: replace UTIL_MAX_CPUS by util_cpu_caps.num_cpu_mask_bits"

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19266>
2022-10-25 11:06:05 +00:00
Yonggang Luo 64ee9c1158 util: Merge duplicated function prototype in u_thread.h that named with util_barrier*
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19266>
2022-10-25 11:06:05 +00:00
Yonggang Luo 17d46893fd util: Remove non used UTIL_MAX_L3_CACHES in u_thread.h
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19266>
2022-10-25 11:06:05 +00:00
Roman Gilg 43d93c32c9 loader/dri3: Add DRI performance option to wait for next buffer on swap
For simple clients using the swap chain contention back pressure to regulate
their drawing and that don't query buffer age introduce a new DRI option with
which set to true (the default is false) we block the client until a new buffer
is available. This way we stall the client's execution until a new buffer is
available and the redrawing of the client starts only at this point and not
before.

The motivation for that is to reduce latency for clients that regulate their
drawing by swapchain contention back pressure. These clients draw whenever
possible and their drawing is implicitly stopping whenever we block. When we
block at the end of the swap and return only when a new buffer is available
the client can draw and we directly present. Otherwise the client would draw,
we block on the buffer becoming available, and only then show what the client
had drawn, usually one frame later.

Co-authored-by: Michel Dänzer <michel@daenzer.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14684>
2022-10-25 08:30:35 +00:00
Jan Beich 1d41dd42df util: unify FreeBSD futex_wait signature with Linux/OpenBSD/Windows
src/util/futex.c:73:5: error: conflicting types for 'futex_wait'
int futex_wait(uint32_t *addr, int32_t value, struct timespec *timeout)
    ^
src/util/futex.h:50:5: note: previous declaration is here
int futex_wait(uint32_t *addr, int32_t value, const struct timespec *timeout);
    ^

Fixes: 095dfc6caa ("util: Move the implementation of futex_wake and futex_wait from futex.h to futex.c")
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19177>
2022-10-23 10:11:01 +00:00
Mike Blumenkrantz 813d502d7c driconf: add mesa_glthread=false for gfxbench
this seems to hurt perf

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19081>
2022-10-23 02:24:13 +00:00
Yonggang Luo 53ab57e888 util: Move the function implementation from u_thread.h to u_thread.c
Move the platform dependent functions from u_thread.h to u_thread.c,
so that avoid pull unneeded headers when using u_thread.h, including the big windows.h

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18425>
2022-10-20 03:04:56 +00:00
Yonggang Luo 0a2506a848 util: Remove include of windows.h in rwlock.h
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18425>
2022-10-20 03:04:56 +00:00
Yonggang Luo c30d63a53d util: Remove include of windows.h in memstream.h
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18425>
2022-10-20 03:04:56 +00:00
Yonggang Luo 797130b449 util: #include <windows.h> in disk_cache_os.c
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18425>
2022-10-20 03:04:56 +00:00
Yonggang Luo 399dc71a30 c11: Getting the macro guard of HAVE_PTHREAD in c11/threads.h to be consistence with util/u_uthread.h
The macro guard of #if defined(_WIN32) && !defined(__CYGWIN__) is comes from yohhoy's implementation
and that's not consistence with util/u_uthread.h, this caused it's hard to understand.
Now we change the behavior that's always rely on how meson detecting HAVE_PTHREAD.

So we always disable detecting of threads on Win32 as it's always included in the kernel32 library to
avoid detecting pthreads in mingw.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18425>
2022-10-20 03:04:56 +00:00
Yonggang Luo 54beddb5d2 util: Remove the guard WIN32_WINNT >= 0x0600 in u_thread.h
We already require Windows Vista or later before this commit;
No need check WIN32_WINNT >= 0x0600

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18425>
2022-10-20 03:04:56 +00:00
Yonggang Luo b6e4aa6f31 meson/mesa/wide: define WIN32_LEAN_AND_MEAN with pre_args
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18425>
2022-10-20 03:04:56 +00:00
Yonggang Luo ea3dd4179d util: #include "util/macros.h" in u_cpu_detect.h for ATTRIBUTE_CONST
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18425>
2022-10-20 03:04:56 +00:00
Yonggang Luo 2b2b8ac64e util: #include "c11/threads.h" when necessary in simple_mtx.h
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18425>
2022-10-20 03:04:56 +00:00
Yonggang Luo cf36399459 util: Remove the need of _MTX_INITIALIZER_NP by using simple_mtx_t/SIMPLE_M in u_debug_refcnt.c
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19154>
2022-10-20 01:32:47 +00:00
Yonggang Luo 8f9e336aed util: Remove the need of _MTX_INITIALIZER_NP by using simple_mtx_t/SIMPLE_MTX_INITIALIZER in u_debug_memory.c
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19154>
2022-10-20 01:32:47 +00:00
Yonggang Luo 44901ebd97 util: Remove the need of _MTX_INITIALIZER_NP by using simple_mtx_t/SIMPLE_MTX_INITIALIZER in u_debug_stack_android.cpp
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19154>
2022-10-20 01:32:47 +00:00
Yonggang Luo a26d5b4b69 util: Remove the need of _MTX_INITIALIZER_NP by using simple_mtx_t/SIMPLE_MTX_INITIALIZER in u_debug_symbol.c
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19154>
2022-10-20 01:32:47 +00:00
Yonggang Luo 404808afc8 util: Call function mtx_init on exit_mutex to replace the usage of _MTX_INITIALIZER_NP in u_queue.c
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19154>
2022-10-20 01:32:47 +00:00
Yonggang Luo 35c7f2e809 util: Remove the need of _MTX_INITIALIZER_NP by using simple_mtx_t/SIMPLE_MTX_INITIALIZER in u_debug_stack.c
This removed the thread-unsafe function initialize_backtrace_mutex.
And remove the _MTX_INITIALIZER_NP that's doesn't belong to c11

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19154>
2022-10-20 01:32:47 +00:00
Dylan Baker c6aca79f63 util/indicies: convert u_unfilled_gen.py to write a file
Which avoids meson needing to wrap the generator to capture the output,
and makes it faster

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19058>
2022-10-19 20:21:08 +00:00
Dylan Baker 090e71e0bf util/indicies: use itertools.product in u_unfilled_gen.py
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19058>
2022-10-19 20:21:08 +00:00
Dylan Baker a72d8425ea util/indicies: simplify some of u_indicies_gen.py
v2:
  - Give variable more descriptive name to avoid shadowing

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>

and avoid shadowing

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19058>
2022-10-19 20:21:08 +00:00
Dylan Baker 1e523f2339 util/indicies: write a file with u_indicies_gen.py
This avoids meson creating a wrapper to redirect stdout, and makes the
generator faster

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19058>
2022-10-19 20:21:08 +00:00
Dylan Baker addd4d71fa util/indicies: use itertools.product instead of deeply nested loops
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19058>
2022-10-19 20:21:08 +00:00
Dylan Baker 55042a1fb9 util/indicies: move common static functions to private header
less duplication is good

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19058>
2022-10-19 20:21:08 +00:00
Marek Olšák 8dba83bb8d driconf: add a workaround for Cossacks 3
Wine issue: https://bugs.winehq.org/show_bug.cgi?id=44560

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19147>
2022-10-19 11:52:46 +00:00
Marek Olšák 53e7f3afbd driconf: add a workaround for a cursor issue with kwin_wayland
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7351

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19147>
2022-10-19 11:52:46 +00:00
Yonggang Luo 095dfc6caa util: Move the implementation of futex_wake and futex_wait from futex.h to futex.c
Doing this is to avoid include bloat on Windows that pulls windows.h,
for other unix platforms, it's also benefit include the used symbols only when use
futex_wake and futex_wait.
No functional change, there is no performance incur because function call is consume
much less time than syscall

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19120>
2022-10-18 23:20:25 +00:00
Yonggang Luo 44ccaca41d util/mesa/wide: Rename _SIMPLE_MTX_INITIALIZER_NP to SIMPLE_MTX_INITIALIZER
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18393>
2022-10-14 03:27:41 +00:00
Yonggang Luo 4f0f272069 util: Implement atomic operations consistently across compilers and testing for it
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18795>
2022-10-13 13:51:18 +00:00
Yonggang Luo 96e7d1cf0c util: Remove the include of windows.h when compiling with MSVC
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7345

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18795>
2022-10-13 13:51:18 +00:00
Timothy Arceri 98944b327b util/radeonsi: enable zerovram workaround for Exanima
The issue is very intermittent and can sometimes work fine
without the workaround but turning it on seems to resolve
any issues.

Issue: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6449

Cc: mesa-stable
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18935>
2022-10-10 11:19:26 +11:00
Timothy Arceri 3200b5c46b util/conf: enable init to zero workaround for Exanima
Fixes rendering issues on llvmpipe.

Issue: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6449

Cc: mesa-stable
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18935>
2022-10-10 11:16:22 +11:00
James Zhu 9055ab9de3 util/format: add util format y8_400_unorm
Signed-off-by: James Zhu <James.Zhu@amd.com>
Signed-off-by: Sathishkumar S <sathishkumar.sundararaju@amd.com>
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Reviewed-by: Boyuan Zhang <Boyuan.Zhang@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18914>
2022-10-07 15:14:39 +00:00
Samuel Pitoiset 0974b67a6e radv: add a new drirc option to enable a unified heap on APUs
This option (radv_enable_unified_heap_on_apu) allows to force the
driver to expose only one heap of VRAM because some games seem to
perform better with that.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18884>
2022-09-30 11:01:48 +02:00
Eric Anholt 5d0050c8bf util/dag: Add a validation function.
I experienced a circular dag in freedreno, and wanted a way to see what
was going wrong.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6656>
2022-09-29 23:40:18 +00:00
Eric Anholt 984aa0ac9a util/dag: Move the callback function pointer to the state.
No sense passing it as a recursive argument when we have this storage
right there.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6656>
2022-09-29 23:40:18 +00:00
Marek Olšák 2fa864b38a glthread,hud: draw per-frame values and expose the number of batches per frame
This is better because we see the statistics for 1 frame instead of 1 second.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18828>
2022-09-26 22:58:16 +00:00
Xin LI 2905dd7951 meson: Improve detection of qsort_r().
Instead of trying to guess the interface style by solely checking
the OS name, check if a fake test program can be built and linked.
This will give more accurate result when FreeBSD and other systems
moved to the interface based on GNU qsort_r().

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18527>
2022-09-23 07:45:01 +00:00
Laurent Bigonville 0edf63de76 Try to fix FTBFS on kfreebsd architecture
Fixes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4081

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15058>
2022-09-22 10:30:36 +02:00
Yonggang Luo 3f18709f1f util: Remove the macro DEBUG_GET_ONCE_FILE_OPTION
DEBUG_GET_ONCE_FILE_OPTION is not a truly once function, it's return a new
FILE* object when calling to it when the conditions are satisfied. And it's
functional can be replaced with DEBUG_GET_ONCE_OPTION properly.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18323>
2022-09-22 04:16:29 +00:00
Yonggang Luo 5229a147c1 util: getting get_tracefile in u_trace.c to be thread safe
Remove the usage of DEBUG_GET_ONCE_FILE_OPTION because it's not a truly
once function, it's return a new FILE* object when calling to it when
the conditions are satisfied.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7151

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18323>
2022-09-22 04:16:29 +00:00
Yonggang Luo 7dfd54cf4a util: Add util_call_once for optimize call to util_call_once_with_context out for hot path
For hot path, there is only need to a load instruction to load if initialized are true now,
So the extra cost is minimal.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18323>
2022-09-22 04:16:29 +00:00
Brian Paul 2967cc25ea util: allow GALLIUM_LOG_FILE=stdout
To log gallium info to stdout instead of a file.

Signed-off-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18213>
2022-09-21 21:55:11 +00:00
Marek Olšák 8a44d32e2c driconf: disable glthread for DeusEx:MD and F1 2015 due to a perf drop
glthread decreases performance for DeusEx:MD by 7.8% and F1 2015 by 5.7%.
I think that other Feral games are affected similarly.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18223>
2022-09-21 14:54:50 +00:00
Marek Olšák fa059811c5 radeonsi: simplify radeonsi_zerovram implementation
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18223>
2022-09-21 14:54:50 +00:00
Kai Wasserbäch e52d3d5f1c fix: util/format: unused variable ‘desc’ [-Wunused-variable]
Only used in debug builds.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18643>
2022-09-19 22:02:16 +00:00
Illia Polishchuk 74658b01d2 driconf/Intel: Add lower_depth_range_rate option workaround for Homerun Clash misrendering issue
Intel has different Z interpolation float point rounding
than other mesa gpus
For example gl_Position.z = 0.0 will be interpolated to
gl_FragCoord.z = 0.5 for all gpus

gl_FragCoord = -0.00000001 will be interpolated to
gl_FragCoord.z = 0.4999999702 for Intel
and rounded to gl_FragCoord.z = 0.5 for other gpus

Games with LEQUAL depth func will fail depth test on Intel
and will pass it on other gpus in such case

This workaround lowers translated depth range
and several gl_FragCoord.z coords with extra small difference
will be translated to the same UINT16\UINT24\UINT32
value of an integer depth buffer

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7199

Signed-off-by: Illia Polishchuk <illia.a.polishchuk@globallogic.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18412>
2022-09-19 10:08:48 +00:00
Ella Stanforth 3c57d05b47 util: fix missing fcntl.h on musl
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18617>
2022-09-16 23:43:13 +00:00
Erik Faye-Lund a6ed406d9f util/format: implement rgtc -> r8 / r8g8 unpack
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Acked-by: Eric Engestrom <eric@igalia.com>
Tested-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18248>
2022-09-15 08:16:01 +00:00
Erik Faye-Lund dfbcd94041 util/format: allow unpacking less than a block from rgtc
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Acked-by: Eric Engestrom <eric@igalia.com>
Tested-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18248>
2022-09-15 08:16:01 +00:00
Erik Faye-Lund 6e1c3e98cd util/format: fix broken indentation
This file had a mixture of tabs and spaces for indent.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Acked-by: Eric Engestrom <eric@igalia.com>
Tested-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18248>
2022-09-15 08:16:01 +00:00
Thomas H.P. Andersen 1980827aeb util: avoid deprecated builtin has_trivial_destructor
From clang 16 has_trivial_destructor is deprecated.
Use the replacement __is_trivially_destructible if it
is available.

Fixes new warnings with clang 16 like:

../src/compiler/glsl/list.h:58:4: warning: builtin __has_trivial_destructor is deprecated; use __is_trivially_destructible instead [-Wdeprecated-builtins]
../src/util/ralloc.h:551:4: note: expanded from macro 'DECLARE_RZALLOC_CXX_OPERATORS'
   DECLARE_ALLOC_CXX_OPERATORS_TEMPLATE(type, rzalloc_size)
   ^
../src/util/ralloc.h:542:12: note: expanded from macro 'DECLARE_ALLOC_CXX_OPERATORS_TEMPLATE'
      if (!HAS_TRIVIAL_DESTRUCTOR(TYPE))                                 \
           ^
../src/util/macros.h:233:44: note: expanded from macro 'HAS_TRIVIAL_DESTRUCTOR'

Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18423>
2022-09-08 10:53:32 +00:00
Erik Faye-Lund a321d157c6 util: allow unpacking less than a block from dxt
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Acked-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18180>
2022-09-06 12:55:02 +00:00
Danylo Piliaiev 699e3452d0 util/u_trace: Add locking for ctx_list
It could be modified from several threads, make it safe.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18391>
2022-09-06 09:29:52 +00:00
Yonggang Luo 5017e805bb util: Fixes comment about debug_get_option
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18242>
2022-09-05 13:34:17 +00:00
Matt Coster c0b891ecca util: Include stddef.h in util/macros.h
This is required for offsetof, used by the container_of macro.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18368>
2022-09-03 17:09:37 +00:00
Chia-I Wu c93173fcec util/perf: use ALWAYS_INLINE for tracepoints
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18309>
2022-09-02 19:46:50 +00:00
Chia-I Wu 4d747d5690 util/perf: simplify u_trace_instrument
When ut_perfetto_enabled changes, update _u_trace_instrument as well.
This allows u_trace_instrument to check just a single variable.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18309>
2022-09-02 19:46:50 +00:00
Chia-I Wu 18d7cb4abb util/perf: add u_trace_instrument
It is called from tracepoints.  When it returns false, instrumentation
is disabled.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18309>
2022-09-02 19:46:50 +00:00
Chia-I Wu aeb2c5a8da util/perf: remove u_trace::enabled
We can set ut_trace_instrument when either GPU_TRACE or
GPU_TRACE_INSTRUMENT is set.  This results in one less variable to check
in tracepoints.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18309>
2022-09-02 19:46:50 +00:00
Chia-I Wu 8d8d4347e3 util/perf: ignore ut->enabled for iterators
With perfetto, instrumentation can be enabled in the middle of cmd
buffer recording even when ut->enabled is false.  It might be better to
be consistent and ignore ut->enabled for iterators.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18309>
2022-09-02 19:46:50 +00:00
Jose Fonseca d43c5b1d19 util: Add macro util_get_cpu_caps in u_cpu_detect.c for avoid accidentally call it in u_cpu_detect.c
Signed-off-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17813>
2022-09-02 01:51:42 +00:00