Mesa (master): gallium: inline struct u_suballocator to remove dereferences

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Dec 3 22:01:37 UTC 2020


Module: Mesa
Branch: master
Commit: 8904fcca6dbe3059b73a90d99b9105bfa0661e12
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8904fcca6dbe3059b73a90d99b9105bfa0661e12

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Sun Nov 29 01:16:25 2020 -0500

gallium: inline struct u_suballocator to remove dereferences

Reviewed-by: Eric Anholt <eric at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7901>

---

 src/gallium/auxiliary/util/u_suballoc.c           | 31 +++++------------------
 src/gallium/auxiliary/util/u_suballoc.h           | 27 +++++++++++++++-----
 src/gallium/drivers/d3d12/d3d12_context.cpp       | 12 ++++-----
 src/gallium/drivers/d3d12/d3d12_context.h         |  4 +--
 src/gallium/drivers/d3d12/d3d12_query.cpp         |  7 +++--
 src/gallium/drivers/r600/r600_asm.c               |  2 +-
 src/gallium/drivers/r600/r600_hw_context.c        |  2 +-
 src/gallium/drivers/r600/r600_pipe.c              | 11 +++-----
 src/gallium/drivers/r600/r600_pipe.h              |  2 +-
 src/gallium/drivers/r600/r600_pipe_common.c       | 11 +++-----
 src/gallium/drivers/r600/r600_pipe_common.h       |  2 +-
 src/gallium/drivers/r600/r600_query.c             |  2 +-
 src/gallium/drivers/r600/r600_streamout.c         |  2 +-
 src/gallium/drivers/radeonsi/gfx10_query.c        |  2 +-
 src/gallium/drivers/radeonsi/si_pipe.c            | 11 +++-----
 src/gallium/drivers/radeonsi/si_pipe.h            |  4 +--
 src/gallium/drivers/radeonsi/si_query.c           |  4 +--
 src/gallium/drivers/radeonsi/si_state_draw.c      |  2 +-
 src/gallium/drivers/radeonsi/si_state_streamout.c |  2 +-
 19 files changed, 62 insertions(+), 78 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_suballoc.c b/src/gallium/auxiliary/util/u_suballoc.c
index 51754087ef1..c5598ebc776 100644
--- a/src/gallium/auxiliary/util/u_suballoc.c
+++ b/src/gallium/auxiliary/util/u_suballoc.c
@@ -36,21 +36,6 @@
 
 #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.
  *
@@ -59,14 +44,14 @@ struct u_suballocator {
  *                            cleared to 0 after the allocation.
  *
  */
-struct u_suballocator *
-u_suballocator_create(struct pipe_context *pipe, unsigned size, unsigned bind,
-                      enum pipe_resource_usage usage, unsigned flags,
-		      boolean zero_buffer_memory)
+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)
 {
-   struct u_suballocator *allocator = CALLOC_STRUCT(u_suballocator);
-   if (!allocator)
-      return NULL;
+   memset(allocator, 0, sizeof(*allocator));
 
    allocator->pipe = pipe;
    allocator->size = size;
@@ -74,14 +59,12 @@ u_suballocator_create(struct pipe_context *pipe, unsigned size, unsigned bind,
    allocator->usage = usage;
    allocator->flags = flags;
    allocator->zero_buffer_memory = zero_buffer_memory;
-   return allocator;
 }
 
 void
 u_suballocator_destroy(struct u_suballocator *allocator)
 {
    pipe_resource_reference(&allocator->buffer, NULL);
-   FREE(allocator);
 }
 
 void
diff --git a/src/gallium/auxiliary/util/u_suballoc.h b/src/gallium/auxiliary/util/u_suballoc.h
index de4905d06e5..ed95e7c32b1 100644
--- a/src/gallium/auxiliary/util/u_suballoc.h
+++ b/src/gallium/auxiliary/util/u_suballoc.h
@@ -31,16 +31,31 @@
 #ifndef U_SUBALLOC
 #define U_SUBALLOC
 
-struct u_suballocator;
-
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-struct u_suballocator *
-u_suballocator_create(struct pipe_context *pipe, unsigned size, unsigned bind,
-                      enum pipe_resource_usage usage, unsigned flags,
-		      boolean zero_buffer_memory);
+struct pipe_context;
+
+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. */
+};
+
+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
 u_suballocator_destroy(struct u_suballocator *allocator);
diff --git a/src/gallium/drivers/d3d12/d3d12_context.cpp b/src/gallium/drivers/d3d12/d3d12_context.cpp
index 0f1cc3749e7..1f00c04cef6 100644
--- a/src/gallium/drivers/d3d12/d3d12_context.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_context.cpp
@@ -76,7 +76,7 @@ d3d12_context_destroy(struct pipe_context *pctx)
    d3d12_gfx_pipeline_state_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)
       u_upload_destroy(pctx->stream_uploader);
@@ -1354,7 +1354,7 @@ d3d12_set_stream_output_targets(struct pipe_context *pctx,
 
       if (target) {
          /* 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);
          fill_stream_output_buffer_view(&ctx->so_buffer_views[i], target);
          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_USAGE_STAGING,
                                                        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);
          pipe_buffer_read(&ctx->base, target->fill_buffer,
                           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.const_uploader = u_upload_create_default(&ctx->base);
-   ctx->so_allocator = u_suballocator_create(&ctx->base, 4096, 0,
-                                             PIPE_USAGE_DEFAULT,
-                                             0, true);
+   u_suballocator_init(&ctx->so_allocator, &ctx->base, 4096, 0,
+                       PIPE_USAGE_DEFAULT,
+                       0, true);
 
    struct primconvert_config cfg;
    cfg.primtypes_mask = 1 << PIPE_PRIM_POINTS |
diff --git a/src/gallium/drivers/d3d12/d3d12_context.h b/src/gallium/drivers/d3d12/d3d12_context.h
index dd0245d460d..a077f56de54 100644
--- a/src/gallium/drivers/d3d12/d3d12_context.h
+++ b/src/gallium/drivers/d3d12/d3d12_context.h
@@ -166,8 +166,8 @@ struct d3d12_context {
    struct slab_child_pool transfer_pool;
    struct primconvert_context *primconvert;
    struct blitter_context *blitter;
-   struct u_suballocator *query_allocator;
-   struct u_suballocator *so_allocator;
+   struct u_suballocator query_allocator;
+   struct u_suballocator so_allocator;
    struct hash_table *pso_cache;
    struct hash_table *root_signature_cache;
    struct hash_table *gs_variant_cache;
diff --git a/src/gallium/drivers/d3d12/d3d12_query.cpp b/src/gallium/drivers/d3d12/d3d12_query.cpp
index a02a8a01ab8..ae7c2e196ed 100644
--- a/src/gallium/drivers/d3d12/d3d12_query.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_query.cpp
@@ -144,7 +144,7 @@ d3d12_create_query(struct pipe_context *pctx,
 
    /* Query result goes into a readback buffer */
    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);
 
    return (struct pipe_query *)query;
@@ -509,9 +509,8 @@ d3d12_context_query_init(struct pipe_context *pctx)
    struct d3d12_context *ctx = d3d12_context(pctx);
    list_inithead(&ctx->active_queries);
 
-   ctx->query_allocator =
-       u_suballocator_create(&ctx->base, 4096, 0, PIPE_USAGE_STAGING,
-                             0, true);
+   u_suballocator_init(&ctx->query_allocator, &ctx->base, 4096, 0, PIPE_USAGE_STAGING,
+                         0, true);
 
    pctx->create_query = d3d12_create_query;
    pctx->destroy_query = d3d12_destroy_query;
diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c
index fbb173b0680..f7bb4d3ecba 100644
--- a/src/gallium/drivers/r600/r600_asm.c
+++ b/src/gallium/drivers/r600/r600_asm.c
@@ -2765,7 +2765,7 @@ void *r600_create_vertex_fetch_shader(struct pipe_context *ctx,
 		return NULL;
 	}
 
-	u_suballocator_alloc(rctx->allocator_fetch_shader, fs_size, 256,
+	u_suballocator_alloc(&rctx->allocator_fetch_shader, fs_size, 256,
 			     &shader->offset,
 			     (struct pipe_resource**)&shader->buffer);
 	if (!shader->buffer) {
diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c
index 494b7ed69eb..c7a53e5094c 100644
--- a/src/gallium/drivers/r600/r600_hw_context.c
+++ b/src/gallium/drivers/r600/r600_hw_context.c
@@ -451,7 +451,7 @@ void r600_emit_pfp_sync_me(struct r600_context *rctx)
 		uint64_t va;
 
 		/* 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);
 		if (!buf) {
 			/* This is too heavyweight, but will work. */
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index 9983a50f404..3068833dcdd 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -118,9 +118,7 @@ static void r600_destroy_context(struct pipe_context *context)
 	if (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);
 
@@ -215,11 +213,8 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen,
 				       r600_context_gfx_flush, rctx, false);
 	rctx->b.gfx.flush = r600_context_gfx_flush;
 
-	rctx->allocator_fetch_shader =
-		u_suballocator_create(&rctx->b.b, 64 * 1024,
-				      0, PIPE_USAGE_DEFAULT, 0, FALSE);
-	if (!rctx->allocator_fetch_shader)
-		goto fail;
+	u_suballocator_init(&rctx->allocator_fetch_shader, &rctx->b.b, 64 * 1024,
+                            0, PIPE_USAGE_DEFAULT, 0, FALSE);
 
 	rctx->isa = calloc(1, sizeof(struct r600_isa));
 	if (!rctx->isa || r600_isa_init(rctx, rctx->isa))
diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index e2c34d78070..a4821002297 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -490,7 +490,7 @@ struct r600_context {
 	struct r600_common_context	b;
 	struct r600_screen		*screen;
 	struct blitter_context		*blitter;
-	struct u_suballocator		*allocator_fetch_shader;
+	struct u_suballocator		allocator_fetch_shader;
 
 	/* Hardware info. */
 	boolean				has_vertex_cache;
diff --git a/src/gallium/drivers/r600/r600_pipe_common.c b/src/gallium/drivers/r600/r600_pipe_common.c
index 30c521ba6ff..3f5cbf03d9b 100644
--- a/src/gallium/drivers/r600/r600_pipe_common.c
+++ b/src/gallium/drivers/r600/r600_pipe_common.c
@@ -617,11 +617,8 @@ bool r600_common_context_init(struct r600_common_context *rctx,
 	r600_query_init(rctx);
 	cayman_init_msaa(&rctx->b);
 
-	rctx->allocator_zeroed_memory =
-		u_suballocator_create(&rctx->b, rscreen->info.gart_page_size,
-				      0, PIPE_USAGE_DEFAULT, 0, true);
-	if (!rctx->allocator_zeroed_memory)
-		return false;
+	u_suballocator_init(&rctx->allocator_zeroed_memory, &rctx->b, rscreen->info.gart_page_size,
+			    0, PIPE_USAGE_DEFAULT, 0, true);
 
 	rctx->b.stream_uploader = u_upload_create(&rctx->b, 1024 * 1024,
 						  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_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_sdma_fence, NULL);
 	r600_resource_reference(&rctx->eop_bug_scratch, NULL);
diff --git a/src/gallium/drivers/r600/r600_pipe_common.h b/src/gallium/drivers/r600/r600_pipe_common.h
index 8accf7eae98..49c7daf12a0 100644
--- a/src/gallium/drivers/r600/r600_pipe_common.h
+++ b/src/gallium/drivers/r600/r600_pipe_common.h
@@ -508,7 +508,7 @@ struct r600_common_context {
 	unsigned			last_num_draw_calls;
 
 	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_unsync; /* for threaded_context */
 
diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c
index 5e10810a6a7..2ac012f1b93 100644
--- a/src/gallium/drivers/r600/r600_query.c
+++ b/src/gallium/drivers/r600/r600_query.c
@@ -1637,7 +1637,7 @@ static void r600_query_hw_get_result_resource(struct r600_common_context *rctx,
 	}
 
 	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);
 		if (!tmp_buffer)
 			return;
diff --git a/src/gallium/drivers/r600/r600_streamout.c b/src/gallium/drivers/r600/r600_streamout.c
index f925c07b26d..e79beb74b6f 100644
--- a/src/gallium/drivers/r600/r600_streamout.c
+++ b/src/gallium/drivers/r600/r600_streamout.c
@@ -51,7 +51,7 @@ r600_create_so_target(struct pipe_context *ctx,
 		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,
 			     (struct pipe_resource**)&t->buf_filled_size);
 	if (!t->buf_filled_size) {
diff --git a/src/gallium/drivers/radeonsi/gfx10_query.c b/src/gallium/drivers/radeonsi/gfx10_query.c
index cb541f06bef..a7729632819 100644
--- a/src/gallium/drivers/radeonsi/gfx10_query.c
+++ b/src/gallium/drivers/radeonsi/gfx10_query.c
@@ -341,7 +341,7 @@ static void gfx10_sh_query_get_result_resource(struct si_context *sctx, struct s
    }
 
    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)
          return;
    }
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index a04c4a3f9fc..91818288f42 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -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_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_sdma_fence, NULL);
@@ -488,11 +487,9 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, unsign
    }
 
    /* Initialize context allocators. */
-   sctx->allocator_zeroed_memory =
-      u_suballocator_create(&sctx->b, 128 * 1024, 0, PIPE_USAGE_DEFAULT,
-                            SI_RESOURCE_FLAG_UNMAPPABLE | SI_RESOURCE_FLAG_CLEAR, false);
-   if (!sctx->allocator_zeroed_memory)
-      goto fail;
+   u_suballocator_init(&sctx->allocator_zeroed_memory, &sctx->b, 128 * 1024, 0,
+                       PIPE_USAGE_DEFAULT,
+                       SI_RESOURCE_FLAG_UNMAPPABLE | SI_RESOURCE_FLAG_CLEAR, false);
 
    sctx->b.stream_uploader =
       u_upload_create(&sctx->b, 1024 * 1024, 0, PIPE_USAGE_STREAM, SI_RESOURCE_FLAG_READ_ONLY);
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index bdbe81878b7..2936e571585 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -29,6 +29,7 @@
 #include "si_state.h"
 #include "util/u_dynarray.h"
 #include "util/u_idalloc.h"
+#include "util/u_suballoc.h"
 #include "util/u_threaded_context.h"
 
 #if UTIL_ARCH_BIG_ENDIAN
@@ -252,7 +253,6 @@ enum si_coherency
 struct si_compute;
 struct si_shader_context;
 struct hash_table;
-struct u_suballocator;
 
 /* Only 32-bit buffer allocations are supported, gallium doesn't support more
  * at the moment.
@@ -910,7 +910,7 @@ struct si_context {
    struct si_resource *eop_bug_scratch_tmz;
    struct u_upload_mgr *cached_gtt_allocator;
    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_unsync; /* for threaded_context */
    struct pipe_device_reset_callback device_reset_callback;
diff --git a/src/gallium/drivers/radeonsi/si_query.c b/src/gallium/drivers/radeonsi/si_query.c
index 49d34396c7f..83eacf28903 100644
--- a/src/gallium/drivers/radeonsi/si_query.c
+++ b/src/gallium/drivers/radeonsi/si_query.c
@@ -1466,7 +1466,7 @@ static void si_query_hw_get_result_resource(struct si_context *sctx, struct si_q
    }
 
    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)
          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;
          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);
 
          /* Reset to NULL to avoid a redundant SET_PREDICATION
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index 6aeac8328b2..a0f94b97fd2 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -1147,7 +1147,7 @@ void si_prim_discard_signal_next_compute_ib_start(struct si_context *sctx)
       return;
 
    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);
    }
 
diff --git a/src/gallium/drivers/radeonsi/si_state_streamout.c b/src/gallium/drivers/radeonsi/si_state_streamout.c
index 2ce8de0ccde..346a603d795 100644
--- a/src/gallium/drivers/radeonsi/si_state_streamout.c
+++ b/src/gallium/drivers/radeonsi/si_state_streamout.c
@@ -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;
-   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);
    if (!t->buf_filled_size) {
       FREE(t);



More information about the mesa-commit mailing list