Go to the source code of this file.
Data Structures | |
struct | pb_desc |
Buffer description. More... | |
struct | pb_buffer |
Base class for all pb_* buffers. More... | |
struct | pb_vtbl |
Virtual function table for the buffer storage operations. More... | |
Functions | |
static struct pipe_buffer * | pb_pipe_buffer (struct pb_buffer *pbuf) |
static struct pb_buffer * | pb_buffer (struct pipe_buffer *buf) |
static void * | pb_map (struct pb_buffer *buf, unsigned flags) |
static void | pb_unmap (struct pb_buffer *buf) |
static void | pb_get_base_buffer (struct pb_buffer *buf, struct pb_buffer **base_buf, unsigned *offset) |
static void | pb_destroy (struct pb_buffer *buf) |
static void | pb_reference (struct pb_buffer **dst, struct pb_buffer *src) |
static boolean | pb_check_alignment (size_t requested, size_t provided) |
Utility function to check whether the provided alignment is consistent with the requested or not. | |
static boolean | pb_check_usage (unsigned requested, unsigned provided) |
Utility function to check whether the provided alignment is consistent with the requested or not. | |
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. | |
void | pb_init_winsys (struct pipe_winsys *winsys) |
Behind a pipe buffle handle there can be DMA buffers, client (or user) buffers, regular malloced buffers, etc. This file provides an abstract base buffer handle that allows the driver to cope with all those kinds of buffers in a more flexible way.
There is no obligation of a winsys driver to use this library. And a pipe driver should be completly agnostic about it.
Definition in file pb_buffer.h.
static struct pb_buffer* pb_buffer | ( | struct pipe_buffer * | buf | ) | [static, read] |
Definition at line 133 of file pb_buffer.h.
References assert.
00134 { 00135 assert(buf); 00136 /* Could add a magic cookie check on debug builds. 00137 */ 00138 return (struct pb_buffer *)buf; 00139 }
static boolean pb_check_alignment | ( | size_t | requested, | |
size_t | provided | |||
) | [static] |
static boolean pb_check_usage | ( | unsigned | requested, | |
unsigned | provided | |||
) | [static] |
static void pb_destroy | ( | struct pb_buffer * | buf | ) | [static] |
Definition at line 181 of file pb_buffer.h.
References assert, pb_vtbl::destroy, and pb_buffer::vtbl.
static void pb_get_base_buffer | ( | struct pb_buffer * | buf, | |
struct pb_buffer ** | base_buf, | |||
unsigned * | offset | |||
) | [static] |
Definition at line 166 of file pb_buffer.h.
References assert, pb_vtbl::get_base_buffer, and pb_buffer::vtbl.
00169 { 00170 assert(buf); 00171 if(!buf) { 00172 base_buf = NULL; 00173 offset = 0; 00174 return; 00175 } 00176 buf->vtbl->get_base_buffer(buf, base_buf, offset); 00177 }
void pb_init_winsys | ( | struct pipe_winsys * | winsys | ) |
Definition at line 164 of file pb_winsys.c.
References pipe_winsys::buffer_destroy, pipe_winsys::buffer_map, pipe_winsys::buffer_unmap, pb_winsys_buffer_destroy(), pb_winsys_buffer_map(), pb_winsys_buffer_unmap(), pb_winsys_user_buffer_create(), and pipe_winsys::user_buffer_create.
00165 { 00166 winsys->user_buffer_create = pb_winsys_user_buffer_create; 00167 winsys->buffer_map = pb_winsys_buffer_map; 00168 winsys->buffer_unmap = pb_winsys_buffer_unmap; 00169 winsys->buffer_destroy = pb_winsys_buffer_destroy; 00170 }
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 }
static void* pb_map | ( | struct pb_buffer * | buf, | |
unsigned | flags | |||
) | [static] |
Definition at line 145 of file pb_buffer.h.
References assert, pb_vtbl::map, and pb_buffer::vtbl.
00147 { 00148 assert(buf); 00149 if(!buf) 00150 return NULL; 00151 return buf->vtbl->map(buf, flags); 00152 }
static struct pipe_buffer* pb_pipe_buffer | ( | struct pb_buffer * | pbuf | ) | [static, read] |
Definition at line 193 of file pb_buffer.h.
References pb_buffer::base, pb_destroy(), and pipe_buffer::refcount.
00195 { 00196 if (src) 00197 src->base.refcount++; 00198 00199 if (*dst && --(*dst)->base.refcount == 0) 00200 pb_destroy( *dst ); 00201 00202 *dst = src; 00203 }
static void pb_unmap | ( | struct pb_buffer * | buf | ) | [static] |