[PATCH] drm/panfrost: Add "compute shader only" hint

Alyssa Rosenzweig alyssa.rosenzweig at collabora.com
Tue Aug 6 19:52:59 UTC 2019


Midgard contains two job slots capable of compute jobs, JS1 and JS2. As
an optimization, it is preferable to schedule compute-only workloads to
JS2, although compute jobs are functionally able to be scheduled to JS1
(barring an obscure errata).

Accordingly, we reserve a compute-only hint in the UABI to allow future
compute-equipped userspace and future compute-optimized kernelspace to
hint towards JS2. At the moment, the hint is ignored, but this is
harmless.

I have verified compute jobs can be successfully submitted and executed
with an appropriate userspace against a 5.1 kernel without this hint.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
---
 drivers/gpu/drm/panfrost/TODO           | 3 ---
 drivers/gpu/drm/panfrost/panfrost_job.c | 4 +++-
 include/uapi/drm/panfrost_drm.h         | 8 ++++++++
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/panfrost/TODO b/drivers/gpu/drm/panfrost/TODO
index c2e44add3..8c367a5a6 100644
--- a/drivers/gpu/drm/panfrost/TODO
+++ b/drivers/gpu/drm/panfrost/TODO
@@ -20,8 +20,5 @@
 
 - Support for madvise and a shrinker.
 
-- Compute job support. So called 'compute only' jobs need to be plumbed up to
-  userspace.
-
 - Performance counter support. (Boris)
 
diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c
index 9bb9260d9..3e1385a3b 100644
--- a/drivers/gpu/drm/panfrost/panfrost_job.c
+++ b/drivers/gpu/drm/panfrost/panfrost_job.c
@@ -108,7 +108,9 @@ static int panfrost_job_get_slot(struct panfrost_job *job)
 	if (job->requirements & PANFROST_JD_REQ_FS)
 		return 0;
 
-/* Not exposed to userspace yet */
+        /* Compute jobs can run on JS1, so compute-only jobs can run with this
+         * simple implementations (useful for backwards compatibility). As an
+         * optimization, we will eventually want to schedule to JS2. */
 #if 0
 	if (job->requirements & PANFROST_JD_REQ_ONLY_COMPUTE) {
 		if ((job->requirements & PANFROST_JD_REQ_CORE_GRP_MASK) &&
diff --git a/include/uapi/drm/panfrost_drm.h b/include/uapi/drm/panfrost_drm.h
index b5d370638..25acde34b 100644
--- a/include/uapi/drm/panfrost_drm.h
+++ b/include/uapi/drm/panfrost_drm.h
@@ -38,6 +38,14 @@ extern "C" {
 #define DRM_IOCTL_PANFROST_PERFCNT_DUMP		DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_PERFCNT_DUMP, struct drm_panfrost_perfcnt_dump)
 
 #define PANFROST_JD_REQ_FS (1 << 0)
+
+/* Optional (mandatory for T600 r0p0 15dev0 due to errata #8987) hint to the
+ * kernel that the commands only contain JOB_TYPE_COMPUTE jobs, without
+ * vertex/tiler/fragment jobs. If present, the kernel may use this as an
+ * optimization, but it is not strictly necessary. */
+
+#define PANFROST_JD_REQ_ONLY_COMPUTE (1 << 1)
+
 /**
  * struct drm_panfrost_submit - ioctl argument for submitting commands to the 3D
  * engine.
-- 
2.20.1



More information about the dri-devel mailing list