Mesa (main): v3d: define our own canonical supported formats

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 19 08:48:38 UTC 2022


Module: Mesa
Branch: main
Commit: e40cbd3438b392aad37805be4dda60a96759f830
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e40cbd3438b392aad37805be4dda60a96759f830

Author: Juan A. Suarez Romero <jasuarez at igalia.com>
Date:   Wed Apr 13 20:08:45 2022 +0200

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 <jasuarez at igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15693>

---

 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 03261278b88..13f2081fa93 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;
 }



More information about the mesa-commit mailing list