From owner-freebsd-x11@FreeBSD.ORG Thu Aug 16 05:22:25 2012 Return-Path: Delivered-To: freebsd-x11@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D4791106564A for ; Thu, 16 Aug 2012 05:22:25 +0000 (UTC) (envelope-from sendtomatt@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id A0B178FC15 for ; Thu, 16 Aug 2012 05:22:25 +0000 (UTC) Received: by pbbrp2 with SMTP id rp2so1056208pbb.13 for ; Wed, 15 Aug 2012 22:22:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=RjRozQTiXvnBVKHbT+xRqKYWUTUsX4oJYz+2ERtMMGg=; b=lLJoYZ0TephxwzjOe6XbVjxFbUm46BeAufwWKa9SKtDrKDKkm1yLwROAdmxkH4ccQW dk1SmZMRd98XUZF5Opqipor5e+1F33IHGlEwqyh7LprAFnmJ2snM2FiExFWuR7vFo2z3 XHkiPP2fZgCYv3vVZo9RtJfCVjJcP2B17mIILK/IFwb4a1XtLE6zJsxfdqW+l4iuMSOZ qyTAsU6/3jAekpqb18xq5yHI1DM/KNSO9NubZh9jrSJt0jXey5qMg8Ns9TzRhm7O64Yq zH/qFdPVK/g1NNCXZSt+hQW8vElMP+rzmkizKgOkGb28WhdBbs6nDuwmvP5pzIaCVk+m Tnrw== Received: by 10.68.131.71 with SMTP id ok7mr968186pbb.9.1345094544762; Wed, 15 Aug 2012 22:22:24 -0700 (PDT) Received: from flatline.local (70-36-223-239.dsl.dynamic.sonic.net. [70.36.223.239]) by mx.google.com with ESMTPS id ns7sm1900363pbc.40.2012.08.15.22.22.22 (version=SSLv3 cipher=OTHER); Wed, 15 Aug 2012 22:22:23 -0700 (PDT) Message-ID: <502C8383.4090801@gmail.com> Date: Wed, 15 Aug 2012 22:22:11 -0700 From: matt User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:14.0) Gecko/20120809 Thunderbird/14.0 MIME-Version: 1.0 To: freebsd-x11@freebsd.org References: <5021CA0E.6080608@gmail.com> <5021CBD6.6010607@gmail.com> <5021FABF.9040802@gmail.com> In-Reply-To: <5021FABF.9040802@gmail.com> Content-Type: multipart/mixed; boundary="------------040407000104090506050207" Subject: Re: Problem with new Xorg, radeon & compiz/Kwin revisited X-BeenThere: freebsd-x11@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: X11 on FreeBSD -- maintaining and support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Aug 2012 05:22:25 -0000 This is a multi-part message in MIME format. --------------040407000104090506050207 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 08/07/12 22:35, matt wrote: > On 08/07/12 19:15, matt wrote: >> >> A while back, I was having a strange issue with the new Xorg and compiz. >> In a nutshell, closing certain windows caused Xorg to exit on nasty >> signals. At the same time, a few users with Radeon cards were having >> issues with Kwin disabling opengl for no apparent reason. >> >> After some research, I had posted a patch seen in a debian mailing list >> as a possible solution, and it did indeed solve the immediate problem of >> crashing Xorg (and later I found out Kwin worked with OpenGL effects >> when the patch is applied). >> >> It was requested I file a PR but first investigate what issues such a >> patch might cause. I'm glad I waited, because there are a few. The >> medicine is a little worse than the disease. First, with Compiz & Xfce4, >> if X was told to shutdown while the previously affected programs >> (xfce4-terminal running under compiz & xfce4 was obvious), the machine >> would immediately reboot. This is obviously not good. So usually I would >> only logout after closing all windows (except Xfce4-panel and the root >> window). This would work, and the machine could be shut down from the >> TTY. >> >> Recently, I installed KDE4. I was so impressed that I was trying to use >> it as my "daily desktop". OpenGL Kwin was working fine. However, >> engaging the screen lock would reboot the machine, as well as the >> machine occasionally spontaneously rebooting. This was much worse than >> the above issue. >> >> The patch had one other odd effect, which was that Dri2 was disabled for >> some reason. >> >> I reverted the patch to xorg-server I had been running, and now Kwin >> will not start OpenGL mode, because it can't find an ARGBGLX visual. If >> Kwin is started alone, OpenGL suprisingly works. Xfce4+compiz crashes >> Xorg as before, however Dri2 is now enabled. The signal is a segfault at >> 0x0. AIGLX on/off have no effect. >> >> Here was the patch (I applied it manually looking at the file, the >> offsets are wrong for us): >> >> diff --git a/glx/glxdri.c b/glx/glxdri.c >> index 326f539..f6ef784 100644 >> --- a/glx/glxdri.c >> +++ b/glx/glxdri.c >> @@ -230,7 +230,7 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable) >> >> /* If the X window was destroyed, the dri DestroyWindow hook will >> * aready have taken care of this, so only call if pDraw isn't >> NULL. */ >> - if (drawable->pDraw != NULL) { >> + if (drawable->pDraw != NULL&& drawable->pDraw->type == >> DRAWABLE_WINDOW) { >> screen = (__GLXDRIscreen *) glxGetScreen(drawable->pDraw->pScreen); >> (*screen->core->destroyDrawable)(private->driDrawable); >> >> It seems like this shouldn't be having as much effect as it does. I can >> only guess the reboots are from memory problems resulting from lingering >> drawables? I can't explain the Dri2 interaction, nor can I explain >> Kwin's behavior (fairly new to KDE, last time I used it was last century >> :) ). >> >> For what it's worth, my driver is xf86-video-ati on a Radeon HD4650. >> I'm thoroughly confused by this problem and I'd welcome some help trying >> to solve the bug. Anyone else seeing problems with RV710 radeons and >> OpenGL compositing? >> >> Matt >> >> >> >> > A quick follow up...dri2 issue was something else, it works with the > patch. I've tried base gcc as well as gcc47 no difference for > xorg-server and the above behavior. The initial check for pDraw != > NULL was to prevent a double free, and the patch adds a check to > prevent an instance. My best guess now is that there is a double free > situation that passes the DRAWABLE_WINDOW check. > > Matt I fixed the issues for radeon using WITH_NEW_XORG (at least for me) 1. The attached patch from Andriy Gaipon fixes an issue with refcounting when releasing pixmaps 2. Apply the other patch that checks for pDraw->type == DRAWABLE_WINDOW that I posted before This has been stable with both KWin and compiz. Was Gaipon's patch previously applied in FreeBSD's xorg? Matt --------------040407000104090506050207 Content-Type: text/plain; charset=us-ascii; name="gaipon.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="gaipon.patch" --- glx/glxdrawable.h.orig 2011-06-11 19:55:47.000000000 +0300 +++ glx/glxdrawable.h 2011-07-30 14:52:16.730791751 +0300 @@ -53,6 +53,7 @@ struct __GLXdrawable { DrawablePtr pDraw; XID drawId; + XID otherId; /* for glx1.3 we need to track the original Drawable as well */ /* ** Either GLX_DRAWABLE_PIXMAP, GLX_DRAWABLE_WINDOW or --- glx/glxcmds.c.orig 2011-06-11 19:55:47.000000000 +0300 +++ glx/glxcmds.c 2011-07-30 14:51:33.374788616 +0300 @@ -1095,6 +1095,7 @@ __glXDrawableInit(__GLXdrawable *drawabl drawable->pDraw = pDraw; drawable->type = type; drawable->drawId = drawId; + drawable->otherId = 0; drawable->config = config; drawable->eventMask = 0; @@ -1131,10 +1132,13 @@ DoCreateGLXDrawable(ClientPtr client, __ * Windows aren't refcounted, so track both the X and the GLX window * so we get called regardless of destruction order. */ - if (drawableId != glxDrawableId && type == GLX_DRAWABLE_WINDOW && - !AddResource(pDraw->id, __glXDrawableRes, pGlxDraw)) { - pGlxDraw->destroy (pGlxDraw); - return BadAlloc; + if (drawableId != glxDrawableId && + (type == GLX_DRAWABLE_WINDOW || type == GLX_DRAWABLE_PIXMAP)) { + if (!AddResource(drawableId, __glXDrawableRes, pGlxDraw)) { + pGlxDraw->destroy (pGlxDraw); + return BadAlloc; + } + pGlxDraw->otherId = drawableId; } return Success; --- glx/glxext.c.orig 2011-06-11 19:55:47.000000000 +0300 +++ glx/glxext.c 2011-07-30 14:51:03.306788511 +0300 @@ -124,14 +124,16 @@ static Bool DrawableGone(__GLXdrawable * { __GLXcontext *c, *next; - if (glxPriv->type == GLX_DRAWABLE_WINDOW) { + if (glxPriv->type == GLX_DRAWABLE_WINDOW || glxPriv->type == GLX_DRAWABLE_PIXMAP) { /* If this was created by glXCreateWindow, free the matching resource */ - if (glxPriv->drawId != glxPriv->pDraw->id) { - if (xid == glxPriv->drawId) - FreeResourceByType(glxPriv->pDraw->id, __glXDrawableRes, TRUE); - else - FreeResourceByType(glxPriv->drawId, __glXDrawableRes, TRUE); - } + if (glxPriv->otherId) { + XID other = glxPriv->otherId; + glxPriv->otherId = 0; + if (xid == other) + FreeResourceByType(glxPriv->drawId, __glXDrawableRes, TRUE); + else + FreeResourceByType(other, __glXDrawableRes, TRUE); + } /* otherwise this window was implicitly created by MakeCurrent */ } --------------040407000104090506050207--