intel: Mark bo's exported to prime as not reusable
authorKristian Høgsberg <krh@bitplanet.net>
Fri, 14 Sep 2012 20:35:19 +0000 (16:35 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Sat, 15 Sep 2012 02:06:14 +0000 (22:06 -0400)
It's the same situation as flink and we need take the same precautions.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
intel/intel_bufmgr_gem.c

index 3bcc8497d9788b29b76d71b760542d49127937cc..898008d795fae9c2f73a18139952abb6f321af94 100644 (file)
@@ -2472,8 +2472,15 @@ drm_intel_bo_gem_export_to_prime(drm_intel_bo *bo, int *prime_fd)
 {
        drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr;
        drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
+       int ret;
+
+       if (drmPrimeHandleToFD(bufmgr_gem->fd, bo_gem->gem_handle,
+                              DRM_CLOEXEC, prime_fd) != 0)
+               return -errno;
 
-       return drmPrimeHandleToFD(bufmgr_gem->fd, bo_gem->gem_handle, DRM_CLOEXEC, prime_fd);
+       bo_gem->reusable = false;
+
+       return 0;
 }
 
 static int