Go to the source code of this file.
Data Structures | |
struct | gdi_softpipe_buffer |
Functions | |
static struct gdi_softpipe_buffer * | gdi_softpipe_buffer (struct pipe_buffer *buf) |
Cast wrapper. | |
static void * | gdi_softpipe_buffer_map (struct pipe_winsys *winsys, struct pipe_buffer *buf, unsigned flags) |
static void | gdi_softpipe_buffer_unmap (struct pipe_winsys *winsys, struct pipe_buffer *buf) |
static void | gdi_softpipe_buffer_destroy (struct pipe_winsys *winsys, struct pipe_buffer *buf) |
static const char * | gdi_softpipe_get_name (struct pipe_winsys *winsys) |
static struct pipe_buffer * | gdi_softpipe_buffer_create (struct pipe_winsys *winsys, unsigned alignment, unsigned usage, unsigned size) |
static struct pipe_buffer * | gdi_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 | gdi_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 * | gdi_softpipe_surface_alloc (struct pipe_winsys *winsys) |
static void | gdi_softpipe_surface_release (struct pipe_winsys *winsys, struct pipe_surface **s) |
static void | gdi_softpipe_dummy_flush_frontbuffer (struct pipe_winsys *winsys, struct pipe_surface *surface, void *context_private) |
static void | gdi_softpipe_fence_reference (struct pipe_winsys *winsys, struct pipe_fence_handle **ptr, struct pipe_fence_handle *fence) |
static int | gdi_softpipe_fence_signalled (struct pipe_winsys *winsys, struct pipe_fence_handle *fence, unsigned flag) |
static int | gdi_softpipe_fence_finish (struct pipe_winsys *winsys, struct pipe_fence_handle *fence, unsigned flag) |
static void | gdi_softpipe_destroy (struct pipe_winsys *winsys) |
static struct pipe_screen * | gdi_softpipe_screen_create (void) |
static struct pipe_context * | gdi_softpipe_context_create (struct pipe_screen *screen) |
static void | gdi_softpipe_flush_frontbuffer (struct pipe_winsys *winsys, struct pipe_surface *surface, HDC hDC) |
BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) |
Variables | |
static struct stw_winsys | stw_winsys |
Definition in file gdi_softpipe_winsys.c.
BOOL WINAPI DllMain | ( | HINSTANCE | hinstDLL, | |
DWORD | fdwReason, | |||
LPVOID | lpReserved | |||
) |
Definition at line 348 of file gdi_softpipe_winsys.c.
References st_cleanup(), st_init(), and TRUE.
00349 { 00350 switch (fdwReason) { 00351 case DLL_PROCESS_ATTACH: 00352 return st_init(&stw_winsys); 00353 00354 case DLL_PROCESS_DETACH: 00355 st_cleanup(); 00356 break; 00357 } 00358 return TRUE; 00359 }
static struct gdi_softpipe_buffer* gdi_softpipe_buffer | ( | struct pipe_buffer * | buf | ) | [static, read] |
Cast wrapper.
Definition at line 62 of file gdi_softpipe_winsys.c.
00063 { 00064 return (struct gdi_softpipe_buffer *)buf; 00065 }
static struct pipe_buffer* gdi_softpipe_buffer_create | ( | struct pipe_winsys * | winsys, | |
unsigned | alignment, | |||
unsigned | usage, | |||
unsigned | size | |||
) | [static, read] |
Definition at line 113 of file gdi_softpipe_winsys.c.
References align_malloc(), pipe_buffer::alignment, gdi_softpipe_buffer::base, CALLOC_STRUCT, gdi_softpipe_buffer::data, pipe_buffer::refcount, pipe_buffer::size, and pipe_buffer::usage.
00117 { 00118 struct gdi_softpipe_buffer *buffer = CALLOC_STRUCT(gdi_softpipe_buffer); 00119 00120 buffer->base.refcount = 1; 00121 buffer->base.alignment = alignment; 00122 buffer->base.usage = usage; 00123 buffer->base.size = size; 00124 00125 buffer->data = align_malloc(size, alignment); 00126 00127 return &buffer->base; 00128 }
static void gdi_softpipe_buffer_destroy | ( | struct pipe_winsys * | winsys, | |
struct pipe_buffer * | buf | |||
) | [static] |
Definition at line 89 of file gdi_softpipe_winsys.c.
References align_free(), gdi_softpipe_buffer::data, FREE, gdi_softpipe_buffer(), and gdi_softpipe_buffer::userBuffer.
00091 { 00092 struct gdi_softpipe_buffer *oldBuf = gdi_softpipe_buffer(buf); 00093 00094 if (oldBuf->data) { 00095 if (!oldBuf->userBuffer) 00096 align_free(oldBuf->data); 00097 00098 oldBuf->data = NULL; 00099 } 00100 00101 FREE(oldBuf); 00102 }
static void* gdi_softpipe_buffer_map | ( | struct pipe_winsys * | winsys, | |
struct pipe_buffer * | buf, | |||
unsigned | flags | |||
) | [static] |
Definition at line 69 of file gdi_softpipe_winsys.c.
References gdi_softpipe_buffer::data, gdi_softpipe_buffer(), and gdi_softpipe_buffer::mapped.
00072 { 00073 struct gdi_softpipe_buffer *gdi_softpipe_buf = gdi_softpipe_buffer(buf); 00074 gdi_softpipe_buf->mapped = gdi_softpipe_buf->data; 00075 return gdi_softpipe_buf->mapped; 00076 }
static void gdi_softpipe_buffer_unmap | ( | struct pipe_winsys * | winsys, | |
struct pipe_buffer * | buf | |||
) | [static] |
Definition at line 80 of file gdi_softpipe_winsys.c.
References gdi_softpipe_buffer(), and gdi_softpipe_buffer::mapped.
00082 { 00083 struct gdi_softpipe_buffer *gdi_softpipe_buf = gdi_softpipe_buffer(buf); 00084 gdi_softpipe_buf->mapped = NULL; 00085 }
static struct pipe_context* gdi_softpipe_context_create | ( | struct pipe_screen * | screen | ) | [static, read] |
Definition at line 304 of file gdi_softpipe_winsys.c.
References softpipe_create(), and pipe_screen::winsys.
00305 { 00306 return softpipe_create(screen, screen->winsys, NULL); 00307 }
static void gdi_softpipe_destroy | ( | struct pipe_winsys * | winsys | ) | [static] |
Definition at line 260 of file gdi_softpipe_winsys.c.
References FREE.
00261 { 00262 FREE(winsys); 00263 }
static void gdi_softpipe_dummy_flush_frontbuffer | ( | struct pipe_winsys * | winsys, | |
struct pipe_surface * | surface, | |||
void * | context_private | |||
) | [static] |
Definition at line 225 of file gdi_softpipe_winsys.c.
References assert.
00228 { 00229 assert(0); 00230 }
static int gdi_softpipe_fence_finish | ( | struct pipe_winsys * | winsys, | |
struct pipe_fence_handle * | fence, | |||
unsigned | flag | |||
) | [static] |
static void gdi_softpipe_fence_reference | ( | struct pipe_winsys * | winsys, | |
struct pipe_fence_handle ** | ptr, | |||
struct pipe_fence_handle * | fence | |||
) | [static] |
static int gdi_softpipe_fence_signalled | ( | struct pipe_winsys * | winsys, | |
struct pipe_fence_handle * | fence, | |||
unsigned | flag | |||
) | [static] |
static void gdi_softpipe_flush_frontbuffer | ( | struct pipe_winsys * | winsys, | |
struct pipe_surface * | surface, | |||
HDC | hDC | |||
) | [static] |
Definition at line 311 of file gdi_softpipe_winsys.c.
References pipe_surface::buffer, gdi_softpipe_buffer::data, pipe_surface::format, gdi_softpipe_buffer(), pipe_surface::height, pf_get_bits(), pf_get_size(), pipe_surface::stride, and pipe_surface::width.
00314 { 00315 struct gdi_softpipe_buffer *buffer; 00316 BITMAPINFO bmi; 00317 00318 buffer = gdi_softpipe_buffer(surface->buffer); 00319 00320 memset(&bmi, 0, sizeof(BITMAPINFO)); 00321 bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); 00322 bmi.bmiHeader.biWidth = surface->stride / pf_get_size(surface->format); 00323 bmi.bmiHeader.biHeight= -(long)surface->height; 00324 bmi.bmiHeader.biPlanes = 1; 00325 bmi.bmiHeader.biBitCount = pf_get_bits(surface->format); 00326 bmi.bmiHeader.biCompression = BI_RGB; 00327 bmi.bmiHeader.biSizeImage = 0; 00328 bmi.bmiHeader.biXPelsPerMeter = 0; 00329 bmi.bmiHeader.biYPelsPerMeter = 0; 00330 bmi.bmiHeader.biClrUsed = 0; 00331 bmi.bmiHeader.biClrImportant = 0; 00332 00333 StretchDIBits(hDC, 00334 0, 0, surface->width, surface->height, 00335 0, 0, surface->width, surface->height, 00336 buffer->data, &bmi, 0, SRCCOPY); 00337 }
static const char* gdi_softpipe_get_name | ( | struct pipe_winsys * | winsys | ) | [static] |
static struct pipe_screen* gdi_softpipe_screen_create | ( | void | ) | [static, read] |
Definition at line 267 of file gdi_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, gdi_softpipe_buffer_create(), gdi_softpipe_buffer_destroy(), gdi_softpipe_buffer_map(), gdi_softpipe_buffer_unmap(), gdi_softpipe_destroy(), gdi_softpipe_dummy_flush_frontbuffer(), gdi_softpipe_fence_finish(), gdi_softpipe_fence_reference(), gdi_softpipe_fence_signalled(), gdi_softpipe_get_name(), gdi_softpipe_surface_alloc(), gdi_softpipe_surface_alloc_storage(), gdi_softpipe_surface_release(), gdi_softpipe_user_buffer_create(), pipe_winsys::get_name, softpipe_create_screen(), pipe_winsys::surface_alloc, pipe_winsys::surface_alloc_storage, pipe_winsys::surface_release, and pipe_winsys::user_buffer_create.
00268 { 00269 static struct pipe_winsys *winsys; 00270 struct pipe_screen *screen; 00271 00272 winsys = CALLOC_STRUCT(pipe_winsys); 00273 if(!winsys) 00274 return NULL; 00275 00276 winsys->destroy = gdi_softpipe_destroy; 00277 00278 winsys->buffer_create = gdi_softpipe_buffer_create; 00279 winsys->user_buffer_create = gdi_softpipe_user_buffer_create; 00280 winsys->buffer_map = gdi_softpipe_buffer_map; 00281 winsys->buffer_unmap = gdi_softpipe_buffer_unmap; 00282 winsys->buffer_destroy = gdi_softpipe_buffer_destroy; 00283 00284 winsys->surface_alloc = gdi_softpipe_surface_alloc; 00285 winsys->surface_alloc_storage = gdi_softpipe_surface_alloc_storage; 00286 winsys->surface_release = gdi_softpipe_surface_release; 00287 00288 winsys->fence_reference = gdi_softpipe_fence_reference; 00289 winsys->fence_signalled = gdi_softpipe_fence_signalled; 00290 winsys->fence_finish = gdi_softpipe_fence_finish; 00291 00292 winsys->flush_frontbuffer = gdi_softpipe_dummy_flush_frontbuffer; 00293 winsys->get_name = gdi_softpipe_get_name; 00294 00295 screen = softpipe_create_screen(winsys); 00296 if(!screen) 00297 gdi_softpipe_destroy(winsys); 00298 00299 return screen; 00300 }
static struct pipe_surface* gdi_softpipe_surface_alloc | ( | struct pipe_winsys * | winsys | ) | [static, read] |
Definition at line 195 of file gdi_softpipe_winsys.c.
References assert, CALLOC_STRUCT, pipe_surface::refcount, and pipe_surface::winsys.
00196 { 00197 struct pipe_surface *surface = CALLOC_STRUCT(pipe_surface); 00198 00199 assert(winsys); 00200 00201 surface->refcount = 1; 00202 surface->winsys = winsys; 00203 00204 return surface; 00205 }
static int gdi_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 165 of file gdi_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.
00171 { 00172 const unsigned alignment = 64; 00173 00174 surf->width = width; 00175 surf->height = height; 00176 surf->format = format; 00177 pf_get_block(format, &surf->block); 00178 surf->nblocksx = pf_get_nblocksx(&surf->block, width); 00179 surf->nblocksy = pf_get_nblocksy(&surf->block, height); 00180 surf->stride = round_up(surf->nblocksx * surf->block.size, alignment); 00181 surf->usage = flags; 00182 00183 assert(!surf->buffer); 00184 surf->buffer = winsys->buffer_create(winsys, alignment, 00185 PIPE_BUFFER_USAGE_PIXEL, 00186 surf->stride * surf->nblocksy); 00187 if(!surf->buffer) 00188 return -1; 00189 00190 return 0; 00191 }
static void gdi_softpipe_surface_release | ( | struct pipe_winsys * | winsys, | |
struct pipe_surface ** | s | |||
) | [static] |
Definition at line 209 of file gdi_softpipe_winsys.c.
References assert, pipe_surface::buffer, pipe_surface::refcount, pipe_surface::texture, and winsys_buffer_reference().
00211 { 00212 struct pipe_surface *surf = *s; 00213 assert(!surf->texture); 00214 surf->refcount--; 00215 if (surf->refcount == 0) { 00216 if (surf->buffer) 00217 winsys_buffer_reference(winsys, &surf->buffer, NULL); 00218 free(surf); 00219 } 00220 *s = NULL; 00221 }
static struct pipe_buffer* gdi_softpipe_user_buffer_create | ( | struct pipe_winsys * | winsys, | |
void * | ptr, | |||
unsigned | bytes | |||
) | [static, read] |
Create buffer which wraps user-space data.
Definition at line 135 of file gdi_softpipe_winsys.c.
References gdi_softpipe_buffer::base, CALLOC_STRUCT, gdi_softpipe_buffer::data, pipe_buffer::refcount, pipe_buffer::size, TRUE, and gdi_softpipe_buffer::userBuffer.
00138 { 00139 struct gdi_softpipe_buffer *buffer; 00140 00141 buffer = CALLOC_STRUCT(gdi_softpipe_buffer); 00142 if(!buffer) 00143 return NULL; 00144 00145 buffer->base.refcount = 1; 00146 buffer->base.size = bytes; 00147 buffer->userBuffer = TRUE; 00148 buffer->data = ptr; 00149 00150 return &buffer->base; 00151 }
static unsigned round_up | ( | unsigned | n, | |
unsigned | multiple | |||
) | [static] |
struct stw_winsys stw_winsys [static] |
Initial value:
Definition at line 340 of file gdi_softpipe_winsys.c.