From 4c5a13277fe32bb9727bd458f540196c379503d9 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 29 May 2015 17:50:36 -0700 Subject: 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 --- drivers/gpu/drm/vc4/vc4_gem.c | 7 +++++++ 1 file changed, 7 insertions(+) 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: -- cgit v1.2.1