VC4_SUBMIT_CL reports the seqno of the job it queued by re-reading
vc4->emit_seqno once vc4_queue_submit() has returned. That counter is
shared by every submission on the device, so a job queued by another
thread in the meantime bumps it first and the ioctl hands userspace a
seqno belonging to a job it did not submit. Waiting on that seqno means
waiting for unrelated work.
Now that the submit path holds a reference to `exec` until it is done
with the job, report the seqno recorded in it.
Fixes: d5b1a78a772f ("drm/vc4: Add support for drawing 3D frames.")
Signed-off-by: Maíra Canal <[email protected]>
---
drivers/gpu/drm/vc4/vc4_gem.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
index b56952bb6b97..9cf343297f83 100644
--- a/drivers/gpu/drm/vc4/vc4_gem.c
+++ b/drivers/gpu/drm/vc4/vc4_gem.c
@@ -620,7 +620,6 @@ vc4_queue_submit(struct drm_device *dev, struct
vc4_exec_info *exec,
{
struct vc4_dev *vc4 = to_vc4_dev(dev);
struct vc4_exec_info *renderjob;
- uint64_t seqno;
unsigned long irqflags;
struct vc4_fence *fence;
@@ -631,8 +630,7 @@ vc4_queue_submit(struct drm_device *dev, struct
vc4_exec_info *exec,
spin_lock_irqsave(&vc4->job_lock, irqflags);
- seqno = ++vc4->emit_seqno;
- exec->seqno = seqno;
+ exec->seqno = ++vc4->emit_seqno;
dma_fence_init(&fence->base, &vc4_fence_ops, &vc4->job_lock,
vc4->dma_fence_context, exec->seqno);
@@ -1170,7 +1168,7 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data,
goto fail_unreserve;
/* Return the seqno for our job. */
- args->seqno = vc4->emit_seqno;
+ args->seqno = exec->seqno;
vc4_exec_put(exec);
--
2.55.0