summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/msm/msm_fence.h
diff options
context:
space:
mode:
authorRob Clark <robdclark@chromium.org>2021-11-09 21:11:04 +0300
committerRob Clark <robdclark@chromium.org>2021-11-28 20:56:47 +0300
commit5f3aee4ceb5b8607e9a4b752c2547667200e19e2 (patch)
tree934beb2681895656580507bbd893c791ac8b3c8d /drivers/gpu/drm/msm/msm_fence.h
parentc28e2f2b417ed747bfbc5f900c87f3ec9cc6b25e (diff)
downloadlinux-5f3aee4ceb5b8607e9a4b752c2547667200e19e2.tar.xz
drm/msm: Handle fence rollover
Add some helpers for fence comparision, which handle rollover properly, and stop open coding fence seqno comparisions. Signed-off-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Akhil P Oommen <akhilpo@codeaurora.org> Link: https://lore.kernel.org/r/20211109181117.591148-5-robdclark@gmail.com Signed-off-by: Rob Clark <robdclark@chromium.org>
Diffstat (limited to 'drivers/gpu/drm/msm/msm_fence.h')
-rw-r--r--drivers/gpu/drm/msm/msm_fence.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/gpu/drm/msm/msm_fence.h b/drivers/gpu/drm/msm/msm_fence.h
index 4783db528bcc..17ee3822b423 100644
--- a/drivers/gpu/drm/msm/msm_fence.h
+++ b/drivers/gpu/drm/msm/msm_fence.h
@@ -60,4 +60,16 @@ void msm_update_fence(struct msm_fence_context *fctx, uint32_t fence);
struct dma_fence * msm_fence_alloc(struct msm_fence_context *fctx);
+static inline bool
+fence_before(uint32_t a, uint32_t b)
+{
+ return (int32_t)(a - b) < 0;
+}
+
+static inline bool
+fence_after(uint32_t a, uint32_t b)
+{
+ return (int32_t)(a - b) > 0;
+}
+
#endif