mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
drm/msm: Fix fence rollover issue
[ Upstream commit2311720a01] And while we are at it, let's start the fence counter close to the rollover point so that if issues slip in, they are more obvious. Signed-off-by: Rob Clark <robdclark@chromium.org> Fixes:fde5de6cb4("drm/msm: move fence code to it's own file") Fixes:5f3aee4ceb("drm/msm: Handle fence rollover") Patchwork: https://patchwork.freedesktop.org/patch/489619/ Link: https://lore.kernel.org/r/20220615162435.3011793-1-robdclark@gmail.com [DB: fixed the conflict while applying the patch] Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
7d25a31004
commit
09ecee270c
@@ -28,6 +28,14 @@ msm_fence_context_alloc(struct drm_device *dev, volatile uint32_t *fenceptr,
|
|||||||
fctx->fenceptr = fenceptr;
|
fctx->fenceptr = fenceptr;
|
||||||
spin_lock_init(&fctx->spinlock);
|
spin_lock_init(&fctx->spinlock);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Start out close to the 32b fence rollover point, so we can
|
||||||
|
* catch bugs with fence comparisons.
|
||||||
|
*/
|
||||||
|
fctx->last_fence = 0xffffff00;
|
||||||
|
fctx->completed_fence = fctx->last_fence;
|
||||||
|
*fctx->fenceptr = fctx->last_fence;
|
||||||
|
|
||||||
return fctx;
|
return fctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +60,8 @@ void msm_update_fence(struct msm_fence_context *fctx, uint32_t fence)
|
|||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
spin_lock_irqsave(&fctx->spinlock, flags);
|
spin_lock_irqsave(&fctx->spinlock, flags);
|
||||||
fctx->completed_fence = max(fence, fctx->completed_fence);
|
if (fence_after(fence, fctx->completed_fence))
|
||||||
|
fctx->completed_fence = fence;
|
||||||
spin_unlock_irqrestore(&fctx->spinlock, flags);
|
spin_unlock_irqrestore(&fctx->spinlock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user