pb_winsys.c File Reference

Implementation of client buffer (also designated as "user buffers"), which are just state-tracker owned data masqueraded as buffers. More...

Include dependency graph for pb_winsys.c:

Go to the source code of this file.

Data Structures

struct  pb_user_buffer
 User buffers are special buffers that initially reference memory held by the user but which may if necessary copy that memory into device memory behind the scenes, for submission to hardware. More...

Functions

static struct pb_user_bufferpb_user_buffer (struct pb_buffer *buf)
static void pb_user_buffer_destroy (struct pb_buffer *buf)
static void * pb_user_buffer_map (struct pb_buffer *buf, unsigned flags)
static void pb_user_buffer_unmap (struct pb_buffer *buf)
static void pb_user_buffer_get_base_buffer (struct pb_buffer *buf, struct pb_buffer **base_buf, unsigned *offset)
static struct pipe_bufferpb_winsys_user_buffer_create (struct pipe_winsys *winsys, void *data, unsigned bytes)
static void * pb_winsys_buffer_map (struct pipe_winsys *winsys, struct pipe_buffer *buf, unsigned flags)
static void pb_winsys_buffer_unmap (struct pipe_winsys *winsys, struct pipe_buffer *buf)
static void pb_winsys_buffer_destroy (struct pipe_winsys *winsys, struct pipe_buffer *buf)
void pb_init_winsys (struct pipe_winsys *winsys)

Variables

struct pb_vtbl pb_user_buffer_vtbl


Detailed Description

Implementation of client buffer (also designated as "user buffers"), which are just state-tracker owned data masqueraded as buffers.

Author:
José Fonseca <jrfonseca@tungstengraphics.com>

Definition in file pb_winsys.c.


Function Documentation

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.

static struct pb_user_buffer* pb_user_buffer ( struct pb_buffer buf  )  [static, read]

Definition at line 63 of file pb_winsys.c.

References assert, pb_user_buffer_vtbl, and pb_buffer::vtbl.

00064 {
00065    assert(buf);
00066    assert(buf->vtbl == &pb_user_buffer_vtbl);
00067    return (struct pb_user_buffer *)buf;
00068 }

static void pb_user_buffer_destroy ( struct pb_buffer buf  )  [static]

Definition at line 72 of file pb_winsys.c.

References assert, and FREE.

00073 {
00074    assert(buf);
00075    FREE(buf);
00076 }

static void pb_user_buffer_get_base_buffer ( struct pb_buffer buf,
struct pb_buffer **  base_buf,
unsigned *  offset 
) [static]

Definition at line 95 of file pb_winsys.c.

00098 {
00099    *base_buf = buf;
00100    *offset = 0;
00101 }

static void* pb_user_buffer_map ( struct pb_buffer buf,
unsigned  flags 
) [static]

Definition at line 80 of file pb_winsys.c.

References pb_user_buffer::data, and pb_user_buffer().

00082 {
00083    return pb_user_buffer(buf)->data;
00084 }

static void pb_user_buffer_unmap ( struct pb_buffer buf  )  [static]

Definition at line 88 of file pb_winsys.c.

00089 {
00090    /* No-op */
00091 }

static void pb_winsys_buffer_destroy ( struct pipe_winsys winsys,
struct pipe_buffer buf 
) [static]

Definition at line 155 of file pb_winsys.c.

References pb_buffer(), and pb_destroy().

00157 {
00158    (void)winsys;
00159    pb_destroy(pb_buffer(buf));
00160 }

static void* pb_winsys_buffer_map ( struct pipe_winsys winsys,
struct pipe_buffer buf,
unsigned  flags 
) [static]

Definition at line 136 of file pb_winsys.c.

References pb_buffer(), and pb_map().

00139 {
00140    (void)winsys;
00141    return pb_map(pb_buffer(buf), flags);
00142 }

static void pb_winsys_buffer_unmap ( struct pipe_winsys winsys,
struct pipe_buffer buf 
) [static]

Definition at line 146 of file pb_winsys.c.

References pb_buffer(), and pb_unmap().

00148 {
00149    (void)winsys;
00150    pb_unmap(pb_buffer(buf));
00151 }

static struct pipe_buffer* pb_winsys_user_buffer_create ( struct pipe_winsys winsys,
void *  data,
unsigned  bytes 
) [static, read]

Definition at line 114 of file pb_winsys.c.

References pipe_buffer::alignment, pb_buffer::base, pb_user_buffer::base, CALLOC_STRUCT, pb_user_buffer::data, pipe_buffer::refcount, pipe_buffer::size, pipe_buffer::usage, and pb_buffer::vtbl.

00117 {
00118    struct pb_user_buffer *buf = CALLOC_STRUCT(pb_user_buffer);
00119 
00120    if(!buf)
00121       return NULL;
00122    
00123    buf->base.base.refcount = 1;
00124    buf->base.base.size = bytes;
00125    buf->base.base.alignment = 0;
00126    buf->base.base.usage = 0;
00127 
00128    buf->base.vtbl = &pb_user_buffer_vtbl;   
00129    buf->data = data;
00130    
00131    return &buf->base.base;
00132 }


Variable Documentation

struct pb_vtbl pb_user_buffer_vtbl [read]

Initial value:

Definition at line 105 of file pb_winsys.c.


Generated on Tue Sep 29 06:25:24 2009 for Gallium3D by  doxygen 1.5.4