gallium: inline struct u_suballocator to remove dereferences
Reviewed-by: Eric Anholt <eric@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7901>
This commit is contained in:
@@ -36,21 +36,6 @@
|
|||||||
|
|
||||||
#include "u_suballoc.h"
|
#include "u_suballoc.h"
|
||||||
|
|
||||||
|
|
||||||
struct u_suballocator {
|
|
||||||
struct pipe_context *pipe;
|
|
||||||
|
|
||||||
unsigned size; /* Size of the whole buffer, in bytes. */
|
|
||||||
unsigned bind; /* Bitmask of PIPE_BIND_* flags. */
|
|
||||||
enum pipe_resource_usage usage;
|
|
||||||
unsigned flags; /* bitmask of PIPE_RESOURCE_FLAG_x */
|
|
||||||
boolean zero_buffer_memory; /* If the buffer contents should be zeroed. */
|
|
||||||
|
|
||||||
struct pipe_resource *buffer; /* The buffer we suballocate from. */
|
|
||||||
unsigned offset; /* Aligned offset pointing at the first unused byte. */
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a suballocator.
|
* Create a suballocator.
|
||||||
*
|
*
|
||||||
@@ -59,14 +44,14 @@ struct u_suballocator {
|
|||||||
* cleared to 0 after the allocation.
|
* cleared to 0 after the allocation.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
struct u_suballocator *
|
void
|
||||||
u_suballocator_create(struct pipe_context *pipe, unsigned size, unsigned bind,
|
u_suballocator_init(struct u_suballocator *allocator,
|
||||||
enum pipe_resource_usage usage, unsigned flags,
|
struct pipe_context *pipe,
|
||||||
boolean zero_buffer_memory)
|
unsigned size, unsigned bind,
|
||||||
|
enum pipe_resource_usage usage, unsigned flags,
|
||||||
|
boolean zero_buffer_memory)
|
||||||
{
|
{
|
||||||
struct u_suballocator *allocator = CALLOC_STRUCT(u_suballocator);
|
memset(allocator, 0, sizeof(*allocator));
|
||||||
if (!allocator)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
allocator->pipe = pipe;
|
allocator->pipe = pipe;
|
||||||
allocator->size = size;
|
allocator->size = size;
|
||||||
@@ -74,14 +59,12 @@ u_suballocator_create(struct pipe_context *pipe, unsigned size, unsigned bind,
|
|||||||
allocator->usage = usage;
|
allocator->usage = usage;
|
||||||
allocator->flags = flags;
|
allocator->flags = flags;
|
||||||
allocator->zero_buffer_memory = zero_buffer_memory;
|
allocator->zero_buffer_memory = zero_buffer_memory;
|
||||||
return allocator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
u_suballocator_destroy(struct u_suballocator *allocator)
|
u_suballocator_destroy(struct u_suballocator *allocator)
|
||||||
{
|
{
|
||||||
pipe_resource_reference(&allocator->buffer, NULL);
|
pipe_resource_reference(&allocator->buffer, NULL);
|
||||||
FREE(allocator);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@@ -31,16 +31,31 @@
|
|||||||
#ifndef U_SUBALLOC
|
#ifndef U_SUBALLOC
|
||||||
#define U_SUBALLOC
|
#define U_SUBALLOC
|
||||||
|
|
||||||
struct u_suballocator;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct u_suballocator *
|
struct pipe_context;
|
||||||
u_suballocator_create(struct pipe_context *pipe, unsigned size, unsigned bind,
|
|
||||||
enum pipe_resource_usage usage, unsigned flags,
|
struct u_suballocator {
|
||||||
boolean zero_buffer_memory);
|
struct pipe_context *pipe;
|
||||||
|
|
||||||
|
unsigned size; /* Size of the whole buffer, in bytes. */
|
||||||
|
unsigned bind; /* Bitmask of PIPE_BIND_* flags. */
|
||||||
|
enum pipe_resource_usage usage;
|
||||||
|
unsigned flags; /* bitmask of PIPE_RESOURCE_FLAG_x */
|
||||||
|
boolean zero_buffer_memory; /* If the buffer contents should be zeroed. */
|
||||||
|
|
||||||
|
struct pipe_resource *buffer; /* The buffer we suballocate from. */
|
||||||
|
unsigned offset; /* Aligned offset pointing at the first unused byte. */
|
||||||
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
u_suballocator_init(struct u_suballocator *allocator,
|
||||||
|
struct pipe_context *pipe,
|
||||||
|
unsigned size, unsigned bind,
|
||||||
|
enum pipe_resource_usage usage, unsigned flags,
|
||||||
|
boolean zero_buffer_memory);
|
||||||
|
|
||||||
void
|
void
|
||||||
u_suballocator_destroy(struct u_suballocator *allocator);
|
u_suballocator_destroy(struct u_suballocator *allocator);
|
||||||
|
@@ -76,7 +76,7 @@ d3d12_context_destroy(struct pipe_context *pctx)
|
|||||||
d3d12_gfx_pipeline_state_cache_destroy(ctx);
|
d3d12_gfx_pipeline_state_cache_destroy(ctx);
|
||||||
d3d12_root_signature_cache_destroy(ctx);
|
d3d12_root_signature_cache_destroy(ctx);
|
||||||
|
|
||||||
u_suballocator_destroy(ctx->query_allocator);
|
u_suballocator_destroy(&ctx->query_allocator);
|
||||||
|
|
||||||
if (pctx->stream_uploader)
|
if (pctx->stream_uploader)
|
||||||
u_upload_destroy(pctx->stream_uploader);
|
u_upload_destroy(pctx->stream_uploader);
|
||||||
@@ -1354,7 +1354,7 @@ d3d12_set_stream_output_targets(struct pipe_context *pctx,
|
|||||||
|
|
||||||
if (target) {
|
if (target) {
|
||||||
/* Sub-allocate a new fill buffer each time to avoid GPU/CPU synchronization */
|
/* Sub-allocate a new fill buffer each time to avoid GPU/CPU synchronization */
|
||||||
u_suballocator_alloc(ctx->so_allocator, sizeof(uint64_t), 4,
|
u_suballocator_alloc(&ctx->so_allocator, sizeof(uint64_t), 4,
|
||||||
&target->fill_buffer_offset, &target->fill_buffer);
|
&target->fill_buffer_offset, &target->fill_buffer);
|
||||||
fill_stream_output_buffer_view(&ctx->so_buffer_views[i], target);
|
fill_stream_output_buffer_view(&ctx->so_buffer_views[i], target);
|
||||||
pipe_so_target_reference(&ctx->so_targets[i], targets[i]);
|
pipe_so_target_reference(&ctx->so_targets[i], targets[i]);
|
||||||
@@ -1407,7 +1407,7 @@ d3d12_enable_fake_so_buffers(struct d3d12_context *ctx, unsigned factor)
|
|||||||
PIPE_BIND_STREAM_OUTPUT,
|
PIPE_BIND_STREAM_OUTPUT,
|
||||||
PIPE_USAGE_STAGING,
|
PIPE_USAGE_STAGING,
|
||||||
target->base.buffer->width0 * factor);
|
target->base.buffer->width0 * factor);
|
||||||
u_suballocator_alloc(ctx->so_allocator, sizeof(uint64_t), 4,
|
u_suballocator_alloc(&ctx->so_allocator, sizeof(uint64_t), 4,
|
||||||
&fake_target->fill_buffer_offset, &fake_target->fill_buffer);
|
&fake_target->fill_buffer_offset, &fake_target->fill_buffer);
|
||||||
pipe_buffer_read(&ctx->base, target->fill_buffer,
|
pipe_buffer_read(&ctx->base, target->fill_buffer,
|
||||||
target->fill_buffer_offset, sizeof(uint64_t),
|
target->fill_buffer_offset, sizeof(uint64_t),
|
||||||
@@ -1913,9 +1913,9 @@ d3d12_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
|
|||||||
|
|
||||||
ctx->base.stream_uploader = u_upload_create_default(&ctx->base);
|
ctx->base.stream_uploader = u_upload_create_default(&ctx->base);
|
||||||
ctx->base.const_uploader = u_upload_create_default(&ctx->base);
|
ctx->base.const_uploader = u_upload_create_default(&ctx->base);
|
||||||
ctx->so_allocator = u_suballocator_create(&ctx->base, 4096, 0,
|
u_suballocator_init(&ctx->so_allocator, &ctx->base, 4096, 0,
|
||||||
PIPE_USAGE_DEFAULT,
|
PIPE_USAGE_DEFAULT,
|
||||||
0, true);
|
0, true);
|
||||||
|
|
||||||
struct primconvert_config cfg;
|
struct primconvert_config cfg;
|
||||||
cfg.primtypes_mask = 1 << PIPE_PRIM_POINTS |
|
cfg.primtypes_mask = 1 << PIPE_PRIM_POINTS |
|
||||||
|
@@ -166,8 +166,8 @@ struct d3d12_context {
|
|||||||
struct slab_child_pool transfer_pool;
|
struct slab_child_pool transfer_pool;
|
||||||
struct primconvert_context *primconvert;
|
struct primconvert_context *primconvert;
|
||||||
struct blitter_context *blitter;
|
struct blitter_context *blitter;
|
||||||
struct u_suballocator *query_allocator;
|
struct u_suballocator query_allocator;
|
||||||
struct u_suballocator *so_allocator;
|
struct u_suballocator so_allocator;
|
||||||
struct hash_table *pso_cache;
|
struct hash_table *pso_cache;
|
||||||
struct hash_table *root_signature_cache;
|
struct hash_table *root_signature_cache;
|
||||||
struct hash_table *gs_variant_cache;
|
struct hash_table *gs_variant_cache;
|
||||||
|
@@ -144,7 +144,7 @@ d3d12_create_query(struct pipe_context *pctx,
|
|||||||
|
|
||||||
/* Query result goes into a readback buffer */
|
/* Query result goes into a readback buffer */
|
||||||
size_t buffer_size = query->query_size * query->num_queries;
|
size_t buffer_size = query->query_size * query->num_queries;
|
||||||
u_suballocator_alloc(ctx->query_allocator, buffer_size, 256,
|
u_suballocator_alloc(&ctx->query_allocator, buffer_size, 256,
|
||||||
&query->buffer_offset, &query->buffer);
|
&query->buffer_offset, &query->buffer);
|
||||||
|
|
||||||
return (struct pipe_query *)query;
|
return (struct pipe_query *)query;
|
||||||
@@ -509,9 +509,8 @@ d3d12_context_query_init(struct pipe_context *pctx)
|
|||||||
struct d3d12_context *ctx = d3d12_context(pctx);
|
struct d3d12_context *ctx = d3d12_context(pctx);
|
||||||
list_inithead(&ctx->active_queries);
|
list_inithead(&ctx->active_queries);
|
||||||
|
|
||||||
ctx->query_allocator =
|
u_suballocator_init(&ctx->query_allocator, &ctx->base, 4096, 0, PIPE_USAGE_STAGING,
|
||||||
u_suballocator_create(&ctx->base, 4096, 0, PIPE_USAGE_STAGING,
|
0, true);
|
||||||
0, true);
|
|
||||||
|
|
||||||
pctx->create_query = d3d12_create_query;
|
pctx->create_query = d3d12_create_query;
|
||||||
pctx->destroy_query = d3d12_destroy_query;
|
pctx->destroy_query = d3d12_destroy_query;
|
||||||
|
@@ -2765,7 +2765,7 @@ void *r600_create_vertex_fetch_shader(struct pipe_context *ctx,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
u_suballocator_alloc(rctx->allocator_fetch_shader, fs_size, 256,
|
u_suballocator_alloc(&rctx->allocator_fetch_shader, fs_size, 256,
|
||||||
&shader->offset,
|
&shader->offset,
|
||||||
(struct pipe_resource**)&shader->buffer);
|
(struct pipe_resource**)&shader->buffer);
|
||||||
if (!shader->buffer) {
|
if (!shader->buffer) {
|
||||||
|
@@ -451,7 +451,7 @@ void r600_emit_pfp_sync_me(struct r600_context *rctx)
|
|||||||
uint64_t va;
|
uint64_t va;
|
||||||
|
|
||||||
/* 16-byte address alignment is required by WAIT_REG_MEM. */
|
/* 16-byte address alignment is required by WAIT_REG_MEM. */
|
||||||
u_suballocator_alloc(rctx->b.allocator_zeroed_memory, 4, 16,
|
u_suballocator_alloc(&rctx->b.allocator_zeroed_memory, 4, 16,
|
||||||
&offset, (struct pipe_resource**)&buf);
|
&offset, (struct pipe_resource**)&buf);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
/* This is too heavyweight, but will work. */
|
/* This is too heavyweight, but will work. */
|
||||||
|
@@ -118,9 +118,7 @@ static void r600_destroy_context(struct pipe_context *context)
|
|||||||
if (rctx->blitter) {
|
if (rctx->blitter) {
|
||||||
util_blitter_destroy(rctx->blitter);
|
util_blitter_destroy(rctx->blitter);
|
||||||
}
|
}
|
||||||
if (rctx->allocator_fetch_shader) {
|
u_suballocator_destroy(&rctx->allocator_fetch_shader);
|
||||||
u_suballocator_destroy(rctx->allocator_fetch_shader);
|
|
||||||
}
|
|
||||||
|
|
||||||
r600_release_command_buffer(&rctx->start_cs_cmd);
|
r600_release_command_buffer(&rctx->start_cs_cmd);
|
||||||
|
|
||||||
@@ -215,11 +213,8 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen,
|
|||||||
r600_context_gfx_flush, rctx, false);
|
r600_context_gfx_flush, rctx, false);
|
||||||
rctx->b.gfx.flush = r600_context_gfx_flush;
|
rctx->b.gfx.flush = r600_context_gfx_flush;
|
||||||
|
|
||||||
rctx->allocator_fetch_shader =
|
u_suballocator_init(&rctx->allocator_fetch_shader, &rctx->b.b, 64 * 1024,
|
||||||
u_suballocator_create(&rctx->b.b, 64 * 1024,
|
0, PIPE_USAGE_DEFAULT, 0, FALSE);
|
||||||
0, PIPE_USAGE_DEFAULT, 0, FALSE);
|
|
||||||
if (!rctx->allocator_fetch_shader)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
rctx->isa = calloc(1, sizeof(struct r600_isa));
|
rctx->isa = calloc(1, sizeof(struct r600_isa));
|
||||||
if (!rctx->isa || r600_isa_init(rctx, rctx->isa))
|
if (!rctx->isa || r600_isa_init(rctx, rctx->isa))
|
||||||
|
@@ -490,7 +490,7 @@ struct r600_context {
|
|||||||
struct r600_common_context b;
|
struct r600_common_context b;
|
||||||
struct r600_screen *screen;
|
struct r600_screen *screen;
|
||||||
struct blitter_context *blitter;
|
struct blitter_context *blitter;
|
||||||
struct u_suballocator *allocator_fetch_shader;
|
struct u_suballocator allocator_fetch_shader;
|
||||||
|
|
||||||
/* Hardware info. */
|
/* Hardware info. */
|
||||||
boolean has_vertex_cache;
|
boolean has_vertex_cache;
|
||||||
|
@@ -617,11 +617,8 @@ bool r600_common_context_init(struct r600_common_context *rctx,
|
|||||||
r600_query_init(rctx);
|
r600_query_init(rctx);
|
||||||
cayman_init_msaa(&rctx->b);
|
cayman_init_msaa(&rctx->b);
|
||||||
|
|
||||||
rctx->allocator_zeroed_memory =
|
u_suballocator_init(&rctx->allocator_zeroed_memory, &rctx->b, rscreen->info.gart_page_size,
|
||||||
u_suballocator_create(&rctx->b, rscreen->info.gart_page_size,
|
0, PIPE_USAGE_DEFAULT, 0, true);
|
||||||
0, PIPE_USAGE_DEFAULT, 0, true);
|
|
||||||
if (!rctx->allocator_zeroed_memory)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
rctx->b.stream_uploader = u_upload_create(&rctx->b, 1024 * 1024,
|
rctx->b.stream_uploader = u_upload_create(&rctx->b, 1024 * 1024,
|
||||||
0, PIPE_USAGE_STREAM, 0);
|
0, PIPE_USAGE_STREAM, 0);
|
||||||
@@ -667,9 +664,7 @@ void r600_common_context_cleanup(struct r600_common_context *rctx)
|
|||||||
slab_destroy_child(&rctx->pool_transfers);
|
slab_destroy_child(&rctx->pool_transfers);
|
||||||
slab_destroy_child(&rctx->pool_transfers_unsync);
|
slab_destroy_child(&rctx->pool_transfers_unsync);
|
||||||
|
|
||||||
if (rctx->allocator_zeroed_memory) {
|
u_suballocator_destroy(&rctx->allocator_zeroed_memory);
|
||||||
u_suballocator_destroy(rctx->allocator_zeroed_memory);
|
|
||||||
}
|
|
||||||
rctx->ws->fence_reference(&rctx->last_gfx_fence, NULL);
|
rctx->ws->fence_reference(&rctx->last_gfx_fence, NULL);
|
||||||
rctx->ws->fence_reference(&rctx->last_sdma_fence, NULL);
|
rctx->ws->fence_reference(&rctx->last_sdma_fence, NULL);
|
||||||
r600_resource_reference(&rctx->eop_bug_scratch, NULL);
|
r600_resource_reference(&rctx->eop_bug_scratch, NULL);
|
||||||
|
@@ -508,7 +508,7 @@ struct r600_common_context {
|
|||||||
unsigned last_num_draw_calls;
|
unsigned last_num_draw_calls;
|
||||||
|
|
||||||
struct threaded_context *tc;
|
struct threaded_context *tc;
|
||||||
struct u_suballocator *allocator_zeroed_memory;
|
struct u_suballocator allocator_zeroed_memory;
|
||||||
struct slab_child_pool pool_transfers;
|
struct slab_child_pool pool_transfers;
|
||||||
struct slab_child_pool pool_transfers_unsync; /* for threaded_context */
|
struct slab_child_pool pool_transfers_unsync; /* for threaded_context */
|
||||||
|
|
||||||
|
@@ -1637,7 +1637,7 @@ static void r600_query_hw_get_result_resource(struct r600_common_context *rctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (query->buffer.previous) {
|
if (query->buffer.previous) {
|
||||||
u_suballocator_alloc(rctx->allocator_zeroed_memory, 16, 256,
|
u_suballocator_alloc(&rctx->allocator_zeroed_memory, 16, 256,
|
||||||
&tmp_buffer_offset, &tmp_buffer);
|
&tmp_buffer_offset, &tmp_buffer);
|
||||||
if (!tmp_buffer)
|
if (!tmp_buffer)
|
||||||
return;
|
return;
|
||||||
|
@@ -51,7 +51,7 @@ r600_create_so_target(struct pipe_context *ctx,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
u_suballocator_alloc(rctx->allocator_zeroed_memory, 4, 4,
|
u_suballocator_alloc(&rctx->allocator_zeroed_memory, 4, 4,
|
||||||
&t->buf_filled_size_offset,
|
&t->buf_filled_size_offset,
|
||||||
(struct pipe_resource**)&t->buf_filled_size);
|
(struct pipe_resource**)&t->buf_filled_size);
|
||||||
if (!t->buf_filled_size) {
|
if (!t->buf_filled_size) {
|
||||||
|
@@ -341,7 +341,7 @@ static void gfx10_sh_query_get_result_resource(struct si_context *sctx, struct s
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (query->first != query->last) {
|
if (query->first != query->last) {
|
||||||
u_suballocator_alloc(sctx->allocator_zeroed_memory, 16, 16, &tmp_buffer_offset, &tmp_buffer);
|
u_suballocator_alloc(&sctx->allocator_zeroed_memory, 16, 16, &tmp_buffer_offset, &tmp_buffer);
|
||||||
if (!tmp_buffer)
|
if (!tmp_buffer)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -305,8 +305,7 @@ static void si_destroy_context(struct pipe_context *context)
|
|||||||
slab_destroy_child(&sctx->pool_transfers);
|
slab_destroy_child(&sctx->pool_transfers);
|
||||||
slab_destroy_child(&sctx->pool_transfers_unsync);
|
slab_destroy_child(&sctx->pool_transfers_unsync);
|
||||||
|
|
||||||
if (sctx->allocator_zeroed_memory)
|
u_suballocator_destroy(&sctx->allocator_zeroed_memory);
|
||||||
u_suballocator_destroy(sctx->allocator_zeroed_memory);
|
|
||||||
|
|
||||||
sctx->ws->fence_reference(&sctx->last_gfx_fence, NULL);
|
sctx->ws->fence_reference(&sctx->last_gfx_fence, NULL);
|
||||||
sctx->ws->fence_reference(&sctx->last_sdma_fence, NULL);
|
sctx->ws->fence_reference(&sctx->last_sdma_fence, NULL);
|
||||||
@@ -488,11 +487,9 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, unsign
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize context allocators. */
|
/* Initialize context allocators. */
|
||||||
sctx->allocator_zeroed_memory =
|
u_suballocator_init(&sctx->allocator_zeroed_memory, &sctx->b, 128 * 1024, 0,
|
||||||
u_suballocator_create(&sctx->b, 128 * 1024, 0, PIPE_USAGE_DEFAULT,
|
PIPE_USAGE_DEFAULT,
|
||||||
SI_RESOURCE_FLAG_UNMAPPABLE | SI_RESOURCE_FLAG_CLEAR, false);
|
SI_RESOURCE_FLAG_UNMAPPABLE | SI_RESOURCE_FLAG_CLEAR, false);
|
||||||
if (!sctx->allocator_zeroed_memory)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
sctx->b.stream_uploader =
|
sctx->b.stream_uploader =
|
||||||
u_upload_create(&sctx->b, 1024 * 1024, 0, PIPE_USAGE_STREAM, SI_RESOURCE_FLAG_READ_ONLY);
|
u_upload_create(&sctx->b, 1024 * 1024, 0, PIPE_USAGE_STREAM, SI_RESOURCE_FLAG_READ_ONLY);
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
#include "si_state.h"
|
#include "si_state.h"
|
||||||
#include "util/u_dynarray.h"
|
#include "util/u_dynarray.h"
|
||||||
#include "util/u_idalloc.h"
|
#include "util/u_idalloc.h"
|
||||||
|
#include "util/u_suballoc.h"
|
||||||
#include "util/u_threaded_context.h"
|
#include "util/u_threaded_context.h"
|
||||||
|
|
||||||
#if UTIL_ARCH_BIG_ENDIAN
|
#if UTIL_ARCH_BIG_ENDIAN
|
||||||
@@ -252,7 +253,6 @@ enum si_coherency
|
|||||||
struct si_compute;
|
struct si_compute;
|
||||||
struct si_shader_context;
|
struct si_shader_context;
|
||||||
struct hash_table;
|
struct hash_table;
|
||||||
struct u_suballocator;
|
|
||||||
|
|
||||||
/* Only 32-bit buffer allocations are supported, gallium doesn't support more
|
/* Only 32-bit buffer allocations are supported, gallium doesn't support more
|
||||||
* at the moment.
|
* at the moment.
|
||||||
@@ -910,7 +910,7 @@ struct si_context {
|
|||||||
struct si_resource *eop_bug_scratch_tmz;
|
struct si_resource *eop_bug_scratch_tmz;
|
||||||
struct u_upload_mgr *cached_gtt_allocator;
|
struct u_upload_mgr *cached_gtt_allocator;
|
||||||
struct threaded_context *tc;
|
struct threaded_context *tc;
|
||||||
struct u_suballocator *allocator_zeroed_memory;
|
struct u_suballocator allocator_zeroed_memory;
|
||||||
struct slab_child_pool pool_transfers;
|
struct slab_child_pool pool_transfers;
|
||||||
struct slab_child_pool pool_transfers_unsync; /* for threaded_context */
|
struct slab_child_pool pool_transfers_unsync; /* for threaded_context */
|
||||||
struct pipe_device_reset_callback device_reset_callback;
|
struct pipe_device_reset_callback device_reset_callback;
|
||||||
|
@@ -1466,7 +1466,7 @@ static void si_query_hw_get_result_resource(struct si_context *sctx, struct si_q
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (query->buffer.previous) {
|
if (query->buffer.previous) {
|
||||||
u_suballocator_alloc(sctx->allocator_zeroed_memory, 16, 16, &tmp_buffer_offset, &tmp_buffer);
|
u_suballocator_alloc(&sctx->allocator_zeroed_memory, 16, 16, &tmp_buffer_offset, &tmp_buffer);
|
||||||
if (!tmp_buffer)
|
if (!tmp_buffer)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1605,7 +1605,7 @@ static void si_render_condition(struct pipe_context *ctx, struct pipe_query *que
|
|||||||
bool old_force_off = sctx->render_cond_force_off;
|
bool old_force_off = sctx->render_cond_force_off;
|
||||||
sctx->render_cond_force_off = true;
|
sctx->render_cond_force_off = true;
|
||||||
|
|
||||||
u_suballocator_alloc(sctx->allocator_zeroed_memory, 8, 8, &squery->workaround_offset,
|
u_suballocator_alloc(&sctx->allocator_zeroed_memory, 8, 8, &squery->workaround_offset,
|
||||||
(struct pipe_resource **)&squery->workaround_buf);
|
(struct pipe_resource **)&squery->workaround_buf);
|
||||||
|
|
||||||
/* Reset to NULL to avoid a redundant SET_PREDICATION
|
/* Reset to NULL to avoid a redundant SET_PREDICATION
|
||||||
|
@@ -1147,7 +1147,7 @@ void si_prim_discard_signal_next_compute_ib_start(struct si_context *sctx)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (!sctx->barrier_buf) {
|
if (!sctx->barrier_buf) {
|
||||||
u_suballocator_alloc(sctx->allocator_zeroed_memory, 4, 4, &sctx->barrier_buf_offset,
|
u_suballocator_alloc(&sctx->allocator_zeroed_memory, 4, 4, &sctx->barrier_buf_offset,
|
||||||
(struct pipe_resource **)&sctx->barrier_buf);
|
(struct pipe_resource **)&sctx->barrier_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -49,7 +49,7 @@ static struct pipe_stream_output_target *si_create_so_target(struct pipe_context
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned buf_filled_size_size = sctx->screen->use_ngg_streamout ? 8 : 4;
|
unsigned buf_filled_size_size = sctx->screen->use_ngg_streamout ? 8 : 4;
|
||||||
u_suballocator_alloc(sctx->allocator_zeroed_memory, buf_filled_size_size, 4,
|
u_suballocator_alloc(&sctx->allocator_zeroed_memory, buf_filled_size_size, 4,
|
||||||
&t->buf_filled_size_offset, (struct pipe_resource **)&t->buf_filled_size);
|
&t->buf_filled_size_offset, (struct pipe_resource **)&t->buf_filled_size);
|
||||||
if (!t->buf_filled_size) {
|
if (!t->buf_filled_size) {
|
||||||
FREE(t);
|
FREE(t);
|
||||||
|
Reference in New Issue
Block a user