Mesa (master): v3d: extend the list of formats supported by the TFU unit

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Dec 11 10:40:27 UTC 2020


Module: Mesa
Branch: master
Commit: 42fd7e3457becc8a6c61132de70d5e70ad11ab70
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=42fd7e3457becc8a6c61132de70d5e70ad11ab70

Author: Juan A. Suarez Romero <jasuarez at igalia.com>
Date:   Thu Dec 10 18:08:37 2020 +0100

v3d: extend the list of formats supported by the TFU unit

TFU can convert from these new formats, but can not autogenerate
mipmaps from them.

Hence we need to set what is the purpose to know if the formats are
supported or not.

v1:
 - Use the same and shorter variable name (Alejandro)

Reviewed-by: Alejandro Piñeiro <apinheiro at igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8050>

---

 src/gallium/drivers/v3d/v3d_blit.c          | 11 +++++++----
 src/gallium/drivers/v3d/v3d_context.h       |  3 ++-
 src/gallium/drivers/v3d/v3d_formats.c       |  7 ++++---
 src/gallium/drivers/v3d/v3dx_context.h      |  3 ++-
 src/gallium/drivers/v3d/v3dx_format_table.c |  8 +++++++-
 5 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/v3d/v3d_blit.c b/src/gallium/drivers/v3d/v3d_blit.c
index 9b0b68dda7b..51ed8a36106 100644
--- a/src/gallium/drivers/v3d/v3d_blit.c
+++ b/src/gallium/drivers/v3d/v3d_blit.c
@@ -214,7 +214,8 @@ v3d_tfu(struct pipe_context *pctx,
         unsigned int base_level,
         unsigned int last_level,
         unsigned int src_layer,
-        unsigned int dst_layer)
+        unsigned int dst_layer,
+        bool for_mipmap)
 {
         struct v3d_context *v3d = v3d_context(pctx);
         struct v3d_screen *screen = v3d->screen;
@@ -234,7 +235,7 @@ v3d_tfu(struct pipe_context *pctx,
         uint32_t tex_format = v3d_get_tex_format(&screen->devinfo,
                                                  pdst->format);
 
-        if (!v3d_tfu_supports_tex_format(&screen->devinfo, tex_format))
+        if (!v3d_tfu_supports_tex_format(&screen->devinfo, tex_format, for_mipmap))
                 return false;
 
         if (pdst->target != PIPE_TEXTURE_2D || psrc->target != PIPE_TEXTURE_2D)
@@ -343,7 +344,8 @@ v3d_generate_mipmap(struct pipe_context *pctx,
                        prsc, prsc,
                        base_level,
                        base_level, last_level,
-                       first_layer, first_layer);
+                       first_layer, first_layer,
+                       true);
 }
 
 static bool
@@ -373,7 +375,8 @@ v3d_tfu_blit(struct pipe_context *pctx, const struct pipe_blit_info *info)
         return v3d_tfu(pctx, info->dst.resource, info->src.resource,
                        info->src.level,
                        info->dst.level, info->dst.level,
-                       info->src.box.z, info->dst.box.z);
+                       info->src.box.z, info->dst.box.z,
+                       false);
 }
 
 static struct pipe_surface *
diff --git a/src/gallium/drivers/v3d/v3d_context.h b/src/gallium/drivers/v3d/v3d_context.h
index d2e13fc4813..89b70fcc0e1 100644
--- a/src/gallium/drivers/v3d/v3d_context.h
+++ b/src/gallium/drivers/v3d/v3d_context.h
@@ -691,7 +691,8 @@ void v3d_get_internal_type_bpp_for_output_format(const struct v3d_device_info *d
                                                  uint32_t *type,
                                                  uint32_t *bpp);
 bool v3d_tfu_supports_tex_format(const struct v3d_device_info *devinfo,
-                                 uint32_t tex_format);
+                                 uint32_t tex_format,
+                                 bool for_mipmap);
 bool v3d_format_supports_tlb_msaa_resolve(const struct v3d_device_info *devinfo,
                                           enum pipe_format f);
 
diff --git a/src/gallium/drivers/v3d/v3d_formats.c b/src/gallium/drivers/v3d/v3d_formats.c
index df1c8a5cb3e..68dda5fbbb0 100644
--- a/src/gallium/drivers/v3d/v3d_formats.c
+++ b/src/gallium/drivers/v3d/v3d_formats.c
@@ -149,12 +149,13 @@ v3d_get_internal_type_bpp_for_output_format(const struct v3d_device_info *devinf
 
 bool
 v3d_tfu_supports_tex_format(const struct v3d_device_info *devinfo,
-                            uint32_t tex_format)
+                            uint32_t tex_format,
+                            bool for_mipmap)
 {
         if (devinfo->ver >= 41) {
-                return v3d41_tfu_supports_tex_format(tex_format);
+                return v3d41_tfu_supports_tex_format(tex_format, for_mipmap);
         } else {
-                return v3d33_tfu_supports_tex_format(tex_format);
+                return v3d33_tfu_supports_tex_format(tex_format, for_mipmap);
         }
 }
 
diff --git a/src/gallium/drivers/v3d/v3dx_context.h b/src/gallium/drivers/v3d/v3dx_context.h
index 6c1ed9b248f..9c64752e8fb 100644
--- a/src/gallium/drivers/v3d/v3dx_context.h
+++ b/src/gallium/drivers/v3d/v3dx_context.h
@@ -44,4 +44,5 @@ const struct v3d_format *v3dX(get_format_desc)(enum pipe_format f);
 void v3dX(get_internal_type_bpp_for_output_format)(uint32_t format,
                                                    uint32_t *type,
                                                    uint32_t *bpp);
-bool v3dX(tfu_supports_tex_format)(uint32_t tex_format);
+bool v3dX(tfu_supports_tex_format)(uint32_t tex_format,
+                                   bool for_mipmap);
diff --git a/src/gallium/drivers/v3d/v3dx_format_table.c b/src/gallium/drivers/v3d/v3dx_format_table.c
index aea3c4cc008..d2dab338393 100644
--- a/src/gallium/drivers/v3d/v3dx_format_table.c
+++ b/src/gallium/drivers/v3d/v3dx_format_table.c
@@ -326,7 +326,8 @@ v3dX(get_internal_type_bpp_for_output_format)(uint32_t format,
 }
 
 bool
-v3dX(tfu_supports_tex_format)(enum V3DX(Texture_Data_Formats) format)
+v3dX(tfu_supports_tex_format)(enum V3DX(Texture_Data_Formats) format,
+                              bool for_mipmap)
 {
         switch (format) {
         case TEXTURE_DATA_FORMAT_R8:
@@ -351,6 +352,11 @@ v3dX(tfu_supports_tex_format)(enum V3DX(Texture_Data_Formats) format)
         case TEXTURE_DATA_FORMAT_R11F_G11F_B10F:
         case TEXTURE_DATA_FORMAT_R4:
                 return true;
+        case TEXTURE_DATA_FORMAT_RGB9_E5:
+        case TEXTURE_DATA_FORMAT_R32F:
+        case TEXTURE_DATA_FORMAT_RG32F:
+        case TEXTURE_DATA_FORMAT_RGBA32F:
+                return !for_mipmap;
         default:
                 return false;
         }



More information about the mesa-commit mailing list