mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 09:04:39 +02:00
drm/msm: Refcount framebuffer pins
We were already keeping a refcount of # of prepares (pins), to clear the iova array. Use that to avoid unpinning the iova until the last cleanup (unpin). This way, when msm_gem_unpin_iova() actually tears down the mapping, we won't have problems if the fb is being scanned out on another display (for example). Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com> Tested-by: Antonino Maniscalco <antomani103@gmail.com> Reviewed-by: Antonino Maniscalco <antomani103@gmail.com> Patchwork: https://patchwork.freedesktop.org/patch/661477/
This commit is contained in:
parent
4d0f62e4fe
commit
8ac37c88f9
|
|
@ -85,7 +85,8 @@ int msm_framebuffer_prepare(struct drm_framebuffer *fb, bool needs_dirtyfb)
|
|||
if (needs_dirtyfb)
|
||||
refcount_inc(&msm_fb->dirtyfb);
|
||||
|
||||
atomic_inc(&msm_fb->prepare_count);
|
||||
if (atomic_inc_return(&msm_fb->prepare_count) > 1)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
ret = msm_gem_get_and_pin_iova(fb->obj[i], vm, &msm_fb->iova[i]);
|
||||
|
|
@ -108,11 +109,13 @@ void msm_framebuffer_cleanup(struct drm_framebuffer *fb, bool needed_dirtyfb)
|
|||
if (needed_dirtyfb)
|
||||
refcount_dec(&msm_fb->dirtyfb);
|
||||
|
||||
if (atomic_dec_return(&msm_fb->prepare_count))
|
||||
return;
|
||||
|
||||
memset(msm_fb->iova, 0, sizeof(msm_fb->iova));
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
msm_gem_unpin_iova(fb->obj[i], vm);
|
||||
|
||||
if (!atomic_dec_return(&msm_fb->prepare_count))
|
||||
memset(msm_fb->iova, 0, sizeof(msm_fb->iova));
|
||||
}
|
||||
|
||||
uint32_t msm_framebuffer_iova(struct drm_framebuffer *fb, int plane)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user