Commit graph

1942 commits

Author SHA1 Message Date
Mike Blumenkrantz
37701ba6bc glx/kopper: don't call glFlush from swapbuffers
this is redundant and leads to extra glthread syncs

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36887>
2025-08-22 00:42:28 +00:00
Mike Blumenkrantz
40b3479635 glx/egl/kopper: explicitly pass __DRI2_FLUSH_CONTEXT when appropriate
this avoids unnecessary st flushing

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36887>
2025-08-22 00:42:28 +00:00
Marek Olšák
ecbe35d878 egl,glx: allow OpenGL with old libx11, but disable glthread if it's unsafe
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
pass bool thread_safe to the dri frontend, and enable glthread accordingly

Reviewed-by: Eric Engestrom <eric@igalia.com>
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36378>
2025-08-21 02:05:26 +00:00
Marek Olšák
8f2532453c mesa: move src/mapi to src/mesa/glapi
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36562>
2025-08-06 20:35:26 +00:00
Yurii Kolesnykov
f292faebd7 Guard call to free_zombie_glx_drawable with condition from its definition
Signed-off-by: Yurii Kolesnykov <root@yurikoles.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13589
Fixes: ad9db6b259 ("glx: Free all populated fields of the glx_display on creation failure")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36495>
2025-08-06 08:46:52 +00:00
Antonio Ospite
ddf2aa3a4d build: avoid redefining unreachable() which is standard in C23
In the C23 standard unreachable() is now a predefined function-like
macro in <stddef.h>

See https://android.googlesource.com/platform/bionic/+/HEAD/docs/c23.md#is-now-a-predefined-function_like-macro-in

And this causes build errors when building for C23:

-----------------------------------------------------------------------
In file included from ../src/util/log.h:30,
                 from ../src/util/log.c:30:
../src/util/macros.h:123:9: warning: "unreachable" redefined
  123 | #define unreachable(str)    \
      |         ^~~~~~~~~~~
In file included from ../src/util/macros.h:31:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:456:9: note: this is the location of the previous definition
  456 | #define unreachable() (__builtin_unreachable ())
      |         ^~~~~~~~~~~
-----------------------------------------------------------------------

So don't redefine it with the same name, but use the name UNREACHABLE()
to also signify it's a macro.

Using a different name also makes sense because the behavior of the
macro was extending the one of __builtin_unreachable() anyway, and it
also had a different signature, accepting one argument, compared to the
standard unreachable() with no arguments.

This change improves the chances of building mesa with the C23 standard,
which for instance is the default in recent AOSP versions.

All the instances of the macro, including the definition, were updated
with the following command line:

  git grep -l '[^_]unreachable(' -- "src/**" | sort | uniq | \
  while read file; \
  do \
    sed -e 's/\([^_]\)unreachable(/\1UNREACHABLE(/g' -i "$file"; \
  done && \
  sed -e 's/#undef unreachable/#undef UNREACHABLE/g' -i src/intel/isl/isl_aux_info.c

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36437>
2025-07-31 17:49:42 +00:00
Faith Ekstrand
56ed5cf1bb dri: Get rid of __DRIbackgroundCallableExtension
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This was originally needed to bind the context to the background thread
for DRI2 because it needs to be able to get buffers from the X server.
With DRI3 and Wayland, however, it's not needed.  All the DRI3 code gets
everything it needs from the drawable and only uses the context for
flushes and blits, which always come from GLX itself, not the render
thread.  Now that we've deleted all the DRI2 code, let's delete this,
too.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36123>
2025-07-16 01:32:56 +00:00
Faith Ekstrand
30b98a7ec1 glx: Refuse to initialize if Display is not thread-safe
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36123>
2025-07-16 01:32:56 +00:00
Faith Ekstrand
950dac6e6c x11: Add an x11_xlib_display_is_thread_safe() helper
Even though Xlib 1.8 enables thread-safety by default it's still
theoretically possible that the user's system has an Xlib that has been
built with this turned off.  Warn in that case.  Since this requires
poking at Xlib internals, it's better to have this as a util helper.

Now that libloader_x11 contains more than just dri3 helpers, we build it
unconditionally if with_platform_x11 and just add loader_x11.c if it

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36123>
2025-07-16 01:32:56 +00:00
Faith Ekstrand
b8ef9bfbf5 x11: Move loader_x11.c/h to x11_dri3.c/h
That's more descriptive of what they actually are.

Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36123>
2025-07-16 01:32:55 +00:00
Faith Ekstrand
4e88f02ab4 egl,glx,kopper: Switch back to DRIkopperLoaderExtension::GetDrawableInfo
This decouples Kopper and swrast.  With this change, dri/kopper.c no
longer references DRIswrastLoaderEsxtension at all.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36014>
2025-07-14 18:31:46 +00:00
Faith Ekstrand
246c588ab2 glx: Drop LIBGL_DRI3_DISABLE
We no longer support DIR2 so there's nothing to fall back to if you
disable DRI3.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36054>
2025-07-10 17:11:13 +00:00
Emma Anholt
b4eed47828 glx: clean up a litttle remains of DRI2 support.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19942>
2025-07-09 14:31:05 -07:00
Daniel Stone
08c6ba223b x11: Remove DRI2 support
DRI2 was hidden behind a legacy-x11 build option back in the 24.2
release. It's now been a year, so let's get on with removing it so we
can simplify our winsys interactions.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35885>
2025-07-09 17:49:58 +00:00
Corentin Noël
ad9db6b259 glx: Free all populated fields of the glx_display on creation failure
Add a common path to ensure that there is no copy-paste error.

