Go to the source code of this file.
Data Structures | |
struct | malloc_buffer |
Functions | |
static struct malloc_buffer * | malloc_buffer (struct pb_buffer *buf) |
static void | malloc_buffer_destroy (struct pb_buffer *buf) |
static void * | malloc_buffer_map (struct pb_buffer *buf, unsigned flags) |
static void | malloc_buffer_unmap (struct pb_buffer *buf) |
static void | malloc_buffer_get_base_buffer (struct pb_buffer *buf, struct pb_buffer **base_buf, unsigned *offset) |
struct pb_buffer * | pb_malloc_buffer_create (size_t size, const struct pb_desc *desc) |
Malloc-based buffer to store data that can't be used by the graphics hardware. | |
static struct pb_buffer * | pb_malloc_bufmgr_create_buffer (struct pb_manager *mgr, size_t size, const struct pb_desc *desc) |
static void | pb_malloc_bufmgr_flush (struct pb_manager *mgr) |
static void | pb_malloc_bufmgr_destroy (struct pb_manager *mgr) |
struct pb_manager * | pb_malloc_bufmgr_create (void) |
Malloc buffer provider. | |
Variables | |
struct pb_vtbl | malloc_buffer_vtbl |
static struct pb_manager | pb_malloc_bufmgr |
Definition in file pb_buffer_malloc.c.
static struct malloc_buffer* malloc_buffer | ( | struct pb_buffer * | buf | ) | [static, read] |
Definition at line 53 of file pb_buffer_malloc.c.
References assert, malloc_buffer_vtbl, and pb_buffer::vtbl.
00054 { 00055 assert(buf); 00056 assert(buf->vtbl == &malloc_buffer_vtbl); 00057 return (struct malloc_buffer *)buf; 00058 }
static void malloc_buffer_destroy | ( | struct pb_buffer * | buf | ) | [static] |
Definition at line 62 of file pb_buffer_malloc.c.
References align_free(), malloc_buffer::data, FREE, and malloc_buffer().
00063 { 00064 align_free(malloc_buffer(buf)->data); 00065 FREE(buf); 00066 }
static void malloc_buffer_get_base_buffer | ( | struct pb_buffer * | buf, | |
struct pb_buffer ** | base_buf, | |||
unsigned * | offset | |||
) | [static] |
Definition at line 85 of file pb_buffer_malloc.c.
00088 { 00089 *base_buf = buf; 00090 *offset = 0; 00091 }
static void* malloc_buffer_map | ( | struct pb_buffer * | buf, | |
unsigned | flags | |||
) | [static] |
Definition at line 70 of file pb_buffer_malloc.c.
References malloc_buffer::data, and malloc_buffer().
00072 { 00073 return malloc_buffer(buf)->data; 00074 }
static void malloc_buffer_unmap | ( | struct pb_buffer * | buf | ) | [static] |
Malloc-based buffer to store data that can't be used by the graphics hardware.
Definition at line 104 of file pb_buffer_malloc.c.
References align_malloc(), pb_desc::alignment, pipe_buffer::alignment, pb_buffer::base, malloc_buffer::base, CALLOC_STRUCT, malloc_buffer::data, FREE, pipe_buffer::refcount, pipe_buffer::size, pb_desc::usage, pipe_buffer::usage, and pb_buffer::vtbl.
00106 { 00107 struct malloc_buffer *buf; 00108 00109 /* TODO: do a single allocation */ 00110 00111 buf = CALLOC_STRUCT(malloc_buffer); 00112 if(!buf) 00113 return NULL; 00114 00115 buf->base.base.refcount = 1; 00116 buf->base.base.alignment = desc->alignment; 00117 buf->base.base.usage = desc->usage; 00118 buf->base.base.size = size; 00119 buf->base.vtbl = &malloc_buffer_vtbl; 00120 00121 buf->data = align_malloc(size, desc->alignment < sizeof(void*) ? sizeof(void*) : desc->alignment); 00122 if(!buf->data) { 00123 FREE(buf); 00124 return NULL; 00125 } 00126 00127 return &buf->base; 00128 }
struct pb_manager* pb_malloc_bufmgr_create | ( | void | ) | [read] |
Malloc buffer provider.
Simple wrapper around pb_malloc_buffer_create for convenience.
Definition at line 163 of file pb_buffer_malloc.c.
00164 { 00165 return &pb_malloc_bufmgr; 00166 }
static struct pb_buffer* pb_malloc_bufmgr_create_buffer | ( | struct pb_manager * | mgr, | |
size_t | size, | |||
const struct pb_desc * | desc | |||
) | [static, read] |
Definition at line 132 of file pb_buffer_malloc.c.
References pb_malloc_buffer_create().
00135 { 00136 return pb_malloc_buffer_create(size, desc); 00137 }
static void pb_malloc_bufmgr_destroy | ( | struct pb_manager * | mgr | ) | [static] |
static void pb_malloc_bufmgr_flush | ( | struct pb_manager * | mgr | ) | [static] |
struct pb_vtbl malloc_buffer_vtbl [read] |
Initial value:
Definition at line 95 of file pb_buffer_malloc.c.
struct pb_manager pb_malloc_bufmgr [static] |
Initial value:
Definition at line 155 of file pb_buffer_malloc.c.