freedreno: fix crash when flush() but no rendering
authorRob Clark <robdclark@gmail.com>
Sun, 14 May 2017 15:32:44 +0000 (11:32 -0400)
committerRob Clark <robdclark@gmail.com>
Sun, 14 May 2017 19:10:08 +0000 (15:10 -0400)
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>
src/gallium/drivers/freedreno/freedreno_context.c

index 8a86f0be149f1392260a083d4947b586ed034f11..450f4a803ed36110e8750e386600a739891a0367 100644 (file)
@@ -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;