Yonggang Luo
235b10e7cf
util/meson: Getting mesa util core to be self contained
...
Guard util to be standalone by move subdir('util') just behind subdir('android_stub')
texcompress_rgtc_tmp.h is not a standard c header, do not treat it as source
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19522 >
2023-08-02 03:41:24 +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
Yonggang Luo
65249c6f0a
util: Fixes prototype of threads_timespec_compare
...
using const struct timespec * is enough
Fixes: 45bd24708a ("c11: Improve mtx_timedlock to use timespec_get instead of time(NULL)")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9230
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com >
Tested-by: Vinson Lee <vlee@freedesktop.org >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23753 >
2023-06-21 06:18:40 +00:00
Yonggang Luo
45bd24708a
c11: Improve mtx_timedlock to use timespec_get instead of time(NULL)
...
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Acked-by: David Heidelberg <david.heidelberg@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23733 >
2023-06-20 00:05:48 +00:00
Yonggang Luo
66a99f619f
c11: Improve timespec_get to support TIME_MONOTONIC TIME_ACTIVE TIME_THREAD_ACTIVE TIME_MONOTONIC_RAW
...
As c11 already provided timespec_get, to avoid symbol conflict, use c23_timespec_get as the function name
and define timespec_get c23_timespec_get to achieve that
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Acked-by: David Heidelberg <david.heidelberg@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23733 >
2023-06-20 00:05:48 +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
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
2f140c564f
c11: Remove the code for Windows XP
...
We already require Windows Vista or later before this commit;
So the code for Windows XP can be removed.
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
f97ba1f95d
c11: #include <threads.h> when the os/platform provide it
...
Closes #6964
CC: mesa-stable
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/18043 >
2022-08-18 01:02:07 +00:00
Yonggang Luo
4579b702f6
c11: Remove mtx_try from mtx enums as it's not a part of c11 standard
...
And we support for four types of mtx init enum values that define by C11 standard:
0 mtx_plain - a simple, non-recursive mutex is created.
2 mtx_timed - a non-recursive mutex, that supports timeout, is created.
1 mtx_plain | mtx_recursive - a recursive mutex is created.
3 mtx_timed | mtx_recursive - a recursive mutex, that supports timeout, is created.
musl library also use these enum combination
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/18036 >
2022-08-15 14:40:52 +00:00
Yonggang Luo
e7b4af434b
c11: Implement and use of thrd_current properly on win32
...
Now thrd_t are a struct that contains both thread handle and thread id.
For threads that not created by thrd_create, thrd_current are returning pseudo thread handle;
but we can still compare threads differences by using thread id.
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/17071 >
2022-08-10 20:14:15 +00:00
Yonggang Luo
125a952b66
c11: call impl_tss_dtor_invoke with tls callback for 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/17071 >
2022-08-10 20:14:15 +00:00
Emil Velikov
899aa7925b
c11: reinstate the original license and authorship
...
The original code that was copied in was Boost licensed, so keep that
in. Since Yonggang Luo has code quite some work, keep their copyright
alongside the original one.
Fixes: b2ddec4e98 ("c11: Implement c11/time.h with c11/impl/time.c")
Fixes: e6392fcf3d ("c11: Move the implementation of threads.h into c source code")
Acked-by: Yonggang Luo <luoyonggang@gmail.com >
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17232 >
2022-06-27 11:46:22 +00:00
Yonggang Luo
09cd5c9bdb
c11: Fixes memory leak of pack in thrd_create 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/15087 >
2022-06-15 17:37:17 +00:00
Yonggang Luo
e6392fcf3d
c11: Move the implementation of threads.h into c source code
...
By doing this, now the global variable impl_tss_dtor_tbl are only defined one time.
So the memory usage would reduced
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/15087 >
2022-06-15 17:37:17 +00:00
Yonggang Luo
65d5ee4012
c11: Implement timespec_get on win32 properly when not available
...
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com >
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15497 >
2022-06-09 17:23:34 +00:00
Yonggang Luo
b2ddec4e98
c11: Implement c11/time.h with c11/impl/time.c
...
Create c11/time.h instead of put timespec_get in `c11/threads.h`
Creating impl folder is used to avoid `#include <time.h>` point the c11/time.h file
Detecting if `struct timespec` present with meson
Define TIME_UTC in `c11/time.h` instead `c11/threads.h`
Define `struct timespec` in `c11/time.h` when not present.
Implement timespec_get in c11/impl/time.c instead threads.h
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com >
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15497 >
2022-06-09 17:23:34 +00:00