mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 19:40:10 +01:00
pan/lib: set afbc mode based on plane-format, not view
The AFBC mode describes the mode of the plane-format, which is what is stored in memory, not the image view format (which is the interpretation of the *decompressed* memory). This requires us to move the special S8 cases to a separate pan_afbc_decompression_mode() helper, since those are decompression-only mode which we need to view Z24S8 (AKA RGBA8) as X24S8, or R8 as R8R8. While at it, get rid of PAN_AFBC_MODE_S8, since it's not a thing in practice. No Fixes or Cc-stable tag here, because things were working just fine before that in the gallium driver, and AFBC is still an opt-in feature in panvk. Closes: https://gitlab.freedesktop.org/panfrost/mesa/-/issues/205 Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Eric R. Smith <eric.smith@collabora.com> Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37158>
This commit is contained in:
parent
2668316917
commit
a4547fd4b1
3 changed files with 19 additions and 13 deletions
|
|
@ -79,7 +79,6 @@ enum pan_afbc_mode {
|
|||
PAN_AFBC_MODE_R8G8B8A8,
|
||||
PAN_AFBC_MODE_R10G10B10A2,
|
||||
PAN_AFBC_MODE_R11G11B10,
|
||||
PAN_AFBC_MODE_S8,
|
||||
|
||||
/* YUV special modes */
|
||||
PAN_AFBC_MODE_YUV420_6C8,
|
||||
|
|
@ -638,13 +637,7 @@ pan_afbc_can_tile(unsigned arch)
|
|||
static inline enum mali_afbc_compression_mode
|
||||
pan_afbc_compression_mode(enum pipe_format format, unsigned plane_idx)
|
||||
{
|
||||
/* 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
|
||||
/* Map canonical formats to the hardware enum. This only
|
||||
* needs to handle the subset of formats returned by
|
||||
* pan_afbc_format.
|
||||
*/
|
||||
|
|
@ -667,8 +660,6 @@ pan_afbc_compression_mode(enum pipe_format format, unsigned plane_idx)
|
|||
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_YUV420_6C8:
|
||||
return MALI_AFBC_COMPRESSION_MODE_YUV420_6C8;
|
||||
case PAN_AFBC_MODE_YUV420_2C8:
|
||||
|
|
@ -699,6 +690,20 @@ pan_afbc_compression_mode(enum pipe_format format, unsigned plane_idx)
|
|||
|
||||
UNREACHABLE("all AFBC formats handled");
|
||||
}
|
||||
|
||||
static inline enum mali_afbc_compression_mode
|
||||
pan_afbc_decompression_mode(enum pipe_format view_format,
|
||||
enum pipe_format img_format, unsigned plane_idx)
|
||||
{
|
||||
/* There are special cases for texture views of stencil images. */
|
||||
if (img_format == PIPE_FORMAT_Z24_UNORM_S8_UINT &&
|
||||
view_format == PIPE_FORMAT_X24S8_UINT)
|
||||
return MALI_AFBC_COMPRESSION_MODE_X24S8;
|
||||
else if (view_format == PIPE_FORMAT_S8_UINT)
|
||||
return MALI_AFBC_COMPRESSION_MODE_S8;
|
||||
|
||||
return pan_afbc_compression_mode(img_format, plane_idx);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -710,7 +710,8 @@ GENX(pan_emit_afbc_color_attachment)(const struct pan_fb_info *fb,
|
|||
cfg.header = header;
|
||||
cfg.body_offset = body_offset;
|
||||
cfg.row_stride = hdr_row_stride;
|
||||
cfg.compression_mode = pan_afbc_compression_mode(iview->format, 0);
|
||||
cfg.compression_mode =
|
||||
pan_afbc_compression_mode(image->props.format, pref.plane_idx);
|
||||
#else
|
||||
cfg.header = header;
|
||||
cfg.body = header + body_offset;
|
||||
|
|
|
|||
|
|
@ -683,8 +683,8 @@ emit_afbc_plane(const struct pan_image_view *iview, int plane_idx,
|
|||
cfg.split_block = (props->modifier & AFBC_FORMAT_MOD_SPLIT);
|
||||
cfg.tiled_header = (props->modifier & AFBC_FORMAT_MOD_TILED);
|
||||
cfg.prefetch = true;
|
||||
cfg.compression_mode =
|
||||
pan_afbc_compression_mode(iview->format, plane_idx);
|
||||
cfg.compression_mode = pan_afbc_decompression_mode(
|
||||
iview->format, props->format, pref.plane_idx);
|
||||
PLANE_SET_SIZE(cfg, plane_size);
|
||||
cfg.pointer = header_addr;
|
||||
cfg.header_row_stride = header_row_stride;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue