From 9eb2517a88e3b48cd84fa4b0c50112dc6de2da06 Mon Sep 17 00:00:00 2001 From: "Juan A. Suarez Romero" Date: Fri, 27 Nov 2020 14:17:59 +0100 Subject: [PATCH] v3d: add helper to check if format supports TLB resolve It checks if the TLB can perform multisample resolve for the specified format. v1: - Fix commit title (Iago) v2: - Fix identation (Iago) - Fix prototype style (Iago) Reviewed-by: Iago Toral Quiroga Signed-off-by: Juan A. Suarez Romero Part-of: --- src/gallium/drivers/v3d/v3d_context.h | 2 ++ src/gallium/drivers/v3d/v3d_formats.c | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/gallium/drivers/v3d/v3d_context.h b/src/gallium/drivers/v3d/v3d_context.h index f2c5dadc9e9..a5275c41243 100644 --- a/src/gallium/drivers/v3d/v3d_context.h +++ b/src/gallium/drivers/v3d/v3d_context.h @@ -686,6 +686,8 @@ void v3d_get_internal_type_bpp_for_output_format(const struct v3d_device_info *d uint32_t *bpp); bool v3d_tfu_supports_tex_format(const struct v3d_device_info *devinfo, uint32_t tex_format); +bool v3d_format_supports_tlb_msaa_resolve(const struct v3d_device_info *devinfo, + enum pipe_format f); void v3d_init_query_functions(struct v3d_context *v3d); void v3d_blit(struct pipe_context *pctx, const struct pipe_blit_info *blit_info); diff --git a/src/gallium/drivers/v3d/v3d_formats.c b/src/gallium/drivers/v3d/v3d_formats.c index 5bd8db0dbd4..df1c8a5cb3e 100644 --- a/src/gallium/drivers/v3d/v3d_formats.c +++ b/src/gallium/drivers/v3d/v3d_formats.c @@ -37,6 +37,10 @@ #include "v3d_context.h" #include "v3d_format_table.h" +/* The format internal types are the same across V3D versions */ +#define V3D_VERSION 33 +#include "broadcom/cle/v3dx_pack.h" + static const struct v3d_format * get_format(const struct v3d_device_info *devinfo, enum pipe_format f) { @@ -153,3 +157,24 @@ v3d_tfu_supports_tex_format(const struct v3d_device_info *devinfo, return v3d33_tfu_supports_tex_format(tex_format); } } + +bool +v3d_format_supports_tlb_msaa_resolve(const struct v3d_device_info *devinfo, + enum pipe_format f) +{ + uint32_t internal_type; + uint32_t internal_bpp; + + const struct v3d_format *vf = get_format(devinfo, f); + + if (!vf) + return false; + + v3d_get_internal_type_bpp_for_output_format(devinfo, + vf->rt_type, + &internal_type, + &internal_bpp); + + return internal_type == V3D_INTERNAL_TYPE_8 || + internal_type == V3D_INTERNAL_TYPE_16F; +}