Skip to content

Commit

Permalink
drm/scheduler: use new iterator in drm_sched_job_add_implicit_depende…
Browse files Browse the repository at this point in the history
…ncies v2

Simplifying the code a bit.

v2: use dma_resv_for_each_fence

Signed-off-by: Christian König <[email protected]>
Reviewed-by: Daniel Vetter <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
ChristianKoenigAMD committed Oct 7, 2021
1 parent dbcae3b commit 9c2ba26
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions drivers/gpu/drm/scheduler/sched_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,30 +699,16 @@ int drm_sched_job_add_implicit_dependencies(struct drm_sched_job *job,
struct drm_gem_object *obj,
bool write)
{
struct dma_resv_iter cursor;
struct dma_fence *fence;
int ret;
struct dma_fence **fences;
unsigned int i, fence_count;

if (!write) {
struct dma_fence *fence = dma_resv_get_excl_unlocked(obj->resv);

return drm_sched_job_add_dependency(job, fence);
}

ret = dma_resv_get_fences(obj->resv, NULL, &fence_count, &fences);
if (ret || !fence_count)
return ret;

for (i = 0; i < fence_count; i++) {
ret = drm_sched_job_add_dependency(job, fences[i]);
dma_resv_for_each_fence(&cursor, obj->resv, write, fence) {
ret = drm_sched_job_add_dependency(job, fence);
if (ret)
break;
return ret;
}

for (; i < fence_count; i++)
dma_fence_put(fences[i]);
kfree(fences);
return ret;
return 0;
}
EXPORT_SYMBOL(drm_sched_job_add_implicit_dependencies);

Expand Down

0 comments on commit 9c2ba26

Please sign in to comment.