summaryrefslogtreecommitdiffstats
path: root/src/glx/dri_glx.c
Commit message (Collapse)AuthorAgeFilesLines
* glx: use v2 of DRI_ConfigOptionsNicolai Hähnle2017-08-021-14/+99
| | | | | | | | | Most of the change is concerned with avoiding memory leaks, since v2 of the DRI extension returns a malloc'ed string. This also allows us to resolve the long-standing issue of keeping drivers loaded when returning from glXGetDriverConfig. Reviewed-by: Marek Olšák <[email protected]>
* glx: remove always true XDAMAGE_1_1_INTERFACE guardEmil Velikov2017-02-131-4/+0
| | | | | Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glx: Implement the libglvnd interface.Kyle Brenneman2016-05-301-2/+2
| | | | | | | | | | | | | | | | With reference to the libglvnd branch: https://cgit.freedesktop.org/mesa/mesa/log/?h=libglvnd This is a squashed commit containing all of Kyle's commits, all but two of Emil's commits (to follow), and a small fixup from myself to mark the rest of the glX* functions as _GLX_PUBLIC so they are not exported when building for libglvnd. I (ajax) squashed them together both for ease of review, and because most of the changes are un-useful intermediate states representing the evolution of glvnd's internal API. Co-author: Emil Velikov <[email protected]> Reviewed-by: Adam Jackson <[email protected]>
* include: move sarea.h next to it's only userEmil Velikov2014-08-211-1/+1
| | | | | | | | | The header is used by DRI1 drivers, which we've removed a while back. Now only the dri1 loader in libGL is using it, so let's move it in src/glx, and prefix it accordingly. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Michel Dänzer <[email protected]>
* glx: Add an error message when a direct renderer's createScreen() routine failsJon TURNEY2014-06-181-1/+3
| | | | | | | | | | | | | | | because no matching fbConfigs or visuals could be found. Nearly all the error cases in *createScreen() issue an error message to diagnose the failure to initialize before branching to handle_error. The few remaining error cases which don't should probably do the same. (At the moment, it seems this can be triggered in drisw with an X server which reports definite values for MAX_PBUFFFER_(WIDTH|HEIGHT|SIZE), because those attributes are checked for an exact match against 0.) Signed-off-by: Jon TURNEY <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glx/dri: explicitly assign struct components for glx_*_vtableEmil Velikov2014-04-281-13/+13
| | | | | | | | ... to improve readability of code. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* glx/dri: use the implemented version of __DRIdamageExtensionEmil Velikov2014-02-231-2/+3
| | | | | | | | ... over the one provided by the headers. Explicitly set extension members to improve clarity. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glx/dri: use the implemented version of __DRIgetDrawableInfoExtensionEmil Velikov2014-02-231-2/+3
| | | | | | | ... over the one provided by the headers. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* loader: Add missing \n on message printingEmil Velikov2014-01-271-4/+4
| | | | | | | | Cover both loader and glx/dri_glx Drop \n from the default loader logger Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glx: Fix two identical null check errors in driSet/GetIntervalJuha-Pekka Heikkila2013-12-191-8/+12
| | | | | Signed-off-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* glx: Add an optional function call for getting the DRI driver interface.Eric Anholt2013-10-241-1/+1
| | | | | | | | | | | | | | The previous interface relied on a static struct, which meant that the driver didn't get a chance to edit the struct before the struct got used. For megadrivers, I want struct specific to the driver being loaded. v2: Fix the prototype in the docs (caught by Marek). Since the driver name was in the function, we didn't need to also pass it in. v3: Fix asprintf error checking (caught by Matt's gcc). Reviewed-by: Matt Turner <[email protected]> (v1) Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* dri: Allow config options to be passed to the loader through extensions.Eric Anholt2013-10-241-3/+14
| | | | | | | | | | | | | | | Turns out already we have this nice mechanism for providing optional things from the driver to the loader, and I was going to have to rename the public global symbol to avoid conflicts when doing megadrivers. While the former __driConfigOptions is technically loader interface, this is the only loader that made use of that symbol. Continue paying attention to it if we can't find the new option, to retain compatibility with old drivers. Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* glx: Validate the GLX_RENDER_TYPE valueTomasz Lis2013-07-181-0/+4
| | | | | | | | | | | | | Correctly handle the value of renderType in GLX context. In case of the value being incorrect, context creation fails. v2 (idr): indirect_create_context is just a memory allocator, so don't validate the GLX_RENDER_TYPE there. Fixes regressions in several GLX_ARB_create_context piglit tests. Signed-off-by: Tomasz Lis <[email protected]> Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glx: Store the value of renderType while creating contextTomasz Lis2013-07-181-0/+2
| | | | | | | | | | | | | Make sure that renderType property value is stored in GLX context while it's being created. Further patches will be provided to make the value correspond to fbconfig's renderType. v2 (idr): Move a hunk from the next patch to this patch to prevent a build break. Signed-off-by: Tomasz Lis <[email protected]> Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glx: move the glFlush call one layer downMarek Olšák2012-12-021-2/+10
|
* dri_glx: fix use after free reportDave Airlie2012-12-011-1/+4
| | | | | | | | | | | the critical error would use driverName. Found by internal RH coverity scan. Note: This is a candidate for stable branches. Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glx/dri1: Remove uncompiled __DRI_SWAP_BUFFER_COUNTER code.Eric Anholt2012-10-091-61/+0
| | | | | | | It's been in place but never enabled since 2010. Note how one piece called a DRI2 function, suggesting never being tested. Reviewed-by: Chad Versace <[email protected]>
* Remove useless memset after callocMatt Turner2012-09-051-1/+0
| | | | Reviewed-by: Brian Paul <[email protected]>
* Use calloc instead of malloc/memset-0Matt Turner2012-09-051-4/+2
| | | | | | | | | | | | | | | | This patch has been generated by the following Coccinelle semantic patch: @@ expression E; identifier I; @@ - I = malloc(E); + I = calloc(1, E); ... - memset(I, 0, sizeof *I); Reviewed-by: Brian Paul <[email protected]>
* Remove useless checks for NULL before freeingMatt Turner2012-09-051-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch has been generated by the following Coccinelle semantic patch: // Remove useless checks for NULL before freeing // // free (NULL) is a no-op, so there is no need to avoid it @@ expression E; @@ + free (E); + E = NULL; - if (unlikely (E != NULL)) { - free(E); ( - E = NULL; | - E = 0; ) ... - } @@ expression E; type T; @@ + free ((T) E); + E = NULL; - if (unlikely (E != NULL)) { - free((T) E); ( - E = NULL; | - E = 0; ) ... - } @@ expression E; @@ + free (E); - if (unlikely (E != NULL)) { - free (E); - } @@ expression E; type T; @@ + free ((T) E); - if (unlikely (E != NULL)) { - free ((T) E); - } Reviewed-by: Brian Paul <[email protected]>
* Remove Xcalloc/Xmalloc/Xfree callsMatt Turner2012-09-051-22/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These calls allowed Xlib to use a custom memory allocator, but Xlib has used the standard C library functions since at least its initial import into git in 2003. It seems unlikely that it will grow a custom memory allocator. The functions now just add extra overhead. Replacing them will make future Coccinelle patches simpler. This patch has been generated by the following Coccinelle semantic patch: // Remove Xcalloc/Xmalloc/Xfree calls @@ expression E1, E2; @@ - Xcalloc (E1, E2) + calloc (E1, E2) @@ expression E; @@ - Xmalloc (E) + malloc (E) @@ expression E; @@ - Xfree (E) + free (E) @@ expression E; @@ - XFree (E) + free (E) Reviewed-by: Brian Paul <[email protected]>
* dri: Emit a critical error if a named driver fails to load.Carl Worth2012-02-081-0/+2
| | | | | | | | | Something has gone wrong if we were asked to load a driver of a specific name, but it failed to load for some reason. The user really should be made aware of this, (and instructed to set LIBGL_DEBUG for more details). Reviewed-by: Eugeni Dodonov <[email protected]>
* glx: Add glx_screen_vtable::create_context_attribsIan Romanick2012-01-021-1/+2
| | | | Signed-off-by: Ian Romanick <[email protected]>
* glx: Send DestroyContext protocol at the correct timesIan Romanick2011-12-191-3/+0
| | | | | | | | | | | | | | | | | | | | | | | Send the DestroyContext protocol immediately when glXDestroyContext is called, and never call it when glXFreeContextEXT is called. In both cases, either destroy the client-side structures or, if the context is current, set xid to None so that the client-side structures will be destroyed later. I believe this restores the behavior of the original SGI code. See src/glx/x11 around commit 5df82c8. The spec doesn't say anything about glXDestroyContext not really destroying imported contexts (it acts like glXFreeContextEXT instead), but that's what the original code did. Note that glXFreeContextEXT on a non-imported context does not destroy it either. Fixes the piglit test glx-free-context. NOTE: This is a candidate for the 7.11 branch. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Adam Jackson <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glx: Don't create a shared context if the other context isn't the same kindIan Romanick2011-12-191-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Each of the DRI, DRI2, and DRISW backends contain code like the following in their create-context routine: if (shareList) { pcp_shared = (struct dri2_context *) shareList; shared = pcp_shared->driContext; } This assumes that the glx_context *shareList is actually the correct derived type. However, if shareList was created as an indirect-rendering context, it will not be the expected type. As a result, shared will contain garbage. This garbage will be passed to the driver, and the driver will probably segfault. This can be observed with the following GLX code: ctx0 = glXCreateContext(dpy, visinfo, NULL, False); ctx1 = glXCreateContext(dpy, visinfo, ctx0, True); Create-context is the only case where this occurs. All other cases where a context is passed to the backend, it is the 'this' pointer (i.e., we got to the backend by call something from ctx->vtable). To work around this, check that the shareList->vtable->destroy method is the same as the destroy method of the expected type. We could also check that shareList->vtable matches the vtable or by adding a "tag" to glx_context to identify the derived type. NOTE: This is a candidate for the 7.11 branch. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Adam Jackson <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glx: Fix indirect fallback when a non-Mesa GLX extension is present.Aaron Plattner2011-12-071-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | When driCreateScreen calls driConvertConfigs to try to convert the configs for swrast, it fails and returns NULL. Instead of checking, it just clobbers psc->base.configs. Then, when the application asks for the FBconfigs, there aren't any. Instead, make the caller responsible for freeing the old modes lists if both calls to driConvertConfigs succeed. Without the second fix, glxinfo fails unless you run it with LIBGL_ALWAYS_INDIRECT: $ glxinfo name of display: :0.0 Error: couldn't find RGB GLX visual or fbconfig $ LIBGL_ALWAYS_INDIRECT=1 glxinfo name of display: :0.0 display: :0 screen: 0 direct rendering: No (LIBGL_ALWAYS_INDIRECT set) server glx vendor string: NVIDIA Corporation server glx version string: 1.4 [...] Signed-off-by: Aaron Plattner <[email protected]> Reviewed-and-tested-by: Ian Romanick <[email protected]> Signed-off-by: Brian Paul <[email protected]>
* dri: Remove all DRI1 driversIan Romanick2011-08-261-2/+2
| | | | | | | | | | Acked-by: Kristian Høgsberg <[email protected]> Acked-by: Marek Olšák <[email protected]> Acked-by: Alan Coopersmith <[email protected]> Acked-by: Jakob Bornecrantz <[email protected]> Acked-by: Dave Airlie <[email protected]> Build-Tested-by: Jakob Bornecrantz <[email protected]> Tested-by: Eugeni Dodonov <[email protected]>
* glx: Allow a context-specific fallback for glXGetProcAddressJeremy Huddleston2011-06-201-0/+1
| | | | | | | | In applegl, GLX advertises the same extensions provided by OpenGL.framework even if such extensions are not provided by glapi. This allows a client to get access to such API. Signed-off-by: Jeremy Huddleston <[email protected]>
* glx: implement drawable refcounting.Stéphane Marchesin2011-06-171-2/+4
| | | | | | | | | | | | The current dri context unbind logic will leak drawables until the process dies (they will then get released by the GEM code). There are two ways to fix this: either always call driReleaseDrawables every time we unbind a context (but that costs us round trips to the X server at getbuffers() time) or implement proper drawable refcounting. This patch implements the latter. Signed-off-by: Antoine Labour <[email protected]> Signed-off-by: Stéphane Marchesin <[email protected]> Reviewed-by: Adam Jackson <[email protected]>
* glx: Fix leaks in DRI screen creation error paths.Henri Verbeet2011-01-311-19/+20
| | | | Signed-off-by: Brian Paul <[email protected]>
* glx: Drop broken drawable garbage collectionKristian Høgsberg2010-09-081-2/+2
| | | | | | Doesn't work for pixmaps, was looking up the GLX XID and was never thread safe. Instead, just destroy the client side structures when the drawable is no long current for a context.
* glx: Move bind and unbind to context vtableKristian Høgsberg2010-07-281-31/+26
|
* glx: Rename __GLXcontext and __GLXdisplayPrivate to struct types.Kristian Høgsberg2010-07-281-9/+9
|
* glx: Rename __GLXscreenConfigs to struct glx_screenKristian Høgsberg2010-07-281-8/+8
| | | | Because double underscores in private type names is painful.
* glx: Use _X_EXPORT instead of our own PUBLIC macroKristian Høgsberg2010-07-281-2/+2
| | | | We're an X client library, so we can use Xfuncproto.h.
* glx: Rename __GLcontextModes to struct glx_configKristian Høgsberg2010-07-281-7/+7
| | | | | With this rename, we use 'config' consitently to refer to GLX configurations instead of the modes/configs/visual mess before.
* glx: Drop duplicate psc field in dri context structKristian Høgsberg2010-07-261-3/+2
| | | | Same problem as fixed for drisw in 4d58b5b482d06ab8d4c4b2db33d0b48b7c82d064.
* glx: Don't destroy context with XID 0Kristian Høgsberg2010-07-231-1/+2
| | | | | We use XID 0 to indicate the context has already been destroyed, but it's currently bound.
* glx: zero out drawable structs after allocationKristian Høgsberg2010-07-231-0/+1
|
* glx: Refactor and simplify context creationKristian Høgsberg2010-07-231-4/+8
| | | | | This lets us better separate context creation between the different backends.
* glx: Move context destroy to context vtableKristian Høgsberg2010-07-231-9/+18
|
* glx: Move WaitGL, WaitX, UseXFont to context vtable functionsKristian Høgsberg2010-07-221-2/+3
|
* glx: Allocate the __GLXcontext in the DRI driversKristian Høgsberg2010-07-221-19/+24
|
* glx: Move DRI CopySubBuffer extension to DRI1 codeKristian Høgsberg2010-07-191-4/+13
| | | | We do this in the X server for DRI2.
* glx: Move driver_configs to DRI screen privatesKristian Høgsberg2010-07-191-1/+3
|
* glx: Move __DRIdrawable pointers to DRI drawable privatesKristian Høgsberg2010-07-191-27/+46
|
* glx: Move __driScreen into the dri screen privatesKristian Høgsberg2010-07-191-10/+11
|
* glx: Move DRI1 specific extensions and code to DRI1 screen privateKristian Høgsberg2010-07-191-1/+123
|
* glx: Add screen privates for dri drivers and moved some fields thereKristian Høgsberg2010-07-191-49/+78
| | | | | | GLXscreenConfigs is badly named and a dumping ground for a lot of stuff. This patch creates private screen structs for the dri drivers and moves some of their fields over there.
* glx: Rename various DRI structs away from obnoxious __GLXfooRec conventionKristian Høgsberg2010-07-191-14/+11
| | | | Enough is enough.