summaryrefslogtreecommitdiff
path: root/src/glx/dri_glx.c
AgeCommit message (Collapse)AuthorFilesLines
2017-02-13glx: remove always true XDAMAGE_1_1_INTERFACE guardEmil Velikov1-4/+0
Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
2016-05-30glx: Implement the libglvnd interface.Kyle Brenneman1-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 <emil.velikov@collabora.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-08-21include: move sarea.h next to it's only userEmil Velikov1-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 <emil.l.velikov@gmail.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2014-06-18glx: Add an error message when a direct renderer's createScreen() routine failsJon TURNEY1-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 <jon.turney@dronecode.org.uk> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-04-28glx/dri: explicitly assign struct components for glx_*_vtableEmil Velikov1-13/+13
... to improve readability of code. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2014-02-23glx/dri: use the implemented version of __DRIdamageExtensionEmil Velikov1-2/+3
... over the one provided by the headers. Explicitly set extension members to improve clarity. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-02-23glx/dri: use the implemented version of __DRIgetDrawableInfoExtensionEmil Velikov1-2/+3
... over the one provided by the headers. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-01-27loader: Add missing \n on message printingEmil Velikov1-4/+4
Cover both loader and glx/dri_glx Drop \n from the default loader logger Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2013-12-19glx: Fix two identical null check errors in driSet/GetIntervalJuha-Pekka Heikkila1-8/+12
Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Reviewed-by: Brian Paul <brianp@vmware.com>
2013-10-24glx: Add an optional function call for getting the DRI driver interface.Eric Anholt1-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 <mattst88@gmail.com> (v1) Reviewed-by: Chad Versace <chad.versace@linux.intel.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2013-10-24dri: Allow config options to be passed to the loader through extensions.Eric Anholt1-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 <mattst88@gmail.com> Reviewed-by: Chad Versace <chad.versace@linux.intel.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2013-07-18glx: Validate the GLX_RENDER_TYPE valueTomasz Lis1-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 <tomasz.lis@intel.com> Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-07-18glx: Store the value of renderType while creating contextTomasz Lis1-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 <tomasz.lis@intel.com> Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2012-12-02glx: move the glFlush call one layer downMarek Olšák1-2/+10
2012-12-01dri_glx: fix use after free reportDave Airlie1-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 <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-10-09glx/dri1: Remove uncompiled __DRI_SWAP_BUFFER_COUNTER code.Eric Anholt1-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 <chad.versace@linux.intel.com>
2012-09-05Remove useless memset after callocMatt Turner1-1/+0
Reviewed-by: Brian Paul <brianp@vmware.com>
2012-09-05Use calloc instead of malloc/memset-0Matt Turner1-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 <brianp@vmware.com>
2012-09-05Remove useless checks for NULL before freeingMatt Turner1-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 <brianp@vmware.com>
2012-09-05Remove Xcalloc/Xmalloc/Xfree callsMatt Turner1-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 <brianp@vmware.com>
2012-02-08dri: Emit a critical error if a named driver fails to load.Carl Worth1-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 <eugeni.dodonov@intel.com>
2012-01-02glx: Add glx_screen_vtable::create_context_attribsIan Romanick1-1/+2
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2011-12-19glx: Send DestroyContext protocol at the correct timesIan Romanick1-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 <ian.d.romanick@intel.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-19glx: Don't create a shared context if the other context isn't the same kindIan Romanick1-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 <ian.d.romanick@intel.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-07glx: Fix indirect fallback when a non-Mesa GLX extension is present.Aaron Plattner1-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 <aplattner@nvidia.com> Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com> Signed-off-by: Brian Paul <brianp@vmware.com>
2011-08-26dri: Remove all DRI1 driversIan Romanick1-2/+2
Acked-by: Kristian Høgsberg <krh@bitplanet.net> Acked-by: Marek Olšák <maraeo@gmail.com> Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Jakob Bornecrantz <jakob@vmware.com> Acked-by: Dave Airlie <airlied@redhat.com> Build-Tested-by: Jakob Bornecrantz <jakob@vmware.com> Tested-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
2011-06-20glx: Allow a context-specific fallback for glXGetProcAddressJeremy Huddleston1-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 <jeremyhu@apple.com>
2011-06-17glx: implement drawable refcounting.Stéphane Marchesin1-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 <piman@chromium.org> Signed-off-by: Stéphane Marchesin <marcheu@chromium.org> Reviewed-by: Adam Jackson <ajax@redhat.com>
2011-01-31glx: Fix leaks in DRI screen creation error paths.Henri Verbeet1-19/+20
Signed-off-by: Brian Paul <brianp@vmware.com>
2010-09-08glx: Drop broken drawable garbage collectionKristian Høgsberg1-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.
2010-07-28glx: Move bind and unbind to context vtableKristian Høgsberg1-31/+26
2010-07-28glx: Rename __GLXcontext and __GLXdisplayPrivate to struct types.Kristian Høgsberg1-9/+9
2010-07-28glx: Rename __GLXscreenConfigs to struct glx_screenKristian Høgsberg1-8/+8
Because double underscores in private type names is painful.
2010-07-28glx: Use _X_EXPORT instead of our own PUBLIC macroKristian Høgsberg1-2/+2
We're an X client library, so we can use Xfuncproto.h.
2010-07-28glx: Rename __GLcontextModes to struct glx_configKristian Høgsberg1-7/+7
With this rename, we use 'config' consitently to refer to GLX configurations instead of the modes/configs/visual mess before.
2010-07-26glx: Drop duplicate psc field in dri context structKristian Høgsberg1-3/+2
Same problem as fixed for drisw in 4d58b5b482d06ab8d4c4b2db33d0b48b7c82d064.
2010-07-23glx: Don't destroy context with XID 0Kristian Høgsberg1-1/+2
We use XID 0 to indicate the context has already been destroyed, but it's currently bound.
2010-07-23glx: zero out drawable structs after allocationKristian Høgsberg1-0/+1
2010-07-23glx: Refactor and simplify context creationKristian Høgsberg1-4/+8
This lets us better separate context creation between the different backends.
2010-07-23glx: Move context destroy to context vtableKristian Høgsberg1-9/+18
2010-07-22glx: Move WaitGL, WaitX, UseXFont to context vtable functionsKristian Høgsberg1-2/+3
2010-07-22glx: Allocate the __GLXcontext in the DRI driversKristian Høgsberg1-19/+24
2010-07-19glx: Move DRI CopySubBuffer extension to DRI1 codeKristian Høgsberg1-4/+13
We do this in the X server for DRI2.
2010-07-19glx: Move driver_configs to DRI screen privatesKristian Høgsberg1-1/+3
2010-07-19glx: Move __DRIdrawable pointers to DRI drawable privatesKristian Høgsberg1-27/+46
2010-07-19glx: Move __driScreen into the dri screen privatesKristian Høgsberg1-10/+11
2010-07-19glx: Move DRI1 specific extensions and code to DRI1 screen privateKristian Høgsberg1-1/+123
2010-07-19glx: Add screen privates for dri drivers and moved some fields thereKristian Høgsberg1-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.
2010-07-19glx: Rename various DRI structs away from obnoxious __GLXfooRec conventionKristian Høgsberg1-14/+11
Enough is enough.
2010-05-21glx: Split tfp functions out to context vtableKristian Høgsberg1-0/+7
This introduces a new per-context vtable, which lets us clean up all the #ifdef's a bit and move the DRI2 specific implementation into dri2_glx.c.