Browse Source

disp: msm: sde: let dma-fence driver set timestamp on signal

Avoid corrupting the cb_list by setting timestamp before signal.
The fence driver changed in msm-5.4 by creating a union for the
fence cb_list, timestamp, and rcu. Therefore only one of these
fields can be used at a time. Fence driver will take care of
setting the timestamp during dma_fence_signal after it has
cached the cb_list. Also, use fence framework API to set fence
error instead of modifying the dma_fence struct directly.

Change-Id: I58dbaa495027cb575f4f0b03275ca4aa551ecacb
Signed-off-by: Steve Cohen <[email protected]>
Steve Cohen 5 năm trước cách đây
mục cha
commit
7fc26f91b2
1 tập tin đã thay đổi với 5 bổ sung6 xóa
  1. 5 6
      msm/sde/sde_fence.c

+ 5 - 6
msm/sde/sde_fence.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
  */
 
 #define pr_fmt(fmt)	"[drm:%s:%d] " fmt, __func__, __LINE__
@@ -289,8 +289,7 @@ void sde_fence_prepare(struct sde_fence_context *ctx)
 	}
 }
 
-static void _sde_fence_trigger(struct sde_fence_context *ctx,
-		ktime_t ts, bool error)
+static void _sde_fence_trigger(struct sde_fence_context *ctx, bool error)
 {
 	unsigned long flags;
 	struct sde_fence *fc, *next;
@@ -306,8 +305,8 @@ static void _sde_fence_trigger(struct sde_fence_context *ctx,
 
 	list_for_each_entry_safe(fc, next, &ctx->fence_list_head, fence_list) {
 		spin_lock_irqsave(&ctx->lock, flags);
-		fc->base.error = error ? -EBUSY : 0;
-		fc->base.timestamp = ts;
+		if (error)
+			dma_fence_set_error(&fc->base, -EBUSY);
 		is_signaled = dma_fence_is_signaled_locked(&fc->base);
 		spin_unlock_irqrestore(&ctx->lock, flags);
 
@@ -398,7 +397,7 @@ void sde_fence_signal(struct sde_fence_context *ctx, ktime_t ts,
 	SDE_EVT32(ctx->drm_id, ctx->done_count, ctx->commit_count,
 			ktime_to_us(ts));
 
-	_sde_fence_trigger(ctx, ts, (fence_event == SDE_FENCE_SIGNAL_ERROR));
+	_sde_fence_trigger(ctx, (fence_event == SDE_FENCE_SIGNAL_ERROR));
 }
 
 void sde_fence_timeline_status(struct sde_fence_context *ctx,