Created attachment 20031 [details] log System Environment: -------------------------- --Platform: q965 --Architecture(32-bit,64-bit,compatiblity): 32-bit --2D driver: (master)7e68786cf746b6b984b184080578db1947b268ed --3D driver: (master)4be624d693554ad3950afab90e331a6725cc5004 --DRM:shipped with kernel 2.6.28-rc3 --libdrm: (master)87e90c73620b88005fcca5fd40aaaad0b08932e1 --Xserver: (master)a7951a4dad902edea76a5cd68f833f0e48ae804b --Kernel: 2.6.28-rc3 commit 4cfed552365fc7b226d93c28ffc5e85db29f2820 Bug detailed description: -------------------------- Start X and run wincopy, Segmentation fault appears immediately. Reproduce steps: ---------------- 1. xinit & 2. ./wincopy
Created attachment 20032 [details] conf
The kernel is from the drm-intel-next branch.
looks like a compat problem from dri2 work. #0 0xb80682ac in driBindContext (context=0x805ac30, draw=0x0, read=0x8083b88) at dri_glx.c:456 #1 0xb804678c in MakeContextCurrent (dpy=0x804b008, draw=46137350, read=46137348, gdb) frame 1 #1 0xb804678c in MakeContextCurrent (dpy=0x804b008, draw=46137350, read=46137348, gc=0x8053018, pre13=0) at glxcurrent.c:390 390 bindReturnValue = (gdb) list 385 /* Bind the direct rendering context to the drawable */ 386 if (gc && gc->driContext) { 387 __GLXDRIdrawable *pdraw = FetchDRIDrawable(dpy, draw, gc, pre13); 388 __GLXDRIdrawable *pread = FetchDRIDrawable(dpy, read, gc, pre13); 389 390 bindReturnValue = 391 (gc->driContext->bindContext) (gc->driContext, pdraw, pread); (gdb) frame 0 #0 0xb80682ac in driBindContext (context=0x805ac30, draw=0x0, read=0x8083b88) at dri_glx.c:456 456 return (*core->bindContext)(pcp->driContext, (gdb) list 451 __GLXDRIdrawable *draw, __GLXDRIdrawable *read) 452 { 453 __GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context; 454 const __DRIcoreExtension *core = pcp->psc->core; 455 456 return (*core->bindContext)(pcp->driContext, 457 draw->driDrawable, 458 read->driDrawable);
Created attachment 21476 [details] [review] check null pointer at early stage FetchDRIDrawable could return NULL obviously, so check the value. Segfault is gone, but this isn't whole point. % ./wincopy Press Esc to exit Press 'f' to toggle front/back buffer drawing glXMakeContextCurrent failed in Redraw() glXMakeCurrent failed in Resize() glXMakeCurrent failed in Resize() glXMakeContextCurrent failed in Redraw() ... glXMakeContextCurrent still fail due to unaccept Window (possible XID?) create by CreateWindow. GLX spec has >For backwards compatiblity with GLX versions 1.2 and earlier, a rendering context can also be used to render into a Window. Thus, a GLXDrawable is the union {GLXWindow, GLXPixmap, GLXPbuffer, Window}. I see "for pre GLX 1.3" code in the source, Unfortunately, i'm not famillar with the X and DRI internals. BTW, similar problem is happened at freeglut. https://sourceforge.net/mailarchive/message.php?msg_name=1226309489.25931.23.camel%40pancake
it's also hannpened on r300, would be GLX problem.
The real question is why pre13 = 0. This should only happen when glXMakeContextCurrent is called, and manywin uses glXMakeCurrent. There is a bug in this area, which is fixed by my patch to bug #19625. GLX_ALIAS is incorrectly used here. The parameter lists for MakeContextCurrent and glXMakeContextCurrent / glXMakeCurrentReadSGI are no longer the same. When GCC function aliasing is used, the last parameter of MakeContextCurrent will get a random value when either of these interfaces is called. While this hits similar code as bug #19625, I do NOT think it's a dup.
Fixed by commit ab9b4e1f593b2006a61c0f5440c2d7d3af80ea74.
verified against below commit: Libdrm: (master)0054e14793e585ec0d8e95e3d7b82cbf1a684af8 Mesa: (mesa_7_4_branch)0e6d9c1a55510cb4096728fb5fcfac77be09129e Xserver: (server-1.6-branch)660c2a7d4c6cb52fd0992e9d2008a24805dc8c02 Xf86_video_intel: (master)506bbb8341c052499057834a669b82787454b426 GEM_kernel: (drm-intel-next)c6f9cade7341025ed342b96ec963a28edd5c3bf8
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.