Re: i.MX8MP: Fix HDMI LCDIF FIFO underruns

Marek Vasut
2026-03-20T03:59:22Z

On 3/19/26 12:45 PM, Krzysztof Hałasa wrote:
> Running (and terminating) Weston on i.MX8MP sometimes produced black
> or grey screens. The LCDIF3 INT_STATUS_D0 register showed a FIFO underrun:
>
> 32FC6024: 1000002
>
> The PANIC0_THRES register was set to:
>
> 32FC6238: AA0154
>
> which apparently meant low = 2736 bytes (0xAA * 16 + 16), high = 5456 bytes
> (0x154 * 16 + 16).
>
> With this patch (based on NXP's driver) the watermarks are only 16 bytes
> higher (register values increased by 1) and the underruns are gone.
>
> Tested on Solidrun Hummingboard Mate with a 1080p60 HDMI display.
>
> Signed-off-by: Krzysztof Hałasa <khalasa@piap.pl>
>
> --- a/drivers/gpu/drm/mxsfb/lcdif_kms.c
> +++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c
> @@ -353,8 +353,8 @@ static void lcdif_enable_controller(struct lcdif_drm_private *lcdif)
> u32 reg;
>
> /* Set FIFO Panic watermarks, low 1/3, high 2/3 . */
> - writel(FIELD_PREP(PANIC0_THRES_LOW_MASK, 1 * PANIC0_THRES_MAX / 3) |
> - FIELD_PREP(PANIC0_THRES_HIGH_MASK, 2 * PANIC0_THRES_MAX / 3),
> + writel(FIELD_PREP(PANIC0_THRES_LOW_MASK, DIV_ROUND_UP(1 * PANIC0_THRES_MAX, 3)) |
> + FIELD_PREP(PANIC0_THRES_HIGH_MASK, DIV_ROUND_UP(2 * PANIC0_THRES_MAX, 3)),

I am starting to wonder, whether this should be configurable in DT,
because it seems there might be users that need to tweak the watermarks
one way or the other for different video outputs ?

+CC Liu