From 6a5542b32d811839fbb99b48e449cb16cdfae7a7 Mon Sep 17 00:00:00 2001 From: Vladimir Bely Date: Mon, 16 Nov 2026 01:45:20 +0300 Subject: [PATCH] drm/msm/dsi: Skip the video mode wait when the hardware blocks DMA Since DSI 6G v1.2.0 the host sets DSI_TRIG_CTRL.BLOCK_DMA_WITHIN_FRAME, which holds a command DMA until the video stream is in blanking. dsi_wait4video_eng_busy() still waits for VIDEO_DONE and then sleeps 2-4 ms before every command. The sleep is longer than the vertical blanking of many panels. A Samsung S6E88A0 panel (540x960, 24 blanking lines) has 0.41 ms of it. The command then waits in hardware for the next blanking, so every command costs about two frames. Skip the software wait when the hardware blocks the DMA itself. On MSM8916 a brightness update of six commands to that panel now takes about 36 ms instead of about 275 ms. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Vladimir Bely --- drivers/gpu/drm/msm/dsi/dsi_host.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index db6da99375a185..3b76cda9f057f9 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -1197,11 +1197,21 @@ static void dsi_wait4video_done(struct msm_dsi_host *msm_host) static void dsi_wait4video_eng_busy(struct msm_dsi_host *msm_host) { + const struct msm_dsi_cfg_handler *cfg_hnd = msm_host->cfg_hnd; u32 data; if (!(msm_host->mode_flags & MIPI_DSI_MODE_VIDEO)) return; + /* + * With BLOCK_DMA_WITHIN_FRAME the hardware holds the DMA until the + * blanking itself. Sleeping past VIDEO_DONE misses short blankings + * and costs a whole frame per command. + */ + if (cfg_hnd->major == MSM_DSI_VER_MAJOR_6G && + cfg_hnd->minor >= MSM_DSI_6G_VER_MINOR_V1_2) + return; + data = dsi_read(msm_host, REG_DSI_STATUS0); /* if video mode engine is not busy, its because