CID: 1644424,1644409 Resource leak

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35474>
2025-06-27 13:56:23 +00:00
Doug Nazar
c3980bb4ec glx: Fix memory leak with software dri
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
dri_screen_init() now calls glx_screen_init() directly. Calling
twice overwrites the config.

Fixes: 7930fe5f01 ("glx: unify dri screen init")
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35525>
2025-06-21 23:47:13 +00:00
Karol Herbst
0e322c6092 glx,egl: drop libpipe_loader_dynamic dependency
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/833>
2025-05-27 07:53:20 +00:00
Karol Herbst
2edd0c4bbd glx,egl: use driGetDriInfoXML
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/833>
2025-05-27 07:53:20 +00:00
Yurii Kolesnykov
9822fa3ef3 Get rid of 5 remaining references to glapitable.h
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Closes: #13003
Fixes: 0cebfb15 ("glapi: remove duplicated generated header glapitable.h")

Co-authored-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Yurii Kolesnykov <root@yurikoles.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34682>
2025-04-23 20:18:25 +00:00
Eric Engestrom
33caee7dfe glx: drop dead GL_LIB_NAME define
Fixes: 5b89be3545 ("glx: Don't try to dlopen ourselves")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34602>
2025-04-18 12:14:11 +00:00
Adam Jackson
5b89be3545 glx: Don't try to dlopen ourselves
The intention here, long ago, was to ensure that any symbols the DRI
driver needed from libGL were available. We don't have this problem
anymore, libgallium does not import any symbols from the GLX frontend
(or any other one for that matter).

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30417>
2025-04-18 07:14:56 +00:00
Marek Olšák
47d08dbde7 glx: stop exporting EXT_texture_object functions from libGLX_mesa.so
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
These aliases of the non-EXT functions have a non-aliased indirect GLX
implementation. Remove it since it's not needed.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34002>
2025-03-27 05:46:35 +00:00
Marek Olšák
574c1a70d6 mesa: move dispatch.h and marshal_generated.h generation to glapi/gen
This is where most files are generated. It's a prerequisite for
a future change.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34002>
2025-03-27 05:46:35 +00:00
Marek Olšák
b928304732 glx: remove the hack that forced exporting GL functions from libGL
GL functions were exported by luck because we incorrectly used
link_with in meson, which exports functions only if the static lib is
used. link_whole guarantees that the functions are always exported
even if the static lib is unused.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34002>
2025-03-27 05:46:35 +00:00
Marek Olšák
dcc805469b glx: add a test to verify exported symbols
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34002>
2025-03-27 05:46:34 +00:00
Marek Olšák
9e24940bc7 glx: don't generate indirect GLX dispatch for ARB_imaging functions
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34002>
2025-03-27 05:46:34 +00:00
Marek Olšák
8bb7033095 glx: fix build with -Dlegacy-x11=dri2
Fixes: 71bb62e3c9 - glx: stop exporting GL functions from libGLX_mesa.so

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33794>
2025-03-06 17:13:23 +00:00
Marek Olšák
0cebfb15b5 glapi: remove duplicated generated header glapitable.h
mesa/main/dispatch.h is exactly the same. We generated the same header
twice.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33794>
2025-03-06 17:13:23 +00:00
Marek Olšák
fefb1a6fb3 meson: remove with_shared_glapi variable (it's always true)
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33794>
2025-03-06 17:13:22 +00:00
Marek Olšák
906dcb56e1 glx: make it more obvious what libglapi_bridge is
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33634>
2025-03-03 21:06:06 +00:00
Marek Olšák
71bb62e3c9 glx: stop exporting GL functions from libGLX_mesa.so
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33634>
2025-03-03 21:06:06 +00:00
Marek Olšák
628608672c glx: fix hardcoded use of dispatch table index in glAreTexturesResidentEXT
No idea why this exists, and it's dead code with glvnd because it's
exported from libGLX_mesa.so.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33634>
2025-03-03 21:06:06 +00:00
Marek Olšák
ebf6008434 glx: don't call GL functions directly, use the current dispatch instead
With glvnd, GL functions will not be publicly exported from libGLX_mesa
and we don't even need them privately defined.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33634>
2025-03-03 21:06:06 +00:00
Marek Olšák
1fde49d50e glapi: remove unused functions from dispatch tables
We also have to remove __indirect_glVertexAttribPointerNV because nothing
uses it after the removal from dispatch tables.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33634>
2025-03-03 21:06:06 +00:00
Mike Blumenkrantz
0e87acb2f3 dri: delete INVALIDATE extension
this shouldn't be needed anymore since it doesn't do anything

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33774>
2025-02-26 21:46:06 +00:00
Adam Jackson
32a10ccbdd glx: Remove (almost) all usage of _X_HIDDEN / _X_INTERNAL
It's redundant at this point. The one exception is for GLX_PUBLIC when
building for glvnd, because then we really do want the GLX API to be
hidden.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33623>
2025-02-20 15:47:23 +00:00
Adam Jackson
09bbf71e68 glx: Make #undef GLX_INDIRECT_RENDERING do something
Not that meson lets you reach this state yet, but if you did, you'd
still build all of the indirect code but the linker would gc most of it.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33623>
2025-02-20 15:47:23 +00:00
Qiang Yu
42068643e9 dri,egl,glx: remove redundant usage of HAVE_X11_DRM
These files are build or used only when drm platform is
available, no need to check this macro inside them.

Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31657>
2025-02-17 02:50:15 +00:00
Qiang Yu
2a1ae6d94b glx/egl/x11: fix x11_dri3_check_multibuffer
glx/egl "multibuffers" denotes if server side support DRI3
multi plane and modifiers which is version >= 1.2. But now
it returns true just when DRI3 version >= 1.

This causes problem when xserver with amdgpu DDX which only
support DRI3 1.0, so "multibuffers" gets set unexpectedly,
and client send DRI3 >= 1.2 request to server which gets
unimplemented error.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31657>
2025-02-17 02:50:15 +00:00
Matt Turner
388e9e6b33 glx: Fix typos
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33556>
2025-02-15 17:43:44 +00:00
Michel Dänzer
e4d189f26f egl/glx/sw: Check xcb_query_extension_reply return value for MIT-SHM
For consistency with other xcb_query_extension_reply callers.

v2:
* Now with less use-after-free. (Eric Engestrom)

Reviewed-by: Eric Engestrom <None>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33400>
2025-02-08 13:50:15 +00:00
Hyunjun Ko
bf88b9b324 kopper: implement to get sync values.
v1. Makes special_event a member of struct dri_drawable to be re-used.
(Michel Dänzer @daenzer)

v2. Guard with VK_USE_PLATFORM_XCB_KHR and clean-up.
(Mike Blumenkrantz @zmike)

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31474>
2025-02-04 14:36:05 +00:00
Marek Olšák
e7214b9446 glapi: rename exported symbols so as not to conflict with old libglapi
libwaffle 1.7.0 has a hack that dlopen's libglapi with RTLD_GLOBAL, which
was meant to preload libglapi, but with this MR it overwrites libgallium's
own symbols, which breaks libgallium.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Eric Engestrom <None>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32789>
2025-01-23 00:49:05 +00:00
Marek Olšák
44bda7c258 dri: put shared-glapi into libgallium.*.so
so that we don't have to maintain a stable ABI for it.

This will allow removal of the remapping table to reduce CALL_* overhead
for GL dispatch tables.

Also we can now clean it up.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Eric Engestrom <None>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32789>
2025-01-23 00:49:05 +00:00
Pierre-Eric Pelloux-Prayer
b307951648 glx: fix glx-create-context-invalid-es-version
* GLES3.x is only valid for x <= 2
* The expected error is GLXBadProfileARB, not BadValue

cc: mesa-stable

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33036>
2025-01-21 14:33:13 +00:00
Qiang Yu
e5e5af05ea egl,gallium,glx: replace dri_get_screen_param with pipe_caps access
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32955>
2025-01-17 04:39:46 +00:00
duncan.hopkins
20b806284a glx: Add back in applegl_create_display() so the OpenGL.framework, on MacOS, pointer get setup.
Fixes: 4e8740370a ("glx: rework __glXInitialize")

Tested-by: Yurii Kolesnykov <root@yurikoles.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32656>
2025-01-12 16:49:33 +00:00
duncan.hopkins
48ebbe2777 glx: Guard some of the bind_extensions() code with the same conditions as glx_screens frontend_screen member.
Configution like simple MacOS builds do not have `frontend_screen` and fail to build.

Fixes: 34dea2b38e ("glx: unify extension binding")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12317

Tested-by: Yurii Kolesnykov <root@yurikoles.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32656>
2025-01-12 16:49:33 +00:00
duncan.hopkins
568a4ca899 glx: ignore zink check for has_explicit_modifiers and DRI3 on MacOS.
MacOS has neither of these so always fails to start up zink.

Reviewed-By: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32568>
2024-12-13 00:39:16 +00:00
duncan.hopkins
e89eba0796 glx: change #if guard around dri_common.h to stop missing 'driDestroyConfigs' symbol on MacOS builds.
Reviewed-By: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32568>
2024-12-13 00:39:16 +00:00