summaryrefslogtreecommitdiff
path: root/glx
AgeCommit message (Collapse)AuthorFilesLines
2014-09-11glx/present: Only send GLX_BufferSwapComplete for PresentCompleteKindPixmapKeith Packard1-2/+5
Present didn't provide the 'kind' argument to the present_complete_notify hook that GLX uses to construct GLX_BufferSwapComplete events, so GLX was reporting events for PresentCompleteKindMSC notifications, which resulted in duplicate GLX_BufferSwapComplete events and crashes in clutter. See the gnome bug: https://bugzilla.gnome.org/show_bug.cgi?id=733282 Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2014-09-11glx: Fix 'y ' value in swrastGetDrawableInfo()Maks Naumov1-1/+1
Signed-off-by: Maks Naumov <maksqwe1@ukr.net> Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Keith Packard <keithp@keithp.com>
2014-05-22glx: Require at least one True/DirectColor visualAdam Jackson1-0/+21
Mesa no longer supports rendering to anything less. GLX 1.2 requires that the server advertise at least one GLX visual. GLX 1.3 and 1.4 are more subtle: they require at least one fbconfig capable of window rendering, and _also_ require that window-capable fbconfigs have a non-zero value for the GLX_VISUAL_ID. In either case we should refuse to init GLX if there's not at least one GL-capable visual on at least one screen. Signed-off-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2014-04-23Add a command line argument for disabling indirect GLX.Eric Anholt1-0/+11
The attack surface for indirect GLX is huge, and it's of no use to most people (if you get an indirect GL context, you're better served by a immediate X error than actually trying to use an indirect GL context and finding out that it doesn't support doing anything you want, slowly). This flag gives you a chance to disable indirect GLX in environments where you just don't need it. I put in both the '+' and '-' arguments right now, so that it's easy to patch the value to change the default policy. Signed-off-by: Eric Anholt <eric@anholt.net> Acked-by: Julien Cristau <jcristau@debian.org> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2014-04-23glx: If DRI2GetBuffers changes the GL context, call it againMichel Dänzer1-0/+15
By changing the context, it may also invalidate the DRI2 buffer information, so we need to get that again. Fixes crashes due to use-after-free with LIBGL_ALWAYS_INDIRECT=1 glxgears and piglit. Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-04-23glx: Make sure that DRI2/swrast calls haven't changed the GL context.Eric Anholt2-8/+63
These functions are called from the GL driver, in some series of GL calls by GLX. If some server component (like glamor CreatePixmap for GetBuffers()) changes the GL context on us, we need to set it back or the later GL calls will land in the glamor context instead of the GLX context. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-04-23glx: Refactor DRI2CopyRegion calls.Eric Anholt1-27/+21
I needed to add some code to each one, so it's a good time to make a helper func. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-04-23glx: Unconditionally clear lastGLContext on loseCurrent().Eric Anholt1-2/+2
This hook calls unbindContext in the DRI driver interface, which unsets the dispatch table, regardless of whether the context argument was the current one or not. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-04-23glx: Move GLX MakeCurrent lastGLContext updates next to makeCurrent().Eric Anholt2-5/+4
We want to make sure that lastGLContext is set correctly during makeCurrent, because we may have recursive GL context changes in the DRI2 interfaces due to glamor. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-04-23glx: Move the GLX variable caching what GL context is current to dix.Eric Anholt3-26/+12
GLX is trying to track whether the context it wants is current, to avoid the glFlush() (and the rest of the overhead) that occurs on all MakeCurrent calls. However, its cache can be incorrect now that glamor exists. This is a step toward getting glamor to coordinate with GLX. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-03-10glx: Clear new FBConfig attributes to 0 by default.Eric Anholt1-1/+1
The visualSelectGroup wasn't getting set (since our DRI drivers don't use it), and and since it's the top priority in the sort order, you got random sorting of your visuals unless malloc really returned you new memory. This manifested as Xephyr -glamor rendering to a multisampled window on my system, which as you might guess was slightly lower performance than expected. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2014-02-07__glGetProcAddress: explictly cast function pointers to void *Alan Coopersmith1-2/+2
Fixes Solaris Studio compiler warning & error: "glxext.c", line 557: warning: assignment type mismatch: pointer to void "=" pointer to function(void) returning void "glxext.c", line 559: error: operands have incompatible types: pointer to void ":" pointer to function(void) returning void Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2014-02-07glx: Delete dead NV program string functions.Eric Anholt1-22/+0
These have been throwing a compiler warning about missing prototypes, since the generated code to define the prototypes stopped being generated (possibly because the code was dead). Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2014-02-07glx: Reduce compiler warnings by not requesting GL extension prototypes.Eric Anholt1-1/+0
They're not officially in the ABI, so you shouldn't use them anyway. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2014-02-07glx: Stop relying on libGL ABI bugs for glGetCompressedTexImage().Eric Anholt1-2/+6
In theory, the linux libGL ABI exposes just GL 1.2 plus GLX 1.3. But, thanks to libglapi, we're letting glGetCompressedTexImageARB() be exposed too. The GLX code was inappropriately relying on it by using GL_GLEXT_PROTOTYPES. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2014-02-07glx: Remove left-over glthread.cJon TURNEY1-204/+0
Commit be668096 "glx: convert to direct GL dispatch (v2)" removes glthread.c from Makefile.am along with the rest of the dispatch table code, but doesn't remove glthread.c itself. Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2014-01-27Warning fixes in glxKeith Packard2-2/+2
Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2014-01-22Merge remote-tracking branch 'anholt/xserver-unifdef'Keith Packard2-83/+1
2014-01-12Replace 'pointer' type with 'void *'Keith Packard2-5/+5
This lets us stop using the 'pointer' typedef in Xdefs.h as 'pointer' is used throughout the X server for other things, and having duplicate names generates compiler warnings. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2013-12-30glx: unifdef swrast dri_interface.h values from Mesa 7.1.Eric Anholt1-24/+1
We can't remove all the ifdefs (__DRI_TEX_BUFFER_VERSION) because configure.ac is only checking for that version of Mesa in the absence of dri2. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-12-30glx: unifdef for DRI2 dri_interface.h things in mesa 9.2.Eric Anholt1-59/+0
Thanks to configure.ac's check, we know that we have a new enough dri_interface.h that we don't need to conditionalize all this code. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-12-13glx: Add null pointer protection to __glGetProcAddressAdam Jackson1-1/+3
This can't happen when GLX is the backing window system, but can elsewhere. We may as well protect against it at a high level. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-12-10glx: Consistently use ARB-suffixed names for ARB_multitexture functionsJon TURNEY2-49/+49
At the moment we have a mix of ARB and non-ARB suffixed forms for ARB_multitexture functions e.g. glMultiTexCoord1fvARB and glMultiTexCoord1dv Consistently use the ARB-suffixed form, assuming that is present in all libGL which provide the OpenGL 1.2.1 ABI we expect to be able to directly link with. Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Adam Jackson <ajax@redhat.com>
2013-12-10drisw: Wire up GetProcAddressAdam Jackson1-0/+5
Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Keith Packard <keithp@keithp.com>
2013-12-10dri2: wire up GetProcAddressAdam Jackson1-1/+5
Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Keith Packard <keithp@keithp.com>
2013-12-10glx: Untangle the prototypes around the GetProcAddress thunkAdam Jackson2-3/+5
Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com> Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2013-12-10glx: Remove function stubsAdam Jackson2-51/+0
Now that we're calling non-1.2 ABI things by function pointer this is no longer needed. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com> Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2013-12-10glx: Convert non-generated function pointer thunkingAdam Jackson3-14/+44
Same concept as the generated code conversion. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2013-12-10glx: Convert generated code function pointer thunkingAdam Jackson2-544/+977
We're meant not to call these by name due to ABI. Rather than try to generate a bunch of little stub functions that do the lookup, just inline it all directly into the calling function. This does not cache results. That's fine, this is not a performance path, and if we're atop WGL then we effectively have to do this every time anyway because wglGetProcAddress results are context-dependent. Signed-off-by: Adam Jackson <ajax@redhat.com> Jon TURNEY <jon.turney@dronecode.org.uk>
2013-12-05glx: Fix incorrect use of dri_interface.h version defines in driver probing.Eric Anholt1-2/+2
If we extend __DRI_CORE or __DRI_SWRAST in dri_interface.h to allow a new version, it shouldn't make old server code retroactively require the new version from swrast drivers. Notably, new Mesa defines __DRI_SWRAST version 4, but we still want to be able to probe version 1 drivers, since we don't use any features beyond version 1 of the struct. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-12-05glx: Fix incorrect use of dri_interface.h version defines in extensions.Eric Anholt3-4/+4
Those defines are so you can compile-time check "do I have a dri_interface.h that defines this new field of the struct?" You don't want the server to claim it implements the new struct just because you installed a new copy of Mesa. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-12-05present: Send GLX_BufferSwapComplete events from present extensionKeith Packard5-23/+86
This allows GL to support the GLX_INTEL_swap_event extension. v2: Return GLX_BLIT_COMPLETE_INTEL for unknown swap types Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2013-11-23glx/glxdri2: Unwrap EnterVT/LeaveVT upon CloseScreenChris Wilson1-0/+4
In a similar spirit to commit d75e8146c414bfd512ba5dbd4a83acb334bbe19b Author: Keith Packard <keithp@keithp.com> Date: Mon Jul 12 16:01:34 2010 -0700 Unwrap/rewrap EnterVT/LeaveVT completely, Fixes 28998 we need to unwrap our pScrn->EnterVT/LeaveVT hooks around server regeneration or else we cause an infinite recursion on the next VT switch afterwards. Bugzilla: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1235516 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2013-10-31glx: Lie about GLX_Y_INVERTED_EXTAdam Jackson1-1/+2
Well, that was lame. The problem with reporting y inversion honestly is that libGL asks the driver _its_ opinion of Y inversion, which it just fabricates from whole cloth. So then when libGL goes to compare the driver's idea of fbconfigs with that of the server - a fairly dumb idea to begin with - nothing matches, and direct rendering fails, and sadness. So until the DRI drivers are fixed we should just continue to lie about Y inversion. GLX_DONT_CARE is what libGL would make up for that attribute if we hadn't sent it, so just send that instead. Signed-off-by: Adam Jackson <ajax@redhat.com> Tested-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2013-10-31dri: Fix GLX_Y_INVERTED_EXT fbconfig attributeAdam Jackson1-0/+1
We're Y-inverted from GL's coordinates, so this is correct. gnome-shell doesn't seem to check this - somewhat reasonable since the only server that answered the other way around was Xglx - but kwin does, and upside-down hilarity ensues. Tested-by: maelcum on #xorg-devel Signed-off-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2013-10-29Merge remote-tracking branch 'idr/glx-float-fbconfig'Keith Packard6-3/+74
2013-10-29glx: convert to direct GL dispatch (v2)Adam Jackson38-41223/+3256
We now expect to be linked against something that provides the GL API, instead of manually grubbing about in the DRI driver's dispatch table. Since the GLX we expose calls GL functions that are meant to be looked up dynamically, also add a way to thunk through to GetProcAddress. This includes a refresh of the generated sources, which requires a correspondingly new Mesa. The GetProcAddress stubs are at the moment merely enough to make this link against Mesa 9.2, but should really be provided for everything not in the OpenGL 1.2 ABI. v2: Explicitly hide the GetProcAddress stubs so we can't conflict with libGL symbols; fix leading tab/space issues [anholt] Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-10-29glx: Remove DRI1 AIGLX (v2)Adam Jackson2-1176/+0
Mesa doesn't ship DRI1 drivers as of 8.0, which is about 18 months and three releases ago. The main reason to have wanted DRI1 AIGLX was to get a GLX compositor working, but DRI1's (lack of) memory management API meant that the cost of a GLX compositor was breaking direct GLX apps, which isn't a great tradeoff. Of the DRI1 drivers Mesa has dropped, I believe only mga stands to lose some functionality here, since it and only it has support for NV_texture_rectangle. Since that's required for every extant GLX compositor I know of, I conclude that anybody with a savage, say, would probably not notice AIGLX going away, since they wouldn't be running a GLX compositor in the first place. In the future we'd like to use GL in the server in a more natural way, as just another EGL client, including in the GLX implementation itself. Since there's no EGL implemented for DRI1 drivers, this would already doom AIGLX on DRI1 (short of entirely forking the GLX implementation, which I'm not enthusiastic about). v2: Remove DRI1 from AIGLX conditionals in configure.ac [anholt] Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-10-29glx: Simplify glXDestroyContextAdam Jackson1-3/+1
We can just free the resource unconditionally here. ContextGone (which FreeResourceByType will call) already does: cx->idExists = GL_FALSE; if (!cx->currentClient) { __glXFreeContext(cx); } Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-10-29glx: Fix a corner case in DrawableGoneAdam Jackson1-1/+1
Losing the drawable does not change our notion of current client. Since the GL under us doesn't understand having a current context without current drawables (sigh), we do still need to loseCurrent so that we re-bind the context on the next request. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65030 Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-10-29glx: Fix memory leak in context garbage collection (v2)Adam Jackson4-24/+35
I broke this, back in: commit a48dadc98a28c969741979b70b7a639f24f4cbbd Author: Adam Jackson <ajax@redhat.com> Date: Mon Mar 21 11:59:29 2011 -0400 glx: Reimplement context tags In that, I changed the glx client state to not explicitly track the list of current contexts for the client (since that was what we were deriving tags from). The bug was that I removed the code for same from glxClientCallback without noticing that it had the side effect of effectively de-currenting those contexts, so that ContextGone could free them. So, if you had a client exit with a context still current, the context's memory would leak. Not a huge deal for direct clients, but viciously bad for indirect, since the swrast context state at the bottom of Mesa is like 15M. Fix this by promoting Bool isCurrent to ClientPtr currentClient, so that we have a back-pointer to chase when walking the list of contexts when ClientStateGone happens. v2: Explicitly call __glXFreeContext on the ClientStateGone path. Our current context might be one we got from EXT_import_context and whose creating client has since died. Without the explicit call, the creating client's FreeClientResources would not free the context because it's still current, and the using client's FreeClientResources would not free the context because it's not an XID it created. This matches the logic from a48dadc. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-10-29glx: Only take a Pixmap reference if creating the GLXPixmap succeededAdam Jackson1-1/+2
Reviewed-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-10-24glx: Enable GLX_ARB_fbconfig_float for DRI2 driversDaniel Czarnowski3-0/+17
v2 (idr): Maintain sort order of extension list. Fixed rebase error (comment header for initializeExtensions was in front of __glXDRIinvalidateBuffers). Re-write commit message. Signed-off-by: Daniel Czarnowski <daniel.czarnowski@intel.com> Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-10-24glx: Handle float config types in glxConvertConfigsDaniel Czarnowski1-3/+39
Replaces old use of floatMode attribute with new, extended range of values in __DRI_ATTRIB_RENDER_TYPE. Also adds new conditions, where the float modes support requires it. Enables support for not only float configs, but packed float configs as well. v2 (idr): Whitespace and formatting fixes. Refactor render type vs. pbuffer checking to a separate function that includes a quote from the spec. Re-write commit message. Fix compiler warnings: glxdricommon.c: In function 'glxConvertConfigs': glxdricommon.c:212:35: warning: pointer targets in passing argument 3 of 'core->getConfigAttrib' differ in signedness [-Wpointer-sign] glxdricommon.c:212:35: note: expected 'unsigned int *' but argument is of type 'int *' glxdricommon.c:230:35: warning: pointer targets in passing argument 3 of 'core->getConfigAttrib' differ in signedness [-Wpointer-sign] glxdricommon.c:230:35: note: expected 'unsigned int *' but argument is of type 'int *' Signed-off-by: Daniel Czarnowski <daniel.czarnowski@intel.com> Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-10-24glx: Allow float renderType in glXCreateContextAttribsARBDaniel Czarnowski2-0/+18
This enables GLX_RGBA_FLOAT_TYPE_ARB and GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT as valid renderType parameters to glXCreateContextAttribsARB. v2 (idr) : Use C-style comments and fix word wrapping. Re-write commit message. Signed-off-by: Daniel Czarnowski <daniel.czarnowski@intel.com> Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-10-23glx: Add support for the new DRI loader entrypoint.Eric Anholt1-2/+22
This is going to be exposed (and not the old entrypoint) for some DRI drivers once the megadrivers series lands, and the plan is to eventually transition all drivers to that. Hopefully this is unobtrusive enough to merge to stable X servers so that they can be compatible with new Mesa versions. v2: typo fix in the comment Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2013-09-11glx: Fill in some missing attributes from DoGetFBConfigsAdam Jackson1-2/+12
Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-09-11glx: Remove a dead commentAdam Jackson1-4/+0
Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-09-11glx: Catch another failure case in drawable creationAdam Jackson1-0/+4
Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-09-11glx: Remove screen number from __GLXconfigAdam Jackson1-2/+0
Not used. There's no real reason to match against this instead of matching against fbconfig or visual ID anyway. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>