All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Price <steven.price@arm.com>
To: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>,
	dri-devel@lists.freedesktop.org
Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Subject: Re: [PATCH v3] drm/panfrost: Add AFBC_FEATURES parameter
Date: Fri, 4 Jun 2021 08:45:42 +0100	[thread overview]
Message-ID: <5858a1e5-1fbf-49b7-a388-7cf23473914d@arm.com> (raw)
In-Reply-To: <20210603212123.1649-1-alyssa.rosenzweig@collabora.com>

On 03/06/2021 22:21, Alyssa Rosenzweig wrote:
> The value of the AFBC_FEATURES register is required by userspace to
> determine AFBC support on Bifrost. A user on our IRC channel (#panfrost)
> reported a workload that raised a fault on one system's Mali G31 but
> worked flawlessly with another system's Mali G31. We determined the
> cause to be missing AFBC support on one vendor's Mali implementation --
> it turns out AFBC is optional on Bifrost!

I was surprised this had been missed, but it turns out the DDK doesn't
care so kbase doesn't expose it either! I guess this is one of those
"recompile the driver to support your hardware" cases with the blob.

> Whether AFBC is supported or not is exposed in the AFBC_FEATURES
> register on Bifrost, which reads back as 0 on Midgard. A zero value
> indicates AFBC is fully supported, provided the architecture itself
> supports AFBC, allowing backwards-compatibility with Midgard. Bits 0 and
> 15 indicate that AFBC support is absent for texturing and rendering
> respectively.
> 
> The user experiencing the fault reports that AFBC_FEATURES reads back
> 0x10001 on their system, confirming the architectural lack of AFBC.
> Userspace needs this this parameter to know to disable AFBC on that
> chip, and perhaps others.
> 
> v2: Fix typo from copy-paste fail.
> 
> v3: Bump the UABI version. This commit was cherry-picked from another
> series so chalking this up to a rebase fail.

I'd like to say third time's the charm, but...

> 
> Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
> Cc: Rob Herring <robh@kernel.org>
> Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> Cc: Steven Price <steven.price@arm.com>
> ---
>  drivers/gpu/drm/panfrost/panfrost_device.h | 1 +
>  drivers/gpu/drm/panfrost/panfrost_drv.c    | 3 ++-
>  drivers/gpu/drm/panfrost/panfrost_gpu.c    | 1 +
>  drivers/gpu/drm/panfrost/panfrost_regs.h   | 1 +
>  include/uapi/drm/panfrost_drm.h            | 1 +
>  5 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h
> index 597cf1459..f614e9877 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_device.h
> +++ b/drivers/gpu/drm/panfrost/panfrost_device.h
> @@ -45,6 +45,7 @@ struct panfrost_features {
>  	u32 thread_max_workgroup_sz;
>  	u32 thread_max_barrier_sz;
>  	u32 coherency_features;
> +	u32 afbc_features;
>  	u32 texture_features[4];
>  	u32 js_features[16];
>  
> diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
> index ca07098a6..365ee53f0 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_drv.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
> @@ -63,6 +63,7 @@ static int panfrost_ioctl_get_param(struct drm_device *ddev, void *data, struct
>  		PANFROST_FEATURE(THREAD_MAX_BARRIER_SZ,
>  				thread_max_barrier_sz);
>  		PANFROST_FEATURE(COHERENCY_FEATURES, coherency_features);
> +		PANFROST_FEATURE(AFBC_FEATURES, afbc_features);
>  		PANFROST_FEATURE_ARRAY(TEXTURE_FEATURES, texture_features, 3);
>  		PANFROST_FEATURE_ARRAY(JS_FEATURES, js_features, 15);
>  		PANFROST_FEATURE(NR_CORE_GROUPS, nr_core_groups);
> @@ -559,7 +560,7 @@ static const struct drm_driver panfrost_drm_driver = {

Missing context:

> /*
>  * Panfrost driver version:
>  * - 1.0 - initial interface
>  * - 1.1 - adds HEAP and NOEXEC flags for CREATE_BO
>  */

It would be good to add the new version in this comment to document what
it adds. With that added:

Reviewed-by: Steven Price <steven.price@arm.com>

Steve

>  	.desc			= "panfrost DRM",
>  	.date			= "20180908",
>  	.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_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c
> index 2aae636f1..0e70e27fd 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_gpu.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c
> @@ -228,6 +228,7 @@ static void panfrost_gpu_init_features(struct panfrost_device *pfdev)
>  	pfdev->features.thread_max_workgroup_sz = gpu_read(pfdev, GPU_THREAD_MAX_WORKGROUP_SIZE);
>  	pfdev->features.thread_max_barrier_sz = gpu_read(pfdev, GPU_THREAD_MAX_BARRIER_SIZE);
>  	pfdev->features.coherency_features = gpu_read(pfdev, GPU_COHERENCY_FEATURES);
> +	pfdev->features.afbc_features = gpu_read(pfdev, GPU_AFBC_FEATURES);
>  	for (i = 0; i < 4; i++)
>  		pfdev->features.texture_features[i] = gpu_read(pfdev, GPU_TEXTURE_FEATURES(i));
>  
> diff --git a/drivers/gpu/drm/panfrost/panfrost_regs.h b/drivers/gpu/drm/panfrost/panfrost_regs.h
> index eddaa62ad..dc9df5457 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_regs.h
> +++ b/drivers/gpu/drm/panfrost/panfrost_regs.h
> @@ -82,6 +82,7 @@
>  
>  #define GPU_TEXTURE_FEATURES(n)		(0x0B0 + ((n) * 4))
>  #define GPU_JS_FEATURES(n)		(0x0C0 + ((n) * 4))
> +#define GPU_AFBC_FEATURES		(0x4C)	/* (RO) AFBC support on Bifrost */
>  
>  #define GPU_SHADER_PRESENT_LO		0x100	/* (RO) Shader core present bitmap, low word */
>  #define GPU_SHADER_PRESENT_HI		0x104	/* (RO) Shader core present bitmap, high word */
> diff --git a/include/uapi/drm/panfrost_drm.h b/include/uapi/drm/panfrost_drm.h
> index ec19db1ee..061e700dd 100644
> --- a/include/uapi/drm/panfrost_drm.h
> +++ b/include/uapi/drm/panfrost_drm.h
> @@ -171,6 +171,7 @@ enum drm_panfrost_param {
>  	DRM_PANFROST_PARAM_JS_FEATURES15,
>  	DRM_PANFROST_PARAM_NR_CORE_GROUPS,
>  	DRM_PANFROST_PARAM_THREAD_TLS_ALLOC,
> +	DRM_PANFROST_PARAM_AFBC_FEATURES,
>  };
>  
>  struct drm_panfrost_get_param {
> 


      reply	other threads:[~2021-06-04  7:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-03 21:21 [PATCH v3] drm/panfrost: Add AFBC_FEATURES parameter Alyssa Rosenzweig
2021-06-04  7:45 ` Steven Price [this message]

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=5858a1e5-1fbf-49b7-a388-7cf23473914d@arm.com \
    --to=steven.price@arm.com \
    --cc=alyssa.rosenzweig@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --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.