Skip to content

Commit e3cac8f

Browse files
author
Marek Vasut
committed
drm: lcdif: Set and enable FIFO Panic threshold
In case the LCDIFv3 is used to drive a 4k panel via i.MX8MP HDMI bridge, the LCDIFv3 becomes susceptible to FIFO underflows, these lead to nasty flicker of the image on the panel, or image being shifted by half frame horizontally every second frame. The flicker can be easily triggered by running 3D application on top of weston compositor, like neverball or chromium. Surprisingly glmark2-es2-wayland or glmark2-es2-drm does not trigger this effect so easily. Configure the FIFO Panic threshold register and enable the FIFO Panic mode, which internally boosts the NoC interconnect priority for LCDIFv3 transactions in case of possible underflow. This mitigates the flicker effect on 4k panels as well. Fixes: 9db35bb ("drm: lcdif: Add support for i.MX8MP LCDIF variant") Signed-off-by: Marek Vasut <[email protected]> Tested-by: Liu Ying <[email protected]> # i.MX8mp EVK Reviewed-by: Liu Ying <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 1a0257c commit e3cac8f

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

drivers/gpu/drm/mxsfb/lcdif_kms.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* This code is based on drivers/gpu/drm/mxsfb/mxsfb*
66
*/
77

8+
#include <linux/bitfield.h>
89
#include <linux/clk.h>
910
#include <linux/io.h>
1011
#include <linux/iopoll.h>
@@ -332,6 +333,18 @@ static void lcdif_enable_controller(struct lcdif_drm_private *lcdif)
332333
{
333334
u32 reg;
334335

336+
/* Set FIFO Panic watermarks, low 1/3, high 2/3 . */
337+
writel(FIELD_PREP(PANIC0_THRES_LOW_MASK, 1 * PANIC0_THRES_MAX / 3) |
338+
FIELD_PREP(PANIC0_THRES_HIGH_MASK, 2 * PANIC0_THRES_MAX / 3),
339+
lcdif->base + LCDC_V8_PANIC0_THRES);
340+
341+
/*
342+
* Enable FIFO Panic, this does not generate interrupt, but
343+
* boosts NoC priority based on FIFO Panic watermarks.
344+
*/
345+
writel(INT_ENABLE_D1_PLANE_PANIC_EN,
346+
lcdif->base + LCDC_V8_INT_ENABLE_D1);
347+
335348
reg = readl(lcdif->base + LCDC_V8_DISP_PARA);
336349
reg |= DISP_PARA_DISP_ON;
337350
writel(reg, lcdif->base + LCDC_V8_DISP_PARA);
@@ -359,6 +372,9 @@ static void lcdif_disable_controller(struct lcdif_drm_private *lcdif)
359372
reg = readl(lcdif->base + LCDC_V8_DISP_PARA);
360373
reg &= ~DISP_PARA_DISP_ON;
361374
writel(reg, lcdif->base + LCDC_V8_DISP_PARA);
375+
376+
/* Disable FIFO Panic NoC priority booster. */
377+
writel(0, lcdif->base + LCDC_V8_INT_ENABLE_D1);
362378
}
363379

364380
static void lcdif_reset_block(struct lcdif_drm_private *lcdif)

drivers/gpu/drm/mxsfb/lcdif_regs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@
255255

256256
#define PANIC0_THRES_LOW_MASK GENMASK(24, 16)
257257
#define PANIC0_THRES_HIGH_MASK GENMASK(8, 0)
258+
#define PANIC0_THRES_MAX 511
258259

259260
#define LCDIF_MIN_XRES 120
260261
#define LCDIF_MIN_YRES 120

0 commit comments

Comments
 (0)