aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/xlib
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-12-10 17:32:08 -0700
committerBrian <[email protected]>2007-12-10 17:32:43 -0700
commit7d1894c6558c5cc7f503142cda11b8a12ea24e65 (patch)
tree0e6bdb0417a0f444f527d2559cc809cab4228703 /src/mesa/pipe/xlib
parentaef25b1994cf93aaf64baf24a2ec4e29ee086a08 (diff)
Cell: first triangle.
This is a feeble first step, but it works. The cell_clear_surface() function has been hijacked to set up a "draw triangle" command and send it to all the SPUs. The Gallium softpipe triangle code was copied to the SPU module and modified. Only the progs/trivial/clear.c program runs.
Diffstat (limited to 'src/mesa/pipe/xlib')
-rw-r--r--src/mesa/pipe/xlib/xm_winsys.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mesa/pipe/xlib/xm_winsys.c b/src/mesa/pipe/xlib/xm_winsys.c
index c372545cf8c..b090d8927c4 100644
--- a/src/mesa/pipe/xlib/xm_winsys.c
+++ b/src/mesa/pipe/xlib/xm_winsys.c
@@ -211,6 +211,7 @@ xm_buffer_data(struct pipe_winsys *pws, struct pipe_buffer_handle *buf,
if (xm_buf->size != size) {
if (xm_buf->data)
align_free(xm_buf->data);
+ /* align to 16-byte multiple for Cell */
xm_buf->data = align_malloc(size, 16);
xm_buf->size = size;
}
@@ -254,6 +255,7 @@ xmesa_display_surface_tiled(XMesaBuffer b, const struct pipe_surface *surf)
XImage *ximage = b->tempImage;
struct xm_buffer *xm_buf = xm_bo(surf->buffer);
const int TILE_SIZE = 32;
+ const uint tilesPerRow = (surf->width + TILE_SIZE - 1) / TILE_SIZE;
uint x, y;
/* check that the XImage has been previously initialized */
@@ -271,7 +273,7 @@ xmesa_display_surface_tiled(XMesaBuffer b, const struct pipe_surface *surf)
int dy = y;
int tx = x / TILE_SIZE;
int ty = y / TILE_SIZE;
- int offset = ty * (surf->width / TILE_SIZE) + tx;
+ int offset = ty * tilesPerRow + tx;
offset *= 4 * TILE_SIZE * TILE_SIZE;
ximage->data = (char *) xm_buf->data + offset;