[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <60ffb6f3-e932-d9af-3b90-81adf0c15250@gmail.com>
Date: Tue, 20 Jul 2021 20:03:20 +0200
From: Christian König <ckoenig.leichtzumerken@...il.com>
To: Rob Clark <robdclark@...il.com>, dri-devel@...ts.freedesktop.org
Cc: Rob Clark <robdclark@...omium.org>,
"open list:DRM DRIVER FOR MSM ADRENO GPU"
<freedreno@...ts.freedesktop.org>, David Airlie <airlied@...ux.ie>,
"open list:DRM DRIVER FOR MSM ADRENO GPU"
<linux-arm-msm@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>,
Christian König <christian.koenig@....com>,
"moderated list:DMA BUFFER SHARING FRAMEWORK"
<linaro-mm-sig@...ts.linaro.org>, Daniel Vetter <daniel@...ll.ch>,
Sean Paul <sean@...rly.run>,
"open list:DMA BUFFER SHARING FRAMEWORK"
<linux-media@...r.kernel.org>
Subject: Re: [Linaro-mm-sig] [PATCH] drm/msm: Add fence->wait() op
Hi Rob,
Am 20.07.21 um 17:07 schrieb Rob Clark:
> From: Rob Clark <robdclark@...omium.org>
>
> Somehow we had neither ->wait() nor dma_fence_signal() calls, and no
> one noticed. Oops.
I'm not sure if that is a good idea.
The dma_fence->wait() callback is pretty much deprecated and should not
be used any more.
What exactly do you need that for?
Regards,
Christian.
>
> Note that this removes the !timeout case, which has not been used in
> a long time.
>
> Signed-off-by: Rob Clark <robdclark@...omium.org>
> ---
> drivers/gpu/drm/msm/msm_fence.c | 59 +++++++++++++++++++--------------
> 1 file changed, 34 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/msm_fence.c b/drivers/gpu/drm/msm/msm_fence.c
> index cd59a5918038..8ee96b90ded6 100644
> --- a/drivers/gpu/drm/msm/msm_fence.c
> +++ b/drivers/gpu/drm/msm/msm_fence.c
> @@ -38,11 +38,10 @@ static inline bool fence_completed(struct msm_fence_context *fctx, uint32_t fenc
> return (int32_t)(fctx->completed_fence - fence) >= 0;
> }
>
> -/* legacy path for WAIT_FENCE ioctl: */
> -int msm_wait_fence(struct msm_fence_context *fctx, uint32_t fence,
> - ktime_t *timeout, bool interruptible)
> +static signed long wait_fence(struct msm_fence_context *fctx, uint32_t fence,
> + signed long remaining_jiffies, bool interruptible)
> {
> - int ret;
> + signed long ret;
>
> if (fence > fctx->last_fence) {
> DRM_ERROR_RATELIMITED("%s: waiting on invalid fence: %u (of %u)\n",
> @@ -50,33 +49,34 @@ int msm_wait_fence(struct msm_fence_context *fctx, uint32_t fence,
> return -EINVAL;
> }
>
> - if (!timeout) {
> - /* no-wait: */
> - ret = fence_completed(fctx, fence) ? 0 : -EBUSY;
> + if (interruptible) {
> + ret = wait_event_interruptible_timeout(fctx->event,
> + fence_completed(fctx, fence),
> + remaining_jiffies);
> } else {
> - unsigned long remaining_jiffies = timeout_to_jiffies(timeout);
> -
> - if (interruptible)
> - ret = wait_event_interruptible_timeout(fctx->event,
> - fence_completed(fctx, fence),
> - remaining_jiffies);
> - else
> - ret = wait_event_timeout(fctx->event,
> - fence_completed(fctx, fence),
> - remaining_jiffies);
> -
> - if (ret == 0) {
> - DBG("timeout waiting for fence: %u (completed: %u)",
> - fence, fctx->completed_fence);
> - ret = -ETIMEDOUT;
> - } else if (ret != -ERESTARTSYS) {
> - ret = 0;
> - }
> + ret = wait_event_timeout(fctx->event,
> + fence_completed(fctx, fence),
> + remaining_jiffies);
> + }
> +
> + if (ret == 0) {
> + DBG("timeout waiting for fence: %u (completed: %u)",
> + fence, fctx->completed_fence);
> + ret = -ETIMEDOUT;
> + } else if (ret != -ERESTARTSYS) {
> + ret = 0;
> }
>
> return ret;
> }
>
> +/* legacy path for WAIT_FENCE ioctl: */
> +int msm_wait_fence(struct msm_fence_context *fctx, uint32_t fence,
> + ktime_t *timeout, bool interruptible)
> +{
> + return wait_fence(fctx, fence, timeout_to_jiffies(timeout), interruptible);
> +}
> +
> /* called from workqueue */
> void msm_update_fence(struct msm_fence_context *fctx, uint32_t fence)
> {
> @@ -114,10 +114,19 @@ static bool msm_fence_signaled(struct dma_fence *fence)
> return fence_completed(f->fctx, f->base.seqno);
> }
>
> +static signed long msm_fence_wait(struct dma_fence *fence, bool intr,
> + signed long timeout)
> +{
> + struct msm_fence *f = to_msm_fence(fence);
> +
> + return wait_fence(f->fctx, fence->seqno, timeout, intr);
> +}
> +
> static const struct dma_fence_ops msm_fence_ops = {
> .get_driver_name = msm_fence_get_driver_name,
> .get_timeline_name = msm_fence_get_timeline_name,
> .signaled = msm_fence_signaled,
> + .wait = msm_fence_wait,
> };
>
> struct dma_fence *
Powered by blists - more mailing lists