diff options
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/pipe/xlib/xm_api.c | 2 | ||||
-rw-r--r-- | src/mesa/pipe/xlib/xm_surface.c | 13 | ||||
-rw-r--r-- | src/mesa/pipe/xlib/xm_winsys.c | 111 | ||||
-rw-r--r-- | src/mesa/pipe/xlib/xmesaP.h | 3 |
4 files changed, 55 insertions, 74 deletions
diff --git a/src/mesa/pipe/xlib/xm_api.c b/src/mesa/pipe/xlib/xm_api.c index 1693530fbf..a05ff358c0 100644 --- a/src/mesa/pipe/xlib/xm_api.c +++ b/src/mesa/pipe/xlib/xm_api.c @@ -1489,8 +1489,8 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) */ #if 0 mesaCtx->st->pipe->surface_alloc = xmesa_surface_alloc; -#endif mesaCtx->st->pipe->is_format_supported = xmesa_is_format_supported; +#endif mesaCtx->st->pipe->get_tile_rgba = xmesa_get_tile_rgba; mesaCtx->st->pipe->put_tile_rgba = xmesa_put_tile_rgba; diff --git a/src/mesa/pipe/xlib/xm_surface.c b/src/mesa/pipe/xlib/xm_surface.c index e7254d0d5a..b7e9d7811d 100644 --- a/src/mesa/pipe/xlib/xm_surface.c +++ b/src/mesa/pipe/xlib/xm_surface.c @@ -193,19 +193,6 @@ xmesa_surface_alloc(struct pipe_context *pipe, GLuint pipeFormat) } -boolean -xmesa_is_format_supported(struct pipe_context *pipe, uint format) -{ - switch( format ) { - case PIPE_FORMAT_U_A8_R8_G8_B8: - case PIPE_FORMAT_S_R16_G16_B16_A16: - case PIPE_FORMAT_S8_Z24: - return TRUE; - }; - return FALSE; -} - - /** * Called via pipe->clear() */ diff --git a/src/mesa/pipe/xlib/xm_winsys.c b/src/mesa/pipe/xlib/xm_winsys.c index 36805437f0..3dd15e198d 100644 --- a/src/mesa/pipe/xlib/xm_winsys.c +++ b/src/mesa/pipe/xlib/xm_winsys.c @@ -42,18 +42,6 @@ /** - * XMesa winsys, derived from softpipe winsys. - * NOTE: there's nothing really X-specific in this winsys layer so - * we could probably lift it up somewhere. - */ -struct xm_winsys -{ - struct softpipe_winsys sws; - int foo; /* placeholder */ -}; - - -/** * Low-level OS/window system memory buffer */ struct xm_buffer @@ -82,14 +70,6 @@ pipe_bo( struct xm_buffer *bo ) return (struct pipe_buffer_handle *) bo; } -/* Turn a softpipe winsys into an xm/softpipe winsys: - */ -static inline struct xm_winsys * -xm_winsys(struct softpipe_winsys *sws) -{ - return (struct xm_winsys *) sws; -} - /* Most callbacks map direcly onto dri_bufmgr operations: */ @@ -315,54 +295,71 @@ xm_surface_alloc(struct pipe_winsys *ws, GLuint pipeFormat) -struct xmesa_pipe_winsys -{ - struct pipe_winsys winsys; - XMesaContext xmesa; -}; - +/** + * Create a winsys layer. + * Nothing special for the Xlib driver so no subclassing or anything. + */ static struct pipe_winsys * -xmesa_create_pipe_winsys( XMesaContext xmesa ) +xmesa_create_pipe_winsys(void) { - struct xmesa_pipe_winsys *xws = CALLOC_STRUCT(xmesa_pipe_winsys); + struct pipe_winsys *ws = CALLOC_STRUCT(pipe_winsys); /* Fill in this struct with callbacks that pipe will need to * communicate with the window system, buffer manager, etc. - * - * Pipe would be happy with a malloc based memory manager, but - * the SwapBuffers implementation in this winsys driver requires - * that rendering be done to an appropriate _DriBufferObject. */ - xws->winsys.buffer_create = xm_buffer_create; - xws->winsys.user_buffer_create = xm_user_buffer_create; - xws->winsys.buffer_map = xm_buffer_map; - xws->winsys.buffer_unmap = xm_buffer_unmap; - xws->winsys.buffer_reference = xm_buffer_reference; - xws->winsys.buffer_data = xm_buffer_data; - xws->winsys.buffer_subdata = xm_buffer_subdata; - xws->winsys.buffer_get_subdata = xm_buffer_get_subdata; - - xws->winsys.region_alloc = xm_region_alloc; - xws->winsys.region_release = xm_region_release; - - xws->winsys.surface_alloc = xm_surface_alloc; - - xws->winsys.flush_frontbuffer = xm_flush_frontbuffer; - xws->winsys.wait_idle = xm_wait_idle; - xws->winsys.printf = xm_printf; - xws->winsys.get_name = xm_get_name; - xws->xmesa = xmesa; - - return &xws->winsys; + ws->buffer_create = xm_buffer_create; + ws->user_buffer_create = xm_user_buffer_create; + ws->buffer_map = xm_buffer_map; + ws->buffer_unmap = xm_buffer_unmap; + ws->buffer_reference = xm_buffer_reference; + ws->buffer_data = xm_buffer_data; + ws->buffer_subdata = xm_buffer_subdata; + ws->buffer_get_subdata = xm_buffer_get_subdata; + + ws->region_alloc = xm_region_alloc; + ws->region_release = xm_region_release; + + ws->surface_alloc = xm_surface_alloc; + + ws->flush_frontbuffer = xm_flush_frontbuffer; + ws->wait_idle = xm_wait_idle; + ws->printf = xm_printf; + ws->get_name = xm_get_name; + + return ws; +} + + +static boolean +xmesa_is_format_supported(struct softpipe_winsys *sws, uint format) +{ + switch (format) { + case PIPE_FORMAT_U_A8_R8_G8_B8: + case PIPE_FORMAT_S_R16_G16_B16_A16: + case PIPE_FORMAT_S8_Z24: + return TRUE; + default: + return FALSE; + }; +} + + +static struct softpipe_winsys * +xmesa_create_softpipe_winsys(void) +{ + struct softpipe_winsys *spws = CALLOC_STRUCT(softpipe_winsys); + if (spws) { + spws->is_format_supported = xmesa_is_format_supported; + } + return spws; } struct pipe_context * xmesa_create_softpipe(XMesaContext xmesa) { - struct xm_winsys *xm_ws = CALLOC_STRUCT( xm_winsys ); + struct pipe_winsys *pws = xmesa_create_pipe_winsys(); + struct softpipe_winsys *spws = xmesa_create_softpipe_winsys(); - /* Create the softpipe context: - */ - return softpipe_create( xmesa_create_pipe_winsys(xmesa), &xm_ws->sws ); + return softpipe_create( pws, spws ); } diff --git a/src/mesa/pipe/xlib/xmesaP.h b/src/mesa/pipe/xlib/xmesaP.h index d0e8f32430..d42b2b3fb9 100644 --- a/src/mesa/pipe/xlib/xmesaP.h +++ b/src/mesa/pipe/xlib/xmesaP.h @@ -548,9 +548,6 @@ xmesa_surface_alloc(struct pipe_context *pipe, GLuint format); extern struct pipe_surface * xmesa_new_color_surface(struct pipe_context *pipe, GLuint format); -extern boolean -xmesa_is_format_supported(struct pipe_context *pipe, uint format); - extern void xmesa_get_tile_rgba(struct pipe_context *pipe, struct pipe_surface *ps, uint x, uint y, uint w, uint h, float *p); |