freedreno: Put an upper limit on VSC size

Left unchecked, an app that just did an endless series of draws could
result in VSC buffer sizes >4GB, which doesn't work out well.

This limit is semi-arbitrary (ie. it is lower than hw limit, but 32*8MB
seems a bit excessive and not a limit that you'd hit in the real world).

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8842>
This commit is contained in:
Rob Clark 2021-02-02 12:32:22 -08:00 committed by Marge Bot
parent ff61e9b54d
commit c167b773fe
1 changed files with 7 additions and 0 deletions

View File

@ -525,6 +525,13 @@ fd_batch_check_size(struct fd_batch *batch)
return;
}
/* Place a reasonable upper bound on prim/draw stream buffer size: */
const unsigned limit_bits = 8 * 8 * 1024 * 1024;
if ((batch->prim_strm_bits > limit_bits) || (batch->draw_strm_bits > limit_bits)) {
fd_batch_flush(batch);
return;
}
if (fd_device_version(batch->ctx->screen->dev) >= FD_VERSION_UNLIMITED_CMDS)
return;