So we can choose to wait for all BO users, or just for writers.

Signed-off-by: Boris Brezillon <boris.brezil...@collabora.com>
---
 drivers/gpu/drm/panfrost/panfrost_drv.c | 8 ++++++--
 include/uapi/drm/panfrost_drm.h         | 4 ++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c 
b/drivers/gpu/drm/panfrost/panfrost_drv.c
index 08082fd557c3..6a94aea2147f 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -322,16 +322,20 @@ panfrost_ioctl_wait_bo(struct drm_device *dev, void *data,
        struct drm_panfrost_wait_bo *args = data;
        struct drm_gem_object *gem_obj;
        unsigned long timeout = drm_timeout_abs_to_jiffies(args->timeout_ns);
+       bool wait_all = !(args->flags & PANFROST_WAIT_BO_WRITERS);
 
        if (args->pad)
                return -EINVAL;
 
+       if (args->flags & ~PANFROST_WAIT_BO_WRITERS)
+               return -EINVAL;
+
        gem_obj = drm_gem_object_lookup(file_priv, args->handle);
        if (!gem_obj)
                return -ENOENT;
 
-       ret = dma_resv_wait_timeout_rcu(gem_obj->resv, true,
-                                                 true, timeout);
+       ret = dma_resv_wait_timeout_rcu(gem_obj->resv, wait_all,
+                                       true, timeout);
        if (!ret)
                ret = timeout ? -ETIMEDOUT : -EBUSY;
 
diff --git a/include/uapi/drm/panfrost_drm.h b/include/uapi/drm/panfrost_drm.h
index 029c6ae1b1f0..ac4facbcee47 100644
--- a/include/uapi/drm/panfrost_drm.h
+++ b/include/uapi/drm/panfrost_drm.h
@@ -111,6 +111,9 @@ struct drm_panfrost_submit {
        __u32 pad;
 };
 
+#define PANFROST_WAIT_ALL_BO_USERS     (0 << 0)
+#define PANFROST_WAIT_BO_WRITERS       (1 << 0)
+
 /**
  * struct drm_panfrost_wait_bo - ioctl argument for waiting for
  * completion of the last DRM_PANFROST_SUBMIT on a BO.
@@ -123,6 +126,7 @@ struct drm_panfrost_wait_bo {
        __u32 handle;
        __u32 pad;
        __s64 timeout_ns;       /* absolute */
+       __u64 flags;
 };
 
 #define PANFROST_BO_NOEXEC     1
-- 
2.21.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to