Commit Graph

12 Commits

Author SHA1 Message Date
Adam Jackson 007d812a83 glx: Fix GLX_CONTEXT_RELEASE_BEHAVIOR_ARB handling
None of this was getting compiled because we hadn't defined the macro
(and aren't getting them from <GL/glxext.h> because reasons). Fix that.

Fixes: xorg/xserver#684
2019-05-01 14:38:09 +00:00
Adam Jackson 133bd4443b glx: Large commands are context state, not client state
There's no reason a multithreaded client shouldn't be allowed to
interleave other requests (for other contexts) with a RenderLarge. Move
the check into __glXForceCurrent, and store the state in the context not
the client.

Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-02-14 17:04:48 -05:00
Adam Jackson d8ec33fe05 glx: Use vnd layer for dispatch (v4)
The big change here is MakeCurrent and context tag tracking. We now
delegate context tags entirely to the vnd layer, and simply store a
pointer to the context state as the tag data. If a context is deleted
while it's current, we allocate a fake ID for the context and move the
context state there, so the tag data still points to a real context. As
a result we can stop trying so hard to detach the client from contexts
at disconnect time and just let resource destruction handle it.

Since vnd handles all the MakeCurrent protocol now, our request handlers
for it can just be return BadImplementation. We also remove a bunch of
LEGAL_NEW_RESOURCE, because now by the time we're called vnd has already
allocated its tracking resource on that XID.

v2: Update to match v2 of the vnd import, and remove more redundant work
like request length checks.

v3: Add/remove the XID map from the vendor private thunk, not the
backend. (Kyle Brenneman)

v4: Fix deletion of ghost contexts (Kyle Brenneman)

Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-02-14 17:04:44 -05:00
Jon TURNEY bc71081f0e glx: Fix crash when a client exits without deleting GL contexts
With the previous patches applied, we now have crash due to use-after-free when
a client exits without deleting all it's GL contexts

On client exit, CloseDownClient first calls glxClientCallback() with
ClientStateGone, which calls __glXFreeContext() directly.

Subsequently CloseDownClient() frees all the clients resources, which leads to
ContextGone() being called for a context resource where the context has already
been freed.

Fix this by modifiying glxClientCallback() to free the context resource.

Also make __glXFreeContext() static, as calling it directly leads to this
problem, instead the context resource should be released.

With the previous patches applied, this can be demonstrated with e.g. glxinfo,
which doesn't delete it's context before exit.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-12-05 16:41:49 +00:00
Daniel Czarnowski eabb523aa4 glx: Allow float renderType in glXCreateContextAttribsARB
This enables GLX_RGBA_FLOAT_TYPE_ARB and
GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT as valid renderType parameters to
glXCreateContextAttribsARB.

v2 (idr) : Use C-style comments and fix word wrapping.  Re-write commit
message.

Signed-off-by: Daniel Czarnowski <daniel.czarnowski@intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-10-24 11:16:27 -07:00
Ian Romanick cd5689cac5 glx: Use one function to add a context to all global tables
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-23 13:08:12 -07:00
Keith Packard 9838b7032e Introduce a consistent coding style
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>
2012-03-21 13:54:42 -07:00
Ian Romanick 2df539c0bc glx: Only declare GlxExtensionInit in one header file
This silences the GCC warning:

In file included from singlepixswap.c:36:0:
glxext.h:47:13: warning: redundant redeclaration of 'GlxExtensionInit' [-Wredundant-decls]
glxserver.h:80:6: note: previous declaration of 'GlxExtensionInit' was here

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2011-12-19 13:38:46 -08:00
Kristian Høgsberg 7b6400a1b8 glx: Fix drawable private leak on destroy
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-13 13:17:53 -04:00
Adam Jackson 69b79c1a66 Update to SGI FreeB 2.0.
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-09-19 12:02:28 -04:00
Kristian Høgsberg 2ce434f54b Clean up unused definitions from glx headers. 2008-07-25 14:29:25 -04:00
Kristian Høgsberg c3eb5b80d8 Move GL/glx on level up now that it's the only thing left under GL. 2008-05-21 13:33:36 -04:00