summaryrefslogtreecommitdiff
path: root/src/gallium/winsys
diff options
context:
space:
mode:
authorYounes Manton <younes.m@gmail.com>2008-06-30 19:26:22 -0400
committerYounes Manton <younes.m@gmail.com>2008-06-30 19:26:22 -0400
commit9833aec6cbd113d24277aa5da8625c1427d831ca (patch)
treef7ee6ca969ad0d4c8e69efe69f058cbf568cfa36 /src/gallium/winsys
parent1c893fd513f5335a81dd72db70d64763634ea856 (diff)
g3dvl: Use block and stride instead of cpp and pitch.
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r--src/gallium/winsys/g3dvl/xsp_winsys.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/gallium/winsys/g3dvl/xsp_winsys.c b/src/gallium/winsys/g3dvl/xsp_winsys.c
index eb4c9085d6..d04c4be580 100644
--- a/src/gallium/winsys/g3dvl/xsp_winsys.c
+++ b/src/gallium/winsys/g3dvl/xsp_winsys.c
@@ -101,6 +101,12 @@ static struct pipe_surface* xsp_surface_alloc(struct pipe_winsys *pws)
return surface;
}
+/* Borrowed from Mesa's xm_winsys */
+static unsigned int round_up(unsigned n, unsigned multiple)
+{
+ return (n + multiple - 1) & ~(multiple - 1);
+}
+
static int xsp_surface_alloc_storage
(
struct pipe_winsys *pws,
@@ -120,10 +126,13 @@ static int xsp_surface_alloc_storage
surface->width = width;
surface->height = height;
surface->format = format;
- surface->cpp = pf_get_size(format);
- surface->pitch = width;
+ pf_get_block(format, &surface->block);
+ surface->nblocksx = pf_get_nblocksx(&surface->block, width);
+ surface->nblocksy = pf_get_nblocksy(&surface->block, height);
+ surface->stride = round_up(surface->nblocksx * surface->block.size, ALIGNMENT);
surface->usage = flags;
- surface->buffer = pws->buffer_create(pws, ALIGNMENT, PIPE_BUFFER_USAGE_PIXEL, surface->pitch * surface->cpp * height);
+ /* XXX: Need to consider block dims? See xm_winsys.c */
+ surface->buffer = pws->buffer_create(pws, ALIGNMENT, PIPE_BUFFER_USAGE_PIXEL, surface->stride * height);
return 0;
}