Juston Li
0c9ee0f2b9
android: look for debug/vendor prefixed options
...
Properties from the vendor partition must use a "vendor." prefix from
Android T+. Meanwhile the "debug." prefix can be used for local
overrides.
The order of precedence thus becomes:
1. getenv
2. debug.mesa.*
3. vendor.mesa.*
4. mesa.* (as a fallback for older versions)
Signed-off-by: Juston Li <justonli@google.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31584 >
2024-10-15 20:22:17 +00:00
Aleksi Sapon
345c198c22
util: fix memory related OS calls on macOS
...
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Eric Engestrom <eric@igalia.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29900 >
2024-07-10 15:23:53 +00:00
C Stout
2a3f53bd3b
util: os_misc: add Fuchsia support
...
v2: cleaner detect os check (robclark@)
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org >
Reviewed-by: Eric Engestrom <eric@igalia.com >
Acked-by: Rob Clark <robdclark@chromium.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29539 >
2024-06-07 18:29:20 +00:00
Yonggang Luo
85ff3f525c
util: Rename DETECT_OS_UNIX to DETECT_OS_POSIX
...
Looking at each usage of DETECT_OS_UNIX, it's more about the POSIX API usage, not the
Unix-like OS, so let's rename it
And for POSIX it's a standard to claim which API present, but for UNIX there is no such thing
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com >
Acked-by: Rob Clark <robdclark@chromium.org >
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29555 >
2024-06-07 01:56:28 +00:00
Yonggang Luo
1ac1c0843f
treewide: Replace usage of macro DEBUG with MESA_DEBUG when possible
...
This is achieved by the following steps:
#ifndef DEBUG => #if !MESA_DEBUG
defined(DEBUG) => MESA_DEBUG
#ifdef DEBUG => #if MESA_DEBUG
This is done by replace in vscode
excludes
docs,*.rs,addrlib,src/imgui,*.sh,src/intel/vulkan/grl/gpu
These are safe because those files should keep DEBUG macro is already excluded;
and not directly replace DEBUG, as we have some symbols around it.
Use debug or NDEBUG instead of DEBUG in comments when proper
This for reduce the usage of DEBUG,
so it's easier migrating to MESA_DEBUG
These are found when migrating DEBUG to MESA_DEBUG,
these are all comment update, so it's safe
Replace comment /* DEBUG */ and /* !DEBUG */ with proper /* MESA_DEBUG */ or /* !MESA_DEBUG */ manually
DEBUG || !NDEBUG -> MESA_DEBUG || !NDEBUG
!DEBUG && NDEBUG -> !(MESA_DEBUG || !NDEBUG)
Replace the DEBUG present in comment with proper new MESA_DEBUG manually
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com >
Acked-by: David Heidelberg <david.heidelberg@collabora.com >
Reviewed-by: Eric Engestrom <eric@igalia.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28092 >
2024-03-22 18:22:34 +00:00
Jesse Natalie
bed69133cd
util: Re-implement getenv for Windows
...
On Windows, the C runtime maintains an environment variable cache for
getenv. But apps and drivers are free to statically link the C runtime,
so you might get different environment variable caches between components.
Specifically, a test trying to putenv to update the environment won't have
its update reflected by the driver if the CRT is statically linked, unless
we go to the Win32 API directly.
Reviewed-by: Sil Vilerino <sivileri@microsoft.com >
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26744 >
2023-12-18 23:49:28 +00:00
Dennis Bonke
653405ee08
mesa: add managarm support
...
Co-authored-by: Alexander Richards <electrodeyt@gmail.com >
Signed-off-by: Alexander Richards <electrodeyt@gmail.com >
Signed-off-by: Dennis Bonke <dennis@managarm.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25818 >
2023-11-20 13:35:19 +00:00
Yonggang Luo
05b840521a
treewide: Replace the usage of TRUE/FALSE with true/false
...
this is a separate patch as it's won't affect the code style
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com >
Acked-by: David Heidelberg <david.heidelberg@collabora.com >
Acked-by: Marek Olšák <marek.olsak@amd.com >
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23577 >
2023-06-27 18:18:28 +08:00
Caleb Cornett
7588164717
util: Add #ifdefs for Xbox GDK support.
...
For the most part this just disables debug/console code, with the minor exception of u_memstream_open.
Co-authored-by: Ethan Lee <flibitijibibo@gmail.com >
Co-authored-by: David Jacewicz <david.jacewicz@protonmail.com >
Co-authored-by: tieuchanlong <tieuchanlong@gmail.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19022 >
2023-01-19 03:25:55 +00:00
Yonggang Luo
22bf19c1f5
util: Fixes os_get_option_cached with bool options_tbl_exited
...
Fixes: cdad035cfd ("util: Add function debug_get_option_cached os_get_option_cached")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7922
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Reviewed-by: Rob Clark <robdclark@chromium.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20386 >
2022-12-20 01:49:10 +00:00
Yonggang Luo
cdad035cfd
util: Add function debug_get_option_cached os_get_option_cached
...
This is used to fixes DEBUG_GET_ONCE_*_OPTION macros latter
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/19554 >
2022-12-16 19:30:19 +00:00
Yonggang Luo
397a5c1b2e
util: Improve os_get_android_option to be thread-safe
...
struct hash_table is not thread-safety, need guard by mutex,
but with thread local storage, we can simplify the code and also
got the thread safety without the need of mutex.
Another advantage is by using thread local storage, os_get_android_option
will have the same actions like getenv does, that it's not cached the
value, each call will access the property_get, like getenv will be affected
by putenv
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/19554 >
2022-12-16 19:30:19 +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
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
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
Yonggang Luo
d85295e6a9
util: Implement os_get_available_system_memory on Win32
...
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/18001 >
2022-08-12 15:05:47 +00:00
Yonggang Luo
b2bf20e28f
util: Fixes typo in function os_get_total_physical_memory
...
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/18001 >
2022-08-12 15:05:47 +00:00
Michel Dänzer
96f0f46350
util: Remove unused Android options_tbl_lock
...
Avoids warning:
../src/util/os_misc.c:132:21: error: unused variable 'options_tbl_lock' [-Werror,-Wunused-variable]
static simple_mtx_t options_tbl_lock = _SIMPLE_MTX_INITIALIZER_NP;
^
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10220 >
2021-04-15 16:01:21 +00:00
Samuel Iglesias Gonsálvez
182fb988c8
util: fix parsing of /proc/meminfo MemAvailable value
...
It was interpreting the value as hexadecimal when it is unsigned.
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com >
Reviewed-by: Eric Anholt <eric@anholt.net >
Reviewed-by: Hyunjun Ko <zzoon@igalia.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8524 >
2021-02-17 08:06:15 +01:00
Marijn Suijten
f173bf1be9
util: Do not insert uninitialized data if Android property is not set
...
This prevents funky segfaults in seemingly unrelated codepaths like:
pid: 20058, tid: 20086, name: Binder:20058_2 >>> /system/bin/surfaceflinger <<<
uid: 1000
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x184
Cause: null pointer dereference
[...]
#00 pc 000000000020b078 /vendor/lib64/dri/gallium_dri.so (ir3_shader_variant+56)
#01 pc 00000000001dc168 /vendor/lib64/dri/gallium_dri.so (fd5_draw_vbo+920)
#02 pc 00000000001a30f8 /vendor/lib64/dri/gallium_dri.so (fd_draw_vbo+1264)
#03 pc 000000000077e714 /vendor/lib64/dri/gallium_dri.so (util_primconvert_draw_vbo+596)
#04 pc 00000000001a2d60 /vendor/lib64/dri/gallium_dri.so (fd_draw_vbo+344)
#05 pc 00000000007671e4 /vendor/lib64/dri/gallium_dri.so (dd_context_draw_vbo+300)
#06 pc 00000000007b6c9c /vendor/lib64/dri/gallium_dri.so (u_vbuf_draw_vbo+2268)
#07 pc 000000000074d230 /vendor/lib64/dri/gallium_dri.so (cso_draw_arrays+96)
#08 pc 00000000007a4258 /vendor/lib64/dri/gallium_dri.so (util_draw_user_vertex_buffer+96)
#09 pc 00000000007b0968 /vendor/lib64/dri/gallium_dri.so (util_run_tests+480)
#10 pc 000000000019e24c /vendor/lib64/dri/gallium_dri.so (pipe_msm_create_screen+68)
#11 pc 00000000006ada8c /vendor/lib64/dri/gallium_dri.so (pipe_loader_create_screen+60)
#12 pc 000000000020e958 /vendor/lib64/dri/gallium_dri.so (dri2_init_screen+120)
#13 pc 00000000006ad088 /vendor/lib64/dri/gallium_dri.so (driCreateNewScreen2+544)
Fixes: eeecc21d93 ("util: Add property_get() fallback for android")
Reviewed-by: Rob Clark <robclark@freedesktop.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7928 >
2020-12-04 19:14:45 +00:00
Vinson Lee
da16425690
util: Add os_get_page_size support for macOS.
...
Fix build error on macOS.
src/util/os_misc.c:352:2: error: unexpected platform in os_sysinfo.c
error unexpected platform in os_sysinfo.c
^
Fixes: ("cdf3a6a83b50 util: Add os_get_page_size query")
Signed-off-by: Vinson Lee <vlee@freedesktop.org >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7911 >
2020-12-03 19:47:58 -08:00
Jan Beich
18f6bd676d
util: unbreak on BSDs after MSVC changes
...
src/util/os_misc.c:352:2: error: unexpected platform in os_sysinfo.c
#error unexpected platform in os_sysinfo.c
^
Fixes: cdf3a6a83b ("util: Add os_get_page_size query")
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7887 >
2020-12-03 00:50:20 +00:00
Jesse Natalie
cdf3a6a83b
util: Add os_get_page_size query
...
No Apple/BSD implementation yet, I have no idea how to do that
Reviewed-by: Francisco Jerez <currojerez@riseup.net >
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680 >
2020-12-02 10:12:27 -08:00
Rob Clark
eeecc21d93
util: Add property_get() fallback for android
...
Environment variables aren't the easiest thing to use on android. So
add a fallback to android's property mechanism for os_get_option().
This is slightly complicated by the fact that the assumption that the
return value of os_get_option() need not be freed.
Signed-off-by: Rob Clark <robdclark@chromium.org >
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7763 >
2020-11-30 22:21:13 +00:00
Vinson Lee
fdb1997ab5
Fix VMware capitalization.
...
Signed-off-by: Vinson Lee <vlee@freedesktop.org >
Reviewed-by: Brian Paul <brianp@vmware.com >
Reviewed-by: Neha Bhende <bhenden@vmware.com >
Reviewed-by: Jose Fonseca <jfonseca@vmware.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7260 >
2020-10-27 15:33:40 -07:00
Emmanuel Vadot
fe894dc0b3
util/os_misc: os_get_available_system_memory() for FreeBSD
...
Based on the OpenBSD variant.
The only difference between those two system is the sysctl mib.
Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org >
Reviewed-by: Matt Turner <mattst88@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6995 >
2020-10-09 09:49:20 +00: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
Rob Clark
f9f7cbc1aa
util: android logging support
...
In particular, it would be nice for failed debug_assert() msgs to show
up in logcat.
Signed-off-by: Rob Clark <robdclark@chromium.org >
Kristian H. Kristensen <hoegsberg@chromium.org >
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com >
2019-09-06 00:45:11 +00:00
Jose Fonseca
46f7b3662f
util: Prevent implicit declaration of function getenv.
...
With MinGW cross compilation.
Reviewed-by: Brian Paul <brianp@vmware.com >
Reviewed-by: Roland Scheidegger <sroland@vmware.com >
Acked-by: Eric Engestrom <eric@engestrom.ch >
2019-08-28 15:52:07 +01:00
Eric Engestrom
7f12a66ad5
util/os_misc: use detect_os.h to start uncoupling from gallium
...
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com >
Reviewed-by: Matt Turner <mattst88@gmail.com >
2019-08-02 18:38:52 +01:00
Eric Engestrom
8c52bca112
gallium/utils: drop PIPE_SUBSYSTEM_WINDOWS_USER
...
This is basically just an alias for PIPE_OS_WINDOWS.
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com >
Reviewed-by: Matt Turner <mattst88@gmail.com >
2019-08-02 18:38:52 +01:00
Eric Engestrom
e740e7a6f0
scons: rename PIPE_SUBSYSTEM_EMBEDDED to EMBEDDED_DEVICE
...
It has nothing to do with the PIPE_SUBSYSTEM_* stuff from gallium.
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com >
Reviewed-by: Matt Turner <mattst88@gmail.com >
2019-08-02 18:38:52 +01:00
Eric Engestrom
bfb70032d4
util: fix typo in comment
...
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com >
Reviewed-by: Matt Turner <mattst88@gmail.com >
2019-08-02 18:38:52 +01:00
Timo Aaltonen
738626daca
util/os_misc: Add check for PIPE_OS_HURD
...
Fix build on Hurd.
Signed-off-by: Timo Aaltonen <tjaalton@debian.org >
Acked-by: Eric Engestrom <eric.engestrom@intel.com >
Acked-by: Emil Velikov <emil.velikov@collabora.com >
2019-02-27 14:56:48 +00:00
Dylan Baker
2fd5dff7e7
util: Move os_misc to util
...
this is needed by u_debug
Tested-by: Brian Paul <brianp@vmware.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
2018-10-30 14:32:52 -07:00