summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2015-05-29 17:50:36 -0700
committerEric Anholt <eric@anholt.net>2015-06-04 14:15:40 -0700
commit4c5a13277fe32bb9727bd458f540196c379503d9 (patch)
treecf66187b8cba2b4cd61e36295286f980b4f0911e
parentd161078693e34a3315d5fd8bee9916eebfc72df3 (diff)
downloadlinux-4c5a13277fe32bb9727bd458f540196c379503d9.tar.gz
drm/vc4: Prevent clients from racing far ahead of execution.
This is policy that we've often left up to userland in various DRM drivers. However, given how thoroughly memory-constrained we are on VC4, letting userspace run away with things and over-inflate their caches is definitely not helping. This hasn't reduced maximum throughput in my testing, since we're only waiting until the exec just before the one we queued is finished, so there will be a job to submit the moment the GPU sends us the frame done interrupt. We would only actually idle the GPU if assembling some scenes takes more CPU time than the time it takes to complete some scenes on the GPU. Signed-off-by: Eric Anholt <eric@anholt.net>
-rw-r--r--drivers/gpu/drm/vc4/vc4_gem.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
index abc0684d7e28..bedf53e02e8e 100644
--- a/drivers/gpu/drm/vc4/vc4_gem.c
+++ b/drivers/gpu/drm/vc4/vc4_gem.c
@@ -604,6 +604,13 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data,
args->seqno = vc4->emit_seqno;
mutex_unlock(&dev->struct_mutex);
+
+ /* To keep any client from getting too far ahead (particularly
+ * a problem when BO caching is involved), we wait on the
+ * previous rendering before returning to userspace.
+ */
+ vc4_wait_for_seqno(dev, args->seqno - 1, ~0ull);
+
return 0;
fail: