[PATCH v3 12/17] drm/v3d: Create a CPU job extension for a indirect CSD job

Iago Toral itoral at igalia.com
Tue Nov 28 08:49:48 UTC 2023


El lun, 27-11-2023 a las 15:48 -0300, Maíra Canal escribió:
(...)
> @@ -860,19 +913,66 @@ v3d_submit_cpu_ioctl(struct drm_device *dev,
> void *data,
>  
>         mutex_lock(&v3d->sched_lock);
>         v3d_push_job(&cpu_job->base);
> +
> +       switch (cpu_job->job_type) {
> +       case V3D_CPU_JOB_TYPE_INDIRECT_CSD:
> +               ret = drm_sched_job_add_dependency(&csd_job-
> >base.base,
> +                                                 
> dma_fence_get(cpu_job->base.done_fence));
> +               if (ret)
> +                       goto fail_unreserve;
> +
> +               v3d_push_job(&csd_job->base);
> +
> +               ret = drm_sched_job_add_dependency(&clean_job->base,
> +                                                 
> dma_fence_get(csd_job->base.done_fence));
> +               if (ret)
> +                       goto fail_unreserve;
> +
> +               v3d_push_job(clean_job);
> +
> +               break;
> +       default:
> +               break;
> +       }
>         mutex_unlock(&v3d->sched_lock);
>  
> +       out_se = (cpu_job->job_type == V3D_CPU_JOB_TYPE_INDIRECT_CSD)
> ? NULL : &se;
> +
>         v3d_attach_fences_and_unlock_reservation(file_priv,
>                                                  &cpu_job->base,
>                                                  &acquire_ctx, 0,
> -                                                NULL, cpu_job-
> >base.done_fence);
> +                                                out_se, cpu_job-
> >base.done_fence);
> +
> +       switch (cpu_job->job_type) {
> +       case V3D_CPU_JOB_TYPE_INDIRECT_CSD:
> +               v3d_attach_fences_and_unlock_reservation(file_priv,
> +                                                        clean_job,
> +                                                        &cpu_job-
> >indirect_csd.acquire_ctx,
> +                                                        0, &se,
> clean_job->done_fence);
> +               break;
> +       default:
> +               break;
> +       }
>  
>         v3d_job_put(&cpu_job->base);
> +       v3d_job_put(&csd_job->base);
> +       v3d_job_put(clean_job);
>  
>         return 0;
>  
> +fail_unreserve:
> +       mutex_unlock(&v3d->sched_lock);
> +
> +       drm_gem_unlock_reservations(cpu_job->base.bo, cpu_job-
> >base.bo_count,
> +                                   &acquire_ctx);
> +
> +       drm_gem_unlock_reservations(clean_job->bo, clean_job-
> >bo_count,
> +                                   &cpu_job-
> >indirect_csd.acquire_ctx);
> +
>  fail:
>         v3d_job_cleanup((void *)cpu_job);
> +       v3d_job_cleanup((void *)csd_job);
> +       v3d_job_cleanup(clean_job);

This should be:

v3d_job_put(&cpu_job->base);
v3d_job_put(&csd_job->base);
v3d_job_cleanup(clean_job);

Iago



More information about the dri-devel mailing list