freedreno: fix fence creation fail if no rendering
authorRob Clark <robdclark@gmail.com>
Fri, 26 May 2017 14:18:31 +0000 (10:18 -0400)
committerRob Clark <robdclark@gmail.com>
Sun, 28 May 2017 18:49:27 +0000 (14:49 -0400)
Android tries to create a FENCE_FD fence without any rendering.  And
then falls over when that fails.  So just always create an initial
batch.

Fixes: e4ad8695 ("freedreno: fix crash when flush() but no rendering")
Signed-off-by: Rob Clark <robdclark@gmail.com>
src/gallium/drivers/freedreno/freedreno_context.c

index 450f4a803ed36110e8750e386600a739891a0367..1cf366b0c6a62e219b440af2594e6fd756e52e67 100644 (file)
@@ -45,12 +45,6 @@ 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;
 
@@ -283,13 +277,7 @@ fd_context_init(struct fd_context *ctx, struct pipe_screen *pscreen,
                goto fail;
        pctx->const_uploader = pctx->stream_uploader;
 
-       /* TODO what about compute?  Ideally it creates it's own independent
-        * batches per compute job (since it isn't using tiling, so no point
-        * in getting involved with the re-ordering madness)..
-        */
-       if (!screen->reorder) {
-               ctx->batch = fd_bc_alloc_batch(&screen->batch_cache, ctx);
-       }
+       ctx->batch = fd_bc_alloc_batch(&screen->batch_cache, ctx);
 
        slab_create_child(&ctx->transfer_pool, &screen->transfer_pool);