panfrost: Add pan_afbc_compression_mode on Valhall
Map a canonical format (a hardware-independent pipe_format) to a compression mode (Valhall-specific hardware enum defined in GenXML). To be used for packing plane descriptors and render target descriptors when AFBC is in use on Valhall. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16800>
This commit is contained in:
parent
87dcdbdad6
commit
c2207d27c2
|
@ -397,6 +397,32 @@ pan_rt_init_format(const struct pan_image_view *rt,
|
|||
cfg->swizzle = panfrost_translate_swizzle_4(swizzle);
|
||||
}
|
||||
|
||||
#if PAN_ARCH >= 9
|
||||
enum mali_afbc_compression_mode
|
||||
pan_afbc_compression_mode(enum pipe_format format)
|
||||
{
|
||||
/* There's a special case for texturing the stencil part from a combined
|
||||
* depth/stencil texture, handle it separately.
|
||||
*/
|
||||
if (format == PIPE_FORMAT_X24S8_UINT)
|
||||
return MALI_AFBC_COMPRESSION_MODE_X24S8;
|
||||
|
||||
/* Otherwise, map canonical formats to the hardware enum. This only
|
||||
* needs to handle the subset of formats returned by
|
||||
* panfrost_afbc_format.
|
||||
*/
|
||||
switch (panfrost_afbc_format(PAN_ARCH, format)) {
|
||||
case PIPE_FORMAT_R8G8_UNORM: return MALI_AFBC_COMPRESSION_MODE_R8G8;
|
||||
case PIPE_FORMAT_R8G8B8_UNORM: return MALI_AFBC_COMPRESSION_MODE_R8G8B8;
|
||||
case PIPE_FORMAT_R8G8B8A8_UNORM: return MALI_AFBC_COMPRESSION_MODE_R8G8B8A8;
|
||||
case PIPE_FORMAT_R5G6B5_UNORM: return MALI_AFBC_COMPRESSION_MODE_R5G6B5;
|
||||
case PIPE_FORMAT_S8_UINT: return MALI_AFBC_COMPRESSION_MODE_S8;
|
||||
case PIPE_FORMAT_NONE: unreachable("invalid format for AFBC");
|
||||
default: unreachable("unknown canonical AFBC format");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
pan_prepare_rt(const struct pan_fb_info *fb, unsigned idx,
|
||||
unsigned cbuf_offset,
|
||||
|
|
|
@ -263,6 +263,12 @@ pan_iview_get_surface(const struct pan_image_view *iview,
|
|||
unsigned level, unsigned layer, unsigned sample,
|
||||
struct pan_surface *surf);
|
||||
|
||||
|
||||
#if PAN_ARCH >= 9
|
||||
enum mali_afbc_compression_mode
|
||||
pan_afbc_compression_mode(enum pipe_format format);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern C */
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue