Mesa (gallium-0.2): gallium: use align() intead of round_up()

Brian Paul brianp at kemper.freedesktop.org
Mon Jan 19 18:51:44 UTC 2009


Module: Mesa
Branch: gallium-0.2
Commit: ba3a879b1cade2cb189b1d6d3b244f1fa3f8f5d7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ba3a879b1cade2cb189b1d6d3b244f1fa3f8f5d7

Author: Brian Paul <brianp at vmware.com>
Date:   Mon Jan 19 11:51:23 2009 -0700

gallium: use align() intead of round_up()

---

 src/gallium/winsys/xlib/xlib_softpipe.c |   14 ++------------
 1 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/src/gallium/winsys/xlib/xlib_softpipe.c b/src/gallium/winsys/xlib/xlib_softpipe.c
index e851306..0c3097c 100644
--- a/src/gallium/winsys/xlib/xlib_softpipe.c
+++ b/src/gallium/winsys/xlib/xlib_softpipe.c
@@ -344,16 +344,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 int
 xm_surface_alloc_storage(struct pipe_winsys *winsys,
                          struct pipe_surface *surf,
@@ -362,7 +352,7 @@ xm_surface_alloc_storage(struct pipe_winsys *winsys,
                          unsigned flags,
                          unsigned tex_usage)
 {
-   const unsigned alignment = 64;
+   const int alignment = 64;
 
    surf->width = width;
    surf->height = height;
@@ -370,7 +360,7 @@ xm_surface_alloc_storage(struct pipe_winsys *winsys,
    pf_get_block(format, &surf->block);
    surf->nblocksx = pf_get_nblocksx(&surf->block, width);
    surf->nblocksy = pf_get_nblocksy(&surf->block, height);
-   surf->stride = round_up(surf->nblocksx * surf->block.size, alignment);
+   surf->stride = align(surf->nblocksx * surf->block.size, alignment);
    surf->usage = flags;
 
    assert(!surf->buffer);




More information about the mesa-commit mailing list