radeon/winsys: fix winsys VM handling
authorChristian König <deathsimple@vodafone.de>
Mon, 6 Aug 2012 15:53:49 +0000 (17:53 +0200)
committerChristian König <deathsimple@vodafone.de>
Wed, 8 Aug 2012 10:35:10 +0000 (12:35 +0200)
Move releasing the VM area after closing the bo handle.

This partially fixes: https://bugs.freedesktop.org/show_bug.cgi?id=45018

Signed-off-by: Christian König <deathsimple@vodafone.de>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
src/gallium/winsys/radeon/drm/radeon_drm_bo.c

index 2626586afd6ce340ac4f7e7a670dfdcfaca5c692..464842c0c2051a3751014140359963bc9012a053 100644 (file)
@@ -319,13 +319,14 @@ static void radeon_bo_destroy(struct pb_buffer *_buf)
     if (bo->ptr)
         os_munmap(bo->ptr, bo->base.size);
 
+    /* Close object. */
+    args.handle = bo->handle;
+    drmIoctl(bo->rws->fd, DRM_IOCTL_GEM_CLOSE, &args);
+
     if (mgr->va) {
         radeon_bomgr_free_va(mgr, bo->va, bo->va_size);
     }
 
-    /* Close object. */
-    args.handle = bo->handle;
-    drmIoctl(bo->rws->fd, DRM_IOCTL_GEM_CLOSE, &args);
     pipe_mutex_destroy(bo->map_mutex);
     FREE(bo);
 }