Commit Graph

341 Commits

Author SHA1 Message Date
Adam Jackson
698888e667 glx: Integer overflow protection for non-generated render requests (v3) [CVE-2014-8093 5/6]
v2:
Fix constants in __glXMap2fReqSize (Michal Srb)
Validate w/h/d for proxy targets too (Keith Packard)

v3:
Fix Map[12]Size to correctly reject order == 0 (Julien Cristau)

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Michal Srb <msrb@suse.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-12-08 18:09:50 -08:00
Julien Cristau
be09e0c988 glx: Length checking for GLXRender requests (v2) [CVE-2014-8098 2/8]
v2:
Remove can't-happen comparison for cmdlen < 0 (Michal Srb)

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Michal Srb <msrb@suse.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
Signed-off-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-12-08 18:09:49 -08:00
Adam Jackson
2a5cbc17fc glx: Add safe_{add,mul,pad} (v3) [CVE-2014-8093 4/6]
These are paranoid about integer overflow, and will return -1 if their
operation would overflow a (signed) integer or if either argument is
negative.

Note that RenderLarge requests are sized with a uint32_t so in principle
this could be sketchy there, but dix limits bigreqs to 128M so you
shouldn't ever notice, and honestly if you're sending more than 2G of
rendering commands you're already doing something very wrong.

v2: Use INT_MAX for consistency with the rest of the server (jcristau)
v3: Reject negative arguments (anholt)

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Michal Srb <msrb@suse.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-12-08 18:09:49 -08:00
Adam Jackson
13d36923e0 glx: Fix image size computation for EXT_texture_integer [CVE-2014-8098 1/8]
Without this we'd reject the request with BadLength.  Note that some old
versions of Mesa had a bug in the same place, and would _send_ zero
bytes of image data; these will now be rejected, correctly.

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Michal Srb <msrb@suse.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-12-08 18:09:49 -08:00
Adam Jackson
717a1b3776 glx: Additional paranoia in __glXGetAnswerBuffer / __GLX_GET_ANSWER_BUFFER (v2) [CVE-2014-8093 3/6]
If the computed reply size is negative, something went wrong, treat it
as an error.

v2: Be more careful about size_t being unsigned (Matthieu Herrb)
v3: SIZE_MAX not SIZE_T_MAX (Alan Coopersmith)

Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Michal Srb <msrb@suse.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-12-08 18:09:49 -08:00
Adam Jackson
ab2ba9338a glx: Be more strict about rejecting invalid image sizes [CVE-2014-8093 2/6]
Before this we'd just clamp the image size to 0, which was just
hideously stupid; if the parameters were such that they'd overflow an
integer, you'd allocate a small buffer, then pass huge values into (say)
ReadPixels, and now you're scribbling over arbitrary server memory.

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Michal Srb <msrb@suse.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-12-08 18:09:49 -08:00
Adam Jackson
23fe7718bb glx: Be more paranoid about variable-length requests [CVE-2014-8093 1/6]
If the size computation routine returns -1 we should just reject the
request outright.  Clamping it to zero could give an attacker the
opportunity to also mangle cmdlen in such a way that the subsequent
length check passes, and the request would get executed, thus passing
data we wanted to reject to the renderer.

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Michal Srb <msrb@suse.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-12-08 18:09:49 -08: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
Jon TURNEY
5c606c0a89 glx: Flush context which is being made non-current due to drawable going away
Some sequences of glean tests fail with GLXBadCurrentWindow when using indirect
rendering, e.g. glean -t 'fpexceptions getString'.

Flush a context which is being made non-current due to the drawable on which is
it is current going away.  Waiting until another context is made current is too
late, as the drawable no longer exists.

v2: Rewrite for direct GL dispatch

v3: Inline FlushContext(), doesn't need to be a separate function

e.g. LIBGL_ALWAYS_INDIRECT=1  ./glean -r results -o --quick -t "fpexceptions
getString" fails with a BadContextTag error.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-12-05 16:39:47 +00:00
Jon TURNEY
437b27494f Revert "glx: Simplify glXDestroyContext"
This reverts commit 7f5adf73a0.

This seems to miss the whole point of the idExists flag, as it makes the
lifetime of that being true the same as the lifetime of the Context resource.

The previously current context tag is always given in a MakeContextCurrent
request, even if that context tag is no longer valid (for example, the context
has been deleted), so this leads to BadContextTag errors.

See fd.o bug #30089 for the makecurrenttest.c testcase, and some discussion of
previous manifestations of this bug.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-12-05 16:37:28 +00:00
Peter Hutterer
732fd7e571 Drop trailing whitespaces
sed -i "s/[ ]\+$//g" **/*.(c|h)

happy reviewing...
git diff -w is an empty diff.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-12 10:25:00 +10:00
Alan Coopersmith
7e5bc49d1e Allocate enough room for both reset & flags attributes
ctx_attribs had room for 3 pairs of attributes, but if both flags & reset
attributes were being returned it was storing 4 pairs in the array.

Found by Coverity #53442:  Out-of-bounds write
This could cause an immediate crash or incorrect computations.
In create_driver_context: Out-of-bounds write to a buffer (CWE-119)

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-10-23 17:31:59 -07:00
Keith Packard
61a292adf4 glx: check return from __glXGetAnswerBuffer
This function can return NULL; make sure every caller tests for that.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-10-09 15:30:52 +02:00
Keith Packard
bf338efc67 glx/present: Only send GLX_BufferSwapComplete for PresentCompleteKindPixmap
Present didn't provide the 'kind' argument to the
present_complete_notify hook that GLX uses to construct
GLX_BufferSwapComplete events, so GLX was reporting events for
PresentCompleteKindMSC notifications, which resulted in duplicate
GLX_BufferSwapComplete events and crashes in clutter.

See the gnome bug: https://bugzilla.gnome.org/show_bug.cgi?id=733282

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-09-11 18:19:41 -07:00
Maks Naumov
e1cc0d3df1 glx: Fix 'y ' value in swrastGetDrawableInfo()
Signed-off-by: Maks Naumov <maksqwe1@ukr.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-09-11 17:51:12 -07:00
Adam Jackson
db2e708f31 glx: Require at least one True/DirectColor visual
Mesa no longer supports rendering to anything less.  GLX 1.2 requires
that the server advertise at least one GLX visual.  GLX 1.3 and 1.4 are
more subtle: they require at least one fbconfig capable of window
rendering, and _also_ require that window-capable fbconfigs have a
non-zero value for the GLX_VISUAL_ID.  In either case we should refuse
to init GLX if there's not at least one GL-capable visual on at least
one screen.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-05-22 18:08:20 -07:00
Eric Anholt
99f0365b1f Add a command line argument for disabling indirect GLX.
The attack surface for indirect GLX is huge, and it's of no use to
most people (if you get an indirect GL context, you're better served
by a immediate X error than actually trying to use an indirect GL
context and finding out that it doesn't support doing anything you
want, slowly).  This flag gives you a chance to disable indirect GLX
in environments where you just don't need it.

I put in both the '+' and '-' arguments right now, so that it's easy
to patch the value to change the default policy.

Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-04-23 13:24:22 -07:00
Michel Dänzer
a69907288d glx: If DRI2GetBuffers changes the GL context, call it again
By changing the context, it may also invalidate the DRI2 buffer
information, so we need to get that again.

Fixes crashes due to use-after-free with LIBGL_ALWAYS_INDIRECT=1
glxgears and piglit.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-04-23 10:32:44 -07:00
Eric Anholt
ab6e958a2e glx: Make sure that DRI2/swrast calls haven't changed the GL context.
These functions are called from the GL driver, in some series of GL
calls by GLX.  If some server component (like glamor CreatePixmap for
GetBuffers()) changes the GL context on us, we need to set it back or
the later GL calls will land in the glamor context instead of the GLX
context.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-04-23 10:32:15 -07:00
Eric Anholt
f3f2fb6baa glx: Refactor DRI2CopyRegion calls.
I needed to add some code to each one, so it's a good time to make a
helper func.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-04-23 10:32:13 -07:00
Eric Anholt
008f1ab31e glx: Unconditionally clear lastGLContext on loseCurrent().
This hook calls unbindContext in the DRI driver interface, which
unsets the dispatch table, regardless of whether the context argument
was the current one or not.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-04-23 10:32:10 -07:00
Eric Anholt
789509ef53 glx: Move GLX MakeCurrent lastGLContext updates next to makeCurrent().
We want to make sure that lastGLContext is set correctly during
makeCurrent, because we may have recursive GL context changes in the
DRI2 interfaces due to glamor.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-04-23 10:32:07 -07:00
Eric Anholt
abf1202706 glx: Move the GLX variable caching what GL context is current to dix.
GLX is trying to track whether the context it wants is current, to
avoid the glFlush() (and the rest of the overhead) that occurs on all
MakeCurrent calls.  However, its cache can be incorrect now that
glamor exists.  This is a step toward getting glamor to coordinate
with GLX.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-04-23 10:32:02 -07:00
Eric Anholt
96a28e9c91 glx: Clear new FBConfig attributes to 0 by default.
The visualSelectGroup wasn't getting set (since our DRI drivers don't
use it), and and since it's the top priority in the sort order, you
got random sorting of your visuals unless malloc really returned you
new memory.  This manifested as Xephyr -glamor rendering to a
multisampled window on my system, which as you might guess was
slightly lower performance than expected.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2014-03-10 13:57:21 -07:00
Alan Coopersmith
08c7df9b08 __glGetProcAddress: explictly cast function pointers to void *
Fixes Solaris Studio compiler warning & error:

"glxext.c", line 557: warning: assignment type mismatch:
	    pointer to void "=" pointer to function(void) returning void
"glxext.c", line 559: error: operands have incompatible types:
	     pointer to void ":" pointer to function(void) returning void

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-02-07 16:14:58 -08:00
Eric Anholt
9f8f6657cd glx: Delete dead NV program string functions.
These have been throwing a compiler warning about missing prototypes,
since the generated code to define the prototypes stopped being
generated (possibly because the code was dead).

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-02-07 16:03:38 -08:00
Eric Anholt
0c774d53c5 glx: Reduce compiler warnings by not requesting GL extension prototypes.
They're not officially in the ABI, so you shouldn't use them anyway.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-02-07 16:02:52 -08:00
Eric Anholt
87c4551c9c glx: Stop relying on libGL ABI bugs for glGetCompressedTexImage().
In theory, the linux libGL ABI exposes just GL 1.2 plus GLX 1.3.  But,
thanks to libglapi, we're letting glGetCompressedTexImageARB() be
exposed too.  The GLX code was inappropriately relying on it by using
GL_GLEXT_PROTOTYPES.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-02-07 16:00:26 -08:00
Jon TURNEY
bf4f02337c glx: Remove left-over glthread.c
Commit be668096 "glx: convert to direct GL dispatch (v2)" removes glthread.c
from Makefile.am along with the rest of the dispatch table code, but doesn't
remove glthread.c itself.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-02-07 15:54:39 -08:00
Keith Packard
9e45a1a030 Warning fixes in glx
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-01-27 11:34:02 -08:00
Keith Packard
0b932cf47a Merge remote-tracking branch 'anholt/xserver-unifdef' 2014-01-22 11:27:36 -08:00
Keith Packard
60014a4a98 Replace 'pointer' type with 'void *'
This lets us stop using the 'pointer' typedef in Xdefs.h as 'pointer'
is used throughout the X server for other things, and having duplicate
names generates compiler warnings.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-01-12 10:24:11 -08:00
Eric Anholt
295d41fa2a glx: unifdef swrast dri_interface.h values from Mesa 7.1.
We can't remove all the ifdefs (__DRI_TEX_BUFFER_VERSION) because
configure.ac is only checking for that version of Mesa in the absence
of dri2.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-12-30 23:10:34 -08:00
Eric Anholt
4ab1a2797b glx: unifdef for DRI2 dri_interface.h things in mesa 9.2.
Thanks to configure.ac's check, we know that we have a new enough
dri_interface.h that we don't need to conditionalize all this code.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-12-30 23:10:21 -08:00
Adam Jackson
8248b4af31 glx: Add null pointer protection to __glGetProcAddress
This can't happen when GLX is the backing window system, but can
elsewhere.  We may as well protect against it at a high level.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-12-13 15:07:48 -05:00
Jon TURNEY
cb48877a3c glx: Consistently use ARB-suffixed names for ARB_multitexture functions
At the moment we have a mix of ARB and non-ARB suffixed forms for ARB_multitexture functions
e.g. glMultiTexCoord1fvARB and glMultiTexCoord1dv

Consistently use the ARB-suffixed form, assuming that is present in all libGL
which provide the OpenGL 1.2.1 ABI we expect to be able to directly link with.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2013-12-10 16:59:53 +00:00
Adam Jackson
a668aa0e41 drisw: Wire up GetProcAddress
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-12-10 08:04:19 -08:00
Adam Jackson
4fcdfeb7bc dri2: wire up GetProcAddress
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-12-10 08:04:04 -08:00
Adam Jackson
47f00b3920 glx: Untangle the prototypes around the GetProcAddress thunk
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2013-12-10 08:03:50 -08:00
Adam Jackson
c1fd143f28 glx: Remove function stubs
Now that we're calling non-1.2 ABI things by function pointer this is no
longer needed.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2013-12-10 08:03:22 -08:00
Adam Jackson
6b93e1f5ff glx: Convert non-generated function pointer thunking
Same concept as the generated code conversion.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2013-12-10 08:02:42 -08:00
Adam Jackson
c4567a3760 glx: Convert generated code function pointer thunking
We're meant not to call these by name due to ABI.  Rather than try to
generate a bunch of little stub functions that do the lookup, just
inline it all directly into the calling function.

This does not cache results.  That's fine, this is not a performance
path, and if we're atop WGL then we effectively have to do this every
time anyway because wglGetProcAddress results are context-dependent.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Jon TURNEY <jon.turney@dronecode.org.uk>
2013-12-10 08:01:37 -08:00
Eric Anholt
ac772cb187 glx: Fix incorrect use of dri_interface.h version defines in driver probing.
If we extend __DRI_CORE or __DRI_SWRAST in dri_interface.h to allow a
new version, it shouldn't make old server code retroactively require
the new version from swrast drivers.

Notably, new Mesa defines __DRI_SWRAST version 4, but we still want to
be able to probe version 1 drivers, since we don't use any features
beyond version 1 of the struct.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-12-05 10:51:01 -08:00
Eric Anholt
6e926b18ca glx: Fix incorrect use of dri_interface.h version defines in extensions.
Those defines are so you can compile-time check "do I have a
dri_interface.h that defines this new field of the struct?"  You don't
want the server to claim it implements the new struct just because you
installed a new copy of Mesa.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-12-05 10:50:53 -08:00
Keith Packard
3dd5bfe540 present: Send GLX_BufferSwapComplete events from present extension
This allows GL to support the GLX_INTEL_swap_event extension.

v2: Return GLX_BLIT_COMPLETE_INTEL for unknown swap types

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2013-12-05 09:51:00 -08:00
Chris Wilson
e7000534a4 glx/glxdri2: Unwrap EnterVT/LeaveVT upon CloseScreen
In a similar spirit to

commit d75e8146c4
Author: Keith Packard <keithp@keithp.com>
Date:   Mon Jul 12 16:01:34 2010 -0700

    Unwrap/rewrap EnterVT/LeaveVT completely, Fixes 28998

we need to unwrap our pScrn->EnterVT/LeaveVT hooks around server
regeneration or else we cause an infinite recursion on the next VT
switch afterwards.

Bugzilla: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1235516
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2013-11-23 21:51:55 -08:00
Adam Jackson
17ed7ac1fe glx: Lie about GLX_Y_INVERTED_EXT
Well, that was lame.  The problem with reporting y inversion honestly is
that libGL asks the driver _its_ opinion of Y inversion, which it just
fabricates from whole cloth.  So then when libGL goes to compare the
driver's idea of fbconfigs with that of the server - a fairly dumb idea
to begin with - nothing matches, and direct rendering fails, and
sadness.

So until the DRI drivers are fixed we should just continue to lie about
Y inversion.  GLX_DONT_CARE is what libGL would make up for that
attribute if we hadn't sent it, so just send that instead.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Tested-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2013-10-31 17:05:14 -07:00
Adam Jackson
2eedf42c22 dri: Fix GLX_Y_INVERTED_EXT fbconfig attribute
We're Y-inverted from GL's coordinates, so this is correct.  gnome-shell
doesn't seem to check this - somewhat reasonable since the only server
that answered the other way around was Xglx - but kwin does, and
upside-down hilarity ensues.

Tested-by: maelcum on #xorg-devel
Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2013-10-31 08:13:26 -07:00
Keith Packard
b32a4c91cc Merge remote-tracking branch 'idr/glx-float-fbconfig' 2013-10-29 09:37:30 -07:00
Adam Jackson
be6680967a glx: convert to direct GL dispatch (v2)
We now expect to be linked against something that provides the GL API,
instead of manually grubbing about in the DRI driver's dispatch table.
Since the GLX we expose calls GL functions that are meant to be looked
up dynamically, also add a way to thunk through to GetProcAddress.

This includes a refresh of the generated sources, which requires a
correspondingly new Mesa.

The GetProcAddress stubs are at the moment merely enough to make this
link against Mesa 9.2, but should really be provided for everything not
in the OpenGL 1.2 ABI.

v2: Explicitly hide the GetProcAddress stubs so we can't conflict with
libGL symbols; fix leading tab/space issues [anholt]

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-10-29 12:29:16 -04:00