From patchwork Tue Aug 6 19:52:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alyssa Rosenzweig X-Patchwork-Id: 11081359 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8A62B13B1 for ; Wed, 7 Aug 2019 07:29:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7367227CEE for ; Wed, 7 Aug 2019 07:29:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 71F0F289D6; Wed, 7 Aug 2019 07:29:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 205CB289D7 for ; Wed, 7 Aug 2019 07:29:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EC8276E68F; Wed, 7 Aug 2019 07:27:40 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4FE956E544 for ; Tue, 6 Aug 2019 19:53:14 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: alyssa) with ESMTPSA id A0F7E28A5CC From: Alyssa Rosenzweig To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/panfrost: Add "compute shader only" hint Date: Tue, 6 Aug 2019 12:52:59 -0700 Message-Id: <20190806195259.3531-1-alyssa.rosenzweig@collabora.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 07 Aug 2019 07:26:18 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alyssa Rosenzweig , tomeu.vizoso@collabora.com, steven.price@arm.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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.