panfrost: Don't export exception_status
[mesa.git] / src / panfrost / encoder / pan_bo.c
index 3087387d54ad836e027e7a1b03a9a698ad107217..71bc109060d77a747436dd2eada7f556b33a4bc3 100644 (file)
@@ -105,16 +105,11 @@ panfrost_bo_free(struct panfrost_bo *bo)
 
 /* Returns true if the BO is ready, false otherwise.
  * access_type is encoding the type of access one wants to ensure is done.
- * Say you want to make sure all writers are done writing, you should pass
- * PAN_BO_ACCESS_WRITE.
- * If you want to wait for all users, you should pass PAN_BO_ACCESS_RW.
- * PAN_BO_ACCESS_READ would work too as waiting for readers implies
- * waiting for writers as well, but we want to make things explicit and waiting
- * only for readers is impossible.
+ * Waiting is always done for writers, but if wait_readers is set then readers
+ * are also waited for.
  */
 bool
-panfrost_bo_wait(struct panfrost_bo *bo, int64_t timeout_ns,
-                 uint32_t access_type)
+panfrost_bo_wait(struct panfrost_bo *bo, int64_t timeout_ns, bool wait_readers)
 {
         struct drm_panfrost_wait_bo req = {
                 .handle = bo->gem_handle,
@@ -122,9 +117,6 @@ panfrost_bo_wait(struct panfrost_bo *bo, int64_t timeout_ns,
         };
         int ret;
 
-        assert(access_type == PAN_BO_ACCESS_WRITE ||
-               access_type == PAN_BO_ACCESS_RW);
-
         /* If the BO has been exported or imported we can't rely on the cached
          * state, we need to call the WAIT_BO ioctl.
          */
@@ -136,8 +128,7 @@ panfrost_bo_wait(struct panfrost_bo *bo, int64_t timeout_ns,
                 /* If the caller only wants to wait for writers and no
                  * writes are pending, we don't have to wait.
                  */
-                if (access_type == PAN_BO_ACCESS_WRITE &&
-                    !(bo->gpu_access & PAN_BO_ACCESS_WRITE))
+                if (!wait_readers && !(bo->gpu_access & PAN_BO_ACCESS_WRITE))
                         return true;
         }
 
@@ -270,7 +261,7 @@ panfrost_bo_cache_put(struct panfrost_bo *bo)
 {
         struct panfrost_device *dev = bo->dev;
 
-        if (bo->flags & PAN_BO_DONT_REUSE)
+        if (bo->flags & PAN_BO_SHARED)
                 return false;
 
         pthread_mutex_lock(&dev->bo_cache.lock);
@@ -477,7 +468,7 @@ panfrost_bo_import(struct panfrost_device *dev, int fd)
                 bo->dev = dev;
                 bo->gpu = (mali_ptr) get_bo_offset.offset;
                 bo->size = lseek(fd, 0, SEEK_END);
-                bo->flags = PAN_BO_DONT_REUSE | PAN_BO_SHARED;
+                bo->flags = PAN_BO_SHARED;
                 bo->gem_handle = gem_handle;
                 assert(bo->size > 0);
                 p_atomic_set(&bo->refcnt, 1);
@@ -517,7 +508,7 @@ panfrost_bo_export(struct panfrost_bo *bo)
         if (ret == -1)
                 return -1;
 
-        bo->flags |= PAN_BO_DONT_REUSE | PAN_BO_SHARED;
+        bo->flags |= PAN_BO_SHARED;
         return args.fd;
 }