All of lore.kernel.org
 help / color / mirror / Atom feed
From: alyssa.rosenzweig@collabora.com
To: dri-devel@lists.freedesktop.org
Cc: tomeu.vizoso@collabora.com, airlied@linux.ie,
	steven.price@arm.com,
	Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Subject: [PATCH 4/4] drm/panfrost: Handle PANFROST_JD_REQ_PERMON
Date: Thu, 27 May 2021 16:38:04 -0400	[thread overview]
Message-ID: <20210527203804.12914-5-alyssa.rosenzweig@collabora.com> (raw)
In-Reply-To: <20210527203804.12914-1-alyssa.rosenzweig@collabora.com>

From: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>

If a job requires cycle counters or timestamps, we must enable cycle
counting just before issuing the job, and disable as soon as the job
completes.

Since this extends the UABI, we bump the driver minor version and date.
That lets userspace detect cycle counter support, and only advertise
features like ARB_shader_clock on kernels with this commit.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
---
 drivers/gpu/drm/panfrost/panfrost_drv.c | 10 +++++++---
 drivers/gpu/drm/panfrost/panfrost_job.c |  6 ++++++
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index ca07098a6..0f11d2df4 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -20,6 +20,10 @@
 #include "panfrost_gpu.h"
 #include "panfrost_perfcnt.h"
 
+#define JOB_REQUIREMENTS \
+	(PANFROST_JD_REQ_FS | \
+	 PANFROST_JD_REQ_PERMON)
+
 static bool unstable_ioctls;
 module_param_unsafe(unstable_ioctls, bool, 0600);
 
@@ -247,7 +251,7 @@ static int panfrost_ioctl_submit(struct drm_device *dev, void *data,
 	if (!args->jc)
 		return -EINVAL;
 
-	if (args->requirements && args->requirements != PANFROST_JD_REQ_FS)
+	if (args->requirements & ~JOB_REQUIREMENTS)
 		return -EINVAL;
 
 	if (args->out_sync > 0) {
@@ -557,9 +561,9 @@ static const struct drm_driver panfrost_drm_driver = {
 	.fops			= &panfrost_drm_driver_fops,
 	.name			= "panfrost",
 	.desc			= "panfrost DRM",
-	.date			= "20180908",
+	.date			= "20210527",
 	.major			= 1,
-	.minor			= 1,
+	.minor			= 2,
 
 	.gem_create_object	= panfrost_gem_create_object,
 	.prime_handle_to_fd	= drm_gem_prime_handle_to_fd,
diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c
index 6003cfeb1..b78147e3d 100644
--- a/drivers/gpu/drm/panfrost/panfrost_job.c
+++ b/drivers/gpu/drm/panfrost/panfrost_job.c
@@ -165,6 +165,9 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js)
 		return;
 	}
 
+	if (job->requirements & PANFROST_JD_REQ_PERMON)
+		panfrost_acquire_permon(job->pfdev);
+
 	cfg = panfrost_mmu_as_get(pfdev, &job->file_priv->mmu);
 
 	job_write(pfdev, JS_HEAD_NEXT_LO(js), jc_head & 0xFFFFFFFF);
@@ -296,6 +299,9 @@ static void panfrost_job_cleanup(struct kref *ref)
 		kvfree(job->bos);
 	}
 
+	if (job->requirements & PANFROST_JD_REQ_PERMON)
+		panfrost_release_permon(job->pfdev);
+
 	kfree(job);
 }
 
-- 
2.30.2


  parent reply	other threads:[~2021-05-27 20:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-27 20:38 [PATCH 0/4] drm/panfrost: Plumb cycle counters to userspace alyssa.rosenzweig
2021-05-27 20:38 ` [PATCH 1/4] drm/panfrost: Add cycle counter job requirement alyssa.rosenzweig
2021-06-02 11:50   ` Steven Price
2021-05-27 20:38 ` [PATCH 2/4] drm/panfrost: Add CYCLE_COUNT_START/STOP commands alyssa.rosenzweig
2021-06-02 11:50   ` Steven Price
2021-05-27 20:38 ` [PATCH 3/4] drm/panfrost: Add permon acquire/release helpers alyssa.rosenzweig
2021-06-02 11:50   ` Steven Price
2021-05-27 20:38 ` alyssa.rosenzweig [this message]
2021-06-02 11:50   ` [PATCH 4/4] drm/panfrost: Handle PANFROST_JD_REQ_PERMON Steven Price
2021-05-27 21:14 ` [PATCH 0/4] drm/panfrost: Plumb cycle counters to userspace Alyssa Rosenzweig
2021-05-28  6:07 ` Tomeu Vizoso
2021-05-28 13:31   ` Alyssa Rosenzweig

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=20210527203804.12914-5-alyssa.rosenzweig@collabora.com \
    --to=alyssa.rosenzweig@collabora.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=steven.price@arm.com \
    --cc=tomeu.vizoso@collabora.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.