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.
This commit is contained in:
José Fonseca 2008-08-15 11:24:06 +01:00
parent 9d58b2a432
commit 4b1b5ca9bd

View file

@ -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;
}