From 17355f716b0fff0491ce1e66673a49df0da6755b Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 31 Oct 2025 13:48:53 -0400 Subject: [PATCH] treewide: use UTIL_DYNARRAY_INIT Instead of util_dynarray_init(&dynarray, NULL), just use UTIL_DYNARRAY_INIT instead. This is more ergonomic. Via Coccinelle patch: @@ identifier dynarray; @@ -struct util_dynarray dynarray = {0}; -util_dynarray_init(&dynarray, NULL); +struct util_dynarray dynarray = UTIL_DYNARRAY_INIT; @@ identifier dynarray; @@ -struct util_dynarray dynarray; -util_dynarray_init(&dynarray, NULL); +struct util_dynarray dynarray = UTIL_DYNARRAY_INIT; @@ expression dynarray; @@ -util_dynarray_init(&(dynarray), NULL); +dynarray = UTIL_DYNARRAY_INIT; @@ expression dynarray; @@ -util_dynarray_init(dynarray, NULL); +(*dynarray) = UTIL_DYNARRAY_INIT; Followed by sed: bash -c "find . -type f -exec sed -i -e 's/util_dynarray_init(&\(.*\), NULL)/\1 = UTIL_DYNARRAY_INIT/g' \{} \;" bash -c "find . -type f -exec sed -i -e 's/util_dynarray_init( &\(.*\), NULL )/\1 = UTIL_DYNARRAY_INIT/g' \{} \;" bash -c "find . -type f -exec sed -i -e 's/util_dynarray_init(\(.*\), NULL)/*\1 = UTIL_DYNARRAY_INIT/g' \{} \;" Signed-off-by: Alyssa Rosenzweig Reviewed-by: Mel Henning Part-of: --- src/amd/common/ac_gather_context_rolls.c | 2 +- src/amd/vulkan/radv_cmd_buffer.c | 2 +- src/amd/vulkan/radv_debug.c | 2 +- src/amd/vulkan/radv_debug_nir.c | 2 +- src/amd/vulkan/radv_pipeline_binary.c | 2 +- src/amd/vulkan/radv_rra.c | 2 +- src/asahi/compiler/agx_compile.c | 3 +- src/asahi/compiler/agx_register_allocate.c | 3 +- src/asahi/compiler/agx_spill.c | 2 +- src/asahi/compiler/test/agx_test.h | 2 +- src/asahi/lib/pool.c | 2 +- src/asahi/vulkan/hk_cmd_buffer.c | 6 +-- src/asahi/vulkan/hk_device.c | 4 +- src/asahi/vulkan/hk_query_pool.c | 2 +- src/asahi/vulkan/hk_queue.c | 5 +-- src/broadcom/simulator/v3d_simulator.c | 2 +- src/compiler/nir/nir_opt_dead_write_vars.c | 3 +- src/compiler/nir/nir_opt_group_loads.c | 3 +- src/compiler/nir/nir_opt_reassociate.c | 2 +- src/compiler/nir/nir_opt_vectorize_io.c | 3 +- src/compiler/nir/nir_opt_vectorize_io_vars.c | 3 +- src/compiler/nir/nir_serialize.c | 4 +- src/egl/drivers/dri2/platform_wayland.c | 2 +- src/etnaviv/isa/assembler.c | 3 +- src/freedreno/common/freedreno_rd_output.c | 2 +- src/freedreno/vulkan/tu_device.cc | 3 +- src/freedreno/vulkan/tu_dynamic_rendering.cc | 2 +- src/freedreno/vulkan/tu_queue.cc | 2 +- .../auxiliary/util/u_threaded_context.c | 2 +- src/gallium/drivers/asahi/agx_batch.c | 3 +- src/gallium/drivers/d3d12/d3d12_batch.cpp | 4 +- .../drivers/d3d12/d3d12_descriptor_pool.cpp | 2 +- src/gallium/drivers/ethosu/ethosu_cmd.c | 4 +- src/gallium/drivers/ethosu/ethosu_ml.c | 4 +- src/gallium/drivers/etnaviv/etnaviv_ml.c | 4 +- src/gallium/drivers/etnaviv/etnaviv_screen.c | 2 +- .../drivers/freedreno/freedreno_batch.c | 15 +++---- .../drivers/freedreno/freedreno_context.c | 2 +- .../drivers/llvmpipe/lp_texture_handle.c | 4 +- .../drivers/nouveau/nv30/nvfx_fragprog.c | 2 +- .../drivers/nouveau/nv30/nvfx_vertprog.c | 2 +- .../drivers/nouveau/nv50/nv50_context.c | 2 +- .../drivers/nouveau/nvc0/nvc0_context.c | 2 +- src/gallium/drivers/panfrost/pan_blend_cso.c | 2 +- src/gallium/drivers/panfrost/pan_csf.c | 2 +- src/gallium/drivers/panfrost/pan_disk_cache.c | 2 +- src/gallium/drivers/panfrost/pan_fb_preload.c | 4 +- src/gallium/drivers/panfrost/pan_job.c | 2 +- src/gallium/drivers/panfrost/pan_shader.c | 2 +- src/gallium/drivers/radeonsi/si_pipe.c | 10 ++--- src/gallium/drivers/rocket/rkt_ml.c | 11 +++-- src/gallium/drivers/zink/zink_batch.c | 40 +++++++++---------- src/gallium/drivers/zink/zink_context.c | 4 +- src/gallium/drivers/zink/zink_descriptors.c | 4 +- src/gallium/drivers/zink/zink_kopper.c | 2 +- src/gallium/drivers/zink/zink_query.c | 2 +- src/gallium/drivers/zink/zink_resource.c | 8 ++-- .../lavapipe/lvp_acceleration_structure.c | 2 +- src/gallium/frontends/lavapipe/lvp_device.c | 6 +-- src/gallium/frontends/lavapipe/lvp_execute.c | 4 +- .../frontends/mediafoundation/encode_h264.cpp | 2 +- .../frontends/mediafoundation/encode_hevc.cpp | 2 +- src/gallium/frontends/va/context.c | 4 +- src/gallium/frontends/va/surface.c | 2 +- src/gallium/frontends/wgl/stw_pixelformat.c | 2 +- src/imagination/pco/pco_nir_pvfio.c | 4 +- src/imagination/pco/pco_opt.c | 3 +- src/imagination/pco/pco_ra.c | 3 +- src/imagination/vulkan/pvr_cmd_buffer.c | 12 +++--- src/imagination/vulkan/pvr_csb.c | 2 +- src/intel/compiler/elk/elk_cfg.cpp | 2 +- src/intel/decoder/intel_batch_decoder.c | 6 +-- src/intel/vulkan/anv_allocator.c | 2 +- src/intel/vulkan/anv_batch_chain.c | 2 +- src/intel/vulkan/anv_sparse.c | 2 +- src/intel/vulkan_hasvk/anv_allocator.c | 2 +- src/kosmickrisp/vulkan/kk_cmd_buffer.c | 2 +- src/kosmickrisp/vulkan/kk_device.c | 2 +- src/kosmickrisp/vulkan/kk_encoder.c | 8 ++-- src/mesa/main/context.c | 2 +- src/mesa/main/texturebindless.c | 6 +-- src/mesa/state_tracker/st_context.c | 2 +- src/microsoft/vulkan/dzn_cmd_buffer.c | 14 +++---- src/microsoft/vulkan/dzn_device.c | 2 +- src/nouveau/vulkan/nvk_cmd_buffer.c | 2 +- src/panfrost/clc/pan_compile.c | 2 +- src/panfrost/compiler/bi_iterator_schedule.c | 3 +- src/panfrost/compiler/bi_spill_ssa.c | 2 +- src/panfrost/compiler/bifrost/bi_schedule.c | 4 +- .../compiler/test/test-pack-formats.cpp | 2 +- src/panfrost/genxml/cs_builder.h | 2 +- src/panfrost/genxml/decode_common.c | 2 +- src/panfrost/midgard/midgard_schedule.c | 7 ++-- src/panfrost/vulkan/jm/panvk_vX_cmd_buffer.c | 4 +- src/panfrost/vulkan/panvk_vX_shader.c | 3 +- src/util/dag.c | 3 +- src/virtio/vdrm/vdrm_vpipe.c | 2 +- src/vulkan/runtime/rmv/vk_rmv_common.c | 2 +- src/vulkan/runtime/vk_command_buffer.c | 2 +- src/vulkan/runtime/vk_meta_object_list.c | 2 +- src/vulkan/runtime/vk_queue.c | 2 +- src/vulkan/wsi/wsi_common_wayland.c | 2 +- 102 files changed, 177 insertions(+), 197 deletions(-) diff --git a/src/amd/common/ac_gather_context_rolls.c b/src/amd/common/ac_gather_context_rolls.c index 9e8774f1ff0..778b38fbbf4 100644 --- a/src/amd/common/ac_gather_context_rolls.c +++ b/src/amd/common/ac_gather_context_rolls.c @@ -313,7 +313,7 @@ void ac_gather_context_rolls(FILE *f, uint32_t **ibs, uint32_t *ib_dw_sizes, uns memset(&ctx, 0, sizeof(ctx)); ctx.info = info; ctx.cur = CALLOC_STRUCT(ac_context_reg_state); - util_dynarray_init(&ctx.rolls, NULL); + ctx.rolls = UTIL_DYNARRAY_INIT; /* Parse the IBs. */ for (unsigned i = 0; i < num_ibs; i++) diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index e759646083f..c5b13ac2efe 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -1220,7 +1220,7 @@ radv_create_cmd_buffer(struct vk_command_pool *pool, VkCommandBufferLevel level, vk_object_base_init(&device->vk, &cmd_buffer->descriptors[i].push_set.set.base, VK_OBJECT_TYPE_DESCRIPTOR_SET); cmd_buffer->accel_struct_buffers = _mesa_pointer_set_create(NULL); - util_dynarray_init(&cmd_buffer->ray_history, NULL); + cmd_buffer->ray_history = UTIL_DYNARRAY_INIT; } *cmd_buffer_out = &cmd_buffer->vk; diff --git a/src/amd/vulkan/radv_debug.c b/src/amd/vulkan/radv_debug.c index 9ecbe6f6f25..583780b02fa 100644 --- a/src/amd/vulkan/radv_debug.c +++ b/src/amd/vulkan/radv_debug.c @@ -151,7 +151,7 @@ radv_init_adress_binding_report(struct radv_device *device) return false; simple_mtx_init(&device->addr_binding_tracker->mtx, mtx_plain); - util_dynarray_init(&device->addr_binding_tracker->reports, NULL); + device->addr_binding_tracker->reports = UTIL_DYNARRAY_INIT; VkDebugUtilsMessengerCreateInfoEXT create_info = { .messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT, diff --git a/src/amd/vulkan/radv_debug_nir.c b/src/amd/vulkan/radv_debug_nir.c index 920b78ad0bd..37237aba4f2 100644 --- a/src/amd/vulkan/radv_debug_nir.c +++ b/src/amd/vulkan/radv_debug_nir.c @@ -22,7 +22,7 @@ radv_printf_data_init(struct radv_device *device) { const struct radv_physical_device *pdev = radv_device_physical(device); - util_dynarray_init(&device->printf.formats, NULL); + device->printf.formats = UTIL_DYNARRAY_INIT; device->printf.buffer_size = debug_get_num_option("RADV_PRINTF_BUFFER_SIZE", 0); if (device->printf.buffer_size < sizeof(struct radv_printf_buffer_header)) diff --git a/src/amd/vulkan/radv_pipeline_binary.c b/src/amd/vulkan/radv_pipeline_binary.c index 5a674c1d36c..ba6821d4ea4 100644 --- a/src/amd/vulkan/radv_pipeline_binary.c +++ b/src/amd/vulkan/radv_pipeline_binary.c @@ -376,7 +376,7 @@ radv_CreatePipelineBinariesKHR(VkDevice _device, const VkPipelineBinaryCreateInf for (uint32_t i = 0; i < pBinaries->pipelineBinaryCount; i++) pBinaries->pPipelineBinaries[i] = VK_NULL_HANDLE; - util_dynarray_init(&pipeline_binaries, NULL); + pipeline_binaries = UTIL_DYNARRAY_INIT; /* Get all pipeline binaries from the pCreateInfo first to simplify the creation. */ result = radv_create_pipeline_binaries(device, pCreateInfo, pAllocator, &pipeline_binaries, NULL); diff --git a/src/amd/vulkan/radv_rra.c b/src/amd/vulkan/radv_rra.c index 682bf881749..40803773684 100644 --- a/src/amd/vulkan/radv_rra.c +++ b/src/amd/vulkan/radv_rra.c @@ -487,7 +487,7 @@ radv_rra_trace_init(struct radv_device *device) radv_find_memory_index(pdev, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | VK_MEMORY_PROPERTY_HOST_CACHED_BIT); - util_dynarray_init(&device->rra_trace.ray_history, NULL); + device->rra_trace.ray_history = UTIL_DYNARRAY_INIT; device->rra_trace.ray_history_buffer_size = debug_get_num_option("RADV_RRA_TRACE_HISTORY_SIZE", 100 * 1024 * 1024); if (device->rra_trace.ray_history_buffer_size < diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index 2c4d0a3dbd0..f8aea130103 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -3787,8 +3787,7 @@ agx_compile_shader_nir(nir_shader *nir, struct agx_shader_key *key, agx_compiler_debug = agx_get_compiler_debug(); struct agx_shader_info *info = &out->info; - struct util_dynarray binary; - util_dynarray_init(&binary, NULL); + struct util_dynarray binary = UTIL_DYNARRAY_INIT; memset(out, 0, sizeof *out); diff --git a/src/asahi/compiler/agx_register_allocate.c b/src/asahi/compiler/agx_register_allocate.c index 851526d347d..eff2a97d6f8 100644 --- a/src/asahi/compiler/agx_register_allocate.c +++ b/src/asahi/compiler/agx_register_allocate.c @@ -615,8 +615,7 @@ find_regs(struct ra_ctx *rctx, agx_instr *I, unsigned dest_idx, unsigned count, assert(!rctx->early_killed && "no live range splits with early kill"); assert(cls == RA_GPR && "no memory live range splits"); - struct util_dynarray copies = {0}; - util_dynarray_init(&copies, NULL); + struct util_dynarray copies = UTIL_DYNARRAY_INIT; reg = assign_regs_by_copying(rctx, I->dest[dest_idx], I, &copies); diff --git a/src/asahi/compiler/agx_spill.c b/src/asahi/compiler/agx_spill.c index a587dbbfc89..c47a9a940de 100644 --- a/src/asahi/compiler/agx_spill.c +++ b/src/asahi/compiler/agx_spill.c @@ -634,7 +634,7 @@ calculate_local_next_use(struct spill_ctx *ctx, struct util_dynarray *out) struct spill_block *sb = spill_block(ctx, ctx->block); unsigned ip = sb->cycles; - util_dynarray_init(out, NULL); + *out = UTIL_DYNARRAY_INIT; struct next_uses nu; init_next_uses(&nu, NULL); diff --git a/src/asahi/compiler/test/agx_test.h b/src/asahi/compiler/test/agx_test.h index bed608853c9..5236f2eec98 100644 --- a/src/asahi/compiler/test/agx_test.h +++ b/src/asahi/compiler/test/agx_test.h @@ -19,7 +19,7 @@ agx_test_builder(void *memctx) list_inithead(&ctx->blocks); agx_block *blk = rzalloc(ctx, agx_block); - util_dynarray_init(&blk->predecessors, NULL); + blk->predecessors = UTIL_DYNARRAY_INIT; ctx->num_blocks = 1; list_addtail(&blk->link, &ctx->blocks); diff --git a/src/asahi/lib/pool.c b/src/asahi/lib/pool.c index db05eaed95f..f5322187d99 100644 --- a/src/asahi/lib/pool.c +++ b/src/asahi/lib/pool.c @@ -36,7 +36,7 @@ agx_pool_init(struct agx_pool *pool, struct agx_device *dev, const char *label, pool->dev = dev; pool->create_flags = create_flags; pool->label = label; - util_dynarray_init(&pool->bos, NULL); + pool->bos = UTIL_DYNARRAY_INIT; if (prealloc) agx_pool_alloc_backing(pool, POOL_SLAB_SIZE); diff --git a/src/asahi/vulkan/hk_cmd_buffer.c b/src/asahi/vulkan/hk_cmd_buffer.c index 91a8976f575..e3342f853cf 100644 --- a/src/asahi/vulkan/hk_cmd_buffer.c +++ b/src/asahi/vulkan/hk_cmd_buffer.c @@ -106,7 +106,7 @@ hk_create_cmd_buffer(struct vk_command_pool *vk_pool, return result; } - util_dynarray_init(&cmd->large_bos, NULL); + cmd->large_bos = UTIL_DYNARRAY_INIT; cmd->vk.dynamic_graphics_state.vi = &cmd->state.gfx._dynamic_vi; cmd->vk.dynamic_graphics_state.ms.sample_locations = @@ -831,8 +831,8 @@ hk_cs_init_graphics(struct hk_cmd_buffer *cmd, struct hk_cs *cs) agx_ppp_fini(&map, &ppp); cs->current = map; - util_dynarray_init(&cs->scissor, NULL); - util_dynarray_init(&cs->depth_bias, NULL); + cs->scissor = UTIL_DYNARRAY_INIT; + cs->depth_bias = UTIL_DYNARRAY_INIT; /* All graphics state must be reemited in each control stream */ hk_cmd_buffer_dirty_all(cmd); diff --git a/src/asahi/vulkan/hk_device.c b/src/asahi/vulkan/hk_device.c index 117ae784839..264f8f9899f 100644 --- a/src/asahi/vulkan/hk_device.c +++ b/src/asahi/vulkan/hk_device.c @@ -435,8 +435,8 @@ hk_CreateDevice(VkPhysicalDevice physicalDevice, agx_scratch_init(&dev->dev, &dev->scratch.cs); u_rwlock_init(&dev->external_bos.lock); - util_dynarray_init(&dev->external_bos.counts, NULL); - util_dynarray_init(&dev->external_bos.list, NULL); + dev->external_bos.counts = UTIL_DYNARRAY_INIT; + dev->external_bos.list = UTIL_DYNARRAY_INIT; return VK_SUCCESS; diff --git a/src/asahi/vulkan/hk_query_pool.c b/src/asahi/vulkan/hk_query_pool.c index 891a040166e..ae600bbe7a6 100644 --- a/src/asahi/vulkan/hk_query_pool.c +++ b/src/asahi/vulkan/hk_query_pool.c @@ -167,7 +167,7 @@ hk_queue_write(struct hk_cmd_buffer *cmd, uint64_t address, uint32_t value, struct libagx_imm_write imm = {.address = address, .value = value}; if (!cs->imm_writes.data) { - util_dynarray_init(&cs->imm_writes, NULL); + cs->imm_writes = UTIL_DYNARRAY_INIT; } util_dynarray_append(&cs->imm_writes, imm); diff --git a/src/asahi/vulkan/hk_queue.c b/src/asahi/vulkan/hk_queue.c index ea8edc3b5f6..d69deaab8e8 100644 --- a/src/asahi/vulkan/hk_queue.c +++ b/src/asahi/vulkan/hk_queue.c @@ -405,7 +405,7 @@ hk_bind_builder(struct hk_device *dev, struct vk_object_base *obj_base, .image = image, }; - util_dynarray_init(&b.binds, NULL); + b.binds = UTIL_DYNARRAY_INIT; return b; } @@ -810,8 +810,7 @@ queue_submit(struct hk_device *dev, struct hk_queue *queue, }; /* Now setup the command structs */ - struct util_dynarray payload; - util_dynarray_init(&payload, NULL); + struct util_dynarray payload = UTIL_DYNARRAY_INIT; unsigned nr_vdm = 0, nr_cdm = 0; diff --git a/src/broadcom/simulator/v3d_simulator.c b/src/broadcom/simulator/v3d_simulator.c index 1de455d5b4a..74b9b1e6204 100644 --- a/src/broadcom/simulator/v3d_simulator.c +++ b/src/broadcom/simulator/v3d_simulator.c @@ -1206,7 +1206,7 @@ v3d_simulator_init_global() _mesa_hash_pointer, _mesa_key_pointer_equal); - util_dynarray_init(&sim_state.bin_oom, NULL); + sim_state.bin_oom = UTIL_DYNARRAY_INIT; v3d_X_simulator(init_regs)(sim_state.v3d); v3d_X_simulator(get_perfcnt_total)(&sim_state.perfcnt_total); diff --git a/src/compiler/nir/nir_opt_dead_write_vars.c b/src/compiler/nir/nir_opt_dead_write_vars.c index 165ed8fe9ac..b7c72eab981 100644 --- a/src/compiler/nir/nir_opt_dead_write_vars.c +++ b/src/compiler/nir/nir_opt_dead_write_vars.c @@ -280,8 +280,7 @@ nir_opt_dead_write_vars(nir_shader *shader) { bool progress = false; - struct util_dynarray unused_writes; - util_dynarray_init(&unused_writes, NULL); + struct util_dynarray unused_writes = UTIL_DYNARRAY_INIT; nir_foreach_function_impl(impl, shader) { progress |= remove_dead_write_vars_impl(shader, impl, &unused_writes); diff --git a/src/compiler/nir/nir_opt_group_loads.c b/src/compiler/nir/nir_opt_group_loads.c index 42034525834..0727ad18116 100644 --- a/src/compiler/nir/nir_opt_group_loads.c +++ b/src/compiler/nir/nir_opt_group_loads.c @@ -464,8 +464,7 @@ nir_opt_group_loads(nir_shader *shader, nir_load_grouping grouping, unsigned max_distance) { /* Temporary space for instruction info. */ - struct util_dynarray infos_scratch; - util_dynarray_init(&infos_scratch, NULL); + struct util_dynarray infos_scratch = UTIL_DYNARRAY_INIT; nir_foreach_function_impl(impl, shader) { nir_metadata_require(impl, nir_metadata_instr_index); diff --git a/src/compiler/nir/nir_opt_reassociate.c b/src/compiler/nir/nir_opt_reassociate.c index 83e02382b81..76097a46e7b 100644 --- a/src/compiler/nir/nir_opt_reassociate.c +++ b/src/compiler/nir/nir_opt_reassociate.c @@ -519,7 +519,7 @@ nir_opt_reassociate(nir_shader *nir, nir_reassociate_options opts) /* Clear pass flags. All instructions are possible roots, a priori. Interior * nodes are indicated with a non-zero pass flags, set as we go. */ - util_dynarray_init(&chains, NULL); + chains = UTIL_DYNARRAY_INIT; nir_shader_clear_pass_flags(nir); /* We use nir_def indices, which are function-local, so the algorithm runs on diff --git a/src/compiler/nir/nir_opt_vectorize_io.c b/src/compiler/nir/nir_opt_vectorize_io.c index aac022433ee..2c2fcee88b1 100644 --- a/src/compiler/nir/nir_opt_vectorize_io.c +++ b/src/compiler/nir/nir_opt_vectorize_io.c @@ -555,8 +555,7 @@ nir_opt_vectorize_io(nir_shader *shader, nir_variable_mode modes, } /* Initialize dynamic arrays. */ - struct util_dynarray io_instructions; - util_dynarray_init(&io_instructions, NULL); + struct util_dynarray io_instructions = UTIL_DYNARRAY_INIT; bool global_progress = false; nir_foreach_function_impl(impl, shader) { diff --git a/src/compiler/nir/nir_opt_vectorize_io_vars.c b/src/compiler/nir/nir_opt_vectorize_io_vars.c index 35b34c19e0e..dd8c8505cf4 100644 --- a/src/compiler/nir/nir_opt_vectorize_io_vars.c +++ b/src/compiler/nir/nir_opt_vectorize_io_vars.c @@ -398,8 +398,7 @@ nir_opt_vectorize_io_vars_impl(nir_function_impl *impl, nir_variable_mode modes) nir_metadata_require(impl, nir_metadata_dominance); - struct util_dynarray demote_vars; - util_dynarray_init(&demote_vars, NULL); + struct util_dynarray demote_vars = UTIL_DYNARRAY_INIT; nir_shader *shader = impl->function->shader; nir_variable *new_inputs[MAX_SLOTS][4] = { { 0 } }; diff --git a/src/compiler/nir/nir_serialize.c b/src/compiler/nir/nir_serialize.c index 6ab58bcabe2..f8194e1863a 100644 --- a/src/compiler/nir/nir_serialize.c +++ b/src/compiler/nir/nir_serialize.c @@ -2138,7 +2138,7 @@ nir_serialize_function(struct blob *blob, const nir_function *fxn) ctx.blob = blob; ctx.nir = fxn->shader; ctx.strip = true; - util_dynarray_init(&ctx.phi_fixups, NULL); + ctx.phi_fixups = UTIL_DYNARRAY_INIT; size_t idx_size_offset = blob_reserve_uint32(blob); @@ -2160,7 +2160,7 @@ serialize_internal(struct blob *blob, const nir_shader *nir, bool strip, bool se ctx.nir = nir; ctx.strip = strip; ctx.debug_info = nir->has_debug_info && !strip; - util_dynarray_init(&ctx.phi_fixups, NULL); + ctx.phi_fixups = UTIL_DYNARRAY_INIT; size_t idx_size_offset = blob_reserve_uint32(blob); diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index 0cafc06e8d0..2228b0e1580 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -422,7 +422,7 @@ dmabuf_feedback_init(struct dmabuf_feedback *dmabuf_feedback) if (dmabuf_feedback_tranche_init(&dmabuf_feedback->pending_tranche) < 0) return -1; - util_dynarray_init(&dmabuf_feedback->tranches, NULL); + dmabuf_feedback->tranches = UTIL_DYNARRAY_INIT; dmabuf_feedback_format_table_init(&dmabuf_feedback->format_table); diff --git a/src/etnaviv/isa/assembler.c b/src/etnaviv/isa/assembler.c index 4f6b08a4c5e..acca92d50ee 100644 --- a/src/etnaviv/isa/assembler.c +++ b/src/etnaviv/isa/assembler.c @@ -95,8 +95,7 @@ main(int argc, char *argv[]) return EXIT_FAILURE; } - struct util_dynarray bin; - util_dynarray_init(&bin, NULL); + struct util_dynarray bin = UTIL_DYNARRAY_INIT; for (unsigned int i = 0; i < result->num_instr; i++) { struct encoded_instr encoded; diff --git a/src/freedreno/common/freedreno_rd_output.c b/src/freedreno/common/freedreno_rd_output.c index 206af9e4dde..7c01c6fd62c 100644 --- a/src/freedreno/common/freedreno_rd_output.c +++ b/src/freedreno/common/freedreno_rd_output.c @@ -78,7 +78,7 @@ fd_rd_output_sanitize_name(char *name) static void fd_rd_parse_dump_range(const char *option_name, struct util_dynarray *range_array) { - util_dynarray_init(range_array, NULL); + *range_array = UTIL_DYNARRAY_INIT; const char *range_value = os_get_option(option_name); if (!range_value) return; diff --git a/src/freedreno/vulkan/tu_device.cc b/src/freedreno/vulkan/tu_device.cc index b65cea64896..69bf4a8d6f1 100644 --- a/src/freedreno/vulkan/tu_device.cc +++ b/src/freedreno/vulkan/tu_device.cc @@ -4209,8 +4209,7 @@ tu_debug_bos_print_stats(struct tu_device *dev) mtx_lock(&dev->bo_mutex); /* Put the HT's sizes data in an array so we can sort by number of allocations. */ - struct util_dynarray dyn; - util_dynarray_init(&dyn, NULL); + struct util_dynarray dyn = UTIL_DYNARRAY_INIT; uint32_t size = 0; uint32_t count = 0; diff --git a/src/freedreno/vulkan/tu_dynamic_rendering.cc b/src/freedreno/vulkan/tu_dynamic_rendering.cc index 7870db9da54..2b28a256d23 100644 --- a/src/freedreno/vulkan/tu_dynamic_rendering.cc +++ b/src/freedreno/vulkan/tu_dynamic_rendering.cc @@ -89,7 +89,7 @@ get_cmd_buffer(struct tu_device *dev, struct tu_cmd_buffer **cmd_buffer_out) VkResult tu_init_dynamic_rendering(struct tu_device *dev) { - util_dynarray_init(&dev->dynamic_rendering_pending, NULL); + dev->dynamic_rendering_pending = UTIL_DYNARRAY_INIT; dev->dynamic_rendering_fence = 0; const VkCommandPoolCreateInfo create_info = { diff --git a/src/freedreno/vulkan/tu_queue.cc b/src/freedreno/vulkan/tu_queue.cc index 8584b7e8a96..5ef98324098 100644 --- a/src/freedreno/vulkan/tu_queue.cc +++ b/src/freedreno/vulkan/tu_queue.cc @@ -384,7 +384,7 @@ queue_submit(struct vk_queue *_queue, struct vk_queue_submit *vk_submit) vk_submit->image_opaque_bind_count) return queue_submit_sparse(_queue, vk_submit); - util_dynarray_init(&dump_cmds, NULL); + dump_cmds = UTIL_DYNARRAY_INIT; uint32_t perf_pass_index = device->perfcntrs_pass_cs_entries ? vk_submit->perf_pass_index : ~0; diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c index d3c977a5fc2..32c9707b796 100644 --- a/src/gallium/auxiliary/util/u_threaded_context.c +++ b/src/gallium/auxiliary/util/u_threaded_context.c @@ -5560,7 +5560,7 @@ threaded_context_create(struct pipe_context *pipe, util_queue_fence_init(&tc->batch_slots[i].fence); tc->batch_slots[i].renderpass_info_idx = -1; if (tc->options.parse_renderpass_info) { - util_dynarray_init(&tc->batch_slots[i].renderpass_infos, NULL); + tc->batch_slots[i].renderpass_infos = UTIL_DYNARRAY_INIT; tc_batch_renderpass_infos_resize(tc, &tc->batch_slots[i]); } } diff --git a/src/gallium/drivers/asahi/agx_batch.c b/src/gallium/drivers/asahi/agx_batch.c index ed355b573dc..75c41cd9e40 100644 --- a/src/gallium/drivers/asahi/agx_batch.c +++ b/src/gallium/drivers/asahi/agx_batch.c @@ -815,8 +815,7 @@ agx_batch_submit(struct agx_context *ctx, struct agx_batch *batch, }; /* Submit! */ - struct util_dynarray cmdbuf; - util_dynarray_init(&cmdbuf, NULL); + struct util_dynarray cmdbuf = UTIL_DYNARRAY_INIT; if (compute) { /* Barrier on previous submission */ diff --git a/src/gallium/drivers/d3d12/d3d12_batch.cpp b/src/gallium/drivers/d3d12/d3d12_batch.cpp index 9af5038e17c..095ffbbfc27 100644 --- a/src/gallium/drivers/d3d12/d3d12_batch.cpp +++ b/src/gallium/drivers/d3d12/d3d12_batch.cpp @@ -59,7 +59,7 @@ d3d12_init_batch(struct d3d12_context *ctx, struct d3d12_batch *batch) batch->bos = _mesa_hash_table_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal); - util_dynarray_init(&batch->local_bos, NULL); + batch->local_bos = UTIL_DYNARRAY_INIT; batch->surfaces = _mesa_set_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal); @@ -89,7 +89,7 @@ d3d12_init_batch(struct d3d12_context *ctx, struct d3d12_batch *batch) if (!batch->sampler_tables || !batch->sampler_views || !batch->view_heap || !batch->queries) return false; - util_dynarray_init(&batch->zombie_samplers, NULL); + batch->zombie_samplers = UTIL_DYNARRAY_INIT; batch->sampler_heap = d3d12_descriptor_heap_new(screen->dev, diff --git a/src/gallium/drivers/d3d12/d3d12_descriptor_pool.cpp b/src/gallium/drivers/d3d12/d3d12_descriptor_pool.cpp index f72bd5190b5..77427beb9b8 100644 --- a/src/gallium/drivers/d3d12/d3d12_descriptor_pool.cpp +++ b/src/gallium/drivers/d3d12/d3d12_descriptor_pool.cpp @@ -79,7 +79,7 @@ d3d12_descriptor_heap_new(ID3D12Device *dev, heap->cpu_base = GetCPUDescriptorHandleForHeapStart(heap->heap).ptr; if (flags & D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE) heap->gpu_base = GetGPUDescriptorHandleForHeapStart(heap->heap).ptr; - util_dynarray_init(&heap->free_list, NULL); + heap->free_list = UTIL_DYNARRAY_INIT; return heap; } diff --git a/src/gallium/drivers/ethosu/ethosu_cmd.c b/src/gallium/drivers/ethosu/ethosu_cmd.c index 5ae23a1b372..e1e8fdfec78 100644 --- a/src/gallium/drivers/ethosu/ethosu_cmd.c +++ b/src/gallium/drivers/ethosu/ethosu_cmd.c @@ -728,8 +728,8 @@ ethosu_emit_cmdstream(struct ethosu_subgraph *subgraph) struct util_dynarray outstanding_dma_ops; struct util_dynarray outstanding_npu_ops; - util_dynarray_init(&outstanding_dma_ops, NULL); - util_dynarray_init(&outstanding_npu_ops, NULL); + outstanding_dma_ops = UTIL_DYNARRAY_INIT; + outstanding_npu_ops = UTIL_DYNARRAY_INIT; subgraph->cmdstream_used = 32; subgraph->cmdstream = calloc(subgraph->cmdstream_used, sizeof(*subgraph->cmdstream)); diff --git a/src/gallium/drivers/ethosu/ethosu_ml.c b/src/gallium/drivers/ethosu/ethosu_ml.c index 815b9e2be58..82eb0716d72 100644 --- a/src/gallium/drivers/ethosu/ethosu_ml.c +++ b/src/gallium/drivers/ethosu/ethosu_ml.c @@ -204,8 +204,8 @@ ethosu_ml_subgraph_create(struct pipe_context *pcontext, subgraph = calloc(1, sizeof(*subgraph)); subgraph->base.context = pcontext; - util_dynarray_init(&subgraph->tensors, NULL); - util_dynarray_init(&subgraph->operations, NULL); + subgraph->tensors = UTIL_DYNARRAY_INIT; + subgraph->operations = UTIL_DYNARRAY_INIT; ethosu_lower_graph(subgraph, poperations, count); diff --git a/src/gallium/drivers/etnaviv/etnaviv_ml.c b/src/gallium/drivers/etnaviv/etnaviv_ml.c index 13841318e8e..9a4e82b0bbd 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_ml.c +++ b/src/gallium/drivers/etnaviv/etnaviv_ml.c @@ -760,9 +760,9 @@ etna_ml_subgraph_create(struct pipe_context *pcontext, list_inithead(&operations); subgraph->base.context = pcontext; - util_dynarray_init(&subgraph->operations, NULL); + subgraph->operations = UTIL_DYNARRAY_INIT; - util_dynarray_init(&subgraph->tensors, NULL); + subgraph->tensors = UTIL_DYNARRAY_INIT; if (!util_dynarray_resize(&subgraph->tensors, struct etna_ml_tensor*, tensor_count)) return NULL; memset(util_dynarray_begin(&subgraph->tensors), 0, subgraph->tensors.size); diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c index 4a85fdd9c87..f4043367e33 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c @@ -1075,7 +1075,7 @@ etna_screen_create(struct etna_device *dev, struct etna_gpu *gpu, etna_init_shader_caps(screen); etna_init_screen_caps(screen); - util_dynarray_init(&screen->supported_pm_queries, NULL); + screen->supported_pm_queries = UTIL_DYNARRAY_INIT; slab_create_parent(&screen->transfer_pool, sizeof(struct etna_transfer), 16); if (screen->drm_version >= ETNA_DRM_VERSION_PERFMON) diff --git a/src/gallium/drivers/freedreno/freedreno_batch.c b/src/gallium/drivers/freedreno/freedreno_batch.c index 4f588e31c93..43440268d94 100644 --- a/src/gallium/drivers/freedreno/freedreno_batch.c +++ b/src/gallium/drivers/freedreno/freedreno_batch.c @@ -119,18 +119,19 @@ fd_batch_create(struct fd_context *ctx, bool nondraw) fd_reset_wfi(batch); - util_dynarray_init(&batch->draw_patches, NULL); - util_dynarray_init(&(batch->fb_read_patches), NULL); + batch->draw_patches = UTIL_DYNARRAY_INIT; + batch->fb_read_patches = UTIL_DYNARRAY_INIT; if (is_a2xx(ctx->screen)) { - util_dynarray_init(&batch->shader_patches, NULL); - util_dynarray_init(&batch->gmem_patches, NULL); + batch->shader_patches = UTIL_DYNARRAY_INIT; + batch->gmem_patches = UTIL_DYNARRAY_INIT; } - if (is_a3xx(ctx->screen)) - util_dynarray_init(&batch->rbrc_patches, NULL); + if (is_a3xx(ctx->screen)) { + batch->rbrc_patches = UTIL_DYNARRAY_INIT; + } - util_dynarray_init(&batch->samples, NULL); + batch->samples = UTIL_DYNARRAY_INIT; u_trace_init(&batch->trace, &ctx->trace_context); batch->last_timestamp_cmd = NULL; diff --git a/src/gallium/drivers/freedreno/freedreno_context.c b/src/gallium/drivers/freedreno/freedreno_context.c index 629e7053fc8..c8068979e12 100644 --- a/src/gallium/drivers/freedreno/freedreno_context.c +++ b/src/gallium/drivers/freedreno/freedreno_context.c @@ -697,7 +697,7 @@ fd_context_init(struct fd_context *ctx, struct pipe_screen *pscreen, slab_create_child(&ctx->transfer_pool, &screen->transfer_pool); slab_create_child(&ctx->transfer_pool_unsync, &screen->transfer_pool); - util_dynarray_init(&ctx->global_bindings, NULL); + ctx->global_bindings = UTIL_DYNARRAY_INIT; fd_draw_init(pctx); fd_resource_context_init(pctx); diff --git a/src/gallium/drivers/llvmpipe/lp_texture_handle.c b/src/gallium/drivers/llvmpipe/lp_texture_handle.c index 3186be9ac60..86e3d21441e 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture_handle.c +++ b/src/gallium/drivers/llvmpipe/lp_texture_handle.c @@ -218,7 +218,7 @@ static void lp_function_cache_init(struct lp_function_cache *cache, struct hash_table *initial_cache) { p_atomic_set(&cache->latest_cache.value, (uint64_t)(uintptr_t)initial_cache); - util_dynarray_init(&cache->trash_caches, NULL); + cache->trash_caches = UTIL_DYNARRAY_INIT; } void @@ -231,7 +231,7 @@ llvmpipe_init_sampler_matrix(struct llvmpipe_context *ctx) struct lp_sampler_matrix *matrix = &ctx->sampler_matrix; - util_dynarray_init(&matrix->gallivms, NULL); + matrix->gallivms = UTIL_DYNARRAY_INIT; matrix->ctx = ctx; diff --git a/src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c b/src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c index 6e658b8b1fb..360e354005b 100644 --- a/src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c +++ b/src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c @@ -1090,7 +1090,7 @@ _nvfx_fragprog_translate(uint16_t oclass, struct nv30_fragprog *fp) goto out_err; tgsi_parse_init(&parse, fp->pipe.tokens); - util_dynarray_init(&insns, NULL); + insns = UTIL_DYNARRAY_INIT; while (!tgsi_parse_end_of_tokens(&parse)) { tgsi_parse_token(&parse); diff --git a/src/gallium/drivers/nouveau/nv30/nvfx_vertprog.c b/src/gallium/drivers/nouveau/nv30/nvfx_vertprog.c index 080915f4dcf..d8d8bd1ca69 100644 --- a/src/gallium/drivers/nouveau/nv30/nvfx_vertprog.c +++ b/src/gallium/drivers/nouveau/nv30/nvfx_vertprog.c @@ -989,7 +989,7 @@ _nvfx_vertprog_translate(uint16_t oclass, struct nv30_vertprog *vp) vpc->cvtx_idx = vpc->hpos_idx; } - util_dynarray_init(&insns, NULL); + insns = UTIL_DYNARRAY_INIT; tgsi_parse_init(&parse, vp->pipe.tokens); while (!tgsi_parse_end_of_tokens(&parse)) { diff --git a/src/gallium/drivers/nouveau/nv50/nv50_context.c b/src/gallium/drivers/nouveau/nv50/nv50_context.c index afc09d01ba6..e9c96849a87 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_context.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_context.c @@ -407,7 +407,7 @@ nv50_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags) nv50->base.scratch.bo_size = 2 << 20; - util_dynarray_init(&nv50->global_residents, NULL); + nv50->global_residents = UTIL_DYNARRAY_INIT; // Make sure that the first TSC entry has SRGB conversion bit set, since we // use it as a fallback. diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c index c1bf83e9f3a..80470e6a995 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c @@ -528,7 +528,7 @@ nvc0_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags) memset(nvc0->tex_handles, ~0, sizeof(nvc0->tex_handles)); - util_dynarray_init(&nvc0->global_residents, NULL); + nvc0->global_residents = UTIL_DYNARRAY_INIT; // Make sure that the first TSC entry has SRGB conversion bit set, since we // use it as a fallback on Fermi for TXF, and on Kepler+ generations for diff --git a/src/gallium/drivers/panfrost/pan_blend_cso.c b/src/gallium/drivers/panfrost/pan_blend_cso.c index 6693fc61237..b937a64a164 100644 --- a/src/gallium/drivers/panfrost/pan_blend_cso.c +++ b/src/gallium/drivers/panfrost/pan_blend_cso.c @@ -124,7 +124,7 @@ GENX(pan_blend_get_shader_locked)(struct pan_blend_shader_cache *cache, #endif struct util_dynarray binary; - util_dynarray_init(&binary, NULL); + binary = UTIL_DYNARRAY_INIT; pan_shader_compile(nir, &inputs, &binary, &info); struct pan_ptr bin = diff --git a/src/gallium/drivers/panfrost/pan_csf.c b/src/gallium/drivers/panfrost/pan_csf.c index c8688636224..df92ab4e49e 100644 --- a/src/gallium/drivers/panfrost/pan_csf.c +++ b/src/gallium/drivers/panfrost/pan_csf.c @@ -656,7 +656,7 @@ GENX(csf_submit_batch)(struct panfrost_batch *batch) uint32_t vm_sync_handle = panthor_kmod_vm_sync_handle(dev->kmod.vm); struct util_dynarray syncops; - util_dynarray_init(&syncops, NULL); + syncops = UTIL_DYNARRAY_INIT; ret = csf_submit_collect_wait_ops(batch, &syncops, vm_sync_handle); if (ret) diff --git a/src/gallium/drivers/panfrost/pan_disk_cache.c b/src/gallium/drivers/panfrost/pan_disk_cache.c index aae390fc102..426c334d54c 100644 --- a/src/gallium/drivers/panfrost/pan_disk_cache.c +++ b/src/gallium/drivers/panfrost/pan_disk_cache.c @@ -141,7 +141,7 @@ panfrost_disk_cache_retrieve(struct disk_cache *cache, struct blob_reader blob; blob_reader_init(&blob, buffer, size); - util_dynarray_init(&binary->binary, NULL); + binary->binary = UTIL_DYNARRAY_INIT; uint32_t binary_size = blob_read_uint32(&blob); void *ptr = util_dynarray_resize_bytes(&binary->binary, binary_size, 1); diff --git a/src/gallium/drivers/panfrost/pan_fb_preload.c b/src/gallium/drivers/panfrost/pan_fb_preload.c index b69b89c6254..d94be7c8b13 100644 --- a/src/gallium/drivers/panfrost/pan_fb_preload.c +++ b/src/gallium/drivers/panfrost/pan_fb_preload.c @@ -551,9 +551,7 @@ pan_preload_get_shader(struct pan_fb_preload_cache *cache, .is_blit = true, .no_idvs = true, }; - struct util_dynarray binary; - - util_dynarray_init(&binary, NULL); + struct util_dynarray binary = UTIL_DYNARRAY_INIT; shader = rzalloc(cache->shaders.preload, struct pan_preload_shader_data); diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c index 86ba62d549e..c81ee68bab4 100644 --- a/src/gallium/drivers/panfrost/pan_job.c +++ b/src/gallium/drivers/panfrost/pan_job.c @@ -84,7 +84,7 @@ panfrost_batch_init(struct panfrost_context *ctx, batch->seqnum = ++ctx->batches.seqnum; - util_dynarray_init(&batch->bos, NULL); + batch->bos = UTIL_DYNARRAY_INIT; batch->minx = batch->miny = ~0; batch->maxx = batch->maxy = 0; diff --git a/src/gallium/drivers/panfrost/pan_shader.c b/src/gallium/drivers/panfrost/pan_shader.c index fba3569db4e..7392505960e 100644 --- a/src/gallium/drivers/panfrost/pan_shader.c +++ b/src/gallium/drivers/panfrost/pan_shader.c @@ -166,7 +166,7 @@ panfrost_shader_compile(struct panfrost_screen *screen, const nir_shader *ir, } } - util_dynarray_init(&out->binary, NULL); + out->binary = UTIL_DYNARRAY_INIT; if (s->info.stage == MESA_SHADER_FRAGMENT) { if (key->fs.nr_cbufs_for_fragcolor) { diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index 97f8ed4ef2e..a826da0e912 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -788,11 +788,11 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, unsign sctx->tex_handles = _mesa_hash_table_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal); sctx->img_handles = _mesa_hash_table_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal); - util_dynarray_init(&sctx->resident_tex_handles, NULL); - util_dynarray_init(&sctx->resident_img_handles, NULL); - util_dynarray_init(&sctx->resident_tex_needs_color_decompress, NULL); - util_dynarray_init(&sctx->resident_img_needs_color_decompress, NULL); - util_dynarray_init(&sctx->resident_tex_needs_depth_decompress, NULL); + sctx->resident_tex_handles = UTIL_DYNARRAY_INIT; + sctx->resident_img_handles = UTIL_DYNARRAY_INIT; + sctx->resident_tex_needs_color_decompress = UTIL_DYNARRAY_INIT; + sctx->resident_img_needs_color_decompress = UTIL_DYNARRAY_INIT; + sctx->resident_tex_needs_depth_decompress = UTIL_DYNARRAY_INIT; sctx->dirty_implicit_resources = _mesa_pointer_hash_table_create(NULL); if (!sctx->dirty_implicit_resources) { diff --git a/src/gallium/drivers/rocket/rkt_ml.c b/src/gallium/drivers/rocket/rkt_ml.c index d24494c1eb6..ce59c4ed1d4 100644 --- a/src/gallium/drivers/rocket/rkt_ml.c +++ b/src/gallium/drivers/rocket/rkt_ml.c @@ -100,7 +100,7 @@ compile_operation(struct rkt_ml_subgraph *subgraph, regcfgs = calloc(num_tasks, sizeof(struct util_dynarray)); for (int i = 0; i < num_tasks; i++) { - util_dynarray_init(®cfgs[i], NULL); + regcfgs[i] = UTIL_DYNARRAY_INIT; rkt_fill_regcmd(subgraph, operation, ®cfgs[i], i); unsigned size = @@ -168,7 +168,7 @@ lower_convolution(struct rkt_ml_subgraph *subgraph, const struct pipe_ml_operation *poperation, struct rkt_operation *operation) { - util_dynarray_init(&operation->tasks, NULL); + operation->tasks = UTIL_DYNARRAY_INIT; operation->depthwise = rkt_is_depthwise(poperation); operation->padding_same = poperation->conv.padding_same; @@ -307,8 +307,8 @@ rkt_ml_subgraph_create(struct pipe_context *pcontext, subgraph->base.context = pcontext; tensor_count = count_tensors(poperations, count); - util_dynarray_init(&subgraph->tensors, NULL); - util_dynarray_init(&subgraph->operations, NULL); + subgraph->tensors = UTIL_DYNARRAY_INIT; + subgraph->operations = UTIL_DYNARRAY_INIT; if (!util_dynarray_resize(&subgraph->tensors, struct pipe_resource *, tensor_count)) return NULL; @@ -473,8 +473,7 @@ rkt_ml_subgraph_invoke(struct pipe_context *pcontext, DBG("Submitting graph\n"); - struct util_dynarray jobs = {0}; - util_dynarray_init(&jobs, NULL); + struct util_dynarray jobs = UTIL_DYNARRAY_INIT; util_dynarray_foreach (&subgraph->operations, struct rkt_operation, operation) { diff --git a/src/gallium/drivers/zink/zink_batch.c b/src/gallium/drivers/zink/zink_batch.c index 4e9c61899c7..0ac877d9f65 100644 --- a/src/gallium/drivers/zink/zink_batch.c +++ b/src/gallium/drivers/zink/zink_batch.c @@ -362,26 +362,26 @@ create_batch_state(struct zink_context *ctx) SET_CREATE(&bs->programs); SET_CREATE(&bs->active_queries); SET_CREATE(&bs->dmabuf_exports); - util_dynarray_init(&bs->signal_semaphores, NULL); - util_dynarray_init(&bs->user_signal_semaphores, NULL); - util_dynarray_init(&bs->user_signal_semaphore_values, NULL); - util_dynarray_init(&bs->wait_semaphores, NULL); - util_dynarray_init(&bs->tracked_semaphores, NULL); - util_dynarray_init(&bs->fd_wait_semaphores, NULL); - util_dynarray_init(&bs->fences, NULL); - util_dynarray_init(&bs->dead_querypools, NULL); - util_dynarray_init(&bs->wait_semaphore_stages, NULL); - util_dynarray_init(&bs->wait_semaphore_values, NULL); - util_dynarray_init(&bs->fd_wait_semaphore_stages, NULL); - util_dynarray_init(&bs->zombie_samplers, NULL); - util_dynarray_init(&bs->freed_sparse_backing_bos, NULL); - util_dynarray_init(&bs->acquires, NULL); - util_dynarray_init(&bs->acquire_flags, NULL); - util_dynarray_init(&bs->bindless_releases[0], NULL); - util_dynarray_init(&bs->bindless_releases[1], NULL); - util_dynarray_init(&bs->swapchain_obj, NULL); - util_dynarray_init(&bs->swapchain_obj_unsync, NULL); - util_dynarray_init(&bs->fence.mfences, NULL); + bs->signal_semaphores = UTIL_DYNARRAY_INIT; + bs->user_signal_semaphores = UTIL_DYNARRAY_INIT; + bs->user_signal_semaphore_values = UTIL_DYNARRAY_INIT; + bs->wait_semaphores = UTIL_DYNARRAY_INIT; + bs->tracked_semaphores = UTIL_DYNARRAY_INIT; + bs->fd_wait_semaphores = UTIL_DYNARRAY_INIT; + bs->fences = UTIL_DYNARRAY_INIT; + bs->dead_querypools = UTIL_DYNARRAY_INIT; + bs->wait_semaphore_stages = UTIL_DYNARRAY_INIT; + bs->wait_semaphore_values = UTIL_DYNARRAY_INIT; + bs->fd_wait_semaphore_stages = UTIL_DYNARRAY_INIT; + bs->zombie_samplers = UTIL_DYNARRAY_INIT; + bs->freed_sparse_backing_bos = UTIL_DYNARRAY_INIT; + bs->acquires = UTIL_DYNARRAY_INIT; + bs->acquire_flags = UTIL_DYNARRAY_INIT; + bs->bindless_releases[0] = UTIL_DYNARRAY_INIT; + bs->bindless_releases[1] = UTIL_DYNARRAY_INIT; + bs->swapchain_obj = UTIL_DYNARRAY_INIT; + bs->swapchain_obj_unsync = UTIL_DYNARRAY_INIT; + bs->fence.mfences = UTIL_DYNARRAY_INIT; cnd_init(&bs->usage.flush); mtx_init(&bs->usage.mtx, mtx_plain); diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index b7cbdadcf0f..977249e9dc9 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -5765,8 +5765,8 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags) mesa_loge("ZINK: failed to allocate ctx->di.bindless[%d].img_infos!",i); goto fail; } - util_dynarray_init(&ctx->di.bindless[i].updates, NULL); - util_dynarray_init(&ctx->di.bindless[i].resident, NULL); + ctx->di.bindless[i].updates = UTIL_DYNARRAY_INIT; + ctx->di.bindless[i].resident = UTIL_DYNARRAY_INIT; } } diff --git a/src/gallium/drivers/zink/zink_descriptors.c b/src/gallium/drivers/zink/zink_descriptors.c index 045db35a4d1..4a3051da52f 100644 --- a/src/gallium/drivers/zink/zink_descriptors.c +++ b/src/gallium/drivers/zink/zink_descriptors.c @@ -1038,8 +1038,8 @@ get_descriptor_pool(struct zink_context *ctx, struct zink_program *pg, enum zink struct zink_descriptor_pool_multi *mpool = CALLOC_STRUCT(zink_descriptor_pool_multi); if (!mpool) return NULL; - util_dynarray_init(&mpool->overflowed_pools[0], NULL); - util_dynarray_init(&mpool->overflowed_pools[1], NULL); + mpool->overflowed_pools[0] = UTIL_DYNARRAY_INIT; + mpool->overflowed_pools[1] = UTIL_DYNARRAY_INIT; mpool->pool_key = pool_key; if (!set_pool(bs, pg, mpool, type)) { multi_pool_destroy(screen, mpool); diff --git a/src/gallium/drivers/zink/zink_kopper.c b/src/gallium/drivers/zink/zink_kopper.c index 91aa6f497c3..38a5567b44c 100644 --- a/src/gallium/drivers/zink/zink_kopper.c +++ b/src/gallium/drivers/zink/zink_kopper.c @@ -832,7 +832,7 @@ kopper_present(void *data, void *gdata, int thread_idx) return; } - util_dynarray_init(arr, NULL); + *arr = UTIL_DYNARRAY_INIT; _mesa_hash_table_insert(swapchain->presents, (void*)(uintptr_t)next, arr); } util_dynarray_append(arr, cpi->sem); diff --git a/src/gallium/drivers/zink/zink_query.c b/src/gallium/drivers/zink/zink_query.c index 3c95112a705..e1a1552aae5 100644 --- a/src/gallium/drivers/zink/zink_query.c +++ b/src/gallium/drivers/zink/zink_query.c @@ -525,7 +525,7 @@ zink_create_query(struct pipe_context *pctx, if (query->vkqtype == -1) return NULL; - util_dynarray_init(&query->starts, NULL); + query->starts = UTIL_DYNARRAY_INIT; assert(!query->precise || query->vkqtype == VK_QUERY_TYPE_OCCLUSION); diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c index b8285ed8cbc..9dfe28de61f 100644 --- a/src/gallium/drivers/zink/zink_resource.c +++ b/src/gallium/drivers/zink/zink_resource.c @@ -133,8 +133,7 @@ zink_debug_mem_print_stats(struct zink_screen *screen) simple_mtx_lock(&screen->debug_mem_lock); /* Put the HT's sizes data in an array so we can sort by number of allocations. */ - struct util_dynarray dyn; - util_dynarray_init(&dyn, NULL); + struct util_dynarray dyn = UTIL_DYNARRAY_INIT; uint32_t size = 0; uint32_t count = 0; @@ -1548,8 +1547,9 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t switch (create_result) { case roc_success: - for (unsigned i = 0; i < max_level; i++) - util_dynarray_init(&obj->copies[i], NULL); + for (unsigned i = 0; i < max_level; i++) { + obj->copies[i] = UTIL_DYNARRAY_INIT; + } FALLTHROUGH; case roc_success_early_return: return obj; diff --git a/src/gallium/frontends/lavapipe/lvp_acceleration_structure.c b/src/gallium/frontends/lavapipe/lvp_acceleration_structure.c index 6f8ae4efe4d..e39e8466d79 100644 --- a/src/gallium/frontends/lavapipe/lvp_acceleration_structure.c +++ b/src/gallium/frontends/lavapipe/lvp_acceleration_structure.c @@ -393,7 +393,7 @@ lvp_flatten_as(const struct vk_ir_header *header, const struct vk_ir_box_node *i /* Select the subtrees that have to be rebuilt in order to * limit the BVH to a supported depth. */ - util_dynarray_init(&subtrees, NULL); + subtrees = UTIL_DYNARRAY_INIT; uint32_t max_subtree_size = 0; lvp_select_subtrees_to_flatten(header, ir_box_nodes, node_depth, child_counts, root_offset, header->ir_internal_node_count - 1, diff --git a/src/gallium/frontends/lavapipe/lvp_device.c b/src/gallium/frontends/lavapipe/lvp_device.c index f50948f403f..d01411b5bcc 100644 --- a/src/gallium/frontends/lavapipe/lvp_device.c +++ b/src/gallium/frontends/lavapipe/lvp_device.c @@ -1795,7 +1795,7 @@ lvp_queue_init(struct lvp_device *device, struct lvp_queue *queue, queue->vk.driver_submit = lvp_queue_submit; simple_mtx_init(&queue->lock, mtx_plain); - util_dynarray_init(&queue->pipeline_destroys, NULL); + queue->pipeline_destroys = UTIL_DYNARRAY_INIT; return VK_SUCCESS; } @@ -1884,8 +1884,8 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateDevice( device->null_image_handle = (void *)(uintptr_t)device->queue.ctx->create_image_handle(device->queue.ctx, &(struct pipe_image_view){ 0 }); - util_dynarray_init(&device->bda_texture_handles, NULL); - util_dynarray_init(&device->bda_image_handles, NULL); + device->bda_texture_handles = UTIL_DYNARRAY_INIT; + device->bda_image_handles = UTIL_DYNARRAY_INIT; device->group_handle_alloc = 1; diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c b/src/gallium/frontends/lavapipe/lvp_execute.c index 04383015958..3e5b061145d 100644 --- a/src/gallium/frontends/lavapipe/lvp_execute.c +++ b/src/gallium/frontends/lavapipe/lvp_execute.c @@ -5395,8 +5395,8 @@ VkResult lvp_execute_cmds(struct lvp_device *device, state->min_samples_dirty = true; state->sample_mask = UINT32_MAX; state->poison_mem = device->poison_mem; - util_dynarray_init(&state->push_desc_sets, NULL); - util_dynarray_init(&state->releasebufs, NULL); + state->push_desc_sets = UTIL_DYNARRAY_INIT; + state->releasebufs = UTIL_DYNARRAY_INIT; /* default values */ state->min_sample_shading = 1; diff --git a/src/gallium/frontends/mediafoundation/encode_h264.cpp b/src/gallium/frontends/mediafoundation/encode_h264.cpp index 90cbca9689f..b9b1c44f995 100644 --- a/src/gallium/frontends/mediafoundation/encode_h264.cpp +++ b/src/gallium/frontends/mediafoundation/encode_h264.cpp @@ -198,7 +198,7 @@ CDX12EncHMFT::PrepareForEncodeHelper( LPDX12EncodeContext pDX12EncodeContext, bo const reference_frames_tracker_frame_descriptor_h264 *cur_frame_desc = nullptr; pipe_h264_enc_picture_desc *pPicInfo = &pDX12EncodeContext->encoderPicInfo.h264enc; // Initialize raw headers array - util_dynarray_init( &pPicInfo->raw_headers, NULL ); + pPicInfo->raw_headers = UTIL_DYNARRAY_INIT; uint32_t height_in_blocks = 0; uint32_t width_in_blocks = 0; diff --git a/src/gallium/frontends/mediafoundation/encode_hevc.cpp b/src/gallium/frontends/mediafoundation/encode_hevc.cpp index 71d95f2c4ec..5258a41752e 100644 --- a/src/gallium/frontends/mediafoundation/encode_hevc.cpp +++ b/src/gallium/frontends/mediafoundation/encode_hevc.cpp @@ -238,7 +238,7 @@ CDX12EncHMFT::PrepareForEncodeHelper( LPDX12EncodeContext pDX12EncodeContext, bo HRESULT hr = S_OK; pipe_h265_enc_picture_desc *pPicInfo = &pDX12EncodeContext->encoderPicInfo.h265enc; // Initialize raw headers array - util_dynarray_init( &pPicInfo->raw_headers, NULL ); + pPicInfo->raw_headers = UTIL_DYNARRAY_INIT; const reference_frames_tracker_frame_descriptor_hevc *cur_frame_desc = nullptr; diff --git a/src/gallium/frontends/va/context.c b/src/gallium/frontends/va/context.c index 031d981018a..100a62c1062 100644 --- a/src/gallium/frontends/va/context.c +++ b/src/gallium/frontends/va/context.c @@ -372,7 +372,7 @@ vlVaCreateContext(VADriverContextP ctx, VAConfigID config_id, int picture_width, context->desc.h264enc.rate_ctrl[i].frame_rate_den = 1; } context->desc.h264enc.frame_idx = util_hash_table_create_ptr_keys(); - util_dynarray_init(&context->desc.h264enc.raw_headers, NULL); + context->desc.h264enc.raw_headers = UTIL_DYNARRAY_INIT; } break; @@ -402,7 +402,7 @@ vlVaCreateContext(VADriverContextP ctx, VAConfigID config_id, int picture_width, context->desc.h265enc.rc[i].frame_rate_den = 1; } context->desc.h265enc.frame_idx = util_hash_table_create_ptr_keys(); - util_dynarray_init(&context->desc.h265enc.raw_headers, NULL); + context->desc.h265enc.raw_headers = UTIL_DYNARRAY_INIT; } break; diff --git a/src/gallium/frontends/va/surface.c b/src/gallium/frontends/va/surface.c index 0d96cdefdf3..efe03f4ca08 100644 --- a/src/gallium/frontends/va/surface.c +++ b/src/gallium/frontends/va/surface.c @@ -1295,7 +1295,7 @@ vlVaCreateSurfaces2(VADriverContextP ctx, unsigned int format, assert(0); } - util_dynarray_init(&surf->subpics, NULL); + surf->subpics = UTIL_DYNARRAY_INIT; surfaces[i] = handle_table_add(drv->htab, surf); if (!surfaces[i]) { vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED; diff --git a/src/gallium/frontends/wgl/stw_pixelformat.c b/src/gallium/frontends/wgl/stw_pixelformat.c index d7db69a2837..f924cbe933d 100644 --- a/src/gallium/frontends/wgl/stw_pixelformat.c +++ b/src/gallium/frontends/wgl/stw_pixelformat.c @@ -317,7 +317,7 @@ stw_pixelformat_init(void) assert(!stw_dev->pixelformat_count); - util_dynarray_init(&stw_dev->pixelformats, NULL); + stw_dev->pixelformats = UTIL_DYNARRAY_INIT; /* normal, displayable formats */ num_formats = add_color_format_variants(stw_pf_color, diff --git a/src/imagination/pco/pco_nir_pvfio.c b/src/imagination/pco/pco_nir_pvfio.c index 38607cf92c5..0ea1e1b5798 100644 --- a/src/imagination/pco/pco_nir_pvfio.c +++ b/src/imagination/pco/pco_nir_pvfio.c @@ -844,8 +844,8 @@ bool pco_nir_pfo(nir_shader *shader, pco_fs_data *fs) state.last_discard_store = nir_build_store_reg(&b, nir_imm_false(&b), state.discard_cond_reg); - util_dynarray_init(&state.loads, NULL); - util_dynarray_init(&state.stores, NULL); + state.loads = UTIL_DYNARRAY_INIT; + state.stores = UTIL_DYNARRAY_INIT; bool progress = false; diff --git a/src/imagination/pco/pco_opt.c b/src/imagination/pco/pco_opt.c index aea3920ff9d..dd89d0389a2 100644 --- a/src/imagination/pco/pco_opt.c +++ b/src/imagination/pco/pco_opt.c @@ -761,8 +761,7 @@ bool pco_opt_comp_only_vecs(pco_shader *shader) bool used_by_noncomps = false; pco_ref dest = vec->dest[0]; - struct util_dynarray comps; - util_dynarray_init(&comps, NULL); + struct util_dynarray comps = UTIL_DYNARRAY_INIT; pco_foreach_instr_in_func_from (instr, vec) { if (instr->op == PCO_OP_COMP) { diff --git a/src/imagination/pco/pco_ra.c b/src/imagination/pco/pco_ra.c index f989933a267..cca5e8f20ba 100644 --- a/src/imagination/pco/pco_ra.c +++ b/src/imagination/pco/pco_ra.c @@ -869,8 +869,7 @@ static bool pco_ra_func(pco_func *func, pco_ra_ctx *ctx) override ? ra_get_node_reg(ra_graph, override->ref.val) : ra_get_node_reg(ra_graph, instr->dest[0].val); - struct util_dynarray copies; - util_dynarray_init(&copies, NULL); + struct util_dynarray copies = UTIL_DYNARRAY_INIT; unsigned highest_temp = 0; unsigned lowest_temp = ~0; diff --git a/src/imagination/vulkan/pvr_cmd_buffer.c b/src/imagination/vulkan/pvr_cmd_buffer.c index 0f48e9cb88c..fc05f5faadb 100644 --- a/src/imagination/vulkan/pvr_cmd_buffer.c +++ b/src/imagination/vulkan/pvr_cmd_buffer.c @@ -237,10 +237,10 @@ static VkResult pvr_cmd_buffer_create(struct pvr_device *device, cmd_buffer->device = device; - util_dynarray_init(&cmd_buffer->depth_bias_array, NULL); - util_dynarray_init(&cmd_buffer->scissor_array, NULL); - util_dynarray_init(&cmd_buffer->deferred_csb_commands, NULL); - util_dynarray_init(&cmd_buffer->deferred_clears, NULL); + cmd_buffer->depth_bias_array = UTIL_DYNARRAY_INIT; + cmd_buffer->scissor_array = UTIL_DYNARRAY_INIT; + cmd_buffer->deferred_csb_commands = UTIL_DYNARRAY_INIT; + cmd_buffer->deferred_clears = UTIL_DYNARRAY_INIT; list_inithead(&cmd_buffer->sub_cmds); list_inithead(&cmd_buffer->bo_list); @@ -2681,7 +2681,7 @@ VkResult pvr_cmd_buffer_start_sub_cmd(struct pvr_cmd_buffer *cmd_buffer, &sub_cmd->gfx.control_stream); } - util_dynarray_init(&sub_cmd->gfx.sec_query_indices, NULL); + sub_cmd->gfx.sec_query_indices = UTIL_DYNARRAY_INIT; break; case PVR_SUB_CMD_TYPE_QUERY: @@ -3664,7 +3664,7 @@ VkResult pvr_BeginCommandBuffer(VkCommandBuffer commandBuffer, state->dirty.isp_userpass = true; } - util_dynarray_init(&state->query_indices, NULL); + state->query_indices = UTIL_DYNARRAY_INIT; memset(state->barriers_needed, 0xFF, diff --git a/src/imagination/vulkan/pvr_csb.c b/src/imagination/vulkan/pvr_csb.c index 985a2545eff..01c2c556f24 100644 --- a/src/imagination/vulkan/pvr_csb.c +++ b/src/imagination/vulkan/pvr_csb.c @@ -92,7 +92,7 @@ void pvr_csb_init(struct pvr_device *device, csb->status = VK_SUCCESS; if (stream_type == PVR_CMD_STREAM_TYPE_GRAPHICS_DEFERRED) - util_dynarray_init(&csb->deferred_cs_mem, NULL); + csb->deferred_cs_mem = UTIL_DYNARRAY_INIT; else list_inithead(&csb->pvr_bo_list); } diff --git a/src/intel/compiler/elk/elk_cfg.cpp b/src/intel/compiler/elk/elk_cfg.cpp index 21a8873158c..076327612bd 100644 --- a/src/intel/compiler/elk/elk_cfg.cpp +++ b/src/intel/compiler/elk/elk_cfg.cpp @@ -623,7 +623,7 @@ elk_cfg_t::dump(FILE *file) * output, making it possible to use it for certain tests. */ util_dynarray scratch; - util_dynarray_init(&scratch, NULL); + scratch = UTIL_DYNARRAY_INIT; foreach_block (block, this) { if (idom && idom->parent(block)) diff --git a/src/intel/decoder/intel_batch_decoder.c b/src/intel/decoder/intel_batch_decoder.c index e77233b91f7..227ca97bb56 100644 --- a/src/intel/decoder/intel_batch_decoder.c +++ b/src/intel/decoder/intel_batch_decoder.c @@ -1584,8 +1584,7 @@ compare_inst_ptr(const void *v1, const void *v2) static void intel_print_accumulated_instrs(struct intel_batch_decode_ctx *ctx) { - struct util_dynarray arr; - util_dynarray_init(&arr, NULL); + struct util_dynarray arr = UTIL_DYNARRAY_INIT; hash_table_foreach(ctx->commands, entry) { struct inst_ptr inst = { @@ -1886,8 +1885,7 @@ compare_inst_stat(const void *v1, const void *v2) void intel_batch_print_stats(struct intel_batch_decode_ctx *ctx) { - struct util_dynarray arr; - util_dynarray_init(&arr, NULL); + struct util_dynarray arr = UTIL_DYNARRAY_INIT; hash_table_foreach(ctx->stats, entry) { struct inst_stat inst = { diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c index 2bc92e7f1e5..013d5bf1913 100644 --- a/src/intel/vulkan/anv_allocator.c +++ b/src/intel/vulkan/anv_allocator.c @@ -1034,7 +1034,7 @@ anv_state_stream_init(struct anv_state_stream *stream, stream->next = block_size; stream->total_size = 0; - util_dynarray_init(&stream->all_blocks, NULL); + stream->all_blocks = UTIL_DYNARRAY_INIT; VG(VALGRIND_CREATE_MEMPOOL(stream, 0, false)); } diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c index f8a1cdce8e0..4d1e085e325 100644 --- a/src/intel/vulkan/anv_batch_chain.c +++ b/src/intel/vulkan/anv_batch_chain.c @@ -1715,7 +1715,7 @@ anv_async_submit_init(struct anv_async_submit *submit, .engine_class = queue->family->engine_class, }; - util_dynarray_init(&submit->batch_bos, NULL); + submit->batch_bos = UTIL_DYNARRAY_INIT; if (create_signal_sync) { result = vk_sync_create(&device->vk, diff --git a/src/intel/vulkan/anv_sparse.c b/src/intel/vulkan/anv_sparse.c index 00242e9e358..1710cbb6461 100644 --- a/src/intel/vulkan/anv_sparse.c +++ b/src/intel/vulkan/anv_sparse.c @@ -802,7 +802,7 @@ anv_sparse_bind_trtt(struct anv_device *device, struct anv_trtt_bind *ptr = alloca(alloc_size); util_dynarray_init_from_stack(&l1_binds, ptr, alloc_size); } else { - util_dynarray_init(&l1_binds, NULL); + l1_binds = UTIL_DYNARRAY_INIT; if (!util_dynarray_ensure_cap(&l1_binds, l1_binds_capacity * sizeof(struct anv_trtt_bind))) goto out_dynarrays; diff --git a/src/intel/vulkan_hasvk/anv_allocator.c b/src/intel/vulkan_hasvk/anv_allocator.c index 04d9618188b..a50abd2bae7 100644 --- a/src/intel/vulkan_hasvk/anv_allocator.c +++ b/src/intel/vulkan_hasvk/anv_allocator.c @@ -1211,7 +1211,7 @@ anv_state_stream_init(struct anv_state_stream *stream, */ stream->next = block_size; - util_dynarray_init(&stream->all_blocks, NULL); + stream->all_blocks = UTIL_DYNARRAY_INIT; VG(VALGRIND_CREATE_MEMPOOL(stream, 0, false)); } diff --git a/src/kosmickrisp/vulkan/kk_cmd_buffer.c b/src/kosmickrisp/vulkan/kk_cmd_buffer.c index f0f0b9b57fd..b38b2f2e844 100644 --- a/src/kosmickrisp/vulkan/kk_cmd_buffer.c +++ b/src/kosmickrisp/vulkan/kk_cmd_buffer.c @@ -84,7 +84,7 @@ kk_create_cmd_buffer(struct vk_command_pool *vk_pool, return result; } - util_dynarray_init(&cmd->large_bos, NULL); + cmd->large_bos = UTIL_DYNARRAY_INIT; cmd->vk.dynamic_graphics_state.vi = &cmd->state.gfx._dynamic_vi; cmd->vk.dynamic_graphics_state.ms.sample_locations = diff --git a/src/kosmickrisp/vulkan/kk_device.c b/src/kosmickrisp/vulkan/kk_device.c index 6bf89bcfb59..bc2f42f57ca 100644 --- a/src/kosmickrisp/vulkan/kk_device.c +++ b/src/kosmickrisp/vulkan/kk_device.c @@ -209,7 +209,7 @@ kk_CreateDevice(VkPhysicalDevice physicalDevice, goto fail_sampler_heap; simple_mtx_init(&dev->user_heap_cache.mutex, mtx_plain); - util_dynarray_init(&dev->user_heap_cache.handles, NULL); + dev->user_heap_cache.handles = UTIL_DYNARRAY_INIT; *pDevice = kk_device_to_handle(dev); diff --git a/src/kosmickrisp/vulkan/kk_encoder.c b/src/kosmickrisp/vulkan/kk_encoder.c index f12a8d153fb..76eb5ad5806 100644 --- a/src/kosmickrisp/vulkan/kk_encoder.c +++ b/src/kosmickrisp/vulkan/kk_encoder.c @@ -21,7 +21,7 @@ kk_encoder_start_internal(struct kk_encoder_internal *encoder, { encoder->cmd_buffer = mtl_new_command_buffer(queue); encoder->last_used = KK_ENC_NONE; - util_dynarray_init(&encoder->fences, NULL); + encoder->fences = UTIL_DYNARRAY_INIT; } VkResult @@ -38,9 +38,9 @@ kk_encoder_init(mtl_device *device, struct kk_queue *queue, kk_encoder_start_internal(&enc->main, device, queue->main.mtl_handle); kk_encoder_start_internal(&enc->pre_gfx, device, queue->pre_gfx.mtl_handle); enc->event = mtl_new_event(device); - util_dynarray_init(&enc->imm_writes, NULL); - util_dynarray_init(&enc->resident_buffers, NULL); - util_dynarray_init(&enc->copy_query_pool_result_infos, NULL); + enc->imm_writes = UTIL_DYNARRAY_INIT; + enc->resident_buffers = UTIL_DYNARRAY_INIT; + enc->copy_query_pool_result_infos = UTIL_DYNARRAY_INIT; *encoder = enc; return VK_SUCCESS; diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 77a6cc5c478..42212685972 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1043,7 +1043,7 @@ _mesa_initialize_context(struct gl_context *ctx, simple_mtx_lock(&ctx->Shared->Mutex); list_addtail(&ctx->SharedLink, &ctx->Shared->Contexts); simple_mtx_unlock(&ctx->Shared->Mutex); - util_dynarray_init(&ctx->ReleaseResources, NULL); + ctx->ReleaseResources = UTIL_DYNARRAY_INIT; return GL_TRUE; diff --git a/src/mesa/main/texturebindless.c b/src/mesa/main/texturebindless.c index b4dd48121ae..24c1a71a564 100644 --- a/src/mesa/main/texturebindless.c +++ b/src/mesa/main/texturebindless.c @@ -442,8 +442,8 @@ _mesa_free_shared_handles(struct gl_shared_state *shared) void _mesa_init_texture_handles(struct gl_texture_object *texObj) { - util_dynarray_init(&texObj->SamplerHandles, NULL); - util_dynarray_init(&texObj->ImageHandles, NULL); + texObj->SamplerHandles = UTIL_DYNARRAY_INIT; + texObj->ImageHandles = UTIL_DYNARRAY_INIT; } void @@ -504,7 +504,7 @@ _mesa_delete_texture_handles(struct gl_context *ctx, void _mesa_init_sampler_handles(struct gl_sampler_object *sampObj) { - util_dynarray_init(&sampObj->Handles, NULL); + sampObj->Handles = UTIL_DYNARRAY_INIT; } void diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index b5f51bfbc80..cf36a0fd9e1 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -769,7 +769,7 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe, list_inithead(&st->zombie_shaders.list.node); simple_mtx_init(&st->zombie_shaders.mutex, mtx_plain); - util_dynarray_init(&st->release_resources, NULL); + st->release_resources = UTIL_DYNARRAY_INIT; ctx->Const.DriverSupportedPrimMask = screen->caps.supported_prim_modes | /* patches is always supported */ diff --git a/src/microsoft/vulkan/dzn_cmd_buffer.c b/src/microsoft/vulkan/dzn_cmd_buffer.c index 2a895b73891..cbb0e896100 100644 --- a/src/microsoft/vulkan/dzn_cmd_buffer.c +++ b/src/microsoft/vulkan/dzn_cmd_buffer.c @@ -609,9 +609,9 @@ dzn_cmd_buffer_create(const VkCommandBufferAllocateInfo *info, cmdbuf->state.multiview.view_mask = 1; for (uint32_t bucket = 0; bucket < DZN_INTERNAL_BUF_BUCKET_COUNT; ++bucket) list_inithead(&cmdbuf->internal_bufs[bucket]); - util_dynarray_init(&cmdbuf->events.signal, NULL); - util_dynarray_init(&cmdbuf->queries.reset, NULL); - util_dynarray_init(&cmdbuf->queries.signal, NULL); + cmdbuf->events.signal = UTIL_DYNARRAY_INIT; + cmdbuf->queries.reset = UTIL_DYNARRAY_INIT; + cmdbuf->queries.signal = UTIL_DYNARRAY_INIT; dzn_descriptor_heap_pool_init(&cmdbuf->rtvs.pool, device, D3D12_DESCRIPTOR_HEAP_TYPE_RTV, false, &pool->alloc); @@ -832,10 +832,10 @@ dzn_cmd_buffer_create_query_pool_state(struct dzn_cmd_buffer *cmdbuf) return NULL; } - util_dynarray_init(&state->reset, NULL); - util_dynarray_init(&state->collect, NULL); - util_dynarray_init(&state->signal, NULL); - util_dynarray_init(&state->zero, NULL); + state->reset = UTIL_DYNARRAY_INIT; + state->collect = UTIL_DYNARRAY_INIT; + state->signal = UTIL_DYNARRAY_INIT; + state->zero = UTIL_DYNARRAY_INIT; return state; } diff --git a/src/microsoft/vulkan/dzn_device.c b/src/microsoft/vulkan/dzn_device.c index 1acad04c8ca..ed4ae15af2d 100644 --- a/src/microsoft/vulkan/dzn_device.c +++ b/src/microsoft/vulkan/dzn_device.c @@ -2404,7 +2404,7 @@ dzn_device_create(struct dzn_physical_device *pdev, } mtx_init(&device->device_heaps[type].lock, mtx_plain); - util_dynarray_init(&device->device_heaps[type].slot_freelist, NULL); + device->device_heaps[type].slot_freelist = UTIL_DYNARRAY_INIT; device->device_heaps[type].next_alloc_slot = 0; } } diff --git a/src/nouveau/vulkan/nvk_cmd_buffer.c b/src/nouveau/vulkan/nvk_cmd_buffer.c index 1b73bc71358..23cf3bc6015 100644 --- a/src/nouveau/vulkan/nvk_cmd_buffer.c +++ b/src/nouveau/vulkan/nvk_cmd_buffer.c @@ -94,7 +94,7 @@ nvk_create_cmd_buffer(struct vk_command_pool *vk_pool, list_inithead(&cmd->owned_mem); list_inithead(&cmd->owned_gart_mem); list_inithead(&cmd->owned_qmd); - util_dynarray_init(&cmd->pushes, NULL); + cmd->pushes = UTIL_DYNARRAY_INIT; cmd->prev_subc = ffs(nvk_cmd_buffer_subchannel_mask(cmd)) - 1; diff --git a/src/panfrost/clc/pan_compile.c b/src/panfrost/clc/pan_compile.c index 63d78698c22..8d4cbf5907f 100644 --- a/src/panfrost/clc/pan_compile.c +++ b/src/panfrost/clc/pan_compile.c @@ -442,7 +442,7 @@ main(int argc, const char **argv) struct util_dynarray shader_binary; struct pan_shader_info shader_info = {0}; - util_dynarray_init(&shader_binary, NULL); + shader_binary = UTIL_DYNARRAY_INIT; pan_shader_compile(clone, &inputs, &shader_binary, &shader_info); assert(shader_info.push.count * 4 <= diff --git a/src/panfrost/compiler/bi_iterator_schedule.c b/src/panfrost/compiler/bi_iterator_schedule.c index f342a59d5ed..7caac64eee3 100644 --- a/src/panfrost/compiler/bi_iterator_schedule.c +++ b/src/panfrost/compiler/bi_iterator_schedule.c @@ -98,8 +98,7 @@ bi_iterator_schedule(bi_context *ctx) } } - struct util_dynarray iterators; - util_dynarray_init(&iterators, NULL); + struct util_dynarray iterators = UTIL_DYNARRAY_INIT; bi_foreach_instr_global(ctx, phi) { if (phi->op != BI_OPCODE_PHI || phi->nr_dests != 1) continue; diff --git a/src/panfrost/compiler/bi_spill_ssa.c b/src/panfrost/compiler/bi_spill_ssa.c index cd3e6bc5d3e..dfad105f9f1 100644 --- a/src/panfrost/compiler/bi_spill_ssa.c +++ b/src/panfrost/compiler/bi_spill_ssa.c @@ -669,7 +669,7 @@ calculate_local_next_use(struct spill_ctx *ctx, struct util_dynarray *out) struct spill_block *sb = spill_block(ctx, ctx->block); unsigned ip = sb->cycles; - util_dynarray_init(out, NULL); + *out = UTIL_DYNARRAY_INIT; struct next_uses nu; init_next_uses(&nu, NULL); diff --git a/src/panfrost/compiler/bifrost/bi_schedule.c b/src/panfrost/compiler/bifrost/bi_schedule.c index 39c731759cb..f42f96dfccd 100644 --- a/src/panfrost/compiler/bifrost/bi_schedule.c +++ b/src/panfrost/compiler/bifrost/bi_schedule.c @@ -225,8 +225,8 @@ bi_create_dependency_graph(struct bi_worklist st, bool inorder, bool is_blend) struct util_dynarray last_read[64], last_write[64]; for (unsigned i = 0; i < 64; ++i) { - util_dynarray_init(&last_read[i], NULL); - util_dynarray_init(&last_write[i], NULL); + last_read[i] = UTIL_DYNARRAY_INIT; + last_write[i] = UTIL_DYNARRAY_INIT; } /* Initialize dependency graph */ diff --git a/src/panfrost/compiler/test/test-pack-formats.cpp b/src/panfrost/compiler/test/test-pack-formats.cpp index f75add21197..ff82ae8e656 100644 --- a/src/panfrost/compiler/test/test-pack-formats.cpp +++ b/src/panfrost/compiler/test/test-pack-formats.cpp @@ -31,7 +31,7 @@ class PackFormats : public testing::Test { protected: PackFormats() { - util_dynarray_init(&result, NULL); + result = UTIL_DYNARRAY_INIT; } ~PackFormats() { diff --git a/src/panfrost/genxml/cs_builder.h b/src/panfrost/genxml/cs_builder.h index e18efee2f72..a94424a3137 100644 --- a/src/panfrost/genxml/cs_builder.h +++ b/src/panfrost/genxml/cs_builder.h @@ -263,7 +263,7 @@ cs_builder_init(struct cs_builder *b, const struct cs_builder_conf *conf, */ b->conf.nr_kernel_registers = MAX2(b->conf.nr_kernel_registers, 3); - util_dynarray_init(&b->blocks.instrs, NULL); + b->blocks.instrs = UTIL_DYNARRAY_INIT; } static inline bool diff --git a/src/panfrost/genxml/decode_common.c b/src/panfrost/genxml/decode_common.c index cb7d286a412..b579a2f3729 100644 --- a/src/panfrost/genxml/decode_common.c +++ b/src/panfrost/genxml/decode_common.c @@ -310,7 +310,7 @@ pandecode_create_context(bool to_stderr) ctx->dump_stream = to_stderr ? stderr : NULL; rb_tree_init(&ctx->mmap_tree); - util_dynarray_init(&ctx->ro_mappings, NULL); + ctx->ro_mappings = UTIL_DYNARRAY_INIT; simple_mtx_t mtx_init = SIMPLE_MTX_INITIALIZER; memcpy(&ctx->lock, &mtx_init, sizeof(simple_mtx_t)); diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c index 83a619a31dc..3b7eebb5cf7 100644 --- a/src/panfrost/midgard/midgard_schedule.c +++ b/src/panfrost/midgard/midgard_schedule.c @@ -107,8 +107,8 @@ mir_create_dependency_graph(midgard_instruction **instructions, unsigned count, struct util_dynarray *last_write = calloc(sizeof(struct util_dynarray), sz); for (unsigned i = 0; i < sz; ++i) { - util_dynarray_init(&last_read[i], NULL); - util_dynarray_init(&last_write[i], NULL); + last_read[i] = UTIL_DYNARRAY_INIT; + last_write[i] = UTIL_DYNARRAY_INIT; } /* Initialize dependency graph */ @@ -1473,8 +1473,7 @@ schedule_block(compiler_context *ctx, midgard_block *block) ++num_ldst; } - struct util_dynarray bundles; - util_dynarray_init(&bundles, NULL); + struct util_dynarray bundles = UTIL_DYNARRAY_INIT; block->quadword_count = 0; diff --git a/src/panfrost/vulkan/jm/panvk_vX_cmd_buffer.c b/src/panfrost/vulkan/jm/panvk_vX_cmd_buffer.c index 8d536ac0aa1..7c8d66de2e4 100644 --- a/src/panfrost/vulkan/jm/panvk_vX_cmd_buffer.c +++ b/src/panfrost/vulkan/jm/panvk_vX_cmd_buffer.c @@ -306,8 +306,8 @@ panvk_per_arch(cmd_open_batch)(struct panvk_cmd_buffer *cmdbuf) cmdbuf->cur_batch = vk_zalloc(&cmdbuf->vk.pool->alloc, sizeof(*cmdbuf->cur_batch), 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); - util_dynarray_init(&cmdbuf->cur_batch->jobs, NULL); - util_dynarray_init(&cmdbuf->cur_batch->event_ops, NULL); + cmdbuf->cur_batch->jobs = UTIL_DYNARRAY_INIT; + cmdbuf->cur_batch->event_ops = UTIL_DYNARRAY_INIT; assert(cmdbuf->cur_batch); return cmdbuf->cur_batch; } diff --git a/src/panfrost/vulkan/panvk_vX_shader.c b/src/panfrost/vulkan/panvk_vX_shader.c index 673aa3df39d..f5e669cdcc7 100644 --- a/src/panfrost/vulkan/panvk_vX_shader.c +++ b/src/panfrost/vulkan/panvk_vX_shader.c @@ -975,8 +975,7 @@ panvk_compile_nir(struct panvk_device *dev, nir_shader *nir, const bool dump_asm = shader_flags & VK_SHADER_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_MESA; - struct util_dynarray binary; - util_dynarray_init(&binary, NULL); + struct util_dynarray binary = UTIL_DYNARRAY_INIT; pan_shader_compile(nir, compile_input, &binary, &shader->info); /* Propagate potential additional FAU values into the panvk info struct. */ diff --git a/src/util/dag.c b/src/util/dag.c index 11d2a0616db..870a714e71c 100644 --- a/src/util/dag.c +++ b/src/util/dag.c @@ -140,8 +140,7 @@ dag_traverse_bottom_up_node(struct dag_node *node, if (_mesa_set_search(state->seen, node)) return; - struct util_dynarray stack; - util_dynarray_init(&stack, NULL); + struct util_dynarray stack = UTIL_DYNARRAY_INIT; do { assert(node); diff --git a/src/virtio/vdrm/vdrm_vpipe.c b/src/virtio/vdrm/vdrm_vpipe.c index 629d43bcd9a..2bb16498db1 100644 --- a/src/virtio/vdrm/vdrm_vpipe.c +++ b/src/virtio/vdrm/vdrm_vpipe.c @@ -797,7 +797,7 @@ vdrm_vpipe_connect(uint32_t context_type) simple_mtx_init(&vtdev->lock, mtx_plain); util_idalloc_init(&vtdev->bo_idx_allocator, 512); - util_dynarray_init(&vtdev->bo_table, NULL); + vtdev->bo_table = UTIL_DYNARRAY_INIT; simple_mtx_lock(&vtdev->lock); send_init(vtdev); diff --git a/src/vulkan/runtime/rmv/vk_rmv_common.c b/src/vulkan/runtime/rmv/vk_rmv_common.c index a32ad75cdaa..9839399b522 100644 --- a/src/vulkan/runtime/rmv/vk_rmv_common.c +++ b/src/vulkan/runtime/rmv/vk_rmv_common.c @@ -30,7 +30,7 @@ vk_memory_trace_init(struct vk_device *device, const struct vk_rmv_device_info * { device->memory_trace_data.device_info = *device_info; device->memory_trace_data.is_enabled = true; - util_dynarray_init(&device->memory_trace_data.tokens, NULL); + device->memory_trace_data.tokens = UTIL_DYNARRAY_INIT; simple_mtx_init(&device->memory_trace_data.token_mtx, mtx_plain); device->memory_trace_data.next_resource_id = 1; diff --git a/src/vulkan/runtime/vk_command_buffer.c b/src/vulkan/runtime/vk_command_buffer.c index da532d224b4..dcc9e6cf838 100644 --- a/src/vulkan/runtime/vk_command_buffer.c +++ b/src/vulkan/runtime/vk_command_buffer.c @@ -46,7 +46,7 @@ vk_command_buffer_init(struct vk_command_pool *pool, command_buffer->record_result = VK_SUCCESS; vk_cmd_queue_init(&command_buffer->cmd_queue, &pool->alloc); vk_meta_object_list_init(&command_buffer->meta_objects); - util_dynarray_init(&command_buffer->labels, NULL); + command_buffer->labels = UTIL_DYNARRAY_INIT; command_buffer->region_begin = true; list_add(&command_buffer->pool_link, &pool->command_buffers); diff --git a/src/vulkan/runtime/vk_meta_object_list.c b/src/vulkan/runtime/vk_meta_object_list.c index d47063f3de2..ac05b5e183c 100644 --- a/src/vulkan/runtime/vk_meta_object_list.c +++ b/src/vulkan/runtime/vk_meta_object_list.c @@ -47,7 +47,7 @@ vk_meta_destroy_object(struct vk_device *device, struct vk_object_base *obj) void vk_meta_object_list_init(struct vk_meta_object_list *mol) { - util_dynarray_init(&mol->arr, NULL); + mol->arr = UTIL_DYNARRAY_INIT; } void diff --git a/src/vulkan/runtime/vk_queue.c b/src/vulkan/runtime/vk_queue.c index 2c8e1f20bad..d92658989f6 100644 --- a/src/vulkan/runtime/vk_queue.c +++ b/src/vulkan/runtime/vk_queue.c @@ -94,7 +94,7 @@ vk_queue_init(struct vk_queue *queue, struct vk_device *device, goto fail_thread; } - util_dynarray_init(&queue->labels, NULL); + queue->labels = UTIL_DYNARRAY_INIT; queue->region_begin = true; return VK_SUCCESS; diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c index bdb6a3a693f..1033bf6a43d 100644 --- a/src/vulkan/wsi/wsi_common_wayland.c +++ b/src/vulkan/wsi/wsi_common_wayland.c @@ -800,7 +800,7 @@ dmabuf_feedback_init(struct dmabuf_feedback *dmabuf_feedback) if (dmabuf_feedback_tranche_init(&dmabuf_feedback->pending_tranche) < 0) return -1; - util_dynarray_init(&dmabuf_feedback->tranches, NULL); + dmabuf_feedback->tranches = UTIL_DYNARRAY_INIT; dmabuf_feedback_format_table_init(&dmabuf_feedback->format_table);