pbuf->size = sz;
if (pbuf->buffer) {
- free(pbuf->buffer);
+ ralloc_free(pbuf->buffer);
pbuf->buffer = NULL;
}
/* Copy the constant buffer into the driver context for later upload */
- pbuf->buffer = malloc(sz);
+ pbuf->buffer = rzalloc_size(ctx, sz);
memcpy(pbuf->buffer, cpu + buf->buffer_offset, sz);
}
struct pipe_resource *texture,
const struct pipe_sampler_view *template)
{
- struct panfrost_sampler_view *so = CALLOC_STRUCT(panfrost_sampler_view);
+ struct panfrost_sampler_view *so = rzalloc(pctx, struct panfrost_sampler_view);
int bytes_per_pixel = util_format_get_blocksize(texture->format);
pipe_reference(NULL, &texture->reference);
struct pipe_sampler_view *view)
{
pipe_resource_reference(&view->texture, NULL);
- free(view);
+ ralloc_free(view);
}
static void
const struct pipe_blend_state *blend)
{
struct panfrost_context *ctx = pan_context(pipe);
- struct panfrost_blend_state *so = CALLOC_STRUCT(panfrost_blend_state);
+ struct panfrost_blend_state *so = rzalloc(ctx, struct panfrost_blend_state);
so->base = *blend;
/* TODO: The following features are not yet implemented */
DBG("Deleting blend state leak blend shaders bytecode\n");
}
- free(blend);
+ ralloc_free(blend);
}
static void
screen->driver->free_slab(screen, &panfrost->shaders);
screen->driver->free_slab(screen, &panfrost->tiler_heap);
screen->driver->free_slab(screen, &panfrost->tiler_polygon_list);
+
+ ralloc_free(pipe);
}
static struct pipe_query *
unsigned type,
unsigned index)
{
- struct panfrost_query *q = CALLOC_STRUCT(panfrost_query);
+ struct panfrost_query *q = rzalloc(pipe, struct panfrost_query);
q->type = type;
q->index = index;
static void
panfrost_destroy_query(struct pipe_context *pipe, struct pipe_query *q)
{
- FREE(q);
+ ralloc_free(q);
}
static boolean
{
struct pipe_stream_output_target *target;
- target = CALLOC_STRUCT(pipe_stream_output_target);
+ target = rzalloc(pctx, struct pipe_stream_output_target);
if (!target)
return NULL;
struct pipe_stream_output_target *target)
{
pipe_resource_reference(&target->buffer, NULL);
- free(target);
+ ralloc_free(target);
}
static void
struct pipe_context *
panfrost_create_context(struct pipe_screen *screen, void *priv, unsigned flags)
{
- struct panfrost_context *ctx = CALLOC_STRUCT(panfrost_context);
+ struct panfrost_context *ctx = rzalloc(screen, struct panfrost_context);
struct panfrost_screen *pscreen = pan_screen(screen);
memset(ctx, 0, sizeof(*ctx));
struct pipe_context *gallium = (struct pipe_context *) ctx;