From bba62e047e88612ae8de768e52858b561dd7f1dd Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Tue, 20 May 2025 14:17:33 +0200 Subject: [PATCH] pan/afrc: Let's not pretend we support AFRC(YUV) Not only the is_yuv() check in pan_afrc_get_format_info() didn't work, because we use the multiplanar-RGB variants in panfrost, but we also need the plane index to pick the right format. Let's just assume AFRC(YUV) is not supported until someone decides to add the necessary bits. Fixes: 2dae926850ee ("panfrost: add utils for AFRC fixed-rate support") Signed-off-by: Boris Brezillon Tested-by: Eric R. Smith Reviewed-by: Eric R. Smith Reviewed-by: Mary Guillemard Part-of: --- src/panfrost/lib/pan_afrc.h | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/panfrost/lib/pan_afrc.h b/src/panfrost/lib/pan_afrc.h index 7981d63cc08..024a8246d49 100644 --- a/src/panfrost/lib/pan_afrc.h +++ b/src/panfrost/lib/pan_afrc.h @@ -87,6 +87,10 @@ pan_afrc_get_format_info(enum pipe_format format) if (desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) return info; + /* No AFRC(YUV) yet. */ + if (pan_format_is_yuv(format)) + return info; + unsigned bpc = 0; for (unsigned c = 0; c < desc->nr_channels; c++) { if (bpc && bpc != desc->channel[c].size) @@ -97,19 +101,9 @@ pan_afrc_get_format_info(enum pipe_format format) info.bpc = bpc; - if (desc->colorspace == UTIL_FORMAT_COLORSPACE_YUV) { - if (desc->layout != UTIL_FORMAT_LAYOUT_SUBSAMPLED) - info.ichange_fmt = PAN_AFRC_ICHANGE_FORMAT_YUV444; - else if (util_format_is_subsampled_422(format)) - info.ichange_fmt = PAN_AFRC_ICHANGE_FORMAT_YUV422; - else - info.ichange_fmt = PAN_AFRC_ICHANGE_FORMAT_YUV420; - } else { - assert(desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB || - desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB); - info.ichange_fmt = PAN_AFRC_ICHANGE_FORMAT_RAW; - } - + assert(desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB || + desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB); + info.ichange_fmt = PAN_AFRC_ICHANGE_FORMAT_RAW; info.num_planes = util_format_get_num_planes(format); info.num_comps = util_format_get_nr_components(format); return info;