From e40cbd3438b392aad37805be4dda60a96759f830 Mon Sep 17 00:00:00 2001 From: "Juan A. Suarez Romero" Date: Wed, 13 Apr 2022 20:08:45 +0200 Subject: [PATCH] v3d: define our own canonical supported formats Some of the canonical formats defined by Gallium are not TLB compatible, so we need to provide an alternative. Signed-off-by: Juan A. Suarez Romero Reviewed-by: Iago Toral Quiroga Part-of: --- src/gallium/drivers/v3d/v3d_resource.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/gallium/drivers/v3d/v3d_resource.c b/src/gallium/drivers/v3d/v3d_resource.c index 0326127..13f2081 100644 --- a/src/gallium/drivers/v3d/v3d_resource.c +++ b/src/gallium/drivers/v3d/v3d_resource.c @@ -1156,6 +1156,18 @@ v3d_resource_get_stencil(struct pipe_resource *prsc) return &rsc->separate_stencil->base; } +static enum pipe_format +v3d_resource_get_compatible_tlb_format(struct pipe_context *pctx, + enum pipe_format format) +{ + switch (format) { + case PIPE_FORMAT_R16G16_UNORM: + return PIPE_FORMAT_R16G16_UINT; + default: + return format; + } +} + static const struct u_transfer_vtbl transfer_vtbl = { .resource_create = v3d_resource_create, .resource_destroy = v3d_resource_destroy, @@ -1199,4 +1211,5 @@ v3d_resource_context_init(struct pipe_context *pctx) pctx->blit = v3d_blit; pctx->generate_mipmap = v3d_generate_mipmap; pctx->flush_resource = v3d_flush_resource; + pctx->get_canonical_format = v3d_resource_get_compatible_tlb_format; } -- 2.7.4