From: Arun Iyengar Date: Tue, 10 Nov 2026 07:18:51 +0000 Subject: [PATCH 3/8] drm/rockchip: vop2: Don't accept AFBC YTR for RGB565 on RK3588 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261110-vop2-fixes-v1-3-d336e9dd90d3@gmail.com> References: <20261110-vop2-fixes-v1-0-d336e9dd90d3@gmail.com> In-Reply-To: <20261110-vop2-fixes-v1-0-d336e9dd90d3@gmail.com> To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Sascha Hauer Cc: dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1794295129; l=2483; i=aiyengar1990@gmail.com; s=20261110; h=from:subject:message-id; bh=dSPTheuoeEWtYE05OjR52Fc58lXeV69Gfn0Qylp8Rv0=; b=s4HVCmDwgYdPn6T1iLJbkUsMIfeJ+cpWRdDnv8reZ6dalUFrLsggZfWE8XBkuxhFbsVyfPrTF HxKH211/MEGDHFmDV3N05Sk2K5j1912ImX9Eti7sR9lTWRyJEJmQfnB X-Developer-Key: i=aiyengar1990@gmail.com; a=ed25519; pk=zXpRgUTrhaFe6jLyPqbBy3ccfkj04w0g2690Wv3mg+0= X-Endpoint-Received: by B4 Relay for aiyengar1990@gmail.com/20261110 with auth_id=1480 List-Id: B4 Relay Submissions The Cluster windows of the RK3588 VOP2 advertise every AFBC modifier of format_modifiers_afbc for RGB565 and BGR565, including the ones with the lossless colour transform (YTR). Scanning out an RGB565 buffer rendered by the Mali-G610 (panfrost) with AFBC(16x16 | SPARSE | YTR) gives a black picture and POST_BUF_EMPTY on the video port, on every Cluster window, while the same buffer rendered with AFBC(16x16 | SPARSE) displays correctly, as do 32 bpp formats with YTR. YTR on RGB565 is also a questionable pairing to start with: Documentation/gpu/afbc.rst requires the R, G, B component order when YTR is used, with component 0 in the least significant bits, which DRM_FORMAT_RGB565 (B in the low bits) doesn't have, and the Arm Mali-D71 (komeda) only accepts AFBC for BGR565. Stop advertising and accepting YTR for the two 16 bpp RGB formats on RK3588, so that userspace picks a modifier the decoder handles. The BGR565 case could not be tested (Mesa can't import BGR565 dma-bufs), it's rejected as well because the decoder is configured identically for both formats, apart from the R/B swap after decoding. Fixes: 5a028e8f062f ("drm/rockchip: vop2: Add support for rk3588") Signed-off-by: Arun Iyengar --- drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c index 76d151b8bc52..629ea7f11250 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c @@ -404,6 +404,18 @@ static bool rockchip_vop2_mod_supported(struct drm_plane *plane, u32 format, if (vop2_convert_afbc_format(format) == VOP2_AFBC_FMT_INVALID) return false; + /* + * The AFBC decoder of the RK3588 Cluster windows can't decode 16 bpp + * RGB that uses the lossless colour transform: the picture stays + * black and the video port reports POST_BUF_EMPTY, while the same + * buffers without YTR display fine. + */ + if (vop2->version == VOP_VERSION_RK3588 && (modifier & AFBC_FORMAT_MOD_YTR) && + (format == DRM_FORMAT_RGB565 || format == DRM_FORMAT_BGR565)) { + drm_dbg_kms(vop2->drm, "No AFBC YTR support for 16 bpp RGB\n"); + return false; + } + /* Different windows have different format/modifier support */ for (i = 0; i < plane->modifier_count; i++) { if (plane->modifiers[i] == modifier) -- 2.55.0