[PATCH 05/12] drm/etnaviv: add DMA-buf user fence support
Christian König
ckoenig.leichtzumerken at gmail.com
Tue May 4 13:27:22 UTC 2021
Just add the call before taking locks.
Signed-off-by: Christian König <christian.koenig at amd.com>
---
drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 23 ++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
index d05c35994579..2e440674ca5b 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
@@ -108,6 +108,21 @@ static int submit_lookup_objects(struct etnaviv_gem_submit *submit,
return ret;
}
+static int submit_sync_user(struct etnaviv_gem_submit *submit)
+{
+ unsigned int i;
+ int ret;
+
+ for (i = 0; i < submit->nr_bos; i++) {
+ struct drm_gem_object *obj = &submit->bos[i].obj->base;
+
+ ret = dma_resv_sync_user_fence(obj->resv);
+ if (ret)
+ return ret;
+ }
+ return 0;
+}
+
static void submit_unlock_object(struct etnaviv_gem_submit *submit, int i)
{
if (submit->bos[i].flags & BO_LOCKED) {
@@ -518,8 +533,6 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
}
}
- ww_acquire_init(&ticket, &reservation_ww_class);
-
submit = submit_create(dev, gpu, args->nr_bos, args->nr_pmrs);
if (!submit) {
ret = -ENOMEM;
@@ -541,6 +554,12 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
if (ret)
goto err_submit_objects;
+ ret = submit_sync_user(submit);
+ if (ret)
+ goto err_submit_objects;
+
+ ww_acquire_init(&ticket, &reservation_ww_class);
+
if ((priv->mmu_global->version != ETNAVIV_IOMMU_V2) &&
!etnaviv_cmd_validate_one(gpu, stream, args->stream_size / 4,
relocs, args->nr_relocs)) {
--
2.25.1
More information about the dri-devel
mailing list