From 4617981ec72f7985941bee4b03c534d97ff96bc6 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Thu, 5 Feb 2009 19:41:18 +0100 Subject: gallium: No longer allow CPU mapping surfaces directly. Instead, a new pipe_transfer object has to be created and mapped for transferring data between the CPU and a texture. This gives the driver more flexibility for textures in address spaces that aren't CPU accessible. This is a first pass; softpipe/xlib builds and runs glxgears, but it only shows a black window. Looks like something's off related to the Z buffer, so the depth test always fails. --- src/gallium/winsys/xlib/xlib_brw_aub.c | 10 +++++----- src/gallium/winsys/xlib/xlib_softpipe.c | 9 +++++---- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'src/gallium/winsys/xlib') diff --git a/src/gallium/winsys/xlib/xlib_brw_aub.c b/src/gallium/winsys/xlib/xlib_brw_aub.c index 2956e1b960..c63cd51d32 100644 --- a/src/gallium/winsys/xlib/xlib_brw_aub.c +++ b/src/gallium/winsys/xlib/xlib_brw_aub.c @@ -322,10 +322,10 @@ void brw_aub_dump_bmp( struct brw_aubfile *aubfile, struct aub_dump_bmp db; unsigned format; - assert(surface->block.width == 1); - assert(surface->block.height == 1); + assert(surface->texture->block.width == 1); + assert(surface->texture->block.height == 1); - if (surface->block.size == 4) + if (surface->texture->block.size == 4) format = 0x7; else format = 0x3; @@ -334,8 +334,8 @@ void brw_aub_dump_bmp( struct brw_aubfile *aubfile, db.xmin = 0; db.ymin = 0; db.format = format; - db.bpp = surface->block.size * 8; - db.pitch = surface->stride/surface->block.size; + db.bpp = surface->texture->block.size * 8; + db.pitch = surface->texture->nblocksx[surface->level]; db.xsize = surface->width; db.ysize = surface->height; db.addr = gtt_offset; diff --git a/src/gallium/winsys/xlib/xlib_softpipe.c b/src/gallium/winsys/xlib/xlib_softpipe.c index 586e1dfca5..52fd7455a5 100644 --- a/src/gallium/winsys/xlib/xlib_softpipe.c +++ b/src/gallium/winsys/xlib/xlib_softpipe.c @@ -244,9 +244,10 @@ xlib_softpipe_display_surface(struct xmesa_buffer *b, return; if (XSHM_ENABLED(xm_buf) && (xm_buf->tempImage == NULL)) { - assert(surf->block.width == 1); - assert(surf->block.height == 1); - alloc_shm_ximage(xm_buf, b, surf->stride/surf->block.size, surf->height); + assert(surf->texture->block.width == 1); + assert(surf->texture->block.height == 1); + alloc_shm_ximage(xm_buf, b, surf->texture->nblocksx[surf->level], + surf->height); } ximage = (XSHM_ENABLED(xm_buf)) ? xm_buf->tempImage : b->tempImage; @@ -264,7 +265,7 @@ xlib_softpipe_display_surface(struct xmesa_buffer *b, /* update XImage's fields */ ximage->width = surf->width; ximage->height = surf->height; - ximage->bytes_per_line = surf->stride; + ximage->bytes_per_line = surf->texture->nblocksx[surf->level]; XPutImage(b->xm_visual->display, b->drawable, b->gc, ximage, 0, 0, 0, 0, surf->width, surf->height); -- cgit v1.2.3 From 9ab677a84b564a00e2e1e6874dbc2c0295b3402d Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Thu, 12 Feb 2009 19:42:22 +0100 Subject: gallium/winsys/xlib: Fix stride calculations. --- src/gallium/winsys/xlib/xlib_brw_aub.c | 4 +++- src/gallium/winsys/xlib/xlib_softpipe.c | 10 +++++----- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src/gallium/winsys/xlib') diff --git a/src/gallium/winsys/xlib/xlib_brw_aub.c b/src/gallium/winsys/xlib/xlib_brw_aub.c index c63cd51d32..73d1ac9161 100644 --- a/src/gallium/winsys/xlib/xlib_brw_aub.c +++ b/src/gallium/winsys/xlib/xlib_brw_aub.c @@ -36,6 +36,7 @@ #include "pipe/p_state.h" #include "pipe/p_debug.h" #include "util/u_memory.h" +#include "softpipe/sp_texture.h" struct brw_aubfile { @@ -335,7 +336,8 @@ void brw_aub_dump_bmp( struct brw_aubfile *aubfile, db.ymin = 0; db.format = format; db.bpp = surface->texture->block.size * 8; - db.pitch = surface->texture->nblocksx[surface->level]; + db.pitch = softpipe_texture(surface->texture)->stride[surface->level] / + surface->texture->block.size; db.xsize = surface->width; db.ysize = surface->height; db.addr = gtt_offset; diff --git a/src/gallium/winsys/xlib/xlib_softpipe.c b/src/gallium/winsys/xlib/xlib_softpipe.c index 52fd7455a5..846b48b4ff 100644 --- a/src/gallium/winsys/xlib/xlib_softpipe.c +++ b/src/gallium/winsys/xlib/xlib_softpipe.c @@ -230,8 +230,8 @@ xlib_softpipe_display_surface(struct xmesa_buffer *b, struct pipe_surface *surf) { XImage *ximage; - struct xm_buffer *xm_buf = xm_buffer( - softpipe_texture(surf->texture)->buffer); + struct softpipe_texture *spt = softpipe_texture(surf->texture); + struct xm_buffer *xm_buf = xm_buffer(spt->buffer); static boolean no_swap = 0; static boolean firsttime = 1; @@ -246,8 +246,8 @@ xlib_softpipe_display_surface(struct xmesa_buffer *b, if (XSHM_ENABLED(xm_buf) && (xm_buf->tempImage == NULL)) { assert(surf->texture->block.width == 1); assert(surf->texture->block.height == 1); - alloc_shm_ximage(xm_buf, b, surf->texture->nblocksx[surf->level], - surf->height); + alloc_shm_ximage(xm_buf, b, spt->stride[surf->level] / + surf->texture->block.size, surf->height); } ximage = (XSHM_ENABLED(xm_buf)) ? xm_buf->tempImage : b->tempImage; @@ -265,7 +265,7 @@ xlib_softpipe_display_surface(struct xmesa_buffer *b, /* update XImage's fields */ ximage->width = surf->width; ximage->height = surf->height; - ximage->bytes_per_line = surf->texture->nblocksx[surf->level]; + ximage->bytes_per_line = spt->stride[surf->level]; XPutImage(b->xm_visual->display, b->drawable, b->gc, ximage, 0, 0, 0, 0, surf->width, surf->height); -- cgit v1.2.3 From aa66f57a5966703d11e20f3c596d8d588a1c7176 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Thu, 12 Feb 2009 19:46:08 +0100 Subject: gallium/winsys/xlib: Use XShmPutImage when possible. --- src/gallium/winsys/xlib/xlib_softpipe.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gallium/winsys/xlib') diff --git a/src/gallium/winsys/xlib/xlib_softpipe.c b/src/gallium/winsys/xlib/xlib_softpipe.c index 846b48b4ff..d8aa4856dc 100644 --- a/src/gallium/winsys/xlib/xlib_softpipe.c +++ b/src/gallium/winsys/xlib/xlib_softpipe.c @@ -170,6 +170,8 @@ alloc_shm_ximage(struct xm_buffer *b, struct xmesa_buffer *xmb, (void) XSetErrorHandler(old_handler); return; } + + b->shm = 1; } -- cgit v1.2.3