Commit Graph

21 Commits

Author SHA1 Message Date
Yonggang Luo 62a68481fa mapi: Remove usage of USE_ELF_TLS
After commit c47fd3dc00 ("windows: Use TLS context/dispatch with shared-glapi")
USE_ELF_TLS are always defined by
pre_args += '-DUSE_ELF_TLS'
So we can remove it safety

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17213>
2022-07-29 23:59:11 +00:00
Yonggang Luo 6bde428c0a mapi: Trim trailing spaces in stub.c and u_current.c
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17213>
2022-07-29 23:59:11 +00:00
Emma Anholt 75a9cb1033 util: Add a helper macro for defining initial-exec variables.
I'm going to add another case for Android shortly, and then we can keep
the logic all in one spot.

Reviewed-by: Roman Stratiienko <r.stratiienko@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10389>
2021-06-02 03:10:49 +00:00
Rob Clark d2a920ee6e util: Extract thread-id helpers from u_current
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/9323>
2021-03-11 04:42:15 +00:00
Michel Zou dfb1c986dd glapi: keep declspec(thread) msvc-specific
gcc ignores with a warning:
glapi.h:83:1: warning: ‘thread’ attribute directive ignored [-Wattributes]

Fixes: ba141b95

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9245>
2021-02-24 13:47:30 +00:00
Jesse Natalie ba141b95a7 glapi: Support "ELF" TLS on Windows
To avoid a massive rename, I'm leaving this as a misnomer, it's not
really ELF TLS, but it's the same concept.

Note that Windows doesn't support thread-local variables imported
or exported between modules, so we can only support this when we're
not using a shared glapi.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4050
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9165>
2021-02-23 17:06:48 +00:00
Erik Faye-Lund 26f58e87a0 mapi: do not return thread-specific data for wrong thread
If the current thread asks for either the current context or the current
dispatch table for a thread that has not yet set any context current, we
currently risk returning the wrong data if there was only a single
thread that had called u_current_init() yet.

So let's first check if the only expected thread-id is the one getting
these, and return NULL and/or __glapi_noop_table instead if not.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7280>
2020-10-26 12:35:22 +00:00
Bas Nieuwenhuizen 9f37c9903b mesa: Rename GLX_USE_TLS to USE_ELF_TLS.
These days it is not GLX only and it does not work with all TLS
implementations.

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
2019-08-03 20:18:17 +02:00
Emil Velikov 4562d88c1d mapi: replace mapi_table abstraction
Replace all instances of mapi_table with the actual struct _glapi_table.
The former may have been needed when the OpenVG was around. But since
that one is long gone, there' no point in having the current confusing
mix of the two.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-05-04 18:17:03 +01:00
Brian Paul 9385c592c6 mapi: remove u_thread.h
Just use c11 threads directly.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2015-03-05 06:59:43 -07:00
Brian Paul 18db13f586 mapi: THREADS was always defined, remove it
THREADS was defined if HAVE_PTHREADS or _WIN32 was defined.  That's
always the case.  The build would die in c11/threads.h otherwise.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2015-03-05 06:59:43 -07:00
Brian Paul 458c7490c2 mapi: rewrite u_current_init() function without u_thread_self()
Remove u_thread_self() since u_thread.h is going away soon.
Create a simple thread ID abstraction which wraps WIN32 or c11 threads.
This also gets rid of the questionable casting of thrd_t to an unsigned
long.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2015-03-05 06:59:43 -07:00
Brian Paul 6b5eb7bce6 mapi: fix preprocessor check in u_current_destroy()
So it matches the preprocessor check around the u_current_init_tsd() code.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2015-03-05 06:59:43 -07:00
Brian Paul 84094a273e glapi: remove u_mutex wrapper code, use c99 thread mutexes directly
v2: fix initializer mistake spotted by Chia-I Wu.

Reviewed-by: Chia-I Wu <olv@lunarg.com>
2014-03-06 07:53:06 -07:00
Brian Paul 846a7e8630 glapi: rename u_current dispatch table functions
Put "table" in the names to make things more understandable.

Reviewed-by: Chia-I Wu <olv@lunarg.com>
2014-03-06 07:47:12 -07:00
Brian Paul 280e065707 glapi: replace 'user' with 'context' in u_current.[ch] code
To make the functions more understandable.

Reviewed-by: Chia-I Wu <olv@lunarg.com>
2014-03-06 07:47:05 -07:00
Rico Schüller 3998cfa933 mesa: remove outdated version lines in comments
Signed-off-by: Brian Paul <brianp@vmware.com>
2013-06-05 08:54:27 -06:00
Kenneth Graunke 3d8d5b298a mesa: Restore 78-column wrapping of license text in C-style comments.
The previous commit introduced extra words, breaking the formatting.

This text transformation was done automatically via the following shell
command:
$ git grep 'THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY' | sed 's/:.*$//' | xargs -I {} sh -c 'vim -e -s {} < vimscript

where 'vimscript' is a file containing:
/THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY/;/\*\// !fmt -w 78 -p ' * '
:wq

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-04-23 22:07:09 -07:00
Kenneth Graunke 96ff2edc73 mesa: Add "OR COPYRIGHT HOLDERS" to license text disclaiming liability.
This brings the license text in line with the MIT License as published
on the Open Source Initiative website:

http://opensource.org/licenses/mit-license.php

Generated automatically be the following shell command:
$ git grep 'THE AUTHORS BE LIABLE' | sed 's/:.*$//g' | xargs -I '{}' \
  sed -i 's/THE AUTHORS/THE AUTHORS OR COPYRIGHT HOLDERS/' {}

This introduces some wrapping issues, to be fixed in the next commit.

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-04-23 22:07:06 -07:00
Kenneth Graunke dd404bc94f mesa: Change "BRIAN PAUL" to "THE AUTHORS" in license text.
Generated automatically be the following shell command:
$ git grep 'BRIAN PAUL BE LIABLE' | sed 's/:.*$//g' | xargs -I '{}' \
  sed -i 's/BRIAN PAUL/THE AUTHORS/' {}

The intention here is to protect all authors, not just Brian Paul.  I
believe that was already the sensible interpretation, but spelling it
out is probably better.

More practically, it also prevents people from accidentally copy &
pasting the license into a new file which says Brian is not liable when
he isn't even one of the authors.

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-04-23 22:06:38 -07:00
Matt Turner d5e9426b96 build: Move src/mapi/mapi/* to src/mapi/
Tested-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-and-Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2013-04-15 12:04:25 -07:00
Renamed from src/mapi/mapi/u_current.c (Browse further)