summaryrefslogtreecommitdiff
path: root/glx
AgeCommit message (Collapse)AuthorFilesLines
2018-06-21glx/vndcmds: Fix vendor hash table key sizeVladimir Panteleev1-1/+1
The keySize parameter of the hashing/comparison functions was incorrectly specified to be sizeof(void*), even though the keys of this hashtable are CARD32. Fixes address sanitizer failure on 64-bit builds. Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-05-08glx: Be sure to set an error for ghost contextsAdam Jackson1-1/+3
Otherwise the caller is going to return garbage memory for the error value. Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-04-24glx: Require depth > 12 for GLX visualsAdam Jackson1-2/+3
fb is happy to do TrueColor to 8bpp drawables, but mesa is not. Depth 12 is the biggest pseudocolor anyone ever really did, and 15 is the least truecolor. Without this Xvfb at depth 8 would "have" GLX, but no vendors would actually back any of the screens. libGL will attempt to call GLXQueryServerString to figure out the GLX version, and vnd will throw an error because there's no vendor to dispatch that to, and then clients crash. Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-04-24vnd: Disable GLX if no vendors successfully initializedAdam Jackson3-3/+12
Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-04-19meson: Fix indenting in glx/meson.buildLyude Paul1-2/+2
No functional changes, just fixing a tabs vs. space error I noticed Signed-off-by: Lyude Paul <lyude@redhat.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-10glx: Do not call into Composite if it is disabled.Michal Srb2-41/+55
Otherwise X server crashes if GLX is enabled and Composite disabled. For example the compIsAlternateVisual function will try to lookup CompScreenPtr using the CompScreenPrivateKey, but that was never initialized if Composite is disabled. Fixes: f84e59a4f4. ("glx: Duplicate relevant fbconfigs for compositing visuals") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104993 Signed-off-by: Michal Srb <msrb@suse.com>
2018-04-09GLX: Fix a use after free error with the GLVND vendor handle.Kyle Brenneman1-6/+7
The GLVND layer will destroy all of the vendor handles at the end of each server generation, but the GLX module then tries to re-use the same (now-freed) handle in xorgGlxServerInit at the start of the next generation. In xorgGlxCloseExtension, explicitly destroy the vendor handle and set it to NULL so that the next call to xorgGlxServerInit will recreate it. Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-02meson: Distribute more SDK headersThierry Reding1-0/+6
Install missing headers to the SDK directory to allow external modules to properly build against the SDK. After this commit, the list of files installed in the SDK include directory is the same as the list of files installed by the autotools-based build. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
2018-03-28Don't delete GLX's extensionInitCallback list during a reset.Kyle Brenneman1-3/+12
When a callback list is initialized using CreateCallbackList via AddCallback, the list gets added to the listsToCleanup array, and as a result the list gets deleted at the end of the server generation. But, vendor libraries add themselves to that callback list only once, not once per generation, so if you delete the list, then no vendor will register itself on the next generation, and GLX breaks. Instead, use a static CallbackListRec for the extensionInitCallback list. That way, it doesn't get added to listsToCleanup, and doesn't get deleted during a reset. Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-21glx: honor LIBGL_DRIVERS_PATH when loading DRI driversNicolai Hähnle1-4/+34
Allow switching to another driver build without a full installation. Glamor already takes LIBGL_DRIVERS_PATH into account, so this change makes sure that the same driver is used in both parts of the server. Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com> Reviewed-by: Ben Crocker <bcrocker@redhat.com> Reviewed-by: Antoine Martin <antoine@nagafix.co.uk> Tested-by: Ben Crocker <bcrocker@redhat.com>
2018-02-28glx: Add vndserver.h to the SDKAdam Jackson1-2/+4
Also unbreak 'make distcheck', sigh autotools. Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-02-26glx: Don't pass NULL to glxGetClientMichel Dänzer1-2/+2
These guards were dropped by the commit below, but it turns out they're needed. Fixes crash on VT switch. Fixes: d8ec33fe0542 ("glx: Use vnd layer for dispatch (v4)") Bugzilla: https://bugs.freedesktop.org/105233 Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-02-26glx: Fix indirect no-config contextsAdam Jackson1-0/+3
We would throw BadValue here for the GLX_SCREEN attribute. The upper dispatch layer already checks this, we can ignore it here. Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-02-26glx: Enable GLX_ARB_create_context_no_error (v2)Adam Jackson6-1/+18
This is mostly for the client library's convenience, if this extension is listed then it can know the attribute won't be rejected. Note that we don't honor this attribute for indirect contexts. That's fine, we don't want to introduce undefined behavior into a potentially privileged process. v2: Remember to ignore the attribute (Eric Anholt) Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-02-21glx: set the version we implement in GlxServerExportsEmil Velikov1-2/+2
Set the major/minor version it's currently implemented, not the one provided by the GLXSERVER_VENDOR_ABI_{MAJOR,MINOR}_VERSION macros. Those are identical for now, but can change in the future. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-02-21glx: use C99 initializers for GlxServerExportsEmil Velikov1-20/+20
Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-02-21glx: NULL check the correct argument in dispatch_GLXVendorPrivEmil Velikov1-3/+4
malloc can return NULL, unlike GetVendorDispatchFunc. The latter provides DispatchBadRequest. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-02-21glx: keep glvnd_vendor a private [static] variableEmil Velikov1-3/+5
Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-02-14dri2: warning fixAdam Jackson1-1/+1
/home/ajax/git/xserver/at/../glx/glxdri2.c: In function ‘create_driver_context’: /home/ajax/git/xserver/at/../glx/glxdri2.c:444:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] const __DRIconfig *driConfig = config ? config->driConfig : NULL; I don't know why autotools has decided not to be C99 but at least it's trivial to fix. Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-02-14glx: Large commands are context state, not client stateAdam Jackson5-61/+61
There's no reason a multithreaded client shouldn't be allowed to interleave other requests (for other contexts) with a RenderLarge. Move the check into __glXForceCurrent, and store the state in the context not the client. Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-02-14glx: Use vnd layer for dispatch (v4)Adam Jackson8-369/+297
The big change here is MakeCurrent and context tag tracking. We now delegate context tags entirely to the vnd layer, and simply store a pointer to the context state as the tag data. If a context is deleted while it's current, we allocate a fake ID for the context and move the context state there, so the tag data still points to a real context. As a result we can stop trying so hard to detach the client from contexts at disconnect time and just let resource destruction handle it. Since vnd handles all the MakeCurrent protocol now, our request handlers for it can just be return BadImplementation. We also remove a bunch of LEGAL_NEW_RESOURCE, because now by the time we're called vnd has already allocated its tracking resource on that XID. v2: Update to match v2 of the vnd import, and remove more redundant work like request length checks. v3: Add/remove the XID map from the vendor private thunk, not the backend. (Kyle Brenneman) v4: Fix deletion of ghost contexts (Kyle Brenneman) Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-02-14glx: Import glxvnd server module (v2)Kyle Brenneman9-1/+1816
This is based on an out-of-tree module written by Kyle: https://github.com/kbrenneman/libglvnd/tree/server-libglx I (ajax) did a bunch of cosmetic fixes, ported it off xfree86 API, added request length checks, and fixed a minor bug or two. v2: Use separate functions to set/get a context tag's private data, and call the backend's MakeCurrent when a client disconnects to unbind the context. (Kyle Brenneman) Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-02-06glx: Only assign 8 bpc fbconfigs for composite visuals.Mario Kleiner1-0/+3
Commit 91c42093b248 ("glx: Duplicate relevant fbconfigs for compositing visuals") adds many new depth 32 fbconfigs as composite visuals. On a X-Screen running at depth 24, this also adds bgra 10-10-10-2 fbconigs, as they also have config.rgbBits == 32, but these are not displayable on a depth 24 screen, leading to visually corrupted desktops under some compositors, e.g., fdo bug 104597 "Compton weird colors" when running compton with "compton --backend glx". Be more conservative for now and only select fbconfigs with 8 bpc red, green, blue components for composite visuals. Fixes: 91c42093b248 ("glx: Duplicate relevant fbconfigs for compositing visuals") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104597 Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-01-22glx: Move provider setup interface to glx_extinit.hAdam Jackson1-10/+1
Keeps us from needing to add glx/ to the include path everywhere, since we can't add it to the dix include path because the header file names conflict with glxproxy. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2018-01-22miinitext: General cleanup (v2)Adam Jackson1-0/+1
This really just wants to be the list of disable booleans and initialization functions, and nothing else. Stop including the protocol headers from extinit.h, remove a stray mention of xgl, and move an XInput declaration to a better place. v2: A bunch of drivers assume they'll get the DPMS tokens implicitly, so add it to globals.h. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2018-01-08glx: Stop printing messages about what GLX extensions we enableAdam Jackson2-29/+3
glxinfo already exists, use it. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2017-12-14glx: do not pick sRGB config for 32-bit RGBA visualTapani Pälli1-0/+5
This fixes blending issues seen with kwin and gnome-shell when 32bit visual has sRGB capability set. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103699 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103646 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103655
2017-12-04glx: Implement GLX_EXT_no_config_context (v2)Adam Jackson6-14/+35
Only enabled for the DRI backends at the moment. In principle WGL/CGL could support this - it's sort of implied by GL 3.0 support - but in practice their implementations back GLX drawables with native drawables (and not anonymous FBOs), so they would need either a corresponding window system binding extension or significant implementation work. v2: Require that the two screen numbers match, per v4 of spec. Khronos: https://github.com/KhronosGroup/OpenGL-Registry/pull/102 Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2017-12-01glx: Prepare __glXGetDrawable for no-config contextsAdam Jackson1-7/+39
Any proper (GLX 1.3) drawable will already have a bound config, but if we're doing the GLX 1.2 thing of making a Window current, we need to infer the config from the window's Visual. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2017-12-01glx: Fix glXQueryContext for GLX_FBCONFIG_ID and GLX_RENDER_TYPE (v2)Adam Jackson3-1/+8
Just never filled in, oops. Seems to have gone unnoticed because normally glXQueryContext simply returns the values filled in by the client library when the context was created. The only path by which you normally get to a GLXQueryContext request is glXImportContext, and then only if the context is already indirect. However, that's a statement about Mesa's libGL (and anything else that inherited that bit of the SGI SI more or less intact). Nothing prevents a mischeivous client from issuing that request of a direct context, and if they did we'd be in trouble because we never bothered to preserve the associated fbconfig in the context state, so we'd crash looking up GLX_VISUAL_ID_EXT. So let's fix that too. v2: Fixed missing preservation of the config in DRI2 (Eric Anholt) Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2017-11-15glx: Only flush indirect contexts in MakeCurrent (v2)Adam Jackson1-1/+1
If the context is direct none of the GL commands were issued by this process, the server couldn't flush them even if it wanted to. v2: Fix embarassingly obvious boolean inversion (Michel Dänzer) Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2017-11-07glx: Fix typos that break GLX_ARB_context_flush_controlAdam Jackson2-2/+2
The trailing \n are just wrong here, __glXEnableExtension wants a string without them. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2017-11-06glx: free fbconfigs on destroyGiuseppe Bilotta1-0/+7
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
2017-11-03glx: Duplicate relevant fbconfigs for compositing visualsThomas Hellstrom3-6/+61
Previously, before GLX_OML_swap_method was fixed, both the X server and client ignored the swapMethod fbconfig value, which meant that, if the dri driver thought it exposed more than one swapMethod, it actually just exported a duplicated set of fbconfigs. When fixing GLX_OML_swap_method and restricting the choice for built-in visuals to a single swap method that meant we didn't have that many fbconfigs to choose from when pairing the compositing visual with an fbconfig, resulting in the fbconfig paired with the compositing visual becoming too restrictive for some applications, (at least for kwin). This problem would also happen if the dri driver only exposed a single swap method to begin with. So, to make sure the compositing visual gets a good enough fbconfig, duplicate fbconfigs that are suitable for compositing visuals and make sure these duplicated fbconfigs can be used only by compositing visuals. For duplicated fbconfigs not paired with a compositing visual, construct new compositing visuals, making compositing clients able to choose visuals / fbconfig more adapted to their needs. This is in some sense equivalent to adding a new "TRUECOLOR_COMPOSITING" GLX visualtype. Fixes: 4486d199bd3b ("glx: Fix visual fbconfig matching with respect to swap method") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102806 Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Tested-By: Nick Sarnie <commendsarnex@gmail.com> Tested-by: Fredrik Höglund <fredrik@kde.org> Reviewed-by: Adam Jackson <ajax@redhat.com>
2017-10-24meson: Don't use '' in link_with, everLyude Paul1-1/+1
String arguments as elements in the array passed to the link_with argument in meson's executable() functions are not valid and will end up causing the build file generation to file. This actually ended up exposing a bug in meson that caused it not to report where in the meson.build file it was failing: https://github.com/mesonbuild/meson/pull/2527 The proper way to have a variable that can contain either an empty link target or an actual link target is: some_target = [] if some_cond some_target = static_library(...) endif This way if some_cond is False, some_target gets set to [], gets passed to executable() in the link_with array, and then gets removed by array flattening. This also unbreaks Xwayland builds with -Dglx=false, the thing that originally made me notice this. Signed-off-by: Lyude Paul <lyude@redhat.com> Reviewed-by: Jon Turney <jon.turney@dronecode.org.uk>
2017-09-20glx: Be a bit more paranoid in glx client cleanupAdam Jackson1-0/+1
This would probably crash (via double-free) if you had multiple GPUs and an indirect context. Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-09-12glx: Fix visual fbconfig matching with respect to swap methodThomas Hellstrom1-0/+9
For the built in visuals, we'd typically select the "best" fbconfig without considering the swap method. If the client then requests a specific swap method, say GLX_SWAP_COPY_OML, it may well happen that the first fbconfig matching requirements would have been paired with the 32-bit compositing visual, and the client would render a potentially transparent window. Fix this so that we try to match fbconfigs with the same swap method to all built-in visuals. That would guarantee that selecting a specific swap- method would not influence the chance of getting a compositing visual. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2017-09-12glx: Work around a GLX_OML swap method in older dri driversThomas Hellstrom1-0/+7
The swapMethod config member would typically contain an arbitrary value on older dri drivers. Fix this so that if we detect an illegal value, return GLX_SWAP_UNDEFINED_OML. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2017-09-08glx: remove unused systemTimeExtensionEmil Velikov4-27/+0
Not even a single DRI2/DRISW driver in mesa ever used this. Appears to be a dri1 artefact copy/pasted in the dri2/drisw codebase. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net>
2017-08-22glx: Fix error generation for non-reply vendor private requestsAdam Jackson2-4/+2
Discarding the return value here is just wrong. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-21glx: Remove some unused stuff from glxserver.hAdam Jackson2-14/+1
Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Keith Packard <keithp@keithp.com>
2017-08-21glx: Inline some reply swapping codeAdam Jackson3-141/+52
Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-21glx: Remove True/False definesAdam Jackson5-33/+26
Those are xlib spellings, we say TRUE/FALSE pretty consistently elsewhere in the server. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Keith Packard <keithp@keithp.com>
2017-08-11glx: remove unused GlxSetVisualConfigs stubEmil Velikov2-9/+0
The function was an empty since 2008 at least. Drop it since no drivers use it any more. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2017-07-31glx: don't export __glXDRISWRastProviderEmil Velikov1-1/+1
The symbol is used only internally and is not part of the API/ABI. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-07-31glx: fix typo becuase -> becauseEmil Velikov1-1/+1
Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-07-31glx: Allow arbitrary context attributes for direct contextsAdam Jackson1-1/+3
For direct contexts, most context attributes don't require any particular awareness on the part of the server. Examples include GLX_ARB_create_context_no_error and GLX_ARB_context_flush_control, where all of the behavior change lives in the renderer; since that's on the client side for a direct context, there's no reason for the X server to validate the attribute. The context attributes will still be validated on the client side, and we still validate attributes for indirect contexts since the server implementation might need to handle them. For example, the indirect code might internally use ARB_context_flush_control for all contexts, in which case it would need to manually emit glFlush when the client switches between two indirect contexts that didn't request the no-flush attribute. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2017-07-20glx: Only include compositeext.h if COMPOSITE is supportedJeremy Huddleston Sequoia1-0/+3
Regressed-in: ea483af99a6351323afe00a0b630cd63310efdb1 Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2017-06-20glx/drisw: Use scratch GCs for swrastPutImageAdam Jackson1-28/+5
The scratch GC defaults to the same state as our persistent GCs. Except for the "draw" GC, which would generate graphics exposures for... well, no reason really, PutImage doesn't generate graphics exposures. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Keith Packard <keithp@keithp.com>
2017-06-20glx/drisw: Remove unused glx_enable_bitsAdam Jackson1-2/+0
Sloppy of me! Signed-off-by: Adam Jackson <ajax@redhat.com> Acked-by: Keith Packard <keithp@keithp.com>