summaryrefslogtreecommitdiff
path: root/glx/glxcmds.c
AgeCommit message (Collapse)AuthorFilesLines
2012-07-09Use C99 designated initializers in glx RepliesAlan Coopersmith1-43/+59
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-09Use calloc to zero fill buffers being allocated for replies & eventsAlan Coopersmith1-2/+2
Ensures padding bytes are zero-filled Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-09Remove unneccesary casts from WriteToClient callsAlan Coopersmith1-16/+13
Casting return to (void) was used to tell lint that you intended to ignore the return value, so it didn't warn you about it. Casting the third argument to (char *) was used as the most generic pointer type in the days before compilers supported C89 (void *) (except for a couple places it's used for byte-sized pointer math). Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-05glx: Track the reset notification strategy for a contextIan Romanick1-0/+10
Also require that the reset notification for a new context and the other context in the share group match. There isn't yet any way to specify a non-default reset notification strategy, but that will come. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2012-05-23glx: Make several functions available outside the glxcmds.c compilation unitIan Romanick1-4/+4
validGlxScreen, validGlxFBConfig, validGlxContext, and __glXdirectContextCreate will soon be used by createcontext.c. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2012-05-23glx: Use one function to add a context to all global tablesIan Romanick1-4/+2
Instead of having separate __glXAddContextToList and AddResource functions, just have one function that does both steps. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2012-05-23glx: Initialize remaining context fieldsIan Romanick1-0/+7
There is no reason to assume the screen's context allocated initialized these fields, so don't. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2012-05-23glx: Initialize all context fields togetherIan Romanick1-17/+9
v2: Fix whitespace error noticed by Christopher James Halse Rogers. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2012-05-23glx: Extend __GLXscreen::createContext to take attributesIan Romanick1-2/+8
The attributes will be used for glXCreateContextAttribsARB additions in follow-on patches. v2: Add missing 'int *error' parameters noticed by Christopher James Halse Rogers. v3: Remove redundant 'int err;' declaration noticed by Christopher James Halse Rogers. This was supposed to be in v2, but I missed it. v4: Add comma missing from additions in v2. Ugh. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2012-05-23glx: Don't track GLClientmajorVersion or GLClientminorVersionIan Romanick1-2/+0
Nothing uses these fields anywhere in the server. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2012-05-23glx: Fix mishandling of shared contextsIan Romanick1-11/+11
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
2012-03-21Introduce a consistent coding styleKeith Packard1-1018/+1089
This is strictly the application of the script 'x-indent-all.sh' from util/modular. Compared to the patch that Daniel posted in January, I've added a few indent flags: -bap -psl -T PrivatePtr -T pmWait -T _XFUNCPROTOBEGIN -T _XFUNCPROTOEND -T _X_EXPORT The typedefs were needed to make the output of sdksyms.sh match the previous output, otherwise, the code is formatted badly enough that sdksyms.sh generates incorrect output. The generated code was compared with the previous version and found to be essentially identical -- "assert" line numbers and BUILD_TIME were the only differences found. The comparison was done with this script: dir1=$1 dir2=$2 for dir in $dir1 $dir2; do (cd $dir && find . -name '*.o' | while read file; do dir=`dirname $file` base=`basename $file .o` dump=$dir/$base.dump objdump -d $file > $dump done) done find $dir1 -name '*.dump' | while read dump; do otherdump=`echo $dump | sed "s;$dir1;$dir2;"` diff -u $dump $otherdump done Signed-off-by: Keith Packard <keithp@keithp.com> Acked-by: Daniel Stone <daniel@fooishbar.org> Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-04-15glx: Fix lifetime tracking for pixmapsAdam Jackson1-4/+7
GLX pixmaps take a reference on the underlying pixmap; X and GLX pixmap IDs can be destroyed in either order with no error. Only windows need to be tracked under both XIDs. Fixes piglit/glx-pixmap-life. Reviewed-by: Michel Dänzer <michel@daenzer.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-03-28glx: Remove some obfuscatory macrosAdam Jackson1-7/+7
Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-03-28glx: Reimplement context tagsAdam Jackson1-74/+24
This would let you do a constant-time context lookup, but if that's your performance problem you have two problems. Just use the context's XID as the tag value instead. In order to do this, we have to defer destroying a context until it actually goes unreferenced, as you're allowed to mention a context tag after you've (ostensibly) destroyed the context, as long as it's still your current context. Thus, change DestroyContext to merely mark the context as dead if it's a current context, and call down to actual resource destruction (and XID reclamation) in StopUsingContext. Also, stop trying to delete context state from DrawableGone. This was always broken, as GLX does not say that contexts are destroyed when their drawables are destroyed. But with the above change to defer context destruction, this would trigger a server crash on client exit as we'd free the context state twice. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-02-15glx: Work around wrong request lengths sent by mesaJulien Cristau1-4/+15
mesa used to send too long requests for GLXDestroyPixmap, GLXDestroyWindow, GLXChangeDrawableAttributes, GLXGetDrawableAttributes and GLXGetFBConfigsSGIX. Fixes a regression introduced in ec9c97c6bf70b523bc500bd3adf62176f1bb33a4 X.Org bug#33324 <https://bugs.freedesktop.org/show_bug.cgi?id=33324> Reported-by: xunx.fang@intel.com Signed-off-by: Julien Cristau <jcristau@debian.org> Reviewed-by: Adam Jackson <ajax@redhat.com>
2011-02-15glx: fix BindTexImageEXT length checkJulien Cristau1-1/+9
The request is followed by a list of attributes. X.Org bug#33449 Reported-and-tested-by: meng <mengmeng.meng@intel.com> Signed-off-by: Julien Cristau <jcristau@debian.org> Reviewed-by: Adam Jackson <ajax@redhat.com>
2011-02-15glx: fix request length check for CreateGLXPbufferSGIXJulien Cristau1-1/+1
The request is followed by an attribute list. Signed-off-by: Julien Cristau <jcristau@debian.org> Reviewed-by: Adam Jackson <ajax@redhat.com>
2011-01-10glx: validate numAttribs field before using itJulien Cristau1-0/+25
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Julien Cristau <jcristau@debian.org>
2011-01-10glx: validate request lengthsJulien Cristau1-9/+133
Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Julien Cristau <jcristau@debian.org>
2011-01-10glx: make sure screen is non-negative in validGlxScreenJulien Cristau1-1/+1
Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Julien Cristau <jcristau@debian.org>
2010-11-30glx: Remove swap barrier and hyperpipe supportAdam Jackson1-233/+0
Never implemented in any open source driver. The implementation assumed explicit DDX driver knowledge of how the client-side driver worked, since at the time the server's GL renderer was not a DRI driver. But now, it is, so any implementation of these should be done with additional DRI driver API, like the swap control extension. Reviewed-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Kristian Høgsberg <krh@bitplanet.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2010-08-19glx: Prevent NULL context deref in __glXGetDrawable() (bug 29184)Chris Wilson1-0/+7
During a SwapBuffers request, we may end up querying an unknown drawable outside of an active context, and so need to report this error prior to attempting to dereference the NULL context. Also fixes: [Bug 29184] glXSwapBuffers with no GLX context crashes X. https://bugs.freedesktop.org/show_bug.cgi?id=29184 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-06-11Get rid of xstrdup when argument is definitely non-NULLMikhail Gusarov1-1/+1
Replace xstrdup with strdup when either constant string is being duplicated or argument is guarded by conditionals and obviously can't be NULL Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2010-06-06Remove more superfluous if(p) checks around free(p)Mikhail Gusarov1-2/+1
This patch has been generated by the following Coccinelle semantic patch: @@ expression E; @@ -if(E) { free(E); } +free(E); Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Julien Cristau <jcristau@debian.org> Reviewed-by: Fernando Carrijo <fcarrijo@yahoo.com.br> Reviewed-by: Matt Turner <mattst88@gmail.com>
2010-05-13Replace X-allocation functions with their C89 counterpartsMikhail Gusarov1-13/+13
The only remaining X-functions used in server are XNF*, the rest is converted to plain alloc/calloc/realloc/free/strdup. X* functions are still exported from server and x* macros are still defined in header file, so both ABI and API are not affected by this change. Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-11dri2: Take an XID for tracking the DRI2 drawableKristian Høgsberg1-9/+14
Some pixmaps (window pixmaps and scratch pixmaps) don't have the drawable->id set and thus DRI2 gets confused when using that field for looking up the DRI2 drawable. Go back to using privates for getting at the DRI2 drawable from a DrawablePtr. We need to keep the resource tracking in place so we can remove the DRI2 drawable when the X resource it was created for goes away. Additionally, we also now track the DRI2 drawable using a client XID so we can reclaim the DRI2 drawable even if the client goes before the drawable and doesn't destroy the DRI2 drawable. Tested-by: Owen W. Taylor <otaylor@fishsoup.net> Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
2010-04-16glx: Let the resource system destroy pixmapsKristian Høgsberg1-14/+15
GLX pbuffers are implemented using a pixmap allocated by the server. With the change to DRI2 to track DRI2 drawables as resources, we need to make sure that every drawable we create a DRI2 drawable for has an XID. By using the XID of the pbuffer, the resource system will automatically reclaim the hidden pixmap and the DRI2 drawable when the pbuffer is destroyed or the client exits. Signed-off-by: Kristian Høgsberg <krh@bitplanet.net> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-04-16glx: Track GLX 1.3 style GLX drawables under their X drawable ID as wellKristian Høgsberg1-0/+12
This ensures that the DrawableGone callback gets called as necessary when the X drawable goes away. Otherwise, using a GLX drawable (say, glXSwapBuffers) in indirect mode after the X drawable has been destroyed will crash the server. Signed-off-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Michel Dänzer <michel@daenzer.net> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-01-11DRI2: add support for new DRI2 protocol requestsJesse Barnes1-1/+1
Support the new DRI2 2.2 protocol requests: DRI2SwapBuffers, DRI2GetMSC, DRI2WaitMSC, DRI2WaitSBC and DRI2SwapInterval. These requests allow the server to support the SGI_video_sync, SGI_swap_interval, and OML_sync_control GLX extensions if DDX support is present. The new DDX APIs are documented in dri2.h. Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Adam Jackson <ajax@nwnk.net> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-10-08Cast small-int values through intptr_t when passed as pointersJamey Sharp1-1/+1
On 64-bit systems, int and pointers don't have the same size, so GCC gives warnings about casts between int and pointer types. However, in the cases covered by this patch, it's always a value that fits in int being stored temporarily as a pointer and then converted back later, which is safe. Casting through the pointer-sized integer type intptr_t convinces the compiler that this is OK. Signed-off-by: Jamey Sharp <jamey@minilop.net> Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2009-10-01GLX: More clearly document the GLX protocol version handlingIan Romanick1-1/+0
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-29GLX: Enable GLX 1.4 on DRI2Ian Romanick1-3/+8
Return the minimum GLX version supported by all screens. Assume that DRI2 screens have all the required features for GLX 1.4. Assume that everyone else can only support GLX 1.2. Reviewed-by: Kristian Høgsberg <krh@redhat.com> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-21input: define server-supported protocol versions in one single file.Peter Hutterer1-2/+3
include/protocol-versions.h specifies each extension version as supported by the server and sent back on the wire to the client. This fixes up several issues with the server potentially reporting a higher version of the protocol if recompiled against a newer version of the protocol. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Rémi Cardona <remi@gentoo.org> Acked-by: Julien Cristau <jcristau@debian.org>
2009-07-06glx: remove Xgl leftoverRALOVICH, Kristóf1-6/+0
GlxSetRenderTables was only used by the long gone Xgl. Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
2009-06-02Remove some libXfont leftoversAdam Jackson1-1/+0
2009-05-29GLX: Purge some glxint.h usage in glxcmds.cJeremy Huddleston1-6/+16
This is related to d0b249f1c5df81f3941d638f9625fe1e16c31807 in the 1.4 branch and was ok'd by krh (cherry picked from commit e587436cf2e1237813c924699ff0662aea3034e1)
2009-04-27Fix obvious copypastaPierre Willenbrock1-2/+2
Reviewed-by: Ian Romanick <idr@freedesktop.org>
2009-04-13glx: Fix drawable private leak on destroyKristian Høgsberg1-15/+29
When a drawable goes away, we don't destroy the GLX drawable in full, since it may be current for a context. This means that when the drawable is destroyed in full later, the backend doesn't get a chance to destroy resources associated with the drawable (the DRI2Drawable). With this patch, we destroy the GLX drawable in full when it goes away and then track down all contexts that reference it and NULL their pointers.
2009-04-09glx: Test the error value, not its address...Michel Dänzer1-1/+1
2009-04-07Add validGlxDrawable() and use dixLookupResourceByType().Kristian Høgsberg1-69/+74
Fixes deprecation warnings, and fixes a couple of GLX error codes for failing drawable lookups.
2009-04-07Don't stomp on dixLookupDrawable() return value in DoCreateGLXPixmap().Kristian Høgsberg1-1/+5
2009-04-07Make GLX context lookup use dixLookupResourceByType()Kristian Høgsberg1-55/+43
2009-04-02Support setTexBuffer2 in AIGLX.Kristian Høgsberg1-0/+5
Fixes broken GLX_tfp, specifically, lets compositors ignore un-defined alpha channel for pixmaps.
2009-02-16dri2: support glXWaitGL & glXWaitX by copying fake front to front andAlan Hourihane1-11/+28
vice-versa.
2009-02-01Prevent double unref of glxdrawablesPierre Willenbrock1-0/+4
Found by valgrind. Bug #18917.
2008-12-12Remove #define NEED_EVENTS and NEED_REPLIESPeter Hutterer1-1/+0
A grep on xorg/* revealed there's no consumer of this define. Quote Alan Coopersmith: "The consumer was in past versions of the headers now located in proto/x11proto - for instance, in X11R6.0's xc/include/Xproto.h, all the event definitions were only available if NEED_EVENTS were defined, and all the reply definitions required NEED_REPLIES. Looks like Xproto.h dropped them by X11R6.3, which didn't have the #ifdef's anymore, so these are truly ancient now." Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
2008-10-06xalloc+memset(0) -> xcallocAdam Jackson1-2/+1
2008-09-19Update to SGI FreeB 2.0.Adam Jackson1-33/+28
Under the terms of version 1.1, "once Covered Code has been published under a particular version of the License, Recipient may, for the duration of the License, continue to use it under the terms of that version, or choose to use such Covered Code under the terms of any subsequent version published by SGI." FreeB 2.0 license refers to "dates of first publication". They are here taken to be 1991-2000, as noted in the original license text: ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. Official FreeB 2.0 text: http://oss.sgi.com/projects/FreeB/SGIFreeSWLicB.2.0.pdf As always, this code has not been tested for conformance with the OpenGL specification. OpenGL conformance testing is available from http://khronos.org/ and is required for use of the OpenGL logo in product advertising and promotion.
2008-08-29DRI2: Drop sarea use, implement server side swap buffers.Kristian Høgsberg1-0/+1