radeonsi: take scratch buffer and draw indirect memory usage into account
authorMarek Olšák <marek.olsak@amd.com>
Fri, 29 Jul 2016 14:33:50 +0000 (16:33 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Sat, 6 Aug 2016 11:56:14 +0000 (13:56 +0200)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeonsi/si_state_draw.c

index 30b644ee42b5fbb9c72ec1b2363ef64b8a7f29cb..e4af4c7bd704501ecbad38aece13dc0e27667a22 100644 (file)
@@ -989,6 +989,12 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
        if (sctx->b.flags)
                si_mark_atom_dirty(sctx, sctx->atoms.s.cache_flush);
 
+       /* Add buffer sizes for memory checking in need_cs_space. */
+       if (sctx->emit_scratch_reloc && sctx->scratch_buffer)
+               r600_context_add_resource_size(ctx, &sctx->scratch_buffer->b.b);
+       if (info->indirect)
+               r600_context_add_resource_size(ctx, info->indirect);
+
        si_need_cs_space(sctx);
 
        /* Emit states. */