[MPlayer-dev-eng] [PATCH] Don't call glxSwapIntervalEXT using glxSwapInterval's prototype

Stephen Warren swarren at nvidia.com
Thu Jan 28 18:12:24 CET 2010

The attached patch fixes a crash in MPlayer when using "-vo gl" with recent
NVIDIA drivers.

The function prototypes for glxSwapIntervalSGI and glxSwapIntervalEXT are:

int glXSwapIntervalSGI(int interval);

void glXSwapIntervalEXT(Display *dpy, GLXDrawable drawable, int interval);

However, libvo/gl_common.c assigns either of those functions to the
SwapInterval pointer, and libvo/vo_gl.c calls through that pointer using
glxSwapIntervalSGI's prototype. This effectively passes invalid parameters to
glxSwapIntervalEXT, and causes a segfault.

Note: NVIDIA's 195.* drivers implement both of these functions; previous
drivers implemented only glxSwapIntervalSGI.

An alternative fix might be to plug some MPlayer-provided wrapper function
into the SwapInterval pointer when the driver is found to implement
glXSwapIntervalEXT. However, that's a more complex patch. I'm not aware
of any drivers that implement glXSwapIntervalEXT but not glXSwapIntervalSGI,
although I haven't looked at all. If such drivers did exist, I suppose this
crash would have been found and fixed before now.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: remove-glxSwapIntervalEXT.patch
Type: application/octet-stream
Size: 926 bytes
Desc: remove-glxSwapIntervalEXT.patch
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20100128/353c045b/attachment.obj>

More information about the MPlayer-dev-eng mailing list