summaryrefslogtreecommitdiff
path: root/src/gallium/winsys/xlib/xlib_cell.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/winsys/xlib/xlib_cell.c')
-rw-r--r--src/gallium/winsys/xlib/xlib_cell.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/gallium/winsys/xlib/xlib_cell.c b/src/gallium/winsys/xlib/xlib_cell.c
index 13e609f58f..47ae0519a4 100644
--- a/src/gallium/winsys/xlib/xlib_cell.c
+++ b/src/gallium/winsys/xlib/xlib_cell.c
@@ -45,6 +45,7 @@
#include "pipe/p_format.h"
#include "pipe/p_context.h"
#include "pipe/p_inlines.h"
+#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
@@ -277,35 +278,24 @@ 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,
enum pipe_format format,
unsigned usage,
+ unsigned tex_usage,
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 = util_format_get_nblocksy(format, height);
+ *stride = align(util_format_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));
}