r600g: Don't blindly unmap NULL->size.
authorHenri Verbeet <hverbeet@gmail.com>
Mon, 16 Aug 2010 20:18:37 +0000 (22:18 +0200)
committerHenri Verbeet <hverbeet@gmail.com>
Sun, 22 Aug 2010 10:43:11 +0000 (12:43 +0200)
There may actually be something mapped in that range, especially for large
buffers like e.g. the GL Drawable.

src/gallium/winsys/r600/drm/radeon_bo.c

index f259ae7fb57dfae04fc1f93bbbf6da9bad8f1609..a1306f6e9d2f077799d9441b9aa744122017cbaf 100644 (file)
@@ -145,7 +145,9 @@ struct radeon_bo *radeon_bo_decref(struct radeon *radeon, struct radeon_bo *bo)
                return NULL;
        }
 
-       munmap(bo->data, bo->size);
+       if (bo->map_count) {
+               munmap(bo->data, bo->size);
+       }
        memset(&args, 0, sizeof(args));
        args.handle = bo->handle;
        drmIoctl(radeon->fd, DRM_IOCTL_GEM_CLOSE, &args);