[PATCH 15/27] drm/etnaviv: move object fence attachment to gem_submit path
Philipp Zabel
p.zabel at pengutronix.de
Mon Dec 11 09:17:11 UTC 2017
On Fri, 2017-12-01 at 11:36 +0100, Lucas Stach wrote:
> The object fencing has nothing to do with the actual GPU buffer submit,
> so move it to the gem submit path to have a cleaner split.
>
> Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel at pengutronix.de>
regards
Philipp
> ---
> drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 21 +++++++++++++++++++++
> drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 7 -------
> 2 files changed, 21 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> index 51ed34586c10..72468f11dd16 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> @@ -180,6 +180,24 @@ static int submit_fence_sync(const struct etnaviv_gem_submit *submit)
> return ret;
> }
>
> +static void submit_attach_object_fences(struct etnaviv_gem_submit *submit)
> +{
> + int i;
> +
> + for (i = 0; i < submit->nr_bos; i++) {
> + struct etnaviv_gem_object *etnaviv_obj = submit->bos[i].obj;
> +
> + if (submit->bos[i].flags & ETNA_SUBMIT_BO_WRITE)
> + reservation_object_add_excl_fence(etnaviv_obj->resv,
> + submit->fence);
> + else
> + reservation_object_add_shared_fence(etnaviv_obj->resv,
> + submit->fence);
> +
> + submit_unlock_object(submit, i);
> + }
> +}
> +
> static void submit_unpin_objects(struct etnaviv_gem_submit *submit)
> {
> int i;
> @@ -335,6 +353,7 @@ static void submit_cleanup(struct etnaviv_gem_submit *submit)
> for (i = 0; i < submit->nr_bos; i++) {
> struct etnaviv_gem_object *etnaviv_obj = submit->bos[i].obj;
>
> + /* if the GPU submit failed, objects might still be locked */
> submit_unlock_object(submit, i);
> drm_gem_object_put_unlocked(&etnaviv_obj->base);
> }
> @@ -507,6 +526,8 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
> if (ret)
> goto out;
>
> + submit_attach_object_fences(submit);
> +
> cmdbuf = NULL;
>
> if (args->flags & ETNA_SUBMIT_FENCE_FD_OUT) {
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> index 85f6ee1da016..d55a2137ee37 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> @@ -1443,13 +1443,6 @@ int etnaviv_gpu_submit(struct etnaviv_gpu *gpu,
> etnaviv_gem_mapping_reference(submit->bos[i].mapping);
> cmdbuf->bo_map[i] = submit->bos[i].mapping;
> atomic_inc(&etnaviv_obj->gpu_active);
> -
> - if (submit->bos[i].flags & ETNA_SUBMIT_BO_WRITE)
> - reservation_object_add_excl_fence(etnaviv_obj->resv,
> - fence);
> - else
> - reservation_object_add_shared_fence(etnaviv_obj->resv,
> - fence);
> }
> cmdbuf->nr_bos = submit->nr_bos;
> hangcheck_timer_reset(gpu);
More information about the dri-devel
mailing list