mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 08:58:02 +02:00
panfrost: Make pan_afbc_compression_mode() per-gen
With the introduction of v10, we need this function to have a per-gen name to avoid duplicates. While at it, move it to pan_texture.c since the prototype is already defined in pan_texture.h. Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26356>
This commit is contained in:
parent
e144347140
commit
1481883a6e
3 changed files with 37 additions and 37 deletions
|
|
@ -430,40 +430,6 @@ pan_rt_init_format(const struct panfrost_device *dev,
|
|||
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.
|
||||
*/
|
||||
/* clang-format off */
|
||||
switch (panfrost_afbc_format(PAN_ARCH, format)) {
|
||||
case PAN_AFBC_MODE_R8: return MALI_AFBC_COMPRESSION_MODE_R8;
|
||||
case PAN_AFBC_MODE_R8G8: return MALI_AFBC_COMPRESSION_MODE_R8G8;
|
||||
case PAN_AFBC_MODE_R5G6B5: return MALI_AFBC_COMPRESSION_MODE_R5G6B5;
|
||||
case PAN_AFBC_MODE_R4G4B4A4: return MALI_AFBC_COMPRESSION_MODE_R4G4B4A4;
|
||||
case PAN_AFBC_MODE_R5G5B5A1: return MALI_AFBC_COMPRESSION_MODE_R5G5B5A1;
|
||||
case PAN_AFBC_MODE_R8G8B8: return MALI_AFBC_COMPRESSION_MODE_R8G8B8;
|
||||
case PAN_AFBC_MODE_R8G8B8A8: return MALI_AFBC_COMPRESSION_MODE_R8G8B8A8;
|
||||
case PAN_AFBC_MODE_R10G10B10A2: return MALI_AFBC_COMPRESSION_MODE_R10G10B10A2;
|
||||
case PAN_AFBC_MODE_R11G11B10: return MALI_AFBC_COMPRESSION_MODE_R11G11B10;
|
||||
case PAN_AFBC_MODE_S8: return MALI_AFBC_COMPRESSION_MODE_S8;
|
||||
case PAN_AFBC_MODE_INVALID: unreachable("Invalid AFBC format");
|
||||
}
|
||||
/* clang-format on */
|
||||
|
||||
unreachable("all AFBC formats handled");
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
pan_prepare_rt(const struct panfrost_device *dev, const struct pan_fb_info *fb,
|
||||
unsigned idx, unsigned cbuf_offset,
|
||||
|
|
@ -525,7 +491,7 @@ pan_prepare_rt(const struct panfrost_device *dev, const struct pan_fb_info *fb,
|
|||
cfg->afbc.body_offset = surf.afbc.body - surf.afbc.header;
|
||||
assert(surf.afbc.body >= surf.afbc.header);
|
||||
|
||||
cfg->afbc.compression_mode = pan_afbc_compression_mode(rt->format);
|
||||
cfg->afbc.compression_mode = GENX(pan_afbc_compression_mode)(rt->format);
|
||||
cfg->afbc.row_stride = row_stride;
|
||||
#else
|
||||
const struct pan_image_slice_layout *slice = &image->layout.slices[level];
|
||||
|
|
|
|||
|
|
@ -517,7 +517,7 @@ panfrost_emit_plane(const struct pan_image_layout *layout,
|
|||
cfg.afbc.ytr = (layout->modifier & AFBC_FORMAT_MOD_YTR);
|
||||
cfg.afbc.tiled_header = (layout->modifier & AFBC_FORMAT_MOD_TILED);
|
||||
cfg.afbc.prefetch = true;
|
||||
cfg.afbc.compression_mode = pan_afbc_compression_mode(format);
|
||||
cfg.afbc.compression_mode = GENX(pan_afbc_compression_mode)(format);
|
||||
cfg.afbc.header_stride = layout->slices[level].afbc.header_size;
|
||||
} else {
|
||||
cfg.plane_type = is_3_planar_yuv ? MALI_PLANE_TYPE_CHROMA_2P
|
||||
|
|
@ -793,3 +793,37 @@ GENX(panfrost_new_texture)(const struct panfrost_device *dev,
|
|||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if PAN_ARCH >= 9
|
||||
enum mali_afbc_compression_mode
|
||||
GENX(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.
|
||||
*/
|
||||
/* clang-format off */
|
||||
switch (panfrost_afbc_format(PAN_ARCH, format)) {
|
||||
case PAN_AFBC_MODE_R8: return MALI_AFBC_COMPRESSION_MODE_R8;
|
||||
case PAN_AFBC_MODE_R8G8: return MALI_AFBC_COMPRESSION_MODE_R8G8;
|
||||
case PAN_AFBC_MODE_R5G6B5: return MALI_AFBC_COMPRESSION_MODE_R5G6B5;
|
||||
case PAN_AFBC_MODE_R4G4B4A4: return MALI_AFBC_COMPRESSION_MODE_R4G4B4A4;
|
||||
case PAN_AFBC_MODE_R5G5B5A1: return MALI_AFBC_COMPRESSION_MODE_R5G5B5A1;
|
||||
case PAN_AFBC_MODE_R8G8B8: return MALI_AFBC_COMPRESSION_MODE_R8G8B8;
|
||||
case PAN_AFBC_MODE_R8G8B8A8: return MALI_AFBC_COMPRESSION_MODE_R8G8B8A8;
|
||||
case PAN_AFBC_MODE_R10G10B10A2: return MALI_AFBC_COMPRESSION_MODE_R10G10B10A2;
|
||||
case PAN_AFBC_MODE_R11G11B10: return MALI_AFBC_COMPRESSION_MODE_R11G11B10;
|
||||
case PAN_AFBC_MODE_S8: return MALI_AFBC_COMPRESSION_MODE_S8;
|
||||
case PAN_AFBC_MODE_INVALID: unreachable("Invalid AFBC format");
|
||||
}
|
||||
/* clang-format on */
|
||||
|
||||
unreachable("all AFBC formats handled");
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ void pan_iview_get_surface(const struct pan_image_view *iview, unsigned level,
|
|||
|
||||
#if PAN_ARCH >= 9
|
||||
enum mali_afbc_compression_mode
|
||||
pan_afbc_compression_mode(enum pipe_format format);
|
||||
GENX(pan_afbc_compression_mode)(enum pipe_format format);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue