util/u_sampler.h \
util/u_simple_shaders.c \
util/u_simple_shaders.h \
- util/u_slab.c \
- util/u_slab.h \
util/u_split_prim.h \
util/u_sse.h \
util/u_string.h \
+++ /dev/null
-/*
- * Copyright 2010 Marek Olšák <maraeo@gmail.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE. */
-
-#include "util/u_slab.h"
-
-#include "util/u_math.h"
-#include "util/u_memory.h"
-#include "util/simple_list.h"
-
-#include <stdio.h>
-
-#define UTIL_SLAB_MAGIC 0xcafe4321
-
-/* The block is either allocated memory or free space. */
-struct util_slab_block {
- /* The header. */
- /* The first next free block. */
- struct util_slab_block *next_free;
-
- intptr_t magic;
-
- /* Memory after the last member is dedicated to the block itself.
- * The allocated size is always larger than this structure. */
-};
-
-static struct util_slab_block *
-util_slab_get_block(struct util_slab_mempool *pool,
- struct util_slab_page *page, unsigned index)
-{
- return (struct util_slab_block*)
- ((uint8_t*)page + sizeof(struct util_slab_page) +
- (pool->block_size * index));
-}
-
-static void util_slab_add_new_page(struct util_slab_mempool *pool)
-{
- struct util_slab_page *page;
- struct util_slab_block *block;
- unsigned i;
-
- page = MALLOC(pool->page_size);
- insert_at_tail(&pool->list, page);
-
- /* Mark all blocks as free. */
- for (i = 0; i < pool->num_blocks-1; i++) {
- block = util_slab_get_block(pool, page, i);
- block->next_free = util_slab_get_block(pool, page, i+1);
- block->magic = UTIL_SLAB_MAGIC;
- }
-
- block = util_slab_get_block(pool, page, pool->num_blocks-1);
- block->next_free = pool->first_free;
- block->magic = UTIL_SLAB_MAGIC;
- pool->first_free = util_slab_get_block(pool, page, 0);
- pool->num_pages++;
-
-#if 0
- fprintf(stderr, "New page! Num of pages: %i\n", pool->num_pages);
-#endif
-}
-
-static void *util_slab_alloc_st(struct util_slab_mempool *pool)
-{
- struct util_slab_block *block;
-
- if (!pool->first_free)
- util_slab_add_new_page(pool);
-
- block = pool->first_free;
- assert(block->magic == UTIL_SLAB_MAGIC);
- pool->first_free = block->next_free;
-
- return (uint8_t*)block + sizeof(struct util_slab_block);
-}
-
-static void util_slab_free_st(struct util_slab_mempool *pool, void *ptr)
-{
- struct util_slab_block *block =
- (struct util_slab_block*)
- ((uint8_t*)ptr - sizeof(struct util_slab_block));
-
- assert(block->magic == UTIL_SLAB_MAGIC);
- block->next_free = pool->first_free;
- pool->first_free = block;
-}
-
-static void *util_slab_alloc_mt(struct util_slab_mempool *pool)
-{
- void *mem;
-
- pipe_mutex_lock(pool->mutex);
- mem = util_slab_alloc_st(pool);
- pipe_mutex_unlock(pool->mutex);
- return mem;
-}
-
-static void util_slab_free_mt(struct util_slab_mempool *pool, void *ptr)
-{
- pipe_mutex_lock(pool->mutex);
- util_slab_free_st(pool, ptr);
- pipe_mutex_unlock(pool->mutex);
-}
-
-void util_slab_set_thread_safety(struct util_slab_mempool *pool,
- enum util_slab_threading threading)
-{
- pool->threading = threading;
-
- if (threading) {
- pool->alloc = util_slab_alloc_mt;
- pool->free = util_slab_free_mt;
- } else {
- pool->alloc = util_slab_alloc_st;
- pool->free = util_slab_free_st;
- }
-}
-
-void util_slab_create(struct util_slab_mempool *pool,
- unsigned item_size,
- unsigned num_blocks,
- enum util_slab_threading threading)
-{
- item_size = align(item_size, sizeof(intptr_t));
-
- pool->num_pages = 0;
- pool->num_blocks = num_blocks;
- pool->block_size = sizeof(struct util_slab_block) + item_size;
- pool->block_size = align(pool->block_size, sizeof(intptr_t));
- pool->page_size = sizeof(struct util_slab_page) +
- num_blocks * pool->block_size;
- pool->first_free = NULL;
-
- make_empty_list(&pool->list);
-
- pipe_mutex_init(pool->mutex);
-
- util_slab_set_thread_safety(pool, threading);
-}
-
-void util_slab_destroy(struct util_slab_mempool *pool)
-{
- struct util_slab_page *page, *temp;
-
- if (pool->list.next) {
- foreach_s(page, temp, &pool->list) {
- remove_from_list(page);
- FREE(page);
- }
- }
-
- pipe_mutex_destroy(pool->mutex);
-}
+++ /dev/null
-/*
- * Copyright 2010 Marek Olšák <maraeo@gmail.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE. */
-
-/**
- * @file
- * Simple slab allocator for equally sized memory allocations.
- * util_slab_alloc and util_slab_free have time complexity in O(1).
- *
- * Good for allocations which have very low lifetime and are allocated
- * and freed very often. Use a profiler first to know if it's worth using it!
- *
- * Candidates: transfer_map
- *
- * @author Marek Olšák
- */
-
-#ifndef U_SLAB_H
-#define U_SLAB_H
-
-#include "os/os_thread.h"
-
-enum util_slab_threading {
- UTIL_SLAB_SINGLETHREADED = FALSE,
- UTIL_SLAB_MULTITHREADED = TRUE
-};
-
-/* The page is an array of blocks (allocations). */
-struct util_slab_page {
- /* The header (linked-list pointers). */
- struct util_slab_page *prev, *next;
-
- /* Memory after the last member is dedicated to the page itself.
- * The allocated size is always larger than this structure. */
-};
-
-struct util_slab_mempool {
- /* Public members. */
- void *(*alloc)(struct util_slab_mempool *pool);
- void (*free)(struct util_slab_mempool *pool, void *ptr);
-
- /* Private members. */
- struct util_slab_block *first_free;
-
- struct util_slab_page list;
-
- unsigned block_size;
- unsigned page_size;
- unsigned num_blocks;
- unsigned num_pages;
- enum util_slab_threading threading;
-
- pipe_mutex mutex;
-};
-
-void util_slab_create(struct util_slab_mempool *pool,
- unsigned item_size,
- unsigned num_blocks,
- enum util_slab_threading threading);
-
-void util_slab_destroy(struct util_slab_mempool *pool);
-
-void util_slab_set_thread_safety(struct util_slab_mempool *pool,
- enum util_slab_threading threading);
-
-static inline void *
-util_slab_alloc(struct util_slab_mempool *pool)
-{
- return pool->alloc(pool);
-}
-
-static inline void
-util_slab_free(struct util_slab_mempool *pool, void *ptr)
-{
- pool->free(pool, ptr);
-}
-
-#endif
if (ctx->primconvert)
util_primconvert_destroy(ctx->primconvert);
- util_slab_destroy(&ctx->transfer_pool);
+ slab_destroy(&ctx->transfer_pool);
for (i = 0; i < ARRAY_SIZE(ctx->pipe); i++) {
struct fd_vsc_pipe *pipe = &ctx->pipe[i];
ctx->batch = fd_bc_alloc_batch(&screen->batch_cache, ctx);
}
- util_slab_create(&ctx->transfer_pool, sizeof(struct fd_transfer),
- 16, UTIL_SLAB_SINGLETHREADED);
+ slab_create(&ctx->transfer_pool, sizeof(struct fd_transfer),
+ 16);
fd_draw_init(pctx);
fd_resource_context_init(pctx);
#include "indices/u_primconvert.h"
#include "util/u_blitter.h"
#include "util/list.h"
-#include "util/u_slab.h"
+#include "util/slab.h"
#include "util/u_string.h"
#include "freedreno_batch.h"
struct primconvert_context *primconvert;
/* slab for pipe_transfer allocations: */
- struct util_slab_mempool transfer_pool;
+ struct slab_mempool transfer_pool;
/* slabs for fd_hw_sample and fd_hw_sample_period allocations: */
- struct util_slab_mempool sample_pool;
- struct util_slab_mempool sample_period_pool;
+ struct slab_mempool sample_pool;
+ struct slab_mempool sample_period_pool;
/* sample-providers for hw queries: */
const struct fd_hw_sample_provider *sample_providers[MAX_HW_SAMPLE_PROVIDERS];
assert(idx >= 0); /* query never would have been created otherwise */
assert(!hq->period);
batch->active_providers |= (1 << idx);
- hq->period = util_slab_alloc(&batch->ctx->sample_period_pool);
+ hq->period = slab_alloc_st(&batch->ctx->sample_period_pool);
list_inithead(&hq->period->list);
hq->period->start = get_sample(batch, ring, hq->base.type);
- /* NOTE: util_slab_alloc() does not zero out the buffer: */
+ /* NOTE: slab_alloc_st() does not zero out the buffer: */
hq->period->end = NULL;
}
fd_hw_sample_reference(ctx, &period->start, NULL);
fd_hw_sample_reference(ctx, &period->end, NULL);
list_del(&period->list);
- util_slab_free(&ctx->sample_period_pool, period);
+ slab_free_st(&ctx->sample_period_pool, period);
}
}
struct fd_hw_sample *
fd_hw_sample_init(struct fd_batch *batch, uint32_t size)
{
- struct fd_hw_sample *samp = util_slab_alloc(&batch->ctx->sample_pool);
+ struct fd_hw_sample *samp = slab_alloc_st(&batch->ctx->sample_pool);
pipe_reference_init(&samp->reference, 1);
samp->size = size;
debug_assert(util_is_power_of_two(size));
batch->next_sample_offset = align(batch->next_sample_offset, size);
samp->offset = batch->next_sample_offset;
- /* NOTE: util_slab_alloc() does not zero out the buffer: */
+ /* NOTE: slab_alloc_st() does not zero out the buffer: */
samp->prsc = NULL;
samp->num_tiles = 0;
samp->tile_stride = 0;
__fd_hw_sample_destroy(struct fd_context *ctx, struct fd_hw_sample *samp)
{
pipe_resource_reference(&samp->prsc, NULL);
- util_slab_free(&ctx->sample_pool, samp);
+ slab_free_st(&ctx->sample_pool, samp);
}
/* called from gmem code once total storage requirements are known (ie.
{
struct fd_context *ctx = fd_context(pctx);
- util_slab_create(&ctx->sample_pool, sizeof(struct fd_hw_sample),
- 16, UTIL_SLAB_SINGLETHREADED);
- util_slab_create(&ctx->sample_period_pool, sizeof(struct fd_hw_sample_period),
- 16, UTIL_SLAB_SINGLETHREADED);
+ slab_create(&ctx->sample_pool, sizeof(struct fd_hw_sample),
+ 16);
+ slab_create(&ctx->sample_period_pool, sizeof(struct fd_hw_sample_period),
+ 16);
list_inithead(&ctx->active_queries);
}
{
struct fd_context *ctx = fd_context(pctx);
- util_slab_destroy(&ctx->sample_pool);
- util_slab_destroy(&ctx->sample_period_pool);
+ slab_destroy(&ctx->sample_pool);
+ slab_destroy(&ctx->sample_period_pool);
}
ptrans->box.x + ptrans->box.width);
pipe_resource_reference(&ptrans->resource, NULL);
- util_slab_free(&ctx->transfer_pool, ptrans);
+ slab_free_st(&ctx->transfer_pool, ptrans);
free(trans->staging);
}
DBG("prsc=%p, level=%u, usage=%x, box=%dx%d+%d,%d", prsc, level, usage,
box->width, box->height, box->x, box->y);
- ptrans = util_slab_alloc(&ctx->transfer_pool);
+ ptrans = slab_alloc_st(&ctx->transfer_pool);
if (!ptrans)
return NULL;
- /* util_slab_alloc() doesn't zero: */
+ /* slab_alloc_st() doesn't zero: */
trans = fd_transfer(ptrans);
memset(trans, 0, sizeof(*trans));
i915->base.draw_vbo = i915_draw_vbo;
/* init this before draw */
- util_slab_create(&i915->transfer_pool, sizeof(struct pipe_transfer),
- 16, UTIL_SLAB_SINGLETHREADED);
- util_slab_create(&i915->texture_transfer_pool, sizeof(struct i915_transfer),
- 16, UTIL_SLAB_SINGLETHREADED);
+ slab_create(&i915->transfer_pool, sizeof(struct pipe_transfer),
+ 16);
+ slab_create(&i915->texture_transfer_pool, sizeof(struct i915_transfer),
+ 16);
/* Batch stream debugging is a bit hacked up at the moment:
*/
#include "tgsi/tgsi_scan.h"
-#include "util/u_slab.h"
+#include "util/slab.h"
#include "util/u_blitter.h"
struct i915_winsys_buffer *validation_buffers[2 + 1 + I915_TEX_UNITS];
int num_validation_buffers;
- struct util_slab_mempool transfer_pool;
- struct util_slab_mempool texture_transfer_pool;
+ struct slab_mempool transfer_pool;
+ struct slab_mempool texture_transfer_pool;
/* state for tracking flushes */
int last_fired_vertices;
{
struct i915_context *i915 = i915_context(pipe);
struct i915_buffer *buffer = i915_buffer(resource);
- struct pipe_transfer *transfer = util_slab_alloc(&i915->transfer_pool);
+ struct pipe_transfer *transfer = slab_alloc_st(&i915->transfer_pool);
if (!transfer)
return NULL;
struct pipe_transfer *transfer)
{
struct i915_context *i915 = i915_context(pipe);
- util_slab_free(&i915->transfer_pool, transfer);
+ slab_free_st(&i915->transfer_pool, transfer);
}
void
{
struct i915_context *i915 = i915_context(pipe);
struct i915_texture *tex = i915_texture(resource);
- struct i915_transfer *transfer = util_slab_alloc(&i915->texture_transfer_pool);
+ struct i915_transfer *transfer = slab_alloc_st(&i915->texture_transfer_pool);
boolean use_staging_texture = FALSE;
struct i915_winsys *iws = i915_screen(pipe->screen)->iws;
enum pipe_format format = resource->format;
pipe_resource_reference(&itransfer->staging_texture, NULL);
}
- util_slab_free(&i915->texture_transfer_pool, itransfer);
+ slab_free_st(&i915->texture_transfer_pool, itransfer);
}
#if 0
if (ilo->cp)
ilo_cp_destroy(ilo->cp);
- util_slab_destroy(&ilo->transfer_mempool);
+ slab_destroy(&ilo->transfer_mempool);
FREE(ilo);
}
* initialize first, otherwise it may not be safe to call
* ilo_context_destroy() on errors
*/
- util_slab_create(&ilo->transfer_mempool,
- sizeof(struct ilo_transfer), 64, UTIL_SLAB_SINGLETHREADED);
+ slab_create(&ilo->transfer_mempool,
+ sizeof(struct ilo_transfer), 64);
ilo->shader_cache = ilo_shader_cache_create();
ilo->cp = ilo_cp_create(ilo->dev, ilo->winsys, ilo->shader_cache);
#define ILO_CONTEXT_H
#include "pipe/p_context.h"
-#include "util/u_slab.h"
+#include "util/slab.h"
#include "ilo_common.h"
#include "ilo_cp.h"
struct intel_winsys *winsys;
struct ilo_dev *dev;
- struct util_slab_mempool transfer_mempool;
+ struct slab_mempool transfer_mempool;
struct ilo_cp *cp;
pipe_resource_reference(&xfer->base.resource, NULL);
- util_slab_free(&ilo->transfer_mempool, xfer);
+ slab_free_st(&ilo->transfer_mempool, xfer);
}
static void *
void *ptr;
/* note that xfer is not zero'd */
- xfer = util_slab_alloc(&ilo->transfer_mempool);
+ xfer = slab_alloc_st(&ilo->transfer_mempool);
if (!xfer) {
*transfer = NULL;
return NULL;
if (!ptr) {
pipe_resource_reference(&xfer->base.resource, NULL);
- util_slab_free(&ilo->transfer_mempool, xfer);
+ slab_free_st(&ilo->transfer_mempool, xfer);
*transfer = NULL;
return NULL;
}
struct toy_inst *inst, *next;
LIST_FOR_EACH_ENTRY_SAFE(inst, next, &tc->instructions, list)
- util_slab_free(&tc->mempool, inst);
+ slab_free_st(&tc->mempool, inst);
- util_slab_destroy(&tc->mempool);
+ slab_destroy(&tc->mempool);
}
/**
tc_init_inst_templ(tc);
- util_slab_create(&tc->mempool, sizeof(struct toy_inst),
- 64, UTIL_SLAB_SINGLETHREADED);
+ slab_create(&tc->mempool, sizeof(struct toy_inst),
+ 64);
list_inithead(&tc->instructions);
/* instructions are added to the tail */
#define TOY_COMPILER_H
#include "genhw/genhw.h"
-#include "util/u_slab.h"
+#include "util/slab.h"
#include "ilo_common.h"
#include "toy_compiler_reg.h"
const struct ilo_dev *dev;
struct toy_inst templ;
- struct util_slab_mempool mempool;
+ struct slab_mempool mempool;
struct list_head instructions;
struct list_head *iter, *iter_next;
{
struct toy_inst *new_inst;
- new_inst = util_slab_alloc(&tc->mempool);
+ new_inst = slab_alloc_st(&tc->mempool);
if (!new_inst)
return NULL;
tc_discard_inst(struct toy_compiler *tc, struct toy_inst *inst)
{
list_del(&inst->list);
- util_slab_free(&tc->mempool, inst);
+ slab_free_st(&tc->mempool, inst);
}
/**
rc_destroy_regalloc_state(&r300->fs_regalloc_state);
/* XXX: No way to tell if this was initialized or not? */
- util_slab_destroy(&r300->pool_transfers);
+ slab_destroy(&r300->pool_transfers);
/* Free the structs allocated in r300_setup_atoms() */
if (r300->aa_state.state) {
r300->context.destroy = r300_destroy_context;
- util_slab_create(&r300->pool_transfers,
- sizeof(struct pipe_transfer), 64,
- UTIL_SLAB_SINGLETHREADED);
+ slab_create(&r300->pool_transfers,
+ sizeof(struct pipe_transfer), 64);
r300->ctx = rws->ctx_create(rws);
if (!r300->ctx)
unsigned nr_vertex_buffers;
struct u_upload_mgr *uploader;
- struct util_slab_mempool pool_transfers;
+ struct slab_mempool pool_transfers;
/* Stat counter. */
uint64_t flush_counter;
#include "r300_chipset.h"
#include "radeon/radeon_winsys.h"
#include "pipe/p_screen.h"
-#include "util/u_slab.h"
+#include "util/slab.h"
#include "os/os_thread.h"
#include <stdio.h>
struct pipe_transfer *transfer;
uint8_t *map;
- transfer = util_slab_alloc(&r300->pool_transfers);
+ transfer = slab_alloc_st(&r300->pool_transfers);
transfer->resource = resource;
transfer->level = level;
transfer->usage = usage;
map = rws->buffer_map(rbuf->buf, r300->cs, usage);
if (!map) {
- util_slab_free(&r300->pool_transfers, transfer);
+ slab_free_st(&r300->pool_transfers, transfer);
return NULL;
}
{
struct r300_context *r300 = r300_context(pipe);
- util_slab_free(&r300->pool_transfers, transfer);
+ slab_free_st(&r300->pool_transfers, transfer);
}
static const struct u_resource_vtbl r300_buffer_vtbl =
unsigned offset)
{
struct r600_common_context *rctx = (struct r600_common_context*)ctx;
- struct r600_transfer *transfer = util_slab_alloc(&rctx->pool_transfers);
+ struct r600_transfer *transfer = slab_alloc_st(&rctx->pool_transfers);
transfer->transfer.resource = resource;
transfer->transfer.level = level;
if (rtransfer->staging)
r600_resource_reference(&rtransfer->staging, NULL);
- util_slab_free(&rctx->pool_transfers, transfer);
+ slab_free_st(&rctx->pool_transfers, transfer);
}
void r600_buffer_subdata(struct pipe_context *ctx,
struct r600_common_screen *rscreen,
unsigned context_flags)
{
- util_slab_create(&rctx->pool_transfers,
- sizeof(struct r600_transfer), 64,
- UTIL_SLAB_SINGLETHREADED);
+ slab_create(&rctx->pool_transfers,
+ sizeof(struct r600_transfer), 64);
rctx->screen = rscreen;
rctx->ws = rscreen->ws;
u_upload_destroy(rctx->uploader);
}
- util_slab_destroy(&rctx->pool_transfers);
+ slab_destroy(&rctx->pool_transfers);
if (rctx->allocator_zeroed_memory) {
u_suballocator_destroy(rctx->allocator_zeroed_memory);
#include "util/u_blitter.h"
#include "util/list.h"
#include "util/u_range.h"
-#include "util/u_slab.h"
+#include "util/slab.h"
#include "util/u_suballoc.h"
#include "util/u_transfer.h"
struct u_upload_mgr *uploader;
struct u_suballocator *allocator_zeroed_memory;
- struct util_slab_mempool pool_transfers;
+ struct slab_mempool pool_transfers;
/* Current unaccounted memory usage. */
uint64_t vram;
if (vc4->uploader)
u_upload_destroy(vc4->uploader);
- util_slab_destroy(&vc4->transfer_pool);
+ slab_destroy(&vc4->transfer_pool);
pipe_surface_reference(&vc4->framebuffer.cbufs[0], NULL);
pipe_surface_reference(&vc4->framebuffer.zsbuf, NULL);
vc4->fd = screen->fd;
- util_slab_create(&vc4->transfer_pool, sizeof(struct vc4_transfer),
- 16, UTIL_SLAB_SINGLETHREADED);
+ slab_create(&vc4->transfer_pool, sizeof(struct vc4_transfer),
+ 16);
vc4->blitter = util_blitter_create(pctx);
if (!vc4->blitter)
goto fail;
#include "pipe/p_context.h"
#include "pipe/p_state.h"
-#include "util/u_slab.h"
+#include "util/slab.h"
#define __user
#include "vc4_drm.h"
bool msaa;
/** @} */
- struct util_slab_mempool transfer_pool;
+ struct slab_mempool transfer_pool;
struct blitter_context *blitter;
/** bitfield of VC4_DIRTY_* */
}
pipe_resource_reference(&ptrans->resource, NULL);
- util_slab_free(&vc4->transfer_pool, ptrans);
+ slab_free_st(&vc4->transfer_pool, ptrans);
}
static struct pipe_resource *
if (usage & PIPE_TRANSFER_WRITE)
rsc->writes++;
- trans = util_slab_alloc(&vc4->transfer_pool);
+ trans = slab_alloc_st(&vc4->transfer_pool);
if (!trans)
return NULL;
/* XXX: Handle DONTBLOCK, DISCARD_RANGE, PERSISTENT, COHERENT. */
- /* util_slab_alloc() doesn't zero: */
+ /* slab_alloc_st() doesn't zero: */
memset(trans, 0, sizeof(*trans));
ptrans = &trans->base;
if (doflushwait)
ctx->flush(ctx, NULL, 0);
- trans = util_slab_alloc(&vctx->texture_transfer_pool);
+ trans = slab_alloc_st(&vctx->texture_transfer_pool);
if (!trans)
return NULL;
}
}
- util_slab_free(&vctx->texture_transfer_pool, trans);
+ slab_free_st(&vctx->texture_transfer_pool, trans);
}
static void virgl_buffer_transfer_flush_region(struct pipe_context *ctx,
#include "util/u_format.h"
#include "util/u_transfer.h"
#include "util/u_helpers.h"
-#include "util/u_slab.h"
+#include "util/slab.h"
#include "util/u_upload_mgr.h"
#include "util/u_blitter.h"
#include "tgsi/tgsi_text.h"
u_upload_destroy(vctx->uploader);
util_primconvert_destroy(vctx->primconvert);
- util_slab_destroy(&vctx->texture_transfer_pool);
+ slab_destroy(&vctx->texture_transfer_pool);
FREE(vctx);
}
virgl_init_so_functions(vctx);
list_inithead(&vctx->to_flush_bufs);
- util_slab_create(&vctx->texture_transfer_pool, sizeof(struct virgl_transfer),
- 16, UTIL_SLAB_SINGLETHREADED);
+ slab_create(&vctx->texture_transfer_pool, sizeof(struct virgl_transfer),
+ 16);
vctx->primconvert = util_primconvert_create(&vctx->base, rs->caps.caps.v1.prim_mask);
vctx->uploader = u_upload_create(&vctx->base, 1024 * 1024,
#include "pipe/p_state.h"
#include "pipe/p_context.h"
-#include "util/u_slab.h"
+#include "util/slab.h"
#include "util/list.h"
struct pipe_screen;
struct pipe_framebuffer_state framebuffer;
- struct util_slab_mempool texture_transfer_pool;
+ struct slab_mempool texture_transfer_pool;
struct pipe_index_buffer index_buffer;
struct u_upload_mgr *uploader;
if (doflushwait)
ctx->flush(ctx, NULL, 0);
- trans = util_slab_alloc(&vctx->texture_transfer_pool);
+ trans = slab_alloc_st(&vctx->texture_transfer_pool);
if (!trans)
return NULL;
if (trans->resolve_tmp)
pipe_resource_reference((struct pipe_resource **)&trans->resolve_tmp, NULL);
- util_slab_free(&vctx->texture_transfer_pool, trans);
+ slab_free_st(&vctx->texture_transfer_pool, trans);
}