summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Clark <robdclark@gmail.com>2017-05-14 11:32:44 -0400
committerEmil Velikov <emil.l.velikov@gmail.com>2017-05-18 18:45:20 +0100
commit6c5bcc6473eaa01982122b51a6561edf94073767 (patch)
treeeb7096e86e3d1abea63c8b49066e4d8cf1f932ec
parent15338b0d1903a85abc2dec14c76e87893627e992 (diff)
downloadmesa-6c5bcc6473eaa01982122b51a6561edf94073767.tar.gz
freedreno: fix crash when flush() but no rendering
If we haven't created a batch, just bail in pipe->flush(), since there is nothing to do. Fixes crash in warsow, which creates a whole bunch of contexts used for nothing but texture uploads. Signed-off-by: Rob Clark <robdclark@gmail.com> (cherry picked from commit e4ad86952a197549894eb4c9a96af0c76dd95d18)
-rw-r--r--src/gallium/drivers/freedreno/freedreno_context.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_context.c b/src/gallium/drivers/freedreno/freedreno_context.c
index 6478e0e7a9c..5e708a2be40 100644
--- a/src/gallium/drivers/freedreno/freedreno_context.c
+++ b/src/gallium/drivers/freedreno/freedreno_context.c
@@ -45,6 +45,12 @@ fd_context_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence,
{
struct fd_context *ctx = fd_context(pctx);
+ if (!ctx->batch) {
+ if (fence)
+ *fence = NULL;
+ return;
+ }
+
if (flags & PIPE_FLUSH_FENCE_FD)
ctx->batch->needs_out_fence_fd = true;