util: Add a way to set the min_buffer_size in linear_alloc
The default value remains 2048, which is also used for rounding up any user provided size. The option is useful in cases where there's a better idea of the amount of data that's going to be used. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25279>
This commit is contained in:
@@ -579,6 +579,10 @@ typedef struct linear_ctx linear_ctx;
|
||||
*/
|
||||
void *linear_alloc_child(linear_ctx *ctx, unsigned size);
|
||||
|
||||
typedef struct {
|
||||
unsigned min_buffer_size;
|
||||
} linear_opts;
|
||||
|
||||
/**
|
||||
* Allocate a linear context that will internally hold linear buffers.
|
||||
* Use it for all child node allocations.
|
||||
@@ -587,6 +591,8 @@ void *linear_alloc_child(linear_ctx *ctx, unsigned size);
|
||||
*/
|
||||
linear_ctx *linear_context(void *ralloc_ctx);
|
||||
|
||||
linear_ctx *linear_context_with_opts(void *ralloc_ctx, const linear_opts *opts);
|
||||
|
||||
/**
|
||||
* Same as linear_alloc_child, but also clears memory.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user