mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 12:25:00 -04:00
Merge "msm: kgsl: Add enable_signaling for timeline fence"
This commit is contained in:
commit
52da8f55ee
2 changed files with 24 additions and 5 deletions
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
@ -478,11 +478,12 @@ static int drawobj_add_sync_timeline(struct kgsl_device *device,
|
|||
drawobj_get_sync_timeline_priv(u64_to_user_ptr(sync.timelines),
|
||||
sync.timelines_size, sync.count);
|
||||
|
||||
/* Set pending flag before adding callback to avoid race */
|
||||
set_bit(event->id, &syncobj->pending);
|
||||
|
||||
ret = dma_fence_add_callback(event->fence,
|
||||
&event->cb, drawobj_sync_timeline_fence_callback);
|
||||
|
||||
set_bit(event->id, &syncobj->pending);
|
||||
|
||||
if (ret) {
|
||||
clear_bit(event->id, &syncobj->pending);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/dma-fence.h>
|
||||
|
|
@ -192,6 +192,16 @@ static bool timeline_fence_signaled(struct dma_fence *fence)
|
|||
fence->ops);
|
||||
}
|
||||
|
||||
static bool timeline_fence_enable_signaling(struct dma_fence *fence)
|
||||
{
|
||||
/*
|
||||
* Return value of false indicates the fence already passed.
|
||||
* When fence is not passed we return true indicating successful
|
||||
* enabling.
|
||||
*/
|
||||
return !timeline_fence_signaled(fence);
|
||||
}
|
||||
|
||||
static const char *timeline_get_driver_name(struct dma_fence *fence)
|
||||
{
|
||||
return "kgsl-sw-timeline";
|
||||
|
|
@ -217,6 +227,7 @@ static const struct dma_fence_ops timeline_fence_ops = {
|
|||
.get_timeline_name = timeline_get_timeline_name,
|
||||
.signaled = timeline_fence_signaled,
|
||||
.release = timeline_fence_release,
|
||||
.enable_signaling = timeline_fence_enable_signaling,
|
||||
.timeline_value_str = timeline_get_value_str,
|
||||
.use_64bit_seqno = true,
|
||||
};
|
||||
|
|
@ -294,10 +305,17 @@ struct dma_fence *kgsl_timeline_fence_alloc(struct kgsl_timeline *timeline,
|
|||
|
||||
INIT_LIST_HEAD(&fence->node);
|
||||
|
||||
if (!dma_fence_is_signaled(&fence->base))
|
||||
/*
|
||||
* Once fence is checked as not signaled, allow it to be added
|
||||
* in the list before other thread such as kgsl_timeline_signal
|
||||
* can get chance to signal.
|
||||
*/
|
||||
spin_lock_irq(&timeline->lock);
|
||||
if (!dma_fence_is_signaled_locked(&fence->base))
|
||||
kgsl_timeline_add_fence(timeline, fence);
|
||||
|
||||
trace_kgsl_timeline_fence_alloc(timeline->id, seqno);
|
||||
spin_unlock_irq(&timeline->lock);
|
||||
|
||||
return &fence->base;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue