[PATCH RFC 4/6] drm/mediatek: ovl: Disallow AFBC buffers with width over 1920

Nícolas F. R. A. Prado posted 6 patches 1 month, 1 week ago
[PATCH RFC 4/6] drm/mediatek: ovl: Disallow AFBC buffers with width over 1920
Posted by Nícolas F. R. A. Prado 1 month, 1 week ago
AFBC buffers with width over 1920 are not supported by OVL. If
attempted, the image displayed contains many artifacts.

Add this restriction to the layer check callback so such configurations
are not allowed.

NOTE: This doesn't seem to be a good way to handle this restriction, as
when tested with Weston, it simply fails to render, rather than fallback
to not using the modifier:

[19:09:03.857] atomic: couldn't commit new state: Invalid argument
[19:09:03.857] repaint-flush failed: Invalid argument

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
index c6a00c2256dd..196b874057ba 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
@@ -368,6 +368,13 @@ int mtk_ovl_layer_check(struct device *dev, unsigned int idx,
 	if (state->fb->format->is_yuv && (state->rotation & ~DRM_MODE_ROTATE_0))
 		return -EINVAL;
 
+	/*
+	 * AFBC buffers with width > 1920 are not supported and produce
+	 * artifacts, so should be disabled.
+	 */
+	if (state->fb->modifier != DRM_FORMAT_MOD_LINEAR && state->fb->width > 1920)
+		return -EINVAL;
+
 	return 0;
 }
 

-- 
2.51.0

Re: [PATCH RFC 4/6] drm/mediatek: ovl: Disallow AFBC buffers with width over 1920
Posted by CK Hu (胡俊光) 6 days, 22 hours ago
On Tue, 2025-12-30 at 11:03 -0300, Nícolas F. R. A. Prado wrote:
> AFBC buffers with width over 1920 are not supported by OVL. If
> attempted, the image displayed contains many artifacts.
> 
> Add this restriction to the layer check callback so such configurations
> are not allowed.
> 
> NOTE: This doesn't seem to be a good way to handle this restriction, as
> when tested with Weston, it simply fails to render, rather than fallback
> to not using the modifier:
> 
> [19:09:03.857] atomic: couldn't commit new state: Invalid argument
> [19:09:03.857] repaint-flush failed: Invalid argument

Reviewed-by: CK Hu <ck.hu@mediatek.com>

> 
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> index c6a00c2256dd..196b874057ba 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> @@ -368,6 +368,13 @@ int mtk_ovl_layer_check(struct device *dev, unsigned int idx,
>  	if (state->fb->format->is_yuv && (state->rotation & ~DRM_MODE_ROTATE_0))
>  		return -EINVAL;
>  
> +	/*
> +	 * AFBC buffers with width > 1920 are not supported and produce
> +	 * artifacts, so should be disabled.
> +	 */
> +	if (state->fb->modifier != DRM_FORMAT_MOD_LINEAR && state->fb->width > 1920)
> +		return -EINVAL;
> +
>  	return 0;
>  }
>  
>