radeonsi: always use RADEON_USAGE_DISALLOW_SLOW_REPLY

All places are fine with getting a false negative as long as buffer_wait
returns quickly. This can improve performance.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32877>
This commit is contained in:
Marek Olšák
2025-01-03 11:42:26 -05:00
committed by Marge Bot
parent 271d5edf87
commit f72a11f38d
5 changed files with 12 additions and 6 deletions
+2 -1
View File
@@ -62,7 +62,8 @@ static bool gfx11_alloc_query_buffer(struct si_context *sctx)
qbuf = list_first_entry(&sctx->shader_query_buffers, struct gfx11_sh_query_buffer, list);
if (!qbuf->refcount &&
!si_cs_is_buffer_referenced(sctx, qbuf->buf->buf, RADEON_USAGE_READWRITE) &&
sctx->ws->buffer_wait(sctx->ws, qbuf->buf->buf, 0, RADEON_USAGE_READWRITE)) {
sctx->ws->buffer_wait(sctx->ws, qbuf->buf->buf, 0,
RADEON_USAGE_READWRITE | RADEON_USAGE_DISALLOW_SLOW_REPLY)) {
/* Can immediately re-use the oldest buffer */
list_del(&qbuf->list);
} else {
+4 -2
View File
@@ -256,7 +256,8 @@ static bool si_invalidate_buffer(struct si_context *sctx, struct si_resource *bu
/* Check if mapping this buffer would cause waiting for the GPU. */
if (si_cs_is_buffer_referenced(sctx, buf->buf, RADEON_USAGE_READWRITE) ||
!sctx->ws->buffer_wait(sctx->ws, buf->buf, 0, RADEON_USAGE_READWRITE)) {
!sctx->ws->buffer_wait(sctx->ws, buf->buf, 0,
RADEON_USAGE_READWRITE | RADEON_USAGE_DISALLOW_SLOW_REPLY)) {
/* Reallocate the buffer in the same pipe_resource. */
si_alloc_resource(sctx->screen, buf);
si_rebind_buffer(sctx, &buf->b.b);
@@ -399,7 +400,8 @@ static void *si_buffer_transfer_map(struct pipe_context *ctx, struct pipe_resour
if (buf->flags & (RADEON_FLAG_SPARSE | RADEON_FLAG_NO_CPU_ACCESS) ||
force_discard_range ||
si_cs_is_buffer_referenced(sctx, buf->buf, RADEON_USAGE_READWRITE) ||
!sctx->ws->buffer_wait(sctx->ws, buf->buf, 0, RADEON_USAGE_READWRITE)) {
!sctx->ws->buffer_wait(sctx->ws, buf->buf, 0,
RADEON_USAGE_READWRITE | RADEON_USAGE_DISALLOW_SLOW_REPLY)) {
/* Do a wait-free write-only transfer using a temporary buffer. */
struct u_upload_mgr *uploader;
struct si_resource *staging = NULL;
+2 -1
View File
@@ -908,7 +908,8 @@ static bool si_is_resource_busy(struct pipe_screen *screen, struct pipe_resource
/* If mapping for write, we need to wait for all reads and writes.
* If mapping for read, we only need to wait for writes.
*/
usage & PIPE_MAP_WRITE ? RADEON_USAGE_READWRITE : RADEON_USAGE_WRITE);
(usage & PIPE_MAP_WRITE ? RADEON_USAGE_READWRITE : RADEON_USAGE_WRITE) |
RADEON_USAGE_DISALLOW_SLOW_REPLY);
}
static struct pipe_context *si_pipe_create_context(struct pipe_screen *screen, void *priv,
+2 -1
View File
@@ -518,7 +518,8 @@ void si_query_buffer_reset(struct si_context *sctx, struct si_query_buffer *buff
/* Discard even the oldest buffer if it can't be mapped without a stall. */
if (si_cs_is_buffer_referenced(sctx, buffer->buf->buf, RADEON_USAGE_READWRITE) ||
!sctx->ws->buffer_wait(sctx->ws, buffer->buf->buf, 0, RADEON_USAGE_READWRITE)) {
!sctx->ws->buffer_wait(sctx->ws, buffer->buf->buf, 0,
RADEON_USAGE_READWRITE | RADEON_USAGE_DISALLOW_SLOW_REPLY)) {
si_resource_reference(&buffer->buf, NULL);
}
}
+2 -1
View File
@@ -2064,7 +2064,8 @@ static void *si_texture_transfer_map(struct pipe_context *ctx, struct pipe_resou
tex->buffer.domains & RADEON_DOMAIN_VRAM || tex->buffer.flags & RADEON_FLAG_GTT_WC;
/* Write & linear only: */
else if (si_cs_is_buffer_referenced(sctx, tex->buffer.buf, RADEON_USAGE_READWRITE) ||
!sctx->ws->buffer_wait(sctx->ws, tex->buffer.buf, 0, RADEON_USAGE_READWRITE)) {
!sctx->ws->buffer_wait(sctx->ws, tex->buffer.buf, 0,
RADEON_USAGE_READWRITE | RADEON_USAGE_DISALLOW_SLOW_REPLY)) {
/* It's busy. */
if (si_can_invalidate_texture(sctx->screen, tex, usage, box))
si_texture_invalidate_storage(sctx, tex);