zink: block oom flushes during unordered blits
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Wed, 29 Mar 2023 20:41:44 +0000 (16:41 -0400)
committerMarge Bot <emma+marge@anholt.net>
Tue, 11 Apr 2023 18:59:13 +0000 (18:59 +0000)
this is broken beyond space and time

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22412>

src/gallium/drivers/zink/zink_context.c
src/gallium/drivers/zink/zink_draw.cpp

index 144ce2e7ea08e4b48428678e4d241aa766a85c96..6518c3b271c075608772f6282f97492bdc1f1d27 100644 (file)
@@ -3172,6 +3172,7 @@ static void
 flush_batch(struct zink_context *ctx, bool sync)
 {
    struct zink_batch *batch = &ctx->batch;
+   assert(!ctx->unordered_blitting);
    if (ctx->clears_enabled)
       /* start rp to do all the clears */
       zink_batch_rp(ctx);
@@ -3502,7 +3503,7 @@ zink_set_framebuffer_state(struct pipe_context *pctx,
    ctx->gfx_pipeline_state.rast_samples = rast_samples;
 
    /* this is an ideal time to oom flush since it won't split a renderpass */
-   if (ctx->oom_flush)
+   if (ctx->oom_flush && !ctx->unordered_blitting)
       flush_batch(ctx, false);
    else
       update_layered_rendering_state(ctx);
index f4efa6389a05923b178248fddae3390c8d792923..7d39a94c7f5210b24faf4ed6ac307593036b1ed7 100644 (file)
@@ -906,7 +906,7 @@ zink_draw(struct pipe_context *pctx,
    batch->last_was_compute = false;
    ctx->batch.work_count = work_count;
    /* flush if there's >100k draws */
-   if (unlikely(work_count >= 30000) || ctx->oom_flush)
+   if (!ctx->unordered_blitting && (unlikely(work_count >= 30000) || ctx->oom_flush))
       pctx->flush(pctx, NULL, 0);
 }
 
@@ -1079,7 +1079,7 @@ zink_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info)
    batch->has_work = true;
    batch->last_was_compute = true;
    /* flush if there's >100k computes */
-   if (unlikely(ctx->batch.work_count >= 30000) || ctx->oom_flush)
+   if (!ctx->unordered_blitting && (unlikely(ctx->batch.work_count >= 30000) || ctx->oom_flush))
       pctx->flush(pctx, NULL, 0);
 }