Commit 80bcfbd3 authored by Daniel Vetter's avatar Daniel Vetter

drm/msm: Use scheduler dependency handling

drm_sched_job_init is already at the right place, so this boils down
to deleting code.
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
Cc: Rob Clark <robdclark@gmail.com>
Reviewed-by: default avatarRob Clark <robdclark@gmail.com>
Cc: Sean Paul <sean@poorly.run>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: linux-arm-msm@vger.kernel.org
Cc: freedreno@lists.freedesktop.org
Cc: linux-media@vger.kernel.org
Cc: linaro-mm-sig@lists.linaro.org
Link: https://patchwork.freedesktop.org/patch/msgid/20210805104705.862416-13-daniel.vetter@ffwll.ch
parent da3208e8
...@@ -312,11 +312,6 @@ struct msm_gem_submit { ...@@ -312,11 +312,6 @@ struct msm_gem_submit {
struct ww_acquire_ctx ticket; struct ww_acquire_ctx ticket;
uint32_t seqno; /* Sequence number of the submit on the ring */ uint32_t seqno; /* Sequence number of the submit on the ring */
/* Array of struct dma_fence * to block on before submitting this job.
*/
struct xarray deps;
unsigned long last_dep;
/* Hw fence, which is created when the scheduler executes the job, and /* Hw fence, which is created when the scheduler executes the job, and
* is signaled when the hw finishes (via seqno write from cmdstream) * is signaled when the hw finishes (via seqno write from cmdstream)
*/ */
......
...@@ -52,8 +52,6 @@ static struct msm_gem_submit *submit_create(struct drm_device *dev, ...@@ -52,8 +52,6 @@ static struct msm_gem_submit *submit_create(struct drm_device *dev,
return ERR_PTR(ret); return ERR_PTR(ret);
} }
xa_init_flags(&submit->deps, XA_FLAGS_ALLOC);
kref_init(&submit->ref); kref_init(&submit->ref);
submit->dev = dev; submit->dev = dev;
submit->aspace = queue->ctx->aspace; submit->aspace = queue->ctx->aspace;
...@@ -72,8 +70,6 @@ void __msm_gem_submit_destroy(struct kref *kref) ...@@ -72,8 +70,6 @@ void __msm_gem_submit_destroy(struct kref *kref)
{ {
struct msm_gem_submit *submit = struct msm_gem_submit *submit =
container_of(kref, struct msm_gem_submit, ref); container_of(kref, struct msm_gem_submit, ref);
unsigned long index;
struct dma_fence *fence;
unsigned i; unsigned i;
if (submit->fence_id) { if (submit->fence_id) {
...@@ -82,12 +78,6 @@ void __msm_gem_submit_destroy(struct kref *kref) ...@@ -82,12 +78,6 @@ void __msm_gem_submit_destroy(struct kref *kref)
mutex_unlock(&submit->queue->lock); mutex_unlock(&submit->queue->lock);
} }
xa_for_each (&submit->deps, index, fence) {
dma_fence_put(fence);
}
xa_destroy(&submit->deps);
dma_fence_put(submit->user_fence); dma_fence_put(submit->user_fence);
dma_fence_put(submit->hw_fence); dma_fence_put(submit->hw_fence);
...@@ -343,8 +333,9 @@ static int submit_fence_sync(struct msm_gem_submit *submit, bool no_implicit) ...@@ -343,8 +333,9 @@ static int submit_fence_sync(struct msm_gem_submit *submit, bool no_implicit)
if (no_implicit) if (no_implicit)
continue; continue;
ret = drm_gem_fence_array_add_implicit(&submit->deps, obj, ret = drm_sched_job_add_implicit_dependencies(&submit->base,
write); obj,
write);
if (ret) if (ret)
break; break;
} }
...@@ -588,7 +579,7 @@ static struct drm_syncobj **msm_parse_deps(struct msm_gem_submit *submit, ...@@ -588,7 +579,7 @@ static struct drm_syncobj **msm_parse_deps(struct msm_gem_submit *submit,
if (ret) if (ret)
break; break;
ret = drm_gem_fence_array_add(&submit->deps, fence); ret = drm_sched_job_add_dependency(&submit->base, fence);
if (ret) if (ret)
break; break;
...@@ -798,7 +789,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, ...@@ -798,7 +789,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
goto out_unlock; goto out_unlock;
} }
ret = drm_gem_fence_array_add(&submit->deps, in_fence); ret = drm_sched_job_add_dependency(&submit->base, in_fence);
if (ret) if (ret)
goto out_unlock; goto out_unlock;
} }
......
...@@ -11,17 +11,6 @@ static uint num_hw_submissions = 8; ...@@ -11,17 +11,6 @@ static uint num_hw_submissions = 8;
MODULE_PARM_DESC(num_hw_submissions, "The max # of jobs to write into ringbuffer (default 8)"); MODULE_PARM_DESC(num_hw_submissions, "The max # of jobs to write into ringbuffer (default 8)");
module_param(num_hw_submissions, uint, 0600); module_param(num_hw_submissions, uint, 0600);
static struct dma_fence *msm_job_dependency(struct drm_sched_job *job,
struct drm_sched_entity *s_entity)
{
struct msm_gem_submit *submit = to_msm_submit(job);
if (!xa_empty(&submit->deps))
return xa_erase(&submit->deps, submit->last_dep++);
return NULL;
}
static struct dma_fence *msm_job_run(struct drm_sched_job *job) static struct dma_fence *msm_job_run(struct drm_sched_job *job)
{ {
struct msm_gem_submit *submit = to_msm_submit(job); struct msm_gem_submit *submit = to_msm_submit(job);
...@@ -52,7 +41,6 @@ static void msm_job_free(struct drm_sched_job *job) ...@@ -52,7 +41,6 @@ static void msm_job_free(struct drm_sched_job *job)
} }
const struct drm_sched_backend_ops msm_sched_ops = { const struct drm_sched_backend_ops msm_sched_ops = {
.dependency = msm_job_dependency,
.run_job = msm_job_run, .run_job = msm_job_run,
.free_job = msm_job_free .free_job = msm_job_free
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment