This is a note to let you know that I've just added the patch titled drm/msm: Fix dirtyfb refcounting to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: drm-msm-fix-dirtyfb-refcounting.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 9225b337072a10bf9b09df8bf281437488dd8a26 Mon Sep 17 00:00:00 2001 From: Rob Clark <robdclark@xxxxxxxxxxxx> Date: Fri, 4 Mar 2022 12:21:45 -0800 Subject: drm/msm: Fix dirtyfb refcounting From: Rob Clark <robdclark@xxxxxxxxxxxx> commit 9225b337072a10bf9b09df8bf281437488dd8a26 upstream. refcount_t complains about 0->1 transitions, which isn't *quite* what we wanted. So use dirtyfb==1 to mean that the fb is not connected to any output that requires dirtyfb flushing, so that we can keep the underflow and overflow checking. Fixes: 9e4dde28e9cd ("drm/msm: Avoid dirtyfb stalls on video mode displays (v2)") Signed-off-by: Rob Clark <robdclark@xxxxxxxxxxxx> Link: https://lore.kernel.org/r/20220304202146.845566-1-robdclark@xxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/msm/msm_fb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/msm/msm_fb.c +++ b/drivers/gpu/drm/msm/msm_fb.c @@ -37,7 +37,7 @@ static int msm_framebuffer_dirtyfb(struc /* If this fb is not used on any display requiring pixel data to be * flushed, then skip dirtyfb */ - if (refcount_read(&msm_fb->dirtyfb) == 0) + if (refcount_read(&msm_fb->dirtyfb) == 1) return 0; return drm_atomic_helper_dirtyfb(fb, file_priv, flags, color, @@ -221,6 +221,8 @@ static struct drm_framebuffer *msm_frame goto fail; } + refcount_set(&msm_fb->dirtyfb, 1); + drm_dbg_state(dev, "create: FB ID: %d (%p)", fb->base.id, fb); return fb; Patches currently in stable-queue which might be from robdclark@xxxxxxxxxxxx are queue-5.15/drm-msm-avoid-dirtyfb-stalls-on-video-mode-displays-.patch queue-5.15/drm-msm-fix-dirtyfb-refcounting.patch queue-5.15/drm-msm-mdp5-fix-global-state-lock-backoff.patch queue-5.15/drm-msm-dpu-fix-for-non-visible-planes.patch