summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/vc4/vc4_draw.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2017-01-04 11:24:31 -0800
committerEric Anholt <eric@anholt.net>2017-01-05 16:23:32 -0800
commitebf33e577aee00cf888c79e11a3b62c181b46510 (patch)
tree142adc22f4a46af254f8a2a38101ef90f844b38c /src/gallium/drivers/vc4/vc4_draw.c
parent076ab157ff2ed7a98b09363bce355247f4ed71e6 (diff)
vc4: Flush the job early if we're referencing too many BOs.
If we get up toward 256MB (or whatever the CMA area size is), VC4_GEM_CREATE will start throwing errors. Even if we don't trigger that, when we flush the kernel's BO allocation for the CLs or bin memory may end up throwing an error, at which point our job won't get rendered at all. Just flush early (half of maximum CMA size) so that hopefully we never get to that point.
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_draw.c')
-rw-r--r--src/gallium/drivers/vc4/vc4_draw.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gallium/drivers/vc4/vc4_draw.c b/src/gallium/drivers/vc4/vc4_draw.c
index 13db9daeb9e..ebd080298a4 100644
--- a/src/gallium/drivers/vc4/vc4_draw.c
+++ b/src/gallium/drivers/vc4/vc4_draw.c
@@ -466,6 +466,13 @@ vc4_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
job->resolve |= PIPE_CLEAR_COLOR0;
+ /* If we've used half of the presumably 256MB CMA area, flush the job
+ * so that we don't accumulate a job that will end up not being
+ * executable.
+ */
+ if (job->bo_space > 128 * 1024 * 1024)
+ vc4_flush(pctx);
+
if (vc4_debug & VC4_DEBUG_ALWAYS_FLUSH)
vc4_flush(pctx);
}