freedreno: defer flush_queue allocation
authorRob Clark <robdclark@gmail.com>
Fri, 22 Jul 2016 21:55:59 +0000 (17:55 -0400)
committerRob Clark <robdclark@gmail.com>
Sat, 30 Jul 2016 13:23:42 +0000 (09:23 -0400)
Some apps, like warsow, create a bazillion contexts but don't render on
most of them.

Signed-off-by: Rob Clark <robdclark@gmail.com>
src/gallium/drivers/freedreno/freedreno_batch.c
src/gallium/drivers/freedreno/freedreno_context.c

index 76aaac8..276f6be 100644 (file)
@@ -265,6 +265,10 @@ batch_flush(struct fd_batch *batch)
        if (batch->ctx->screen->reorder) {
                struct fd_batch *tmp = NULL;
                fd_batch_reference(&tmp, batch);
+
+               if (!util_queue_is_initialized(&batch->ctx->flush_queue))
+                       util_queue_init(&batch->ctx->flush_queue, "flush_queue", 16, 1);
+
                util_queue_add_job(&batch->ctx->flush_queue,
                                batch, &batch->flush_fence,
                                batch_flush_func, batch_cleanup_func);
index 269602e..ab2faa4 100644 (file)
@@ -184,8 +184,6 @@ fd_context_init(struct fd_context *ctx, struct pipe_screen *pscreen,
         */
        if (!screen->reorder) {
                ctx->batch = fd_bc_alloc_batch(&screen->batch_cache, ctx);
-       } else {
-               util_queue_init(&ctx->flush_queue, "flush_queue", 16, 1);
        }
 
        util_slab_create(&ctx->transfer_pool, sizeof(struct fd_transfer),