From 4b1b5ca9bd4d861ac8654c510f12b52a1a646ec4 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 15 Aug 2008 11:24:06 +0100 Subject: xlib: Kill xmesa_surface. A winsys cannot expect that the surfaces passed display_surface are the surfaces it created, as surface are now in generate texture views created by pipe_screen. Indeed, the fact it was working so far was mere luck. This fixes a weird tiled output when using the trace pipe driver. Winsys' surfaces should die. --- src/gallium/winsys/xlib/xm_winsys.c | 62 ++++++++++++------------------------- 1 file changed, 19 insertions(+), 43 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/xlib/xm_winsys.c b/src/gallium/winsys/xlib/xm_winsys.c index 3ab4c67cae..4b4dc56e84 100644 --- a/src/gallium/winsys/xlib/xm_winsys.c +++ b/src/gallium/winsys/xlib/xm_winsys.c @@ -81,18 +81,6 @@ struct xm_buffer }; -/** - * Subclass of pipe_surface for Xlib winsys - */ -struct xmesa_surface -{ - struct pipe_surface surface; - - int tileSize; - boolean no_swap; -}; - - /** * Subclass of pipe_winsys for Xlib winsys */ @@ -105,14 +93,6 @@ struct xmesa_pipe_winsys -/** Cast wrapper */ -static INLINE struct xmesa_surface * -xmesa_surface(struct pipe_surface *ps) -{ - return (struct xmesa_surface *) ps; -} - - /** Cast wrapper */ static INLINE struct xm_buffer * xm_buffer( struct pipe_buffer *buf ) @@ -358,13 +338,24 @@ xmesa_display_surface(XMesaBuffer b, const struct pipe_surface *surf) { XImage *ximage; struct xm_buffer *xm_buf = xm_buffer(surf->buffer); - const struct xmesa_surface *xm_surf - = xmesa_surface((struct pipe_surface *) surf); + static boolean no_swap = 0; + static boolean firsttime = 1; + static int tileSize = 0; - if (xm_surf->no_swap) + if (firsttime) { + no_swap = getenv("SP_NO_RAST") != NULL; +#ifdef GALLIUM_CELL + if (!getenv("GALLIUM_NOCELL")) { + tileSize = 32; /** probably temporary */ + } +#endif + firsttime = 0; + } + + if (no_swap) return; - if (xm_surf->tileSize) { + if (tileSize) { xmesa_display_surface_tiled(b, surf); return; } @@ -531,29 +522,14 @@ xm_surface_alloc_storage(struct pipe_winsys *winsys, static struct pipe_surface * xm_surface_alloc(struct pipe_winsys *ws) { - struct xmesa_surface *xms = CALLOC_STRUCT(xmesa_surface); - static boolean no_swap = 0; - static boolean firsttime = 1; - - if (firsttime) { - no_swap = getenv("SP_NO_RAST") != NULL; - firsttime = 0; - } + struct pipe_surface *surface = CALLOC_STRUCT(pipe_surface); assert(ws); - xms->surface.refcount = 1; - xms->surface.winsys = ws; + surface->refcount = 1; + surface->winsys = ws; -#ifdef GALLIUM_CELL - if (!getenv("GALLIUM_NOCELL")) { - xms->tileSize = 32; /** probably temporary */ - } -#endif - - xms->no_swap = no_swap; - - return &xms->surface; + return surface; } -- cgit v1.2.3