Go to the source code of this file.
Data Structures | |
struct | st_softpipe_buffer |
Functions | |
static struct st_softpipe_buffer * | st_softpipe_buffer (struct pipe_buffer *buf) |
Cast wrapper. | |
static void * | st_softpipe_buffer_map (struct pipe_winsys *winsys, struct pipe_buffer *buf, unsigned flags) |
static void | st_softpipe_buffer_unmap (struct pipe_winsys *winsys, struct pipe_buffer *buf) |
static void | st_softpipe_buffer_destroy (struct pipe_winsys *winsys, struct pipe_buffer *buf) |
static void | st_softpipe_flush_frontbuffer (struct pipe_winsys *winsys, struct pipe_surface *surf, void *context_private) |
static const char * | st_softpipe_get_name (struct pipe_winsys *winsys) |
static struct pipe_buffer * | st_softpipe_buffer_create (struct pipe_winsys *winsys, unsigned alignment, unsigned usage, unsigned size) |
static struct pipe_buffer * | st_softpipe_user_buffer_create (struct pipe_winsys *winsys, void *ptr, unsigned bytes) |
Create buffer which wraps user-space data. | |
static unsigned | round_up (unsigned n, unsigned multiple) |
Round n up to next multiple. | |
static int | st_softpipe_surface_alloc_storage (struct pipe_winsys *winsys, struct pipe_surface *surf, unsigned width, unsigned height, enum pipe_format format, unsigned flags, unsigned tex_usage) |
static struct pipe_surface * | st_softpipe_surface_alloc (struct pipe_winsys *winsys) |
static void | st_softpipe_surface_release (struct pipe_winsys *winsys, struct pipe_surface **s) |
static void | st_softpipe_fence_reference (struct pipe_winsys *winsys, struct pipe_fence_handle **ptr, struct pipe_fence_handle *fence) |
static int | st_softpipe_fence_signalled (struct pipe_winsys *winsys, struct pipe_fence_handle *fence, unsigned flag) |
static int | st_softpipe_fence_finish (struct pipe_winsys *winsys, struct pipe_fence_handle *fence, unsigned flag) |
static void | st_softpipe_destroy (struct pipe_winsys *winsys) |
static struct pipe_screen * | st_softpipe_screen_create (void) |
static struct pipe_context * | st_softpipe_context_create (struct pipe_screen *screen) |
Variables | |
struct st_winsys | st_softpipe_winsys |
Definition in file st_softpipe_winsys.c.
static unsigned round_up | ( | unsigned | n, | |
unsigned | multiple | |||
) | [static] |
static struct st_softpipe_buffer* st_softpipe_buffer | ( | struct pipe_buffer * | buf | ) | [static, read] |
Cast wrapper.
Definition at line 60 of file st_softpipe_winsys.c.
00061 { 00062 return (struct st_softpipe_buffer *)buf; 00063 }
static struct pipe_buffer* st_softpipe_buffer_create | ( | struct pipe_winsys * | winsys, | |
unsigned | alignment, | |||
unsigned | usage, | |||
unsigned | size | |||
) | [static, read] |
Definition at line 120 of file st_softpipe_winsys.c.
References align_malloc(), pipe_buffer::alignment, st_softpipe_buffer::base, CALLOC_STRUCT, st_softpipe_buffer::data, pipe_buffer::refcount, pipe_buffer::size, and pipe_buffer::usage.
00124 { 00125 struct st_softpipe_buffer *buffer = CALLOC_STRUCT(st_softpipe_buffer); 00126 00127 buffer->base.refcount = 1; 00128 buffer->base.alignment = alignment; 00129 buffer->base.usage = usage; 00130 buffer->base.size = size; 00131 00132 buffer->data = align_malloc(size, alignment); 00133 00134 return &buffer->base; 00135 }
static void st_softpipe_buffer_destroy | ( | struct pipe_winsys * | winsys, | |
struct pipe_buffer * | buf | |||
) | [static] |
Definition at line 87 of file st_softpipe_winsys.c.
References align_free(), st_softpipe_buffer::data, FREE, st_softpipe_buffer(), and st_softpipe_buffer::userBuffer.
00089 { 00090 struct st_softpipe_buffer *oldBuf = st_softpipe_buffer(buf); 00091 00092 if (oldBuf->data) { 00093 if (!oldBuf->userBuffer) 00094 align_free(oldBuf->data); 00095 00096 oldBuf->data = NULL; 00097 } 00098 00099 FREE(oldBuf); 00100 }
static void* st_softpipe_buffer_map | ( | struct pipe_winsys * | winsys, | |
struct pipe_buffer * | buf, | |||
unsigned | flags | |||
) | [static] |
Definition at line 67 of file st_softpipe_winsys.c.
References st_softpipe_buffer::data, st_softpipe_buffer::mapped, and st_softpipe_buffer().
00070 { 00071 struct st_softpipe_buffer *st_softpipe_buf = st_softpipe_buffer(buf); 00072 st_softpipe_buf->mapped = st_softpipe_buf->data; 00073 return st_softpipe_buf->mapped; 00074 }
static void st_softpipe_buffer_unmap | ( | struct pipe_winsys * | winsys, | |
struct pipe_buffer * | buf | |||
) | [static] |
Definition at line 78 of file st_softpipe_winsys.c.
References st_softpipe_buffer::mapped, and st_softpipe_buffer().
00080 { 00081 struct st_softpipe_buffer *st_softpipe_buf = st_softpipe_buffer(buf); 00082 st_softpipe_buf->mapped = NULL; 00083 }
static struct pipe_context* st_softpipe_context_create | ( | struct pipe_screen * | screen | ) | [static, read] |
Definition at line 302 of file st_softpipe_winsys.c.
References softpipe_create(), and pipe_screen::winsys.
00303 { 00304 return softpipe_create(screen, screen->winsys, NULL); 00305 }
static void st_softpipe_destroy | ( | struct pipe_winsys * | winsys | ) | [static] |
Definition at line 258 of file st_softpipe_winsys.c.
References FREE.
00259 { 00260 FREE(winsys); 00261 }
static int st_softpipe_fence_finish | ( | struct pipe_winsys * | winsys, | |
struct pipe_fence_handle * | fence, | |||
unsigned | flag | |||
) | [static] |
static void st_softpipe_fence_reference | ( | struct pipe_winsys * | winsys, | |
struct pipe_fence_handle ** | ptr, | |||
struct pipe_fence_handle * | fence | |||
) | [static] |
static int st_softpipe_fence_signalled | ( | struct pipe_winsys * | winsys, | |
struct pipe_fence_handle * | fence, | |||
unsigned | flag | |||
) | [static] |
static void st_softpipe_flush_frontbuffer | ( | struct pipe_winsys * | winsys, | |
struct pipe_surface * | surf, | |||
void * | context_private | |||
) | [static] |
static const char* st_softpipe_get_name | ( | struct pipe_winsys * | winsys | ) | [static] |
static struct pipe_screen* st_softpipe_screen_create | ( | void | ) | [static, read] |
Definition at line 265 of file st_softpipe_winsys.c.
References pipe_winsys::buffer_create, pipe_winsys::buffer_destroy, pipe_winsys::buffer_map, pipe_winsys::buffer_unmap, CALLOC_STRUCT, pipe_winsys::destroy, pipe_winsys::fence_finish, pipe_winsys::fence_reference, pipe_winsys::fence_signalled, pipe_winsys::flush_frontbuffer, pipe_winsys::get_name, softpipe_create_screen(), st_softpipe_buffer_create(), st_softpipe_buffer_destroy(), st_softpipe_buffer_map(), st_softpipe_buffer_unmap(), st_softpipe_destroy(), st_softpipe_fence_finish(), st_softpipe_fence_reference(), st_softpipe_fence_signalled(), st_softpipe_flush_frontbuffer(), st_softpipe_get_name(), st_softpipe_surface_alloc(), st_softpipe_surface_alloc_storage(), st_softpipe_surface_release(), st_softpipe_user_buffer_create(), pipe_winsys::surface_alloc, pipe_winsys::surface_alloc_storage, pipe_winsys::surface_release, and pipe_winsys::user_buffer_create.
00266 { 00267 static struct pipe_winsys *winsys; 00268 struct pipe_screen *screen; 00269 00270 winsys = CALLOC_STRUCT(pipe_winsys); 00271 if(!winsys) 00272 return NULL; 00273 00274 winsys->destroy = st_softpipe_destroy; 00275 00276 winsys->buffer_create = st_softpipe_buffer_create; 00277 winsys->user_buffer_create = st_softpipe_user_buffer_create; 00278 winsys->buffer_map = st_softpipe_buffer_map; 00279 winsys->buffer_unmap = st_softpipe_buffer_unmap; 00280 winsys->buffer_destroy = st_softpipe_buffer_destroy; 00281 00282 winsys->surface_alloc = st_softpipe_surface_alloc; 00283 winsys->surface_alloc_storage = st_softpipe_surface_alloc_storage; 00284 winsys->surface_release = st_softpipe_surface_release; 00285 00286 winsys->fence_reference = st_softpipe_fence_reference; 00287 winsys->fence_signalled = st_softpipe_fence_signalled; 00288 winsys->fence_finish = st_softpipe_fence_finish; 00289 00290 winsys->flush_frontbuffer = st_softpipe_flush_frontbuffer; 00291 winsys->get_name = st_softpipe_get_name; 00292 00293 screen = softpipe_create_screen(winsys); 00294 if(!screen) 00295 st_softpipe_destroy(winsys); 00296 00297 return screen; 00298 }
static struct pipe_surface* st_softpipe_surface_alloc | ( | struct pipe_winsys * | winsys | ) | [static, read] |
Definition at line 202 of file st_softpipe_winsys.c.
References assert, CALLOC_STRUCT, pipe_surface::refcount, and pipe_surface::winsys.
00203 { 00204 struct pipe_surface *surface = CALLOC_STRUCT(pipe_surface); 00205 00206 assert(winsys); 00207 00208 surface->refcount = 1; 00209 surface->winsys = winsys; 00210 00211 return surface; 00212 }
static int st_softpipe_surface_alloc_storage | ( | struct pipe_winsys * | winsys, | |
struct pipe_surface * | surf, | |||
unsigned | width, | |||
unsigned | height, | |||
enum pipe_format | format, | |||
unsigned | flags, | |||
unsigned | tex_usage | |||
) | [static] |
Definition at line 172 of file st_softpipe_winsys.c.
References assert, pipe_surface::block, pipe_surface::buffer, pipe_winsys::buffer_create, pipe_surface::format, pipe_surface::height, pipe_surface::nblocksx, pipe_surface::nblocksy, pf_get_block(), pf_get_nblocksx(), pf_get_nblocksy(), PIPE_BUFFER_USAGE_PIXEL, round_up(), pipe_format_block::size, pipe_surface::stride, pipe_surface::usage, and pipe_surface::width.
00178 { 00179 const unsigned alignment = 64; 00180 00181 surf->width = width; 00182 surf->height = height; 00183 surf->format = format; 00184 pf_get_block(format, &surf->block); 00185 surf->nblocksx = pf_get_nblocksx(&surf->block, width); 00186 surf->nblocksy = pf_get_nblocksy(&surf->block, height); 00187 surf->stride = round_up(surf->nblocksx * surf->block.size, alignment); 00188 surf->usage = flags; 00189 00190 assert(!surf->buffer); 00191 surf->buffer = winsys->buffer_create(winsys, alignment, 00192 PIPE_BUFFER_USAGE_PIXEL, 00193 surf->stride * surf->nblocksy); 00194 if(!surf->buffer) 00195 return -1; 00196 00197 return 0; 00198 }
static void st_softpipe_surface_release | ( | struct pipe_winsys * | winsys, | |
struct pipe_surface ** | s | |||
) | [static] |
Definition at line 216 of file st_softpipe_winsys.c.
References assert, pipe_surface::buffer, pipe_surface::refcount, pipe_surface::texture, and winsys_buffer_reference().
00218 { 00219 struct pipe_surface *surf = *s; 00220 assert(!surf->texture); 00221 surf->refcount--; 00222 if (surf->refcount == 0) { 00223 if (surf->buffer) 00224 winsys_buffer_reference(winsys, &surf->buffer, NULL); 00225 free(surf); 00226 } 00227 *s = NULL; 00228 }
static struct pipe_buffer* st_softpipe_user_buffer_create | ( | struct pipe_winsys * | winsys, | |
void * | ptr, | |||
unsigned | bytes | |||
) | [static, read] |
Create buffer which wraps user-space data.
Definition at line 142 of file st_softpipe_winsys.c.
References st_softpipe_buffer::base, CALLOC_STRUCT, st_softpipe_buffer::data, pipe_buffer::refcount, pipe_buffer::size, TRUE, and st_softpipe_buffer::userBuffer.
00145 { 00146 struct st_softpipe_buffer *buffer; 00147 00148 buffer = CALLOC_STRUCT(st_softpipe_buffer); 00149 if(!buffer) 00150 return NULL; 00151 00152 buffer->base.refcount = 1; 00153 buffer->base.size = bytes; 00154 buffer->userBuffer = TRUE; 00155 buffer->data = ptr; 00156 00157 return &buffer->base; 00158 }
struct st_winsys st_softpipe_winsys |
Initial value:
Definition at line 308 of file st_softpipe_winsys.c.