radeonsi: rename buffer functions so as not to reference rings

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7908>
This commit is contained in:
Marek Olšák 2020-12-03 18:01:11 -05:00 committed by Marge Bot
parent ab1377cf92
commit 5b81194fee
6 changed files with 19 additions and 19 deletions

View File

@ -79,7 +79,7 @@ static bool gfx10_alloc_query_buffer(struct si_context *sctx)
qbuf = list_first_entry(&sctx->shader_query_buffers, struct gfx10_sh_query_buffer, list);
if (!qbuf->refcount &&
!si_rings_is_buffer_referenced(sctx, qbuf->buf->buf, RADEON_USAGE_READWRITE) &&
!si_cs_is_buffer_referenced(sctx, qbuf->buf->buf, RADEON_USAGE_READWRITE) &&
sctx->ws->buffer_wait(qbuf->buf->buf, 0, RADEON_USAGE_READWRITE)) {
/* Can immediately re-use the oldest buffer */
list_del(&qbuf->list);
@ -251,7 +251,7 @@ static bool gfx10_sh_query_get_result(struct si_context *sctx, struct si_query *
if (rquery->b.flushed)
map = sctx->ws->buffer_map(qbuf->buf->buf, NULL, usage);
else
map = si_buffer_map_sync_with_rings(sctx, qbuf->buf, usage);
map = si_buffer_map(sctx, qbuf->buf, usage);
if (!map)
return false;

View File

@ -30,8 +30,8 @@
#include <inttypes.h>
#include <stdio.h>
bool si_rings_is_buffer_referenced(struct si_context *sctx, struct pb_buffer *buf,
enum radeon_bo_usage usage)
bool si_cs_is_buffer_referenced(struct si_context *sctx, struct pb_buffer *buf,
enum radeon_bo_usage usage)
{
if (sctx->ws->cs_is_buffer_referenced(&sctx->gfx_cs, buf, usage)) {
return true;
@ -43,8 +43,8 @@ bool si_rings_is_buffer_referenced(struct si_context *sctx, struct pb_buffer *bu
return false;
}
void *si_buffer_map_sync_with_rings(struct si_context *sctx, struct si_resource *resource,
unsigned usage)
void *si_buffer_map(struct si_context *sctx, struct si_resource *resource,
unsigned usage)
{
enum radeon_bo_usage rusage = RADEON_USAGE_READWRITE;
bool busy = false;
@ -300,7 +300,7 @@ static bool si_invalidate_buffer(struct si_context *sctx, struct si_resource *bu
return false;
/* Check if mapping this buffer would cause waiting for the GPU. */
if (si_rings_is_buffer_referenced(sctx, buf->buf, RADEON_USAGE_READWRITE) ||
if (si_cs_is_buffer_referenced(sctx, buf->buf, RADEON_USAGE_READWRITE) ||
!sctx->ws->buffer_wait(buf->buf, 0, RADEON_USAGE_READWRITE)) {
/* Reallocate the buffer in the same pipe_resource. */
si_alloc_resource(sctx->screen, buf);
@ -457,7 +457,7 @@ static void *si_buffer_transfer_map(struct pipe_context *ctx, struct pipe_resour
/* Check if mapping this buffer would cause waiting for the GPU.
*/
if (buf->flags & RADEON_FLAG_SPARSE || force_discard_range ||
si_rings_is_buffer_referenced(sctx, buf->buf, RADEON_USAGE_READWRITE) ||
si_cs_is_buffer_referenced(sctx, buf->buf, RADEON_USAGE_READWRITE) ||
!sctx->ws->buffer_wait(buf->buf, 0, RADEON_USAGE_READWRITE)) {
/* Do a wait-free write-only transfer using a temporary buffer. */
struct u_upload_mgr *uploader;
@ -505,7 +505,7 @@ static void *si_buffer_transfer_map(struct pipe_context *ctx, struct pipe_resour
si_sdma_copy_buffer(sctx, &staging->b.b, resource, box->x % SI_MAP_BUFFER_ALIGNMENT,
box->x, box->width);
data = si_buffer_map_sync_with_rings(sctx, staging, usage & ~PIPE_MAP_UNSYNCHRONIZED);
data = si_buffer_map(sctx, staging, usage & ~PIPE_MAP_UNSYNCHRONIZED);
if (!data) {
si_resource_reference(&staging, NULL);
return NULL;
@ -518,7 +518,7 @@ static void *si_buffer_transfer_map(struct pipe_context *ctx, struct pipe_resour
}
}
data = si_buffer_map_sync_with_rings(sctx, buf, usage);
data = si_buffer_map(sctx, buf, usage);
if (!data) {
return NULL;
}

View File

@ -1060,7 +1060,7 @@ static bool si_pc_query_get_result(struct si_context *sctx, struct si_query *squ
if (squery->b.flushed)
map = sctx->ws->buffer_map(qbuf->buf->buf, NULL, usage);
else
map = si_buffer_map_sync_with_rings(sctx, qbuf->buf, usage);
map = si_buffer_map(sctx, qbuf->buf, usage);
if (!map)
return false;

View File

@ -1320,10 +1320,10 @@ void si_decompress_dcc(struct si_context *sctx, struct si_texture *tex);
void si_flush_implicit_resources(struct si_context *sctx);
/* si_buffer.c */
bool si_rings_is_buffer_referenced(struct si_context *sctx, struct pb_buffer *buf,
enum radeon_bo_usage usage);
void *si_buffer_map_sync_with_rings(struct si_context *sctx, struct si_resource *resource,
unsigned usage);
bool si_cs_is_buffer_referenced(struct si_context *sctx, struct pb_buffer *buf,
enum radeon_bo_usage usage);
void *si_buffer_map(struct si_context *sctx, struct si_resource *resource,
unsigned usage);
void si_init_resource_fields(struct si_screen *sscreen, struct si_resource *res, uint64_t size,
unsigned alignment);
bool si_alloc_resource(struct si_screen *sscreen, struct si_resource *res);

View File

@ -607,7 +607,7 @@ void si_query_buffer_reset(struct si_context *sctx, struct si_query_buffer *buff
return;
/* Discard even the oldest buffer if it can't be mapped without a stall. */
if (si_rings_is_buffer_referenced(sctx, buffer->buf->buf, RADEON_USAGE_READWRITE) ||
if (si_cs_is_buffer_referenced(sctx, buffer->buf->buf, RADEON_USAGE_READWRITE) ||
!sctx->ws->buffer_wait(buffer->buf->buf, 0, RADEON_USAGE_READWRITE)) {
si_resource_reference(&buffer->buf, NULL);
} else {
@ -1462,7 +1462,7 @@ bool si_query_hw_get_result(struct si_context *sctx, struct si_query *squery, bo
if (squery->b.flushed)
map = sctx->ws->buffer_map(qbuf->buf->buf, NULL, usage);
else
map = si_buffer_map_sync_with_rings(sctx, qbuf->buf, usage);
map = si_buffer_map(sctx, qbuf->buf, usage);
if (!map)
return false;

View File

@ -1877,7 +1877,7 @@ static void *si_texture_transfer_map(struct pipe_context *ctx, struct pipe_resou
use_staging_texture =
tex->buffer.domains & RADEON_DOMAIN_VRAM || tex->buffer.flags & RADEON_FLAG_GTT_WC;
/* Write & linear only: */
else if (si_rings_is_buffer_referenced(sctx, tex->buffer.buf, RADEON_USAGE_READWRITE) ||
else if (si_cs_is_buffer_referenced(sctx, tex->buffer.buf, RADEON_USAGE_READWRITE) ||
!sctx->ws->buffer_wait(tex->buffer.buf, 0, RADEON_USAGE_READWRITE)) {
/* It's busy. */
if (si_can_invalidate_texture(sctx->screen, tex, usage, box))
@ -1955,7 +1955,7 @@ static void *si_texture_transfer_map(struct pipe_context *ctx, struct pipe_resou
if (sizeof(void *) == 4)
usage |= RADEON_MAP_TEMPORARY;
if (!(map = si_buffer_map_sync_with_rings(sctx, buf, usage)))
if (!(map = si_buffer_map(sctx, buf, usage)))
goto fail_trans;
*ptransfer = &trans->b.b;