Mesa (main): v3d: use surface format defined on pipe_blit

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


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

Author: Juan A. Suarez Romero <jasuarez at igalia.com>
Date:   Wed Apr 13 19:42:37 2022 +0200

v3d: use surface format defined on pipe_blit

When trying to perform a TLB-based blit, we need to create a surface out
of the src and dst resources. But instead of using the same formats as
the resources, we need to use the format that is passed through
pipe_blit_info.

This was making some cases to use the render-based blit instead of the
TLB-based blit, which is more performant.

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_blit.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/v3d/v3d_blit.c b/src/gallium/drivers/v3d/v3d_blit.c
index 00bf21fb885..84bc5fc5263 100644
--- a/src/gallium/drivers/v3d/v3d_blit.c
+++ b/src/gallium/drivers/v3d/v3d_blit.c
@@ -391,12 +391,13 @@ v3d_tfu_blit(struct pipe_context *pctx, struct pipe_blit_info *info)
 static struct pipe_surface *
 v3d_get_blit_surface(struct pipe_context *pctx,
                      struct pipe_resource *prsc,
+                     enum pipe_format format,
                      unsigned level,
                      int16_t layer)
 {
         struct pipe_surface tmpl;
 
-        tmpl.format = prsc->format;
+        tmpl.format = format;
         tmpl.u.tex.level = level;
         tmpl.u.tex.first_layer = layer;
         tmpl.u.tex.last_layer = layer;
@@ -439,14 +440,14 @@ v3d_tlb_blit(struct pipe_context *pctx, struct pipe_blit_info *info)
                 return;
 
         if (is_color_blit &&
-            util_format_is_depth_or_stencil(info->dst.resource->format))
+            util_format_is_depth_or_stencil(info->dst.format))
                 return;
 
-        if (!v3d_rt_format_supported(&screen->devinfo, info->src.resource->format))
+        if (!v3d_rt_format_supported(&screen->devinfo, info->src.format))
                 return;
 
-        if (v3d_get_rt_format(&screen->devinfo, info->src.resource->format) !=
-            v3d_get_rt_format(&screen->devinfo, info->dst.resource->format))
+        if (v3d_get_rt_format(&screen->devinfo, info->src.format) !=
+            v3d_get_rt_format(&screen->devinfo, info->dst.format))
                 return;
 
         bool msaa = (info->src.resource->nr_samples > 1 ||
@@ -455,15 +456,15 @@ v3d_tlb_blit(struct pipe_context *pctx, struct pipe_blit_info *info)
                                 info->dst.resource->nr_samples < 2);
 
         if (is_msaa_resolve &&
-            !v3d_format_supports_tlb_msaa_resolve(&screen->devinfo, info->src.resource->format))
+            !v3d_format_supports_tlb_msaa_resolve(&screen->devinfo, info->src.format))
                 return;
 
         v3d_flush_jobs_writing_resource(v3d, info->src.resource, V3D_FLUSH_DEFAULT, false);
 
         struct pipe_surface *dst_surf =
-           v3d_get_blit_surface(pctx, info->dst.resource, info->dst.level, info->dst.box.z);
+           v3d_get_blit_surface(pctx, info->dst.resource, info->dst.format, info->dst.level, info->dst.box.z);
         struct pipe_surface *src_surf =
-           v3d_get_blit_surface(pctx, info->src.resource, info->src.level, info->src.box.z);
+           v3d_get_blit_surface(pctx, info->src.resource, info->src.format, info->src.level, info->src.box.z);
 
         struct pipe_surface *surfaces[V3D_MAX_DRAW_BUFFERS] = { 0 };
         if (is_color_blit)



More information about the mesa-commit mailing list