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 <cohens@codeaurora.org>
This commit is contained in:
Steve Cohen
2020-02-06 18:55:07 -05:00
parent 9beffdfdc6
commit 7fc26f91b2

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only // 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__ #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, static void _sde_fence_trigger(struct sde_fence_context *ctx, bool error)
ktime_t ts, bool error)
{ {
unsigned long flags; unsigned long flags;
struct sde_fence *fc, *next; 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) { list_for_each_entry_safe(fc, next, &ctx->fence_list_head, fence_list) {
spin_lock_irqsave(&ctx->lock, flags); spin_lock_irqsave(&ctx->lock, flags);
fc->base.error = error ? -EBUSY : 0; if (error)
fc->base.timestamp = ts; dma_fence_set_error(&fc->base, -EBUSY);
is_signaled = dma_fence_is_signaled_locked(&fc->base); is_signaled = dma_fence_is_signaled_locked(&fc->base);
spin_unlock_irqrestore(&ctx->lock, flags); 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, SDE_EVT32(ctx->drm_id, ctx->done_count, ctx->commit_count,
ktime_to_us(ts)); 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, void sde_fence_timeline_status(struct sde_fence_context *ctx,