[Mesa-dev] [PATCH v2 2/8] panfrost: Detect GPU version at runtime

Rob Herring robh at kernel.org
Fri Mar 8 15:40:15 UTC 2019


On Fri, Mar 8, 2019 at 3:27 AM Tomeu Vizoso <tomeu.vizoso at collabora.com> wrote:
>
> Also use the raw GPU ID value to decide whether to use SFD or MFD.
>
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso at collabora.com>
> ---
>  src/gallium/drivers/panfrost/pan_context.c | 66 ++++++++++------------
>  src/gallium/drivers/panfrost/pan_context.h | 10 ++++
>  src/gallium/drivers/panfrost/pan_screen.h  |  1 +
>  3 files changed, 41 insertions(+), 36 deletions(-)

> @@ -2724,8 +2712,14 @@ struct pipe_context *
>  panfrost_create_context(struct pipe_screen *screen, void *priv, unsigned flags)
>  {
>          struct panfrost_context *ctx = CALLOC_STRUCT(panfrost_context);
> +        struct panfrost_screen *pscreen = pan_screen(screen);
>          memset(ctx, 0, sizeof(*ctx));
>          struct pipe_context *gallium = (struct pipe_context *) ctx;
> +        unsigned gpu_id;
> +
> +        gpu_id = pscreen->driver->query_gpu_version(pscreen);
> +        ctx->is_t6xx = gpu_id <= 0x0750; /* For now, this flag means t76x or less */

This doesn't work for t604 which has a special version of 0x6???. That
helpfully also collides with bifrost versions. We could fix this up in
the kernel to expose it as 0x0600. Then an 'is_bifrost' would be an
easy (gpu_id & 0xf000).

Why isn't this 'is_t8xx' instead as you are touching it everywhere or
this needs to be t8xx and bifrost? If not you could just do ((gpu_id &
0xff00) == 0x0800).

Rob


More information about the mesa-dev mailing list