soc: qcom: hgsl: Add signaled cb to isync sync

In ts signal mode, usermode maybe create a fences with old timestamp
after timestamp of the timeline goes forward. These fences should be
treated as signaled.
The signaled cb could compare fence ts and timeline ts and return status
to caller.

Change-Id: I727a093188b50f693a26c16361e2a295d550fcb0
Signed-off-by: Ya <yatang@codeaurora.org>
Signed-off-by: Kasin Li <donglil@codeaurora.org>
This commit is contained in:
Ya 2021-04-13 10:45:41 +08:00 • committed by Kasin Li
commit 79b35d069f

View file

@ -266,6 +266,7 @@ int hgsl_isync_timeline_create(struct hgsl_priv *priv,
INIT_LIST_HEAD(&timeline->fence_list);
spin_lock_init(&timeline->lock);
timeline->priv = priv;
timeline->last_ts = 0;
idr_preload(GFP_KERNEL);
spin_lock(&priv->isync_timeline_lock);
@ -516,6 +517,21 @@ static bool hgsl_isync_enable_signaling(struct dma_fence *base)
return true;
}
static bool hgsl_isync_has_signaled(struct dma_fence *base)
{
struct hgsl_isync_fence *fence = NULL;
struct hgsl_isync_timeline *timeline = NULL;
if (base) {
fence = container_of(base, struct hgsl_isync_fence, fence);
timeline = fence->timeline;
if (timeline && timeline->last_ts > 0)
return hgsl_ts_ge(timeline->last_ts, fence->ts);
}
return false;
}
static void hgsl_isync_fence_release(struct dma_fence *base)
{
struct hgsl_isync_fence *fence = container_of(base,
@ -538,6 +554,7 @@ static const struct dma_fence_ops hgsl_isync_fence_ops = {
.get_driver_name = hgsl_isync_get_driver_name,
.get_timeline_name = hgsl_isync_get_timeline_name,
.enable_signaling = hgsl_isync_enable_signaling,
.signaled = hgsl_isync_has_signaled,
.wait = dma_fence_default_wait,
.release = hgsl_isync_fence_release,