Mesa (master): gallium/winsys/xlib: Fix stride calculations.
Michel Dänzer
daenzer at kemper.freedesktop.org
Wed Feb 18 15:51:08 UTC 2009
Module: Mesa
Branch: master
Commit: 9ab677a84b564a00e2e1e6874dbc2c0295b3402d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9ab677a84b564a00e2e1e6874dbc2c0295b3402d
Author: Michel Dänzer <daenzer at vmware.com>
Date: Thu Feb 12 19:42:22 2009 +0100
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(-)
diff --git a/src/gallium/winsys/xlib/xlib_brw_aub.c b/src/gallium/winsys/xlib/xlib_brw_aub.c
index c63cd51..73d1ac9 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 52fd745..846b48b 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);
More information about the mesa-commit
mailing list