mesa/src/glx
Daniel Manjarres 86bd2196b4 glx: Don't crash on swap event for a Window (non-GLXWindow)
Prior to GLX 1.3 there was the glxMakeCurrent() function that took a
single drawable handle. The Drawable could be either a bare XID for a
Window or an XID for a glxpixmap.

GLX 1.3 added glxMakeContextCurrent that takes 2 handles: one for
reading, one for writing. Nowadays the old glxMakeCurrent call is
implemented as a call to glxMakeContextCurrent with the single handle
duplicated.

Because of this it is allowed to use a plain-old Window ID as an
argument to glxMakeContextCurrent, although nobody really documents this
sort of thing. The manpage for the NEW call specifies the arguments as
GLXPixmaps, but the actual code accepts Window XIDs too, and handles
them correctly.

Similarly, the glxSelectEvents function can also take a bare Window XID.

The "piglit" tests all use GLXWindows and/or GLXPixmaps. You never
tested swap events with a bare Window XID. That is what my app was
doing.

The swap_events code worked with Window XIDs in mesa 7.x.y. The new code
added in versions 8, 9, and 10 assumes that all buffer swap events have
a GLXPixmap associated with them. Because of the historical quirks
above, this is not true. Swap events for bare Window XIDs do NOT have a
glxpixmap resulting in a segfault.

Any app that uses the old school glxMakeCurrent call with a Window XID
while trying to use swap_events will crash when the libs try to lookup
the nonexistent GLXPixmap associated with the incoming swap event.

I believe that the people who wrote the spec overlooked this, because
the "sbc" field comes from the OML_sync extension that is defined in
terms of glxpixmaps only.

v2 (idr): Formatting changes.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54372
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
2014-06-20 11:04:04 -07:00
..
apple darwin: Remove extra kCGLPFAColorSize attribute when requesting an offscreen context 2014-05-31 03:44:51 -07:00
tests Make DRI dependencies and build depend on the target 2014-05-23 15:24:04 +01:00
.gitignore Clean up .gitignore files 2013-01-10 22:01:31 +01:00
applegl_glx.c Fix build of appleglx 2014-05-23 15:24:07 +01:00
clientattrib.c glx: Check malloc return value before accessing memory in glx/clientattrib.c 2013-12-03 14:35:41 -07:00
clientinfo.c glx: Add missing null check in __glX_send_client_info() 2014-02-07 08:14:05 -07:00
compsize.c Have __glImageSize handle format GL_DEPTH_STENCIL_NV the same way as the server does 2012-02-06 23:00:44 +00:00
create_context.c glx: Store the RENDER_TYPE in indirect rendering 2013-07-18 16:03:42 -07:00
dri2.c glx: Don't crash on swap event for a Window (non-GLXWindow) 2014-06-20 11:04:04 -07:00
dri2.h dri3: Enable GLX_MESA_query_renderer on DRI3 too 2014-05-02 22:13:58 +01:00
dri2_glx.c glx: Add an error message when a direct renderer's createScreen() routine fails 2014-06-18 09:55:45 +01:00
dri2_priv.h glx/dri2: Add DRI2 support for GLX_MESA_query_renderer 2013-11-07 18:12:33 -08:00
dri2_query_renderer.c glx: Conditionally compile GLX_MESA_query_renderer DRI3 support 2014-05-02 23:20:34 +01:00
dri3_glx.c glx: Add an error message when a direct renderer's createScreen() routine fails 2014-06-18 09:55:45 +01:00
dri3_priv.h dri3: Enable GLX_MESA_query_renderer on DRI3 too 2014-05-02 22:13:58 +01:00
dri_common.c mesa: glx: Reduce error log level 2014-06-12 10:19:00 -06:00
dri_common.h dri: Reuse dri_message to implement our other message handlers. 2014-01-27 09:37:29 -08:00
dri_glx.c glx: Add an error message when a direct renderer's createScreen() routine fails 2014-06-18 09:55:45 +01:00
drisw_glx.c glx: Add an error message when a direct renderer's createScreen() routine fails 2014-06-18 09:55:45 +01:00
eval.c Retire miniglx and move the actual glx code up to src/glx 2010-02-09 09:58:36 -05:00
glx_error.c glx: Deliver an xlib style error to the application from an XCB error 2011-12-23 08:40:30 -08:00
glx_error.h glx: Deliver an xlib style error to the application from an XCB error 2011-12-23 08:40:30 -08:00
glx_pbuffer.c Fix build of appleglx 2014-05-23 15:24:07 +01:00
glx_query.c glx: Unifdef USE_XCB. 2012-10-09 14:32:02 -07:00
glxclient.h dri3: Add GLX_EXT_buffer_age support 2014-03-13 14:19:21 -07:00
glxcmds.c glx: Fix build in GLX_DIRECT_RENDERING !GLX_USE_APPLEGL !GLX_USE_DRM case 2014-06-10 10:32:22 +01:00
glxconfig.c Don't cast the return value of malloc/realloc 2012-09-05 22:28:50 -07:00
glxconfig.h glx/dri: add initial dri interface for GLX_EXT_framebuffer_sRGB. 2011-03-06 20:06:42 +10:00
glxcurrent.c Fix build of appleglx 2014-05-23 15:24:07 +01:00
glxext.c glx: Fix build in GLX_DIRECT_RENDERING !GLX_USE_APPLEGL !GLX_USE_DRM case 2014-06-10 10:32:22 +01:00
glxextensions.c glx: Do not advertise buffer_age on dri2 2014-04-02 21:28:26 +01:00
glxextensions.h dri3: Add GLX_EXT_buffer_age support 2014-03-13 14:19:21 -07:00
glxhash.c Retire miniglx and move the actual glx code up to src/glx 2010-02-09 09:58:36 -05:00
glxhash.h Retire miniglx and move the actual glx code up to src/glx 2010-02-09 09:58:36 -05:00
indirect_glx.c Fix build of appleglx 2014-05-23 15:24:07 +01:00
indirect_init.h glx: Rename __GLXcontext and __GLXdisplayPrivate to struct types. 2010-07-28 16:45:25 -04:00
indirect_texture_compression.c mesa: Standardize names of OpenGL functions. 2012-11-12 10:53:57 -08:00
indirect_transpose_matrix.c mesa: Standardize names of OpenGL functions. 2012-11-12 10:53:57 -08:00
indirect_vertex_array.c glx: check memory allocations in __glXInitVertexArrayState() 2014-01-06 10:23:26 -07:00
indirect_vertex_array.h Retire miniglx and move the actual glx code up to src/glx 2010-02-09 09:58:36 -05:00
indirect_vertex_array_priv.h Retire miniglx and move the actual glx code up to src/glx 2010-02-09 09:58:36 -05:00
indirect_vertex_program.c mesa: Standardize names of OpenGL functions. 2012-11-12 10:53:57 -08:00
indirect_window_pos.c mesa: Standardize names of OpenGL functions. 2012-11-12 10:53:57 -08:00
Makefile.am Fix build of appleglx 2014-05-23 15:24:07 +01:00
packrender.h glx: Rename __GLXcontext and __GLXdisplayPrivate to struct types. 2010-07-28 16:45:25 -04:00
packsingle.h glx: Rename __GLXcontext and __GLXdisplayPrivate to struct types. 2010-07-28 16:45:25 -04:00
pixel.c glx: Rename __GLXcontext and __GLXdisplayPrivate to struct types. 2010-07-28 16:45:25 -04:00
pixelstore.c glx: Rename __GLXcontext and __GLXdisplayPrivate to struct types. 2010-07-28 16:45:25 -04:00
query_renderer.c glx: change query_renderer_integer() value param to unsigned 2013-11-11 08:10:12 -07:00
render2.c Fix build of appleglx 2014-05-23 15:24:07 +01:00
renderpix.c Don't cast the return value of malloc/realloc 2012-09-05 22:28:50 -07:00
SConscript glx: use the loader util lib 2014-01-18 18:47:48 +00:00
single2.c glx: move declarations before code 2013-06-27 07:48:18 -06:00
singlepix.c mesa: remove empty glthread.h file 2014-03-03 13:08:59 -07:00
vertarr.c Fix build of appleglx 2014-05-23 15:24:07 +01:00
XF86dri.c s/Tungsten Graphics/VMware/ 2014-01-17 20:00:32 +00:00
xf86dri.h s/Tungsten Graphics/VMware/ 2014-01-17 20:00:32 +00:00
xf86dristr.h s/Tungsten Graphics/VMware/ 2014-01-17 20:00:32 +00:00
xfont.c mesa: remove outdated version lines in comments 2013-06-05 08:54:27 -06:00