aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/xlib/xlib_softpipe.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/winsys/xlib/xlib_softpipe.c')
-rw-r--r--src/gallium/winsys/xlib/xlib_softpipe.c245
1 files changed, 0 insertions, 245 deletions
diff --git a/src/gallium/winsys/xlib/xlib_softpipe.c b/src/gallium/winsys/xlib/xlib_softpipe.c
index 7ad73be2608..775e345c2b1 100644
--- a/src/gallium/winsys/xlib/xlib_softpipe.c
+++ b/src/gallium/winsys/xlib/xlib_softpipe.c
@@ -46,14 +46,6 @@
#include "util/u_memory.h"
#include "softpipe/sp_winsys.h"
-#ifdef GALLIUM_CELL
-#include "cell/ppu/cell_context.h"
-#include "cell/ppu/cell_screen.h"
-#include "cell/ppu/cell_winsys.h"
-#else
-#define TILE_SIZE 32 /* avoid compilation errors */
-#endif
-
#include "xlib.h"
/**
@@ -69,9 +61,7 @@ struct xm_buffer
XImage *tempImage;
int shm;
-#if defined(USE_XSHM)
XShmSegmentInfo shminfo;
-#endif
};
@@ -98,8 +88,6 @@ xm_buffer( struct pipe_buffer *buf )
/**
* X Shared Memory Image extension code
*/
-#if defined(USE_XSHM)
-
#define XSHM_ENABLED(b) ((b)->shm)
static volatile int mesaXErrorFlag = 0;
@@ -150,9 +138,6 @@ alloc_shm_ximage(struct xm_buffer *b, struct xmesa_buffer *xmb,
* errors at different points if the extension won't work. Therefore
* we have to be very careful...
*/
-#if 0
- GC gc;
-#endif
int (*old_handler)(Display *, XErrorEvent *);
b->tempImage = XShmCreateImage(xmb->xm_visual->display,
@@ -184,40 +169,8 @@ alloc_shm_ximage(struct xm_buffer *b, struct xmesa_buffer *xmb,
(void) XSetErrorHandler(old_handler);
return;
}
-
-
- /* Finally, try an XShmPutImage to be really sure the extension works */
-#if 0
- gc = XCreateGC(xmb->xm_visual->display, xmb->drawable, 0, NULL);
- XShmPutImage(xmb->xm_visual->display, xmb->drawable, gc,
- b->tempImage, 0, 0, 0, 0, 1, 1 /*one pixel*/, False);
- XSync(xmb->xm_visual->display, False);
- XFreeGC(xmb->xm_visual->display, gc);
- (void) XSetErrorHandler(old_handler);
- if (mesaXErrorFlag) {
- XFlush(xmb->xm_visual->display);
- mesaXErrorFlag = 0;
- XDestroyImage(b->tempImage);
- b->tempImage = NULL;
- b->shm = 0;
- return;
- }
-#endif
}
-#else
-
-#define XSHM_ENABLED(b) 0
-
-static void
-alloc_shm_ximage(struct xm_buffer *b, struct xmesa_buffer *xmb,
- unsigned width, unsigned height)
-{
- b->shm = 0;
-}
-#endif /* USE_XSHM */
-
-
/* Most callbacks map direcly onto dri_bufmgr operations:
@@ -245,7 +198,6 @@ xm_buffer_destroy(struct pipe_winsys *pws,
struct xm_buffer *oldBuf = xm_buffer(buf);
if (oldBuf->data) {
-#if defined(USE_XSHM)
if (oldBuf->shminfo.shmid >= 0) {
shmdt(oldBuf->shminfo.shmaddr);
shmctl(oldBuf->shminfo.shmid, IPC_RMID, 0);
@@ -254,7 +206,6 @@ xm_buffer_destroy(struct pipe_winsys *pws,
oldBuf->shminfo.shmaddr = (char *) -1;
}
else
-#endif
{
if (!oldBuf->userBuffer) {
align_free(oldBuf->data);
@@ -268,107 +219,6 @@ xm_buffer_destroy(struct pipe_winsys *pws,
}
-/**
- * For Cell. Basically, rearrange the pixels/quads from this layout:
- * +--+--+--+--+
- * |p0|p1|p2|p3|....
- * +--+--+--+--+
- *
- * to this layout:
- * +--+--+
- * |p0|p1|....
- * +--+--+
- * |p2|p3|
- * +--+--+
- */
-static void
-twiddle_tile(const uint *tileIn, uint *tileOut)
-{
- int y, x;
-
- for (y = 0; y < TILE_SIZE; y+=2) {
- for (x = 0; x < TILE_SIZE; x+=2) {
- int k = 4 * (y/2 * TILE_SIZE/2 + x/2);
- tileOut[y * TILE_SIZE + (x + 0)] = tileIn[k];
- tileOut[y * TILE_SIZE + (x + 1)] = tileIn[k+1];
- tileOut[(y + 1) * TILE_SIZE + (x + 0)] = tileIn[k+2];
- tileOut[(y + 1) * TILE_SIZE + (x + 1)] = tileIn[k+3];
- }
- }
-}
-
-
-
-/**
- * Display a surface that's in a tiled configuration. That is, all the
- * pixels for a TILE_SIZExTILE_SIZE block are contiguous in memory.
- */
-static void
-xlib_cell_display_surface(struct xmesa_buffer *b, struct pipe_surface *surf)
-{
- XImage *ximage;
- struct xm_buffer *xm_buf = xm_buffer(surf->buffer);
- const uint tilesPerRow = (surf->width + TILE_SIZE - 1) / TILE_SIZE;
- uint x, y;
-
- if (XSHM_ENABLED(xm_buf) && (xm_buf->tempImage == NULL)) {
- alloc_shm_ximage(xm_buf, b, TILE_SIZE, TILE_SIZE);
- }
-
- ximage = (XSHM_ENABLED(xm_buf)) ? xm_buf->tempImage : b->tempImage;
-
- /* check that the XImage has been previously initialized */
- assert(ximage->format);
- assert(ximage->bitmap_unit);
-
- if (!XSHM_ENABLED(xm_buf)) {
- /* update XImage's fields */
- ximage->width = TILE_SIZE;
- ximage->height = TILE_SIZE;
- ximage->bytes_per_line = TILE_SIZE * 4;
- }
-
- for (y = 0; y < surf->height; y += TILE_SIZE) {
- for (x = 0; x < surf->width; x += TILE_SIZE) {
- uint tmpTile[TILE_SIZE * TILE_SIZE];
- int tx = x / TILE_SIZE;
- int ty = y / TILE_SIZE;
- int offset = ty * tilesPerRow + tx;
- int w = TILE_SIZE;
- int h = TILE_SIZE;
-
- if (y + h > surf->height)
- h = surf->height - y;
- if (x + w > surf->width)
- w = surf->width - x;
-
- /* offset in pixels */
- offset *= TILE_SIZE * TILE_SIZE;
-
- if (0 && XSHM_ENABLED(xm_buf)) {
- ximage->data = (char *) xm_buf->data + 4 * offset;
- /* make copy of tile data */
- memcpy(tmpTile, (uint *) ximage->data, sizeof(tmpTile));
- /* twiddle from temp to ximage in shared memory */
- twiddle_tile(tmpTile, (uint *) ximage->data);
- /* display image in shared memory */
-#if defined(USE_XSHM)
- XShmPutImage(b->xm_visual->display, b->drawable, b->gc,
- ximage, 0, 0, x, y, w, h, False);
-#endif
- }
- else {
- /* twiddle from ximage buffer to temp tile */
- twiddle_tile((uint *) xm_buf->data + offset, tmpTile);
- /* display temp tile data */
- ximage->data = (char *) tmpTile;
- XPutImage(b->xm_visual->display, b->drawable, b->gc,
- ximage, 0, 0, x, y, w, h);
- }
- }
- }
-}
-
/**
* Display/copy the image in the surface into the X window specified
@@ -386,22 +236,12 @@ xlib_softpipe_display_surface(struct xmesa_buffer *b,
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 (tileSize) {
- xlib_cell_display_surface(b, surf);
- return;
- }
-
if (XSHM_ENABLED(xm_buf) && (xm_buf->tempImage == NULL)) {
assert(surf->block.width == 1);
assert(surf->block.height == 1);
@@ -413,10 +253,8 @@ xlib_softpipe_display_surface(struct xmesa_buffer *b,
/* display image in Window */
if (XSHM_ENABLED(xm_buf)) {
-#if defined(USE_XSHM)
XShmPutImage(b->xm_visual->display, b->drawable, b->gc,
ximage, 0, 0, 0, 0, surf->width, surf->height, False);
-#endif
} else {
/* check that the XImage has been previously initialized */
assert(ximage->format);
@@ -462,17 +300,12 @@ xm_buffer_create(struct pipe_winsys *pws,
unsigned size)
{
struct xm_buffer *buffer = CALLOC_STRUCT(xm_buffer);
-#if defined(USE_XSHM)
struct xmesa_pipe_winsys *xpws = (struct xmesa_pipe_winsys *) pws;
-#endif
buffer->base.refcount = 1;
buffer->base.alignment = alignment;
buffer->base.usage = usage;
buffer->base.size = size;
-
-
-#if defined(USE_XSHM)
buffer->shminfo.shmid = -1;
buffer->shminfo.shmaddr = (char *) -1;
@@ -483,7 +316,6 @@ xm_buffer_create(struct pipe_winsys *pws,
buffer->data = buffer->shminfo.shmaddr;
}
}
-#endif
if (buffer->data == NULL) {
buffer->shm = 0;
@@ -545,11 +377,7 @@ xm_surface_alloc_storage(struct pipe_winsys *winsys,
assert(!surf->buffer);
surf->buffer = winsys->buffer_create(winsys, alignment,
PIPE_BUFFER_USAGE_PIXEL,
-#ifdef GALLIUM_CELL /* XXX a bit of a hack */
- surf->stride * round_up(surf->nblocksy, TILE_SIZE));
-#else
surf->stride * surf->nblocksy);
-#endif
if(!surf->buffer)
return -1;
@@ -628,8 +456,6 @@ xlib_create_softpipe_winsys( void )
if (!ws) {
ws = CALLOC_STRUCT(xmesa_pipe_winsys);
- //ws->shm = xmesa_check_for_xshm( display );
-
/* Fill in this struct with callbacks that pipe will need to
* communicate with the window system, buffer manager, etc.
*/
@@ -698,75 +524,4 @@ struct xm_driver xlib_softpipe_driver =
};
-/***********************************************************************
- * Cell piggybacks on softpipe code still.
- *
- * Should be untangled sufficiently to live in a separate file, at
- * least. That would mean removing #ifdef GALLIUM_CELL's from above
- * and creating cell-specific versions of either those functions or
- * the entire file.
- */
-#ifdef GALLIUM_CELL
-
-static struct pipe_winsys *
-xlib_create_cell_winsys( void )
-{
- return xlib_create_softpipe_winsys();
-}
-
-static struct pipe_screen *
-xlib_create_cell_screen( struct pipe_winsys *pws )
-{
- return cell_create_screen( pws );
-}
-
-
-static struct pipe_context *
-xlib_create_cell_context( struct pipe_screen *screen,
- void *priv )
-{
- struct cell_winsys *cws;
- struct pipe_context *pipe;
-
- if (getenv("GALLIUM_NOCELL"))
- return xlib_create_softpipe_context( screen, priv );
-
-
- /* This takes a cell_winsys pointer, but probably that should be
- * created and stored at screen creation, not context creation.
- *
- * The actual cell_winsys value isn't used for anything, so just
- * passing NULL for now.
- */
- pipe = cell_create_context( screen, NULL);
- if (pipe == NULL)
- goto fail;
-
- pipe->priv = priv;
-
- return pipe;
-
-fail:
- return NULL;
-}
-#endif
-
-#if defined(GALLIUM_CELL)
-struct xm_driver xlib_cell_driver =
-{
- .create_pipe_winsys = xlib_create_cell_winsys,
- .create_pipe_screen = xlib_create_cell_screen,
- .create_pipe_context = xlib_create_cell_context,
- .display_surface = xlib_cell_display_surface,
-};
-#else
-struct xm_driver xlib_cell_driver =
-{
- .create_pipe_winsys = xlib_create_softpipe_winsys,
- .create_pipe_screen = xlib_create_softpipe_screen,
- .create_pipe_context = xlib_create_softpipe_context,
- .display_surface = xlib_softpipe_display_surface,
-};
-#endif
-