summaryrefslogtreecommitdiff
path: root/glx
AgeCommit message (Collapse)AuthorFilesLines
2024-10-10drop obsolete HAVE_DIX_CONFIG_HEnrico Weigelt, metux IT consult24-48/+0
The symbol controls whether to include dix-config.h, and it's always set, thus we don't need it (and dozens of ifdef's) anymore. This commit only removes them from our own source files, where we can guarantee that dix-config.h is present - leaving the (potentially exported) headers untouched. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-07-26treewide: replace xnfstrdup() calls by XNFstrdup()Enrico Weigelt, metux IT consult1-1/+1
This has been nothing but an alias for two decades now (somewhere in R6.6), so there doesn't seem to be any practical need for this indirection. The macro still needs to remain, as long as (external) drivers still using it. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1529>
2024-07-26treewide: replace xnfalloc() calls to XNFalloc()Enrico Weigelt, metux IT consult2-2/+2
This has been nothing but an alias for two decades now (somewhere in R6.6), so there doesn't seem to be any practical need for this indirection. The macro still needs to remain, as long as (external) drivers still using it. Fixes: ded6147bfb5d75ff1e67c858040a628b61bc17d1 Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1529>
2024-06-23dix: unexport fields from opaque.h not used by modules/driversEnrico Weigelt, metux IT consult1-0/+2
Lots of fields from opaque.h aren't used by any drivers/modules and thus don't need to be exported at all. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1351>
2024-06-23xace: typesafe hook function for XACE_RESOURCE_ACCESSEnrico Weigelt, metux IT consult1-1/+1
The generic XaceHook() call isn't typesafe (und unnecessarily slow). Better add an explicit function, just like we already have for others. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1556>
2024-04-30include: move private definitions out of extinit.hEnrico Weigelt, metux IT consult1-0/+1
Public server module API shouldn't be clobbered with private definitions, thus move them out to extinit_priv.h. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1289>
2024-04-15rename remaining RT_* defines to X11_RESTYPE_*Enrico Weigelt, metux IT consult2-3/+3
Since we already had to rename some of them, in order to fix name clashes on win32, it's now time to rename all the remaining ones. The old ones are still present as define's to the new ones, just for backwards compatibility. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1355>
2024-04-15prevent name clash on Windows w/ RT_* definesEnrico Weigelt, metux IT consult2-2/+2
Windows' native headers using some our RT_* define's names for other things. Since the naming isn't very nice anyways, introducing some new ones (X11_RESTYPE_NONE, X11_RESTYPE_FONT, X11_RESTYPE_CURSOR) and define the old ones as an alias to them, in case some out-of-tree code still uses them. With thins change, we don't need to be so extremely careful about include ordering and have explicit #undef's in order to prevent name clashes on Win32 targets. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1355>
2024-04-15dix: unexport some lookup functionsEnrico Weigelt, metux IT consult2-2/+6
These aren't used by any drivers, so no need to export them. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1380>
2024-03-03include: drop obsolete registry.hEnrico Weigelt, metux IT consult1-1/+0
Now that there's no actual consumer of it left, it can be dropped. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1348>
2024-02-22glx: move private definitions from vndserver.h to vndserver_priv.hEnrico Weigelt, metux IT consult5-92/+121
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1292>
2024-02-19drop remains of support for old Sun compilersEnrico Weigelt, metux IT consult4-4/+4
With transition from autoconf to meson, these aren't actually supported anymore, and re-adding it isn't planned. Thus the now dead code pathes can be completely removed. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1286>
2024-01-16glx: Call XACE hooks on the GLX bufferOlivier Fourdan1-0/+8
The XSELINUX code will label resources at creation by checking the access mode. When the access mode is DixCreateAccess, it will call the function to label the new resource SELinuxLabelResource(). However, GLX buffers do not go through the XACE hooks when created, hence leaving the resource actually unlabeled. When, later, the client tries to create another resource using that drawable (like a GC for example), the XSELINUX code would try to use the security ID of that object which has never been labeled, get a NULL pointer and crash when checking whether the requested permissions are granted for subject security ID. To avoid the issue, make sure to call the XACE hooks when creating the GLX buffers. Credit goes to Donn Seeley <donn@xmission.com> for providing the patch. CVE-2024-0408 Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-12-09GLX: Free the tag of the old context laterDoğukan Korkmaztürk1-4/+3
In CommonMakeCurrent() function, the tag of the old context is freed before the new context is made current. This is problematic because if the CommonMakeNewCurrent() function fails, the tag of the old context ends up being removed, even though it is still active. This causes subsequent glXMakeCurrent() or glXMakeContextCurrent() requests to generate a GLXBadContextTag error. This change moves the function call that frees the old tag to a location where the result of CommonMakeNewCurrent() call is known and it is safe to free it. Signed-off-by: Doğukan Korkmaztürk <dkorkmazturk@nvidia.com>
2022-04-02glx: remove a noop assert (index is unsigned)Konstantin Kharlamov1-1/+0
Fixes "Pointless comparison of unsigned value to zero." Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2021-12-19glx/dri: Filter out fbconfigs that don't have a supported pixmap formatAdam Jackson1-0/+20
For depth 30 in particular it's not uncommon for the DDX to not have a configured pixmap format. Since the client expects to back both GLXPixmaps and GLXPbuffers with X Pixmaps, trying to use an x2rgb10 fbconfig would fail along various paths to CreatePixmap. Filter these fbconfigs out so the client can't ask for something that we know won't work.
2021-10-27Remove autotools supportPovilas Kanapickas1-95/+0
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2021-06-21glx: Fix use after free in MakeCurrentOlivier Fourdan1-2/+2
The fix from commit c468d34c7 - "glx: Set ContextTag for all contexts" is actually incomplete, it correctly sets the context tag for direct contexts as well, but would fail to mark the context's currentClient. As a result, when the context is destroyed, it would be freed immediately rather than being just scheduled for deletion, even though it is still current for some client. leading to a use-after-free. Make sure to also set the context's currentClient for direct contexts as well, not just indirect ones. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Fixes: c468d34c7 - "glx: Set ContextTag for all contexts" Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1186 Reviewed-by: Adam Jackson <ajax@redhat.com>
2021-06-08glx: Set ContextTag for all contextsOlivier Fourdan1-1/+2
Currently, xorgGlxMakeCurrent() would set the context tag only for indirect GLX contexts. However, several other places expect to find a context for the tag or they would raise a GLXBadContextTag error, such as WaitGL() or WaitX(). Set the context tag for direct contexts as well, to avoid raising an error and possibly killing the client. Thanks to Erik Kurzinger <ekurzinger@nvidia.com> for spotting the issue. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2021-06-07glx: don't create implicit GLXWindow if one already existsErik Kurzinger1-2/+9
If a GLXMakeCurrent request specifies an X window as its drawable, __glXGetDrawable will implicitly create a GLXWindow for it. However, the client may have already explicitly created a GLXWindow for that X window. If that happens, two __glXDrawableRes resources will be added to the window. If the explicitly-created GLXWindow is later destroyed by the client, DrawableGone will call FreeResourceByType on the X window, but this will actually free the resource for the implicitly-created GLXWindow, since that one would be at the head of the list. Then if the X window is destroyed after that, the resource for the explicitly-created GLXWindow will be freed. But that GLXWindow was already destroyed above. This crashes the server when it tries to call the destroyed GLXWindow's destructor. It also means the implicitly-created GLXWindow would have been leaked since the FreeResourceByType call mentioned above skips calling the destructor. To fix this, if __glXGetDrawable is given an X window, it should check if there is already a GLXWindow associated with it, and only create an implicit one if there is not. Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2021-05-30glx: Check for byte-swapping in SetReplyHeaderNiveditha Rau1-0/+3
Check for the need to byte-swap when attempting to display GL apps between a big-endian server and little-endian client or vice versa. Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1127
2021-05-30glx: Fix error return code in GLXGetDrawableAttributesAdam Jackson1-1/+1
This should only ever throw GLXBadDrawable, says the protocol spec.
2021-04-24glxcmds: Fix possible out of boundsqarmin1-1/+0
2021-03-11meson: hide C API if Xorg is disabled (like autotools)Jan Beich1-1/+3
When building only Xwayland using Meson some files are always installed. This causes package conflict if Xwayland is built separately from Xorg. include/xorg/compositeext.h include/xorg/damage.h include/xorg/damagestr.h include/xorg/dbestruct.h include/xorg/dri3.h include/xorg/fb.h include/xorg/fboverlay.h include/xorg/fbpict.h include/xorg/fbrop.h include/xorg/geext.h include/xorg/geint.h include/xorg/glyphstr.h include/xorg/mi.h include/xorg/micmap.h include/xorg/micoord.h include/xorg/migc.h include/xorg/miline.h include/xorg/mioverlay.h include/xorg/mipict.h include/xorg/mipointer.h include/xorg/mipointrst.h include/xorg/mistruct.h include/xorg/misync.h include/xorg/misyncfd.h include/xorg/misyncshm.h include/xorg/misyncstr.h include/xorg/mizerarc.h include/xorg/panoramiX.h include/xorg/panoramiXsrv.h include/xorg/picture.h include/xorg/picturestr.h include/xorg/present.h include/xorg/presentext.h include/xorg/randrstr.h include/xorg/rrtransform.h include/xorg/shadow.h include/xorg/shmint.h include/xorg/syncsdk.h include/xorg/vndserver.h include/xorg/wfbrename.h include/xorg/xace.h include/xorg/xacestr.h include/xorg/xorg-server.h include/xorg/xvdix.h include/xorg/xvmcext.h share/aclocal/xorg-server.m4 Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2020-11-30glx: Remove unused bswap_CARD64Michel Dänzer1-12/+0
GCC warned about it: ../../../glx/indirect_dispatch_swap.c:85:1: warning: ‘bswap_CARD64’ defined but not used [-Wunused-function] 85 | bswap_CARD64(const void *src) | ^~~~~~~~~~~~
2020-11-26GLX: fix context render type queriesErik Kurzinger3-5/+16
Querying the GLX_RENDER_TYPE of a GLX context via glXQueryContext will currently return the render type of the context's FB config, which is a bitmask of GLX_RGBA_BIT / GLX_COLOR_INDEX_BIT / ... values. However, this query should really return the render type that was specified when creating the context, which is one of GLX_RGBA_TYPE / GLX_COLOR_INDEX_TYPE / .... To enable this, save the render type when creating a new context (defaulting to GLX_RGBA_TYPE if unspecified), and then include this value in the context attributes sent to clients.
2020-11-09configure: Build hashtable for Xres and glvndOlivier Fourdan1-1/+3
With autoconf, hashtable support is built along with Xres support. Yet, glvnd also use it, so when disabling Xres from configure, the build will fail at link time because hashtable functions are not available. Untie the build of hashtable from Xres support, just like meson build does. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1091
2020-09-30glx: set errorValue when returning GLXBadFBConfigPeter Harris1-2/+7
client->errorValue is already set in validGlxFBConfig. Set it in __glXDisp_CreateContextAttribsARB for consistency. Signed-off-by: Peter Harris <pharris@opentext.com>
2020-09-28glx: Implement GLX_EXT_get_drawable_typeAdam Jackson3-1/+11
Trivial extension to let the client query whether this is a window pixmap or pbuffer. Mostly for Mesa's convenience when setting up drawable state, but plausibly useful for apps and middleware as well. Upstream OpenGL Registry merge request: https://github.com/KhronosGroup/OpenGL-Registry/pull/425
2020-07-05Fix spelling/wording issuesAlan Coopersmith2-2/+2
Most (but not all) of these were found by using codespell --builtin clear,rare,usage,informal,code,names but not everything reported by that was fixed. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-05-27glx: unbreak on Unix without /usr/include/drmJan Beich1-0/+1
In file included from ../glx/glxdri2.c:35: /usr/local/include/GL/internal/dri_interface.h:43:10: fatal error: 'drm.h' file not found #include <drm.h> ^~~~~~~ In file included from ../glx/glxdriswrast.c:39: /usr/local/include/GL/internal/dri_interface.h:43:10: fatal error: 'drm.h' file not found #include <drm.h> ^~~~~~~
2020-03-30glx: Require screens match for share contexts for classic CreateContextAdam Jackson1-0/+9
The GLX_ARB_create_context path (with which this should all get unified, someday, sigh) already enforces this, but the classic path does not. It's effectively assumed by the implementation anyway, so let's enforce it rather than do crashy things. Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
2020-03-23glx: fixup symbol name for get_extensions functionVasily Khoruzhick1-0/+10
glxProbeDriver() concatenates __DRI_DRIVER_GET_EXTENSIONS with driver name to get symbol name for get_extension function. Unfortunately that doesn't work for drivers that have hyphen in their name, e.g. sun4i-drm -- get_extensions() for these uses underscore instead. As result dlsym() doesn't find get_extension() function and AIGLX initialization fails resulting in following message in Xorg.0.log: (EE) AIGLX error: sun4i-drm does not export required DRI extension Replace all non-alpha-numeric characters with underscore to fix the issue. Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
2020-01-28Revert "dri2: Don't make reference to noClientException"Adam Jackson1-1/+1
It's true that the value would always be -1, if it's not zero, but it's usually zero is the problem. As a result we return failure from otherwise successful indirect GLX paths, which isn't very nice of us. This reverts commit 7d33ab0f8c7958b205076f71e4b47c24aace77fd. Fixes: https://gitlab.freedesktop.org/xorg/xserver/issues/211
2019-10-30dix: Call SourceValidate before GetImageAdam Jackson1-0/+1
This ensures that any prep work for the drawable we're about to read from is already done before we call down to GetImage. This should be no functional change as most of the callers with a non-trivial SourceValidate are already wrapping GetImage and doing the equivalent thing, but we'll be simplifying that shortly. More importantly this ensures that if any of that prep work would generate events - like automatic compositing flushing rendering to a parent pixmap which then triggers damage - then it happens entirely before we start writing the GetImage reply header. Note that we do not do the same for GetSpans, but that's okay. The only way to get to GetSpans is through miCopyArea or miCopyPlane - where the callers must already call SourceValidate - or miGetImage - which this commit now protects with SourceValidate. Fixes: xorg/xserver#902 Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2019-10-09meson: Apparently 1.2 is < 1.2.0Adam Jackson1-1/+1
Siiiigh.
2019-10-09meson: Fix another reference to "gl" 9.2.0Adam Jackson1-1/+1
Previous commit e6ef2b12 missed a spot.
2019-10-08build: glx: Lower gl version to work with libglvndMarvin Schmidt1-1/+1
When using mesa with libglvnd support, mesa will no longer install the gl, glx, egl pkg-config files but instead let libglvnd provide them. libglvnd maintainers decided to change the versioning as it was mesa-specific previously. Now the libraries have versions of the API they expose[1]. This causes problems when building the X server: checking for glproto >= 1.4.17 gl >= 9.2.0... no configure: error: Package requirements (glproto >= 1.4.17 gl >= 9.2.0) were not met: Requested 'gl >= 9.2.0' but version of gl is 1.2 Lower the version requirement to 1.2 to allow building against libglvnd provided libraries [1] https://github.com/NVIDIA/libglvnd/commit/0dfaea2bcb7cdcc785f95e244223bd004a2d7fba
2019-08-26glx: Disable GLX_EXT_import_context if !enableIndirectGLXAdam Jackson1-2/+6
GLX_EXT_import_context allows multiple clients to share the same indirect context. If you can't create an indirect context, you're certainly not going to be able to share one. Hide the extension from the server string if we've disabled indirect contexts. This turns piglit's tests from fail to skip when indirect contexts are disabled. Since GLX_EXT_import_context has been supported in xfree86-derived servers since day 1 (it was included in the initial GLX code drop from SGI), this is now also a hint to the client that indirect contexts are unlikely to work at all. Reviewed-by: Michel Dänzer <michel@daenzer.net>
2019-08-20glx: Fix previous context validation in xorgGlxMakeCurrentAdam Jackson1-3/+1
vnd has already verified that the context tag is valid before this gets called, and we only set the context tag private data to non-null for indirect clients. Mesa happens to be buggy and doesn't send MakeCurrent requests nearly as much as it should for direct contexts, but if you fix that, then unbinding a direct context would fail here with GLXBadContextTag. Sadly Mesa will still need to carry a workaround here for broken servers, but we should still fix the server.
2019-05-21GLX: Set GlxServerExports::{major,minor}VersionAaron Plattner1-2/+2
Commit 56c0a71fdd94a008e5d746261f70a713c4767f93 incremented the GLXSERVER_VENDOR_ABI_MINOR_VERSION define, but this define was not actually being used to set glxServer.minorVersion. Update the initializer for glxServer to use the correct version numbers. Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
2019-05-17Merge commit 'refs/merge-requests/194/head' of ↵Aaron Plattner4-11/+79
gitlab.freedesktop.org:xorg/xserver
2019-05-17GLX: Add a function to change a clients vendor list.Kyle Brenneman3-0/+23
Add a new function, GlxServerExports::setClientScreenVendor, which will change the vendor that handles GLX requests for a screen, but only for requests from a specific client. v2: Increment the GLXVND minor version number. v3: Note the GLXVND version requirement for setClientScreenVendor. Signed-off-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2019-05-17GLX: Use the sending client for looking up XID'sKyle Brenneman3-6/+26
When GlxGetXIDMap looks up an unknown XID, it will now look up a vendor based on the screen number for the XID and the client that sent the current request. In GlxGetXIDMap, if the XID is for a regular X window, then it won't be in the (XID -> vendor) mapping, so we have to look up a vendor by screen number. With this change, GlxGetXIDMap will use the (screen -> vendor) map for whichever client sent the current request, instead of using the global (screen -> vendor) map. Since GlxGetXIDMap doesn't take a ClientPtr argument, GlxDispatchRequest will store the client for the current request in a global variable. That way, the ABI for GLXVND doesn't need to change. v2: Fix an error check in GlxDispatchRequest. Signed-off-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2019-05-17GLX: Add a per-client vendor mapping.Kyle Brenneman3-5/+30
Each client now has its own (screen, vendor) mapping. Currently, it's just a copy of the global mapping, but later changes will allow it to change. Signed-off-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2019-05-14glx: Fix potential crashes in glXWait{GL,X}Adam Jackson1-2/+2
glxc->drawPriv will be NULL if the context is direct, or if it is current but without a bound drawable. Mesa's libGL won't normally emit protocol for direct contexts for these calls, but a malign client could still crash the server.
2019-05-01glx: Fix GLX_CONTEXT_RELEASE_BEHAVIOR_ARB handlingAdam Jackson2-6/+5
None of this was getting compiled because we hadn't defined the macro (and aren't getting them from <GL/glxext.h> because reasons). Fix that. Fixes: xorg/xserver#684
2019-04-30meson: Fix value of libglxvnd in -Dglx=false buildJon Turney1-1/+1
hw/vfb/meson.build:7:0: ERROR: '' is not a target.
2019-01-16vnd: Fix a silly memory leakAdam Jackson1-4/+0
'disp' was already allocated by LookupVendorPrivDispatch above, clobbering it will do no good. Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-09-10glx: check for indirect context in CreateContextAttribsARB()Olivier Fourdan1-0/+12
Commit 99f0365b "Add a command line argument for disabling indirect GLX" added a test to check if indirect context are enabled in `DoCreateContext()` but `__glXDisp_CreateContextAttribsARB()` doesn't use `DoCreateContext()` and doesn't check if indirect context is enabled. As a result, clients can still manage to create indirect contexts using `glXCreateContextAttribsARB()` even if indirect contexts are disabled, which can possibly crash Xservers such as Xwayland or Xephyr when the context is destroyed. To avoid the issue, check for `enableIndirectGLX` in `__glXDisp_CreateContextAttribsARB()` as well. Fixes: 99f0365b "Add a command line argument for disabling indirect GLX" Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107508 Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>