mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 20:38:06 +02:00
gallium: add PIPE_CAP_MAP_UNSYNCHRONIZED_THREAD_SAFE for glthread
and add radeonsi support. Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4758>
This commit is contained in:
parent
6215465842
commit
19eb89b0f3
5 changed files with 23 additions and 5 deletions
|
|
@ -422,6 +422,7 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
|
|||
|
||||
case PIPE_CAP_VIEWPORT_TRANSFORM_LOWERED:
|
||||
case PIPE_CAP_PSIZ_CLAMPED:
|
||||
case PIPE_CAP_MAP_UNSYNCHRONIZED_THREAD_SAFE:
|
||||
return 0;
|
||||
|
||||
case PIPE_CAP_GL_BEGIN_END_BUFFER_SIZE:
|
||||
|
|
|
|||
|
|
@ -576,6 +576,7 @@ The integer capabilities:
|
|||
* ``PIPE_CAP_VIEWPORT_SWIZZLE``: Whether pipe_viewport_state::swizzle can be used to specify pre-clipping swizzling of coordinates (see GL_NV_viewport_swizzle).
|
||||
* ``PIPE_CAP_SYSTEM_SVM``: True if all application memory can be shared with the GPU without explicit mapping.
|
||||
* ``PIPE_CAP_VIEWPORT_MASK``: Whether ``TGSI_SEMANTIC_VIEWPORT_MASK`` and ``TGSI_PROPERTY_LAYER_VIEWPORT_RELATIVE`` are supported (see GL_NV_viewport_array2).
|
||||
* ``PIPE_CAP_MAP_UNSYNCHRONIZED_THREAD_SAFE``: Whether mapping a buffer as unsynchronized from any thread is safe.
|
||||
|
||||
.. _pipe_capf:
|
||||
|
||||
|
|
|
|||
|
|
@ -324,7 +324,9 @@ static void *si_buffer_get_transfer(struct pipe_context *ctx, struct pipe_resour
|
|||
struct si_context *sctx = (struct si_context *)ctx;
|
||||
struct si_transfer *transfer;
|
||||
|
||||
if (usage & TC_TRANSFER_MAP_THREADED_UNSYNC)
|
||||
if (usage & PIPE_TRANSFER_THREAD_SAFE)
|
||||
transfer = malloc(sizeof(*transfer));
|
||||
else if (usage & TC_TRANSFER_MAP_THREADED_UNSYNC)
|
||||
transfer = slab_alloc(&sctx->pool_transfers_unsync);
|
||||
else
|
||||
transfer = slab_alloc(&sctx->pool_transfers);
|
||||
|
|
@ -461,7 +463,7 @@ static void *si_buffer_transfer_map(struct pipe_context *ctx, struct pipe_resour
|
|||
(buf->flags & RADEON_FLAG_SPARSE)) {
|
||||
struct si_resource *staging;
|
||||
|
||||
assert(!(usage & TC_TRANSFER_MAP_THREADED_UNSYNC));
|
||||
assert(!(usage & (TC_TRANSFER_MAP_THREADED_UNSYNC | PIPE_TRANSFER_THREAD_SAFE)));
|
||||
staging = si_resource(pipe_buffer_create(ctx->screen, 0, PIPE_USAGE_STAGING,
|
||||
box->width + (box->x % SI_MAP_BUFFER_ALIGNMENT)));
|
||||
if (staging) {
|
||||
|
|
@ -574,9 +576,14 @@ static void si_buffer_transfer_unmap(struct pipe_context *ctx, struct pipe_trans
|
|||
assert(stransfer->b.staging == NULL); /* for threaded context only */
|
||||
pipe_resource_reference(&transfer->resource, NULL);
|
||||
|
||||
/* Don't use pool_transfers_unsync. We are always in the driver
|
||||
* thread. */
|
||||
slab_free(&sctx->pool_transfers, transfer);
|
||||
if (transfer->usage & PIPE_TRANSFER_THREAD_SAFE) {
|
||||
free(transfer);
|
||||
} else {
|
||||
/* Don't use pool_transfers_unsync. We are always in the driver
|
||||
* thread. Freeing an object into a different pool is allowed.
|
||||
*/
|
||||
slab_free(&sctx->pool_transfers, transfer);
|
||||
}
|
||||
}
|
||||
|
||||
static void si_buffer_subdata(struct pipe_context *ctx, struct pipe_resource *buffer,
|
||||
|
|
|
|||
|
|
@ -161,6 +161,7 @@ static int si_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
|
|||
case PIPE_CAP_GL_SPIRV:
|
||||
case PIPE_CAP_DRAW_INFO_START_WITH_USER_INDICES:
|
||||
case PIPE_CAP_ALPHA_TO_COVERAGE_DITHER_CONTROL:
|
||||
case PIPE_CAP_MAP_UNSYNCHRONIZED_THREAD_SAFE:
|
||||
return 1;
|
||||
|
||||
case PIPE_CAP_QUERY_SO_OVERFLOW:
|
||||
|
|
|
|||
|
|
@ -345,6 +345,13 @@ enum pipe_transfer_usage
|
|||
*/
|
||||
PIPE_TRANSFER_COHERENT = (1 << 14),
|
||||
|
||||
/**
|
||||
* Map a resource in a thread-safe manner, because the calling thread can
|
||||
* be any thread. It can only be used if both WRITE and UNSYNCHRONIZED are
|
||||
* set.
|
||||
*/
|
||||
PIPE_TRANSFER_THREAD_SAFE = 1 << 15,
|
||||
|
||||
/**
|
||||
* This and higher bits are reserved for private use by drivers. Drivers
|
||||
* should use this as (PIPE_TRANSFER_DRV_PRV << i).
|
||||
|
|
@ -938,6 +945,7 @@ enum pipe_cap
|
|||
PIPE_CAP_SYSTEM_SVM,
|
||||
PIPE_CAP_VIEWPORT_MASK,
|
||||
PIPE_CAP_ALPHA_TO_COVERAGE_DITHER_CONTROL,
|
||||
PIPE_CAP_MAP_UNSYNCHRONIZED_THREAD_SAFE,
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue