radeon: fix context destroy needing lock for flushing.
authorDave Airlie <airlied@linux.ie>
Wed, 25 Nov 2009 10:23:22 +0000 (20:23 +1000)
committerDave Airlie <airlied@linux.ie>
Wed, 25 Nov 2009 10:40:15 +0000 (20:40 +1000)
Thanks to Intel code which I've just stolen pretty much as usual.

This fixes fdo bug 22851 which is a dri1 regression since rewrite.

Tested by: fpiobaf (Fabio) on #radeon
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/mesa/drivers/dri/radeon/radeon_lock.c

index 02de8e5fd1d92716130cc31118ccbc954a2c28ac..7ad781ba6192c49e7b843872c1c199b457484949 100644 (file)
@@ -62,8 +62,6 @@ void radeonGetLock(radeonContextPtr rmesa, GLuint flags)
        __DRIdrawablePrivate *const readable = radeon_get_readable(rmesa);
        __DRIscreenPrivate *sPriv = rmesa->dri.screen;
 
-       assert(drawable != NULL);
-
        drmGetLock(rmesa->dri.fd, rmesa->dri.hwContext, flags);
 
        /* The window might have moved, so we might need to get new clip
@@ -74,12 +72,13 @@ void radeonGetLock(radeonContextPtr rmesa, GLuint flags)
         * Since the hardware state depends on having the latest drawable
         * clip rects, all state checking must be done _after_ this call.
         */
-       DRI_VALIDATE_DRAWABLE_INFO(sPriv, drawable);
-       if (drawable != readable) {
+       if (drawable)
+               DRI_VALIDATE_DRAWABLE_INFO(sPriv, drawable);
+       if (readable && drawable != readable) {
                DRI_VALIDATE_DRAWABLE_INFO(sPriv, readable);
        }
 
-       if (rmesa->lastStamp != drawable->lastStamp) {
+       if (drawable && (rmesa->lastStamp != drawable->lastStamp)) {
                radeon_window_moved(rmesa);
                rmesa->lastStamp = drawable->lastStamp;
        }