dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Rob Herring <robh+dt@kernel.org>,
	Tomeu Vizoso <tomeu@tomeuvizoso.net>,
	Alyssa Rosenzweig <alyssa@rosenzweig.io>,
	Steven Price <steven.price@arm.com>
Cc: Boris Brezillon <boris.brezillon@collabora.com>,
	dri-devel@lists.freedesktop.org
Subject: [PATCH 2/2] drm/panfrost: Extend the bo_wait() ioctl
Date: Fri, 13 Sep 2019 13:17:48 +0200	[thread overview]
Message-ID: <20190913111748.21071-2-boris.brezillon@collabora.com> (raw)
In-Reply-To: <20190913111748.21071-1-boris.brezillon@collabora.com>

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

Signed-off-by: Boris Brezillon <boris.brezillon@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	other threads:[~2019-09-13 11:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-13 11:17 [PATCH 1/2] drm/panfrost: Allow passing extra information about BOs used by a job Boris Brezillon
2019-09-13 11:17 ` Boris Brezillon [this message]
2019-09-13 13:46   ` [PATCH 2/2] drm/panfrost: Extend the bo_wait() ioctl Steven Price
2019-09-16 12:55     ` Boris Brezillon
2019-09-13 13:44 ` [PATCH 1/2] drm/panfrost: Allow passing extra information about BOs used by a job Steven Price
2019-09-16 12:11   ` Alyssa Rosenzweig
2019-09-16 13:11   ` Boris Brezillon
2019-09-16 22:28   ` Rob Herring
2019-09-16 22:20 ` Rob Herring
2019-09-17  7:15   ` Boris Brezillon
2019-09-23 13:41     ` Steven Price

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190913111748.21071-2-boris.brezillon@collabora.com \
    --to=boris.brezillon@collabora.com \
    --cc=alyssa@rosenzweig.io \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=robh+dt@kernel.org \
    --cc=steven.price@arm.com \
    --cc=tomeu@tomeuvizoso.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox