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 <itoral@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7816>
This commit is contained in:
Juan A. Suarez Romero 2020-11-27 14:17:59 +01:00 committed by Marge Bot
parent 8b3bc4e2fb
commit 9eb2517a88
2 changed files with 27 additions and 0 deletions

View File

@ -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);

View File

@ -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;
}