aboutsummaryrefslogtreecommitdiffstats
path: root/src/glx
Commit message (Collapse)AuthorAgeFilesLines
* glx: Fix drawable lookup bugs in glXUseXFontAdam Jackson2019-09-191-16/+6
| | | | | | | | | | | | We were using the current drawable of the context to name the appropriate screen for creating the bitmaps. But one, the current drawable can be None, and two, it can be a GLXDrawable. Passing either one as the second argument to XCreatePixmap will throw BadDrawable. Use the root window of the context's screen instead. Gitlab: https://gitlab.freedesktop.org/mesa/mesa/issues/89 LOLed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
* glx: Avoid atof() when computing the server's GLX versionAdam Jackson2019-09-191-1/+2
| | | | | | | | | | | atof() is locale-dependent (sigh), which means 1.3 becomes 1.0 if the locale's decimal separator isn't a full-stop. Just use the protocol major/minor instead. This would be slightly broken if the server generically implements 1.3+ but a particular screen is only capable of less, but in practice no such servers exist. Gitlab: https://gitlab.freedesktop.org/mesa/mesa/issues/74 Reviewed-by: Eric Engestrom <[email protected]>
* glx: Remove redundant null check.Bas Nieuwenhuizen2019-09-191-1/+1
| | | | | Gitlab: https://gitlab.freedesktop.org/mesa/mesa/issues/64 Reviewed-by: Adam Jackson <[email protected]>
* glx: Remove unused indirection for glx_context->fillImageAdam Jackson2019-09-123-21/+9
| | | | | | | This slot is always filled in with __glFillImage. Reviewed-by: Michel Dänzer <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glx: Fix SEGV due to dereferencing a NULL ptr from XCB-GLX.Hal Gentz2019-09-042-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When run in optirun, applications that linked to `libGLX.so` and then proceeded to querying Mesa for extension strings caused a SEGV in Mesa. `glXQueryExtensionsString` was calling a chain of functions that eventually led to `__glXQueryServerString`. This function would call `xcb_glx_query_server_string` then `xcb_glx_query_server_string_reply`. The latter for some unknown reason returned `NULL`. Passing this `NULL` to `xcb_glx_query_server_string_string_length` would cause a SEGV as the function tried to dereference it. The reason behind the function returning `NULL` is yet to be determined, however, simply checking that the ptr is not `NULL` resolves this. A similar check has been added to `__glXGetString` for completeness sake, although not immediately necessary. In addition to that, we stumbled into a similar problem in `AllocAndFetchScreenConfigs` which tries to access the configs to free them if `__glXQueryServerString` fails. This, of course, SEGVs, because the configs are yet to have been allocated. Simply continuing past the configs if their config ptrs are `NULL` resolves this. We also switch to `calloc` to make sure that the config ptrs are `NULL` by default, and not some uninitialized value. Cc: [email protected] Fixes: 24b8a8cfe821 "glx: implement __glXGetString, hide __glXGetStringFromServer" Fixes: cb3610e37c4c "Import the GLX client side library, formerly from xc/lib/GL/glx. Build it " Reviewed-by: Adam Jackson <[email protected]> Signed-off-by: Hal Gentz <[email protected]>
* Revert "glx: Unset the direct_support bit for GLX_EXT_import_context"Adam Jackson2019-08-301-1/+1
| | | | | | | | | | The GLX extension strings are independent of any context, so abusing the direct_support bit to control this extension's visibility is wrong. This reverts commit 079d0717fc896bc8086b037d0ed22642274986c7. Reported-by: Michel Dänzer <[email protected]> Reviewed-by: Michel Dänzer <[email protected]>
* glx: Unset the direct_support bit for GLX_EXT_import_contextAdam Jackson2019-08-271-1/+1
| | | | | | | GLX_EXT_import_context operates only on indirect contexts, a direct context cannot possibly support it. Without this change the extension will appear in the combined GLX extension string even if it is missing from the server string, indicating a lack of required server support.
* glx: Fix up glXQueryGLXPbufferSGIX on macOS.Vinson Lee2019-08-231-1/+0
| | | | | | | | | | | | | Fix this build error on macOS. ../src/glx/apple/glx_empty.c:158:4: error: void function 'glXQueryGLXPbufferSGIX' should not return a value [-Wreturn-type] return 0; ^ ~ Fixes: 3dd299c3d5b8 ("glx: Sync <GL/glxext.h> with Khronos") Signed-off-by: Vinson Lee <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Adam Jackson <[email protected]>
* glx: Make __glXGetDrawableAttribute return true sometimesAdam Jackson2019-08-221-1/+1
| | | | | | | | | | | | | | | | | | | Right now it always returns zero, but as of: commit a48a6b8a400e6e92961cf7b7b4c287e8e9875f39 Author: Adam Jackson <[email protected]> Date: Tue Nov 14 15:13:05 2017 -0500 glx: Prepare driFetchDrawable for no-config contexts We were hoping it would return true if the drawable could actually be looked up. It wasn't, so that didn't go very well. With the most recent update to <GL/glxext.h> glXQueryGLXPbufferSGIX (correctly) returns void, so there's no longer anything else besides driFetchDrawable that depends on the return value from __glXGetDrawableAttribute. Acked-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glx: Sync <GL/glxext.h> with KhronosAdam Jackson2019-08-223-5/+3
| | | | | | | | Minor fixups required to keep the prototypes matching and to remove mention of retired enums. Acked-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glx: Whitespace cleanupsAdam Jackson2019-08-221-2/+2
| | | | | Acked-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glx: Add fields for color shiftsKevin Strasser2019-08-212-0/+5
| | | | | | | | | | glx doesn't read the masks from the dri config directly, but for consistency add shifts to the glxconfig. Signed-off-by: Kevin Strasser <[email protected]> Reviewed-by: Adam Jackson <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* glx: Eliminate glx_config::{rgb,float,colorIndex}ModeAdam Jackson2019-08-204-37/+9
| | | | | These are redundant with glx_config::renderType, let's just use that consistently.
* glx: Remove unused glx_config::pixmapModeAdam Jackson2019-08-201-2/+0
| | | | Reviewed-by: Eric Engestrom <[email protected]>
* glx: convert glx_config_create_list to one big callocAdam Jackson2019-08-201-37/+26
| | | | | | Simpler, less failure prone, less malloc overhead, what's not to like. Reviewed-by: Eric Engestrom <[email protected]>
* glx: convert a malloc+memset to callocAdam Jackson2019-08-201-2/+1
| | | | Reviewed-by: Eric Engestrom <[email protected]>
* glx: Fix parameter documentation of glx_config_create_listAdam Jackson2019-08-201-4/+0
| | | | | | 'minimum_size' is not, in fact, an argument to this function. Reviewed-by: Eric Engestrom <[email protected]>
* glx: drop unnecessary pointer deref for function callsEric Engestrom2019-08-044-46/+46
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Adam Jackson <[email protected]>
* mesa: Rename GLX_USE_TLS to USE_ELF_TLS.Bas Nieuwenhuizen2019-08-033-5/+5
| | | | | | | These days it is not GLX only and it does not work with all TLS implementations. Reviewed-by: Eric Engestrom <[email protected]>
* meson: replace last uses of libxmlconfig with idep_xmlconfigEric Engestrom2019-08-031-2/+5
| | | | | | Signed-off-by: Eric Engestrom <[email protected]> Acked-by: Eric Anholt <[email protected]> Tested-by: Vinson Lee <[email protected]>
* meson: replace libmesa_util with idep_mesautilEric Engestrom2019-08-031-2/+2
| | | | | | | | | | | This automates the include_directories and dependencies tracking so that all users of libmesa_util don't need to add them manually. Next commit will remove the ones that were only added for that reason. Signed-off-by: Eric Engestrom <[email protected]> Acked-by: Eric Anholt <[email protected]> Tested-by: Vinson Lee <[email protected]>
* meson: Test for random_r()Matt Turner2019-07-301-1/+1
| | | | | | | It's better to test for needed functions instead of using external knowledge about presence in this or that C library. Reviewed-by: Eric Engestrom <[email protected]>
* meson: allow building all glx without any driversDylan Baker2019-07-231-3/+3
| | | | | | | | Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111016 Fixes: a47c525f3281a2753180e076c7e9b7772aff8f06 ("meson: build glx") Acked-by: Emil Velikov <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glx: fix glvnd pointer typesEric Engestrom2019-06-202-3/+3
| | | | | | | Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110709 Fixes: 22a9e00aab66d3dd6890 ("glx: Implement the libglvnd interface.") Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glx: drop misleading comment about the file being "generated"Eric Engestrom2019-06-201-4/+0
| | | | | | | | | | | | | | | | This `gen_scrn_dispatch.pl` has never existed, in the sense that NVIDIA never published it. There have been a number (6) of commits to fix various things in there over the years, and never anything from NVIDIA. For all intents and purposes this file is hand-written and hand-maintained, and we're on our own. Let's make this clear by removing this misleading comment. Suggested-by: Eric Anholt <[email protected]> Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Acked-by: Emil Velikov <[email protected]>
* glx/windows: Fix compilation with -Werror-formatJon Turney2019-06-072-5/+5
| | | | | | | | | | | | | | | | | | | | Fix compilation where the DWORD type is used with a format, after -Werror-format added by c9c1e261. Some Win32 API types are different fundamental types in the 32-bit and 64-bit versions. This problem is then further compounded by the fact that whilst both 32-bit Cygwin and 32-bit MinGW use the ILP32 data model, 64-bit MinGW uses the LLP64 data model, but 64-bit Cygwin uses the LP64 data model. This makes it near impossible to write printf format specifiers which are correct for all those targets. In the Win32 API, DWORD is an unsigned, 32-bit type. So, it is defined in terms of an unsigned long, except in the LP64 data model used by 64-bit Cygwin, where it is an unsigned int. It should always be safe to cast it to unsigned int and use %u or %x. Reviewed-by: Eric Anholt <[email protected]>
* glx: Fix error message when no driverName is availableCaio Marcelo de Oliveira Filho2019-06-041-1/+1
| | | | | | | | | | | | | | | | | | | Just provide a "(null)" literal in case driverName is NULL. In file included from ../src/glx/dri3_glx.c:76: ../src/glx/dri3_glx.c: In function ‘dri3_create_screen’: ../src/glx/dri_common.h:70:36: error: ‘%s’ directive argument is null [-Werror=format-overflow=] 70 | #define CriticalErrorMessageF(...) dri_message(_LOADER_FATAL, __VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/glx/dri3_glx.c:1002:4: note: in expansion of macro ‘CriticalErrorMessageF’ 1002 | CriticalErrorMessageF("failed to load driver: %s\n", driverName); | ^~~~~~~~~~~~~~~~~~~~~ ../src/glx/dri3_glx.c:1002:50: note: format string is defined here 1002 | CriticalErrorMessageF("failed to load driver: %s\n", driverName); | ^~ cc1: some warnings being treated as errors Reviewed-by: Kenneth Graunke <[email protected]>
* Revert "glx: Fix synthetic error generation in __glXSendError"Timothy Arceri2019-05-081-2/+2
| | | | | | | | | | | This reverts commit e91ee763c378d03883eb88cf0eadd8aa916f7878. This seems to have broken a number of wine games. Lets revert everything for now and try again later. Acked-by: Adam Jackson <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110632 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110590
* delete autotools input filesEric Engestrom2019-04-291-9/+0
| | | | | | | Leftovers from when autotools was deleted. Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* delete autotools .gitignore filesEric Engestrom2019-04-292-6/+0
| | | | | | | | One special case, `src/util/xmlpool/.gitignore` is not entirely deleted, as `xmlpool.pot` still gets generated (eg. by `ninja xmlpool-pot`). Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* glx: Fix synthetic error generation in __glXSendErrorHal Gentz2019-04-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | To quote Uli Schlachter, who understands this stuff more than I do: > The function __glXSendError() in mesa's src/glx/glx_error.c invents an X11 > protocol error out of thin air. For the sequence number it uses dpy->request. > This is the sequence number of the last request that was sent. _XError() will > then update dpy->last_request_read based on the sequence number of the error > that just "came in". > > If now another something comes in with a sequence number less than > dpy->last_request_read, since sequence numbers are monotonically increasing, > widen() will incorrectly add 1<<32 to the sequence number and things might go > downhill afterwards. `__glXSendErrorForXcb` was also patched, as that's the function that `glXCreateContextAttribsARB` actually uses. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99781 Cc: [email protected] Fixes: ad503c41 'apple: Initial import of libGL for OSX from AppleSGLX svn repository' Reviewed-by: Adam Jackson <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Hal Gentz <[email protected]>
* Delete autotoolsDylan Baker2019-04-154-317/+0
| | | | | | | | | | Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Acked-by: Marek Olšák <[email protected]> Acked-by: Jason Ekstrand <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Matt Turner <[email protected]>
* drisw: Try harder to probe whether MIT-SHM worksAdam Jackson2019-04-091-4/+21
| | | | | | | | | | | | | | | | XQueryExtension merely tells you whether the extension exists, it doesn't tell you whether you're local enough for it to work. XShmQueryVersion is not enough to discover this either, you need to provoke the server to do actual work, and if it thinks you're remote it will throw BadRequest at you. So send an invalid ShmDetach and use the error code to distinguish local from remote. [airlied: fixed bug not resetting xshm_error to 0 on success, which made later stuff fail completely.] Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Signed-off-by: Adam Jackson <[email protected]>
* dri3: Return the current swap interval from glXGetSwapIntervalMESA().Eric Anholt2019-04-012-3/+1
| | | | | | | | | We were caching only the value set with glXSwapIntervalSGI(), missing out on the default setting of the swap interval by the loader. This fixes glxgears's warning about being vblank synchronized by default. Fixes: 9777c4234b0e ("loader: drop the [gs]et_swap_interval callbacks") Reviewed-by: Ian Romanick <[email protected]>
* glx: add support for GLX_ARB_create_context_no_error (v3)Grigori Goronzy2019-03-128-1/+96
| | | | | | | | | v2: Only reject no-error contexts for too-old GL if we're actually trying to create a no-error context (Adam Jackson) v3: Fix share contexts (Adam Jackson) Reviewed-by: Adam Jackson <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glx/meson: use full include path for dri_interface.hEric Engestrom2019-03-085-6/+5
| | | | | | | | | | | | Everything else uses `#include "GL/internal/dri_interface.h"` instead, and this full path was even already used in other parts of GLX. While at it, nothing uses `inc_gl_internal` anymore so let's remove it as well. Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]> Tested-by: Clayton Craft <[email protected]>
* glx: fix shared memory leak in X11Ray Zhang2019-02-281-0/+3
| | | | | | | | call XShmDetach to allow X server to free shared memory Fixes: bcd80be49a8260c2233d "drisw/glx: use XShm if possible" Signed-off-by: Ray Zhang <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* glx: add support for putimageshm2 path (v2)Dave Airlie2019-01-251-7/+23
| | | | | | | v2: pass x,0 in as the offset coords at glx level not earlier Cc: <[email protected]> Reviewed-by: Adam Jackson <[email protected]>
* glx/test: meson: assorted include fixesEmil Velikov2018-12-121-2/+2
| | | | | | | | | Swap '..' with the symbolic inc_glx and add glproto as dependency. That will pull the correct include, effectively fixing the tests on macOS. Fixes: a47c525f328 ("meson: build glx") Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* glx: meson: wire up the dispatch-index-check testEmil Velikov2018-12-121-0/+5
| | | | | | | | Accidentally dropped with earlier commit.! Fixes: 4ccb9816737 ("meson: Use consistent style for tests") Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* glx: meson: drop includes from a link-only libraryEmil Velikov2018-12-121-1/+0
| | | | | | | | | When producing the final libGL.so/libGLX_mesa.so we only link the local static helper lib (libglx). Thus there's no reason for the includes. Fixes: a47c525f328 ("meson: build glx") Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* TODO: glx: meson: build dri based glx tests, only with -Dglx=driEmil Velikov2018-12-121-18/+15
| | | | | | | | | | | | | | | | The library itself (libGL) is only built when -Dglx=dri, yet it's accompanying tests are build even with -Dglx=xlib. Adjust the guards, so we don't build the tests when they are not applicable v2: - Reword commit message (Dylan) - Drop build_by_default hunk (Dylan) Fixes: a47c525f328 ("meson: build glx") Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* glx: Fix compilation with GLX_USE_WINDOWSGLJon Turney2018-12-151-2/+4
| | | | | | | | | | | | | | | | Sadly, the GLX_USE_APPLEGL and GLX_USE_WINDOWSGL cases are not identical (because GLX_USE_WINDOWSGL uses vtables rather than a maze of ifdefs) Include <sys/time.h> again, as functions prototyped by it are used in the GLX_USE_WINDOWSGL path. Make the include guard around the __glxGetMscRate() definition match the one at it's declaration again, as it's referenced from dri_common.c which is built for GLX_USE_WINDOWSGL. Fixes: a95ec138 ("glx: mandate xf86vidmode only for "drm" dri platforms") Signed-off-by: Jon Turney <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* glx: mandate xf86vidmode only for "drm" dri platformsEmil Velikov2018-12-131-2/+4
| | | | | | | | | | | | | | | Currently we have the three dri "platforms" - drm, apple and windows. Since xf86vidmode is a thing only for the drm one, adjust the preprocessor guards and correctly check for the dependency. v2: terminate the GLX_USE_WINDOWSGL hunk Cc: Jon TURNEY <[email protected]> Fixes: 5bc509363b6 ("glx: make xf86vidmode mandatory for direct rendering") Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Dylan Baker <[email protected]> Acked-by: Eric Engestrom <[email protected]>
* meson: Add tests to suitesDylan Baker2018-11-201-1/+2
| | | | | | | | | | | | | | | | Meson test has a concepts of suites, which allow tests to be grouped together. This allows for a subtest of tests to be run only (say only the tests for nir). A test can be added to more than one suite, but for the most part I've only added a test to a single suite, though I've added a compiler group that includes nir, glsl, and glcpp tests. To use this you'll need to invoke meson test directly, instead of ninja test (which always runs all targets). it can be invoked as: `meson test -C builddir --suite $suitename` (meson test has addition options that are pretty useful). Tested-By: Gert Wollny <[email protected]> Acked-by: Eric Engestrom <[email protected]>
* glx: make xf86vidmode mandatory for direct renderingEmil Velikov2018-11-204-20/+3
| | | | | | | | | | | | | | | | | | | Currently we detect the module and if missing, the glXGetMsc* API is effectively a stub, always returning false. This is what effectively has been happening with our meson build :-( Thus users have no chance of using it - they cannot even distinguish if the failure is due to a misconfigured build. There's no reason for keeping xf86vidmode optional - it has been available in all distributions for years. Cc: [email protected] Signed-off-by: Emil Velikov <[email protected]> Acked-by: Dylan Baker <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Fixes: a47c525f3281a2753180e "meson: build glx"
* loader: Factor out the common driver opening logic from each loader.Eric Anholt2018-11-164-90/+8
| | | | | | | | | | | | | I copied the code from egl_dri2.c, but the functionality was equivalent between all the loaders other than their particular environment variables. v2: Drop the logging function equivalent to loader_default_logger() (requested by Eric, Emil). Move the SCons workaround across. Drop the now-unused driGetDriverExtensions() declaration that was lost in a rebase. Reviewed-by: Eric Engestrom <[email protected]> (v1) Reviewed-by: Emil Velikov <[email protected]> (v1)
* glx: Move DRI extensions pointer loading to driOpenDriver().Eric Anholt2018-11-166-52/+26
| | | | | | | | | | | The only thing you do with a dri driver handle is get the extensions pointer, so just fold it in to simplify the callers. v2: Add the declaration of driGetDriverExtensions() that got lost in a rebase. Reviewed-by: Eric Engestrom <[email protected]> (v1) Reviewed-by: Emil Velikov <[email protected]> (v1)
* glx: Remove an old DEFAULT_DRIVER_DIR default.Eric Anholt2018-11-162-6/+2
| | | | | | | | | | | You can tell by "Mesa/configs/default" how old this is. Your build system really has to provide the DEFAULT_DRIVER_DIR, or other loaders will break. v2: Move the bad (non-prefix-dependent) define to the SConscript to avoid breaking it. Reviewed-by: Eric Engestrom <[email protected]> (v1) Reviewed-by: Emil Velikov <[email protected]> (v1)
* glx: Demand success from CreateContext requests (v2)Adam Jackson2018-11-071-38/+55
| | | | | | | | | | | | | | | | | | | | | | | GLXCreate{,New}Context, like most X resource creation requests, does not emit a reply and therefore is emitted into the X stream asynchronously. However, unlike most resource creation requests, the GLXContext we return is a handle to library state instead of an XID. So if context creation fails for any reason - say, the server doesn't support indirect contexts - then we will fail in strange places for strange reasons. We could make every GLX entrypoint robust against half-created contexts, or we could just verify that context creation worked. Reuse the __glXIsDirect code to do this, as a cheap way of verifying that the XID is real. glXCreateContextAttribsARB solves this by using the _checked version of the xcb command, so effectively this change makes the classic context creation paths as robust as CreateContextAttribs. v2: Better use of Bool, check that error != NULL first (Olivier Fourdan) Signed-off-by: Adam Jackson <[email protected]> Reviewed-by: Michel Dänzer <[email protected]>