From: Rob Clark Date: Fri, 4 Mar 2022 20:21:45 +0000 (-0800) Subject: drm/msm: Fix dirtyfb refcounting X-Git-Tag: baikal/mips/sdk6.1~6168^2~4^2~2 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=6cf1ba54d6910472a4b8a663e61bee6f9ea5556f;p=kernel.git drm/msm: Fix dirtyfb refcounting 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: ec882c8d0ec6 ("drm/msm: Avoid dirtyfb stalls on video mode displays (v2)") Signed-off-by: Rob Clark Link: https://lore.kernel.org/r/20220304202146.845566-1-robdclark@gmail.com --- diff --git a/drivers/gpu/drm/msm/msm_fb.c b/drivers/gpu/drm/msm/msm_fb.c index 96b379a08327c..7137492fe78e2 100644 --- 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(struct drm_framebuffer *fb, /* 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_framebuffer_init(struct drm_device *dev, goto fail; } + refcount_set(&msm_fb->dirtyfb, 1); + drm_dbg_state(dev, "create: FB ID: %d (%p)", fb->base.id, fb); return fb;