summaryrefslogtreecommitdiff
path: root/src/gallium/winsys/xlib
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/winsys/xlib')
-rw-r--r--src/gallium/winsys/xlib/xlib_cell.c20
-rw-r--r--src/gallium/winsys/xlib/xlib_llvmpipe.c15
-rw-r--r--src/gallium/winsys/xlib/xlib_softpipe.c15
3 files changed, 16 insertions, 34 deletions
diff --git a/src/gallium/winsys/xlib/xlib_cell.c b/src/gallium/winsys/xlib/xlib_cell.c
index 13e609f58f..6e984ebe3c 100644
--- a/src/gallium/winsys/xlib/xlib_cell.c
+++ b/src/gallium/winsys/xlib/xlib_cell.c
@@ -277,15 +277,6 @@ xm_user_buffer_create(struct pipe_winsys *pws, void *ptr, unsigned bytes)
-/**
- * Round n up to next multiple.
- */
-static INLINE unsigned
-round_up(unsigned n, unsigned multiple)
-{
- return (n + multiple - 1) & ~(multiple - 1);
-}
-
static struct pipe_buffer *
xm_surface_buffer_create(struct pipe_winsys *winsys,
unsigned width, unsigned height,
@@ -294,18 +285,15 @@ xm_surface_buffer_create(struct pipe_winsys *winsys,
unsigned *stride)
{
const unsigned alignment = 64;
- struct pipe_format_block block;
- unsigned nblocksx, nblocksy;
+ unsigned nblocksy;
- pf_get_block(format, &block);
- nblocksx = pf_get_nblocksx(&block, width);
- nblocksy = pf_get_nblocksy(&block, height);
- *stride = round_up(nblocksx * block.size, alignment);
+ nblocksy = pf_get_nblocksy(format, height);
+ *stride = align(pf_get_stride(format, width), alignment);
return winsys->buffer_create(winsys, alignment,
usage,
/* XXX a bit of a hack */
- *stride * round_up(nblocksy, TILE_SIZE));
+ *stride * align(nblocksy, TILE_SIZE));
}
diff --git a/src/gallium/winsys/xlib/xlib_llvmpipe.c b/src/gallium/winsys/xlib/xlib_llvmpipe.c
index 3dd15e099b..41f3e248e8 100644
--- a/src/gallium/winsys/xlib/xlib_llvmpipe.c
+++ b/src/gallium/winsys/xlib/xlib_llvmpipe.c
@@ -58,7 +58,6 @@
struct xm_displaytarget
{
enum pipe_format format;
- struct pipe_format_block block;
unsigned width;
unsigned height;
unsigned stride;
@@ -262,10 +261,10 @@ xm_llvmpipe_display(struct xmesa_buffer *xm_buffer,
{
if (xm_dt->tempImage == NULL)
{
- assert(xm_dt->block.width == 1);
- assert(xm_dt->block.height == 1);
+ assert(pf_get_blockwidth(xm_dt->format) == 1);
+ assert(pf_get_blockheight(xm_dt->format) == 1);
alloc_shm_ximage(xm_dt, xm_buffer,
- xm_dt->stride / xm_dt->block.size,
+ xm_dt->stride / pf_get_blocksize(xm_dt->format),
xm_dt->height);
}
@@ -321,7 +320,7 @@ xm_displaytarget_create(struct llvmpipe_winsys *winsys,
unsigned *stride)
{
struct xm_displaytarget *xm_dt = CALLOC_STRUCT(xm_displaytarget);
- unsigned nblocksx, nblocksy, size;
+ unsigned nblocksy, size;
xm_dt = CALLOC_STRUCT(xm_displaytarget);
if(!xm_dt)
@@ -331,10 +330,8 @@ xm_displaytarget_create(struct llvmpipe_winsys *winsys,
xm_dt->width = width;
xm_dt->height = height;
- pf_get_block(format, &xm_dt->block);
- nblocksx = pf_get_nblocksx(&xm_dt->block, width);
- nblocksy = pf_get_nblocksy(&xm_dt->block, height);
- xm_dt->stride = align(nblocksx * xm_dt->block.size, alignment);
+ nblocksy = pf_get_nblocksy(format, height);
+ xm_dt->stride = align(pf_get_stride(format, width), alignment);
size = xm_dt->stride * nblocksy;
#ifdef USE_XSHM
diff --git a/src/gallium/winsys/xlib/xlib_softpipe.c b/src/gallium/winsys/xlib/xlib_softpipe.c
index 260b39e2a0..69a5dcc2b7 100644
--- a/src/gallium/winsys/xlib/xlib_softpipe.c
+++ b/src/gallium/winsys/xlib/xlib_softpipe.c
@@ -254,10 +254,10 @@ xlib_softpipe_display_surface(struct xmesa_buffer *b,
{
if (xm_buf->tempImage == NULL)
{
- assert(surf->texture->block.width == 1);
- assert(surf->texture->block.height == 1);
+ assert(pf_get_blockwidth(surf->texture->format) == 1);
+ assert(pf_get_blockheight(surf->texture->format) == 1);
alloc_shm_ximage(xm_buf, b, spt->stride[surf->level] /
- surf->texture->block.size, surf->height);
+ pf_get_blocksize(surf->texture->format), surf->height);
}
ximage = xm_buf->tempImage;
@@ -360,13 +360,10 @@ xm_surface_buffer_create(struct pipe_winsys *winsys,
unsigned *stride)
{
const unsigned alignment = 64;
- struct pipe_format_block block;
- unsigned nblocksx, nblocksy, size;
+ unsigned nblocksy, size;
- pf_get_block(format, &block);
- nblocksx = pf_get_nblocksx(&block, width);
- nblocksy = pf_get_nblocksy(&block, height);
- *stride = align(nblocksx * block.size, alignment);
+ nblocksy = pf_get_nblocksy(format, height);
+ *stride = align(pf_get_stride(format, width), alignment);
size = *stride * nblocksy;
#ifdef USE_XSHM