[PATCH 08/16] drm/etnaviv: always wait for kernel fences
Christian König
ckoenig.leichtzumerken at gmail.com
Wed Apr 6 07:51:24 UTC 2022
Even for explicit synchronization we should wait for kernel fences.
Signed-off-by: Christian König <christian.koenig at amd.com>
---
drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 27 ++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
index 98bb5c9239de..3fedd29732d5 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
@@ -171,6 +171,26 @@ static int submit_lock_objects(struct etnaviv_gem_submit *submit,
return ret;
}
+/* TODO: This should be moved into the GPU scheduler if others need it */
+static int submit_fence_kernel_sync(struct etnaviv_gem_submit *submit,
+ struct dma_resv *resv)
+{
+ struct dma_resv_iter cursor;
+ struct dma_fence *fence;
+ int ret;
+
+ dma_resv_for_each_fence(&cursor, resv, DMA_RESV_USAGE_KERNEL, fence) {
+ /* Make sure to grab an additional ref on the added fence */
+ dma_fence_get(fence);
+ ret = drm_sched_job_add_dependency(&submit->sched_job, fence);
+ if (ret) {
+ dma_fence_put(fence);
+ return ret;
+ }
+ }
+ return 0;
+}
+
static int submit_fence_sync(struct etnaviv_gem_submit *submit)
{
int i, ret = 0;
@@ -183,8 +203,11 @@ static int submit_fence_sync(struct etnaviv_gem_submit *submit)
if (ret)
return ret;
- if (submit->flags & ETNA_SUBMIT_NO_IMPLICIT)
- continue;
+ if (submit->flags & ETNA_SUBMIT_NO_IMPLICIT) {
+ ret = submit_fence_kernel_sync(submit, robj);
+ if (ret)
+ return ret;
+ }
ret = drm_sched_job_add_implicit_dependencies(&submit->sched_job,
&bo->obj->base,
--
2.25.1
More information about the dri-devel
mailing list