Commit 9225b337 authored by Rob Clark's avatar Rob Clark

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: 9e4dde28 ("drm/msm: Avoid dirtyfb stalls on video mode displays (v2)")
Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
Link: https://lore.kernel.org/r/20220304202146.845566-1-robdclark@gmail.com
parent cca96584
...@@ -37,7 +37,7 @@ static int msm_framebuffer_dirtyfb(struct drm_framebuffer *fb, ...@@ -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 /* If this fb is not used on any display requiring pixel data to be
* flushed, then skip dirtyfb * flushed, then skip dirtyfb
*/ */
if (refcount_read(&msm_fb->dirtyfb) == 0) if (refcount_read(&msm_fb->dirtyfb) == 1)
return 0; return 0;
return drm_atomic_helper_dirtyfb(fb, file_priv, flags, color, 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, ...@@ -221,6 +221,8 @@ static struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev,
goto fail; goto fail;
} }
refcount_set(&msm_fb->dirtyfb, 1);
drm_dbg_state(dev, "create: FB ID: %d (%p)", fb->base.id, fb); drm_dbg_state(dev, "create: FB ID: %d (%p)", fb->base.id, fb);
return fb; return fb;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment