summaryrefslogtreecommitdiff
path: root/glx
AgeCommit message (Collapse)AuthorFilesLines
2017-05-03meson: Fix glx build with DRI2 disabled.Eric Anholt1-1/+1
A common meson pattern is to use empty arrays for optional sources and dependencies, since it generally iterates over trees of arrays looking for values. A value of '' will actually go looking for ''. Daniel Stone <daniels@collabora.com> Signed-off-by: Eric Anholt <eric@anholt.net>
2017-04-27meson: Build libglx.soAdam Jackson1-0/+5
Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-04-26Add a Meson build system alongside autotools.Eric Anholt1-0/+50
This is a work in progress that builds Xvfb, Xephyr, Xwayland, Xnest, and Xdmx so far. The outline of Xquartz/Xwin support is in tree, but hasn't been built yet. The unit tests are also not done. The intent is to build this as a complete replacement for the autotools system, then eventually replace autotools. meson is faster to generate the build, faster to run the bulid, shorter to write the build files in, and less error-prone than autotools. v2: Fix indentation nits, move version declaration to project(), use existing meson_options for version-config.h's vendor name/web. Signed-off-by: Eric Anholt <eric@anholt.net> Acked-by: Keith Packard <keithp@keithp.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-25Rewrite the byte swapping macros.Eric Anholt1-21/+0
The clever pointer tricks were actually not working, and we were doing the byte-by-byte moves in general. By just doing the memcpy and obvious byte swap code, we end up generating actual byte swap instructions, thanks to optimizing compilers. text data bss dec hex filename before: 2240807 51552 132016 2424375 24fe37 hw/xfree86/Xorg after: 2215167 51552 132016 2398735 249a0f hw/xfree86/Xorg Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2017-04-21glx: Use the same endian swapping as the rest of the server.Eric Anholt1-20/+20
This dumps a ton of configure-time checks for system endian macros. Given that we're marking the mixed-endian fixup code as cold, getting at the system macros is a waste of code. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2017-04-10glx: Remove enter/leave server APIAdam Jackson3-57/+0
Dead code since: commit 8aacf47e1778d8b72811b025a82452b933d3c1f2 Author: Adam Jackson <ajax@redhat.com> Date: Fri Oct 4 12:58:19 2013 -0400 glx: Remove DRI1 AIGLX (v2) Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-03-24glx: Fix MakeCurrent with no drawablesAdam Jackson1-22/+17
GLX_ARB_create_context, which we aspire to support, allows making GL 3.0 or newer contexts current with null current drawables. Strictly this might not be legal for pre-3.0 contexts, but there's no harm in allowing it anyway. Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-01-25glx: Move Composite's synthetic visuals to a different select groupAdam Jackson1-0/+5
Should you find yourself using a 16bpp display while also using a compositor, you poor soul, you may find that your GLX applications behave strangely; in particular, glxgears will be transparent. This is because it clears to (0,0,0,0) which is transparent if you honor alpha, and it will choose the synthetic visual because it has the most available r/g/b bits. To avoid this, bump synthetic visuals to a higher (less-preferred) select group. Unless the client explicitly asks for non-zero alpha bits, this will prefer any rgb565 visual ahead of the argb8888 visual. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-01-25glx: Send GLX_VISUAL_SELECT_GROUP_SGIX attribute for visualsAdam Jackson1-2/+3
We already send this for fbconfigs. Mesa happens to implement glXChooseVisual relative to the fbconfig data, but that might not be true of NVIDIA's libGL. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-10-27glx/dri2: Don't build DRI loader if DRI2 isn't enabledJon Turney1-3/+8
This partially reverts 501d8e2b. Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-10-10glx/dri2: Don't include drm headersAdam Jackson1-2/+0
They're not needed, and they won't be present on win32. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Emil Velikov <emil.l.veikov@gmail.com>
2016-10-05configure.ac: remove --enable-aiglx optionEmil Velikov1-10/+1
Presently the option guards both direct and accelerated indirect GLX. As such when one toggles it off they end up without any acceleration. Remove the option all together until we have the time to split/rework things. Cc: Jon Turney <jon.turney@dronecode.org.uk> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-10-05glx: drisw is not accelerated IGLX, reflect that in log messagesEmil Velikov1-3/+3
The messages from glxdricommon.c (used by drisw) still have the A, but at least we're don't have it locally. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-09-28glx: Always enable EXT_texture_from_pixmap for DRI swrast glxHans de Goede1-2/+1
Prior to commit f95645c6f700 ("glx: Don't enable EXT_texture_from_pixmap unconditionally") DRI glx would always advertise EXT_texture_from_pixmap. That commit moved the setting of the extension in the extension bits from __glXInitExtensionEnableBits to its callers so that __glXInitExtensionEnableBits can be used more generally, but at the same time made the setting of EXT_texture_from_pixmap conditionally on __DRI_TEX_BUFFER being present. This has result in an unintended behavior change which breaks e.g. compositors running on llvmpipe. This commit makes the DRI swrast glx code advertise EXT_texture_from_pixmap unconditionally again fixing this. Fixes: f95645c6f700 ("glx: Don't enable EXT_texture_from_pixmap unconditionally") Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- Changes in v2: -Only add unconditional advertising of GLX_EXT_texture_from_pixmap to glxdriswrast.c, do not also add it to glxdri2.c
2016-09-15Add Windows-DRI extensionJon Turney2-1/+4
If windowsdriproto headers are available, build a Windows-DRI extension, which supports requests to enable local clients to directly render GL to a Windows drawable: - a query to check if WGL is being used on a screen - a query to map a fbconfigID to a native pixelformatindex - a query to map a drawable to a native handle Windows-DRI can only be useful if we are using WGL, so make an note if WGL is active on a screen. Make validGlxDrawable() public Adjust glxWinSetPixelFormat() so it doesn't require a context, just a screen and config. That enables factoring out the deferred drawable creation code as glxWinDeferredCreateDrawable() Enhance glxWinDeferredCreateDrawable(), so that pixmaps are placed into a file mapping, so they exist in memory which can be shared with the direct rendering process. Currently, this file mapping is accessed by a name generated from the XID. This will not be unique across multiple server instances. It would perhaps be better, although more complicated, to use an anonymous file mapping, and then duplicate the handle for the direct rendering process. Use glxWinDeferredCreateDrawable() to ensure the native handle exists for the Windows-DRI query to map a drawable to native handle. v2: Various printf format warning fixes v3: Fix format warnings on x86 Move some uninteresting windows-dri output to debug log level v4: check for windowsdriproto when --enable-windowsdri use windowsdriproto_CFLAGS Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk> Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2016-09-06glx: Fix computation of GLX_X_RENDERABLE fbconfig attributeAdam Jackson6-52/+31
>From the GLX spec: "GLX_X_RENDERABLE is a boolean indicating whether X can be used to render into a drawable created with the GLXFBConfig. This attribute is True if the GLXFBConfig supports GLX windows and/or pixmaps." Every backend was setting this to true unconditionally, and then the core ignored that value and sent true unconditionally on its own. This is broken for ARB_fbconfig_float and EXT_fbconfig_packed_float, which only apply to pbuffers, which are not renderable from non-GLX APIs. Instead compute GLX_X_RENDERABLE from the supported drawable types. The dri backends were getting _that_ wrong too, so fix that as well. This is not a functional change, as there are no mesa drivers that claim to support __DRI_ATTRIB_{UNSIGNED_,}FLOAT_BIT yet. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2016-09-02dri2: Don't make reference to noClientExceptionAdam Jackson1-1/+1
noClientException is now never filled in with a meaningful value, it's always -1. The sole caller of this function disregards the error value in any case. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-06-21res: Account for GLXPixmap references tooAdam Jackson1-0/+19
GLX_EXT_tetxure_from_pixmap operates on a GLXPixmap, which takes a reference on the backing pixmap; that GLXPixmap might be long-lived, so we should account for it in ResQueryClientPixmapBytes. Acked-by: Michel Dänzer <michel.daenzer@amd.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-06-20glx: avoid memory leak when using indirect renderingGuilherme Quentel Melo1-0/+6
When multiple processes are using GL with indirect rendering a race condition can make drawables refcount never drop to zero. This situation could happen when there are many X clients using indirect GLX: 1 - client1: calls glXMakeCurrent 2 - client2: calls glXMakeCurrent This is the first context switch for this client. So old_context_tag=0 3 - client1: calls glXRender For the client, its context is already current. For the server side lastGLContext points to client2's context. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Guilherme Quentel Melo <gqmelo@gmail.com>
2016-05-11glx: Stop tracking hasUnflushedCommandsAdam Jackson7-23/+1
This is only meaningful for indirect contexts, and all it does is (maybe) prevent a flush when switching away from an indirect context. Indirect contexts aren't worth optimizing for, and Mesa tracks whether a flush is needed anyway. Careful readers will note that ReadPixels would reset the flag even though it doesn't imply a flush! Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-05-11glx: Remove some redundant zero-init of GLX context stateAdam Jackson2-16/+0
The context is already calloc'd. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-05-11glx/dri2: Implement dri2FlushFrontBuffer explicitlyAdam Jackson1-1/+4
No functional change. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-05-11glx: Code motionAdam Jackson2-67/+67
No functional change, just rearranging some code to make later commits more obvious. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-03-30glx: Implement GLX_EXT_libglvnd (v2)Adam Jackson7-0/+42
For the dri2 backend, we depend on xfree86 already, so we can walk the options for the screen looking for a vendor string from xorg.conf. For the swrast backend we don't have that luxury, so just say mesa. This extension isn't really meaningful on Windows or OSX yet (since libglvnd isn't really functional there yet), so on those platforms we don't say anything and return BadValue for the token from QueryServerString. v2: Use xnf* allocators when parsing options (Eric and Emil) Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-03-30glx: Compute the GLX extension string from __glXScreenInitAdam Jackson3-24/+8
Now that the enable bits are in the screen base class we can compute this in one place, rather than making every backend do it. Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-03-30glx: Move glx_enable_bits up to the GLX screen base classAdam Jackson3-22/+25
Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-03-30glx: Enable GLX 1.4 unconditionallyAdam Jackson6-49/+4
Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-03-30glx: Enable GLX_SGI_make_current_read in the coreAdam Jackson3-9/+1
GLX 1.3 implies equivalent functionality, so this is safe to enable unconditionally, and bindContext always takes both drawable and readable arguments in any case. Mesa stopped exporting the __DRI_READ_DRAWABLE extension in 8.0 (when the DRI1 drivers were removed) so this will restore the extension string. Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-03-30glx: Don't enable EXT_texture_from_pixmap unconditionallyAdam Jackson3-3/+5
Not all backend servers implement this. Those that don't happen to not use __glXInitExtensionEnableBits, but we'd like that to change, so fix it up before we switch them over. Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-03-30glx: Remove server-side mention of GLX_MESA_swap_controlAdam Jackson1-3/+1
This extension is direct-only and has no GLX protocol. We don't even track an enable bit for it, trying to turn it on is pointless. Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-03-30glx: Remove default server glx extension stringAdam Jackson3-23/+1
This existed only to be strdup'd and then immediately freed. Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-03-10glx: Implement GLX_EXT_fbconfig_packed_floatAdam Jackson4-0/+9
The tokens for this are already defined by GLX_ARB_fbconfig_float, which we already support, so just add the extension to the list and let the driver provide those configs if it wants. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-03-10glx: Implement GLX_EXT_stereo_treeAdam Jackson3-1/+11
This is correct as it is, but only because we know no DRI drivers implement stereo. v2: Use new ATTRIB macro Reviewed-by: James Jones <jajones@nvidia.com> Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-03-10glx: Add GLX_SCREEN to the GetDrawableAttributes responseAdam Jackson1-1/+2
libglvnd would like to use this to map from drawable to screen, so it can know which driver to dispatch to. Refer to the spec proposal here: https://lists.freedesktop.org/archives/mesa-dev/2016-March/109543.html Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-03-10glx: Macroize building the attribute list in DoGetDrawableAttributesAdam Jackson1-23/+16
No functional change, just a little easier to read and harder to get wrong. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-03-08glx: don't call pGlxDraw->destroy() if AddResource failsJulien Cristau1-7/+2
AddResource will have called DrawableGone, which takes care of the destruction. Reviewed-by: Rémi Cardona <remi@gentoo.org> Signed-off-by: Julien Cristau <jcristau@debian.org>
2016-01-21glx: Fix GLX_EXT_create_context_es2_profile supportAdam Jackson5-26/+13
As of v4 of this extension, any GLES version number may be requested (to enable GLES3 and later). To comply with this, simply remove the API version checks and leave it to the DRI driver to validate. This happens to also enable using GLES1 in direct contexts, so if that's the dire situation you find yourself in, your client driver at least stands a chance of working. v4 also specifies that both extension strings should be advertised for compatibility with clients written against v1 of the extension spec, so add the es_profile bit to the extension list and enable it whenever we would enable es2_profile. Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Signed-off-by: Adam Jackson <ajax@redhat.com>
2015-10-19glx: Fix header length error checking in __glXDisp_RenderLargeJeremy Huddleston1-1/+1
glxcmds.c:2206:46: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare,Semantic Issue] if ((cmdlen = safe_pad(hdr->length)) < 0) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~ Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2015-10-06glx: Synchronize Xserver glx/rensize.c with mesa src/glx/compsize.cJon TURNEY1-0/+1
Noticed while investigating https://bugs.freedesktop.org/show_bug.cgi?id=30102 Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-09-23glx: fix regression with copy sub buffer disappearingDave Airlie1-2/+3
So copy sub buffer isn't a core extensions it's a driver extension which means we are using totally the wrong interface to query for it here, which means bad things happen when you roll out this code, for instance MESA_copy_sub_buffer stops working. This is just the hack I'm sticking in Fedora to avoid the regression for now, but hopefully will inspire us. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-07-08glx: Implement GLX_ARB_context_flush_controlAdam Jackson7-2/+57
This extension allows clients to opt out of the implicit glFlush on context release, which is quite nice for performance for clients using multiple contexts. The server doesn't really need to be aware of the client's decision, at least for direct contexts, but it does need to not reject the context attribute out of hand. This patch won't do anything unless built against a Mesa that defines the __DRI2_FLUSH_CONTROL extension (and a new enough glxext.h, but that's been there since 10.3 at least). Reviewed-by: James Jones <jajones@nvidia.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
2015-07-08glx/swrast: Do more GLX extension setupAdam Jackson1-3/+34
This gets you nice things like core contexts when using Xvfb. Also, no, MESA_copy_sub_buffer is not enabled automatically. Reviewed-by: James Jones <jajones@nvidia.com> Reviewed-by: Jon Turney <jon.turney@dronecode.org.uk> Signed-off-by: Adam Jackson <ajax@redhat.com>
2015-05-14Revert "glx/dri2: Disable AIGLX if indirect GLX is disabled"Keith Packard1-3/+0
This reverts commit d61ae18074e53c2cdfb13cc37693b526160d6ca7. If the DRI2 provider is disabled, then we don't advertise the correct GLX extensions to clients, and things like GLES fail. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90442 Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-05-11Merge remote-tracking branch 'ajax/xserver-next'Keith Packard1-0/+3
2015-05-07glx/dri2: Disable AIGLX if indirect GLX is disabledChris Wilson1-0/+3
There is no point in setting up the acceleration for indirect GLX if indirect GLX is itself disabled. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-04-21Convert glamor & glx to new *allocarray functionsAlan Coopersmith2-10/+8
v2: fixup whitespace Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2014-12-10glx: Add hack for GLX-1.2-style naked windows to GetDrawableAttributesAdam Jackson1-19/+29
Some people like to call this on bare Window XIDs and expect reasonable results. I sure wish they wouldn't, but since they do, if we're given a window without any glx decoration just fill in as much as we can. This means you won't actually get an answer for GLX_FBCONFIG_ID and friends, but there's not much to be done about that, and it matches what NVIDIA's driver seems to do. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54080 Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2014-12-10glx: Dynamically compute attribute slot in GetDrawableAttributesAdam Jackson1-24/+25
No functional change. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2014-12-09glx: Add implementation of __GLXContext->loseCurrent for direct ctxtsNeil Roberts1-0/+7
This adds a dummy implementation for the loseCurrent function in __GLXContext for direct contexts which just returns GL_TRUE. Without this then the X server can crash if receives a MakeCurrent message for a direct context because it will attempt to call loseCurrent when cleaning up the client in the callback for ClientStateGone. [ajax: added assumed s-o-b line] Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86531 Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Neil Roberts <neil@linux.intel.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2014-12-09glx: Can't mix declarations and code in X.org sources [CVE-2014-8098 pt. 9]Keith Packard1-1/+2
We're using compiler compatibility settings which generate warnings when a variable is declared after the first statement. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>