Mesa (master): gallium: Move minify() to u_math.

Corbin Simpson csimpson at kemper.freedesktop.org
Sat Aug 8 04:43:59 UTC 2009


Module: Mesa
Branch: master
Commit: 847fcb645c1d0c69617f0cafe8e6410e13f08fa6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=847fcb645c1d0c69617f0cafe8e6410e13f08fa6

Author: Corbin Simpson <MostAwesomeDude at gmail.com>
Date:   Fri Aug  7 20:16:39 2009 -0700

gallium: Move minify() to u_math.

minify() is usually used in mipmap size calculation. Strangely enough,
we all defined it as MAX2(1, d >> 1); imagine that. :3

---

 src/gallium/auxiliary/util/u_math.h             |    5 +++++
 src/gallium/drivers/cell/ppu/cell_texture.c     |    7 -------
 src/gallium/drivers/i915simple/i915_texture.c   |    5 -----
 src/gallium/drivers/i965simple/brw_tex_layout.c |    5 -----
 src/gallium/drivers/r300/r300_texture.c         |    7 -------
 src/gallium/drivers/softpipe/sp_texture.c       |    5 -----
 6 files changed, 5 insertions(+), 29 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
index 167fc83..57410e7 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -450,6 +450,11 @@ align(int value, int alignment)
    return (value + alignment - 1) & ~(alignment - 1);
 }
 
+static INLINE unsigned
+minify(unsigned value)
+{
+    return MAX2(1, value >> 1);
+}
 
 #ifndef COPY_4V
 #define COPY_4V( DST, SRC )         \
diff --git a/src/gallium/drivers/cell/ppu/cell_texture.c b/src/gallium/drivers/cell/ppu/cell_texture.c
index e265944..80418f5 100644
--- a/src/gallium/drivers/cell/ppu/cell_texture.c
+++ b/src/gallium/drivers/cell/ppu/cell_texture.c
@@ -44,13 +44,6 @@
 
 
 
-static unsigned
-minify(unsigned d)
-{
-   return MAX2(1, d>>1);
-}
-
-
 static void
 cell_texture_layout(struct cell_texture *ct)
 {
diff --git a/src/gallium/drivers/i915simple/i915_texture.c b/src/gallium/drivers/i915simple/i915_texture.c
index ac38bb5..03f0e14 100644
--- a/src/gallium/drivers/i915simple/i915_texture.c
+++ b/src/gallium/drivers/i915simple/i915_texture.c
@@ -72,11 +72,6 @@ static const int step_offsets[6][2] = {
    {-1, 1}
 };
 
-static unsigned minify( unsigned d )
-{
-   return MAX2(1, d>>1);
-}
-
 static unsigned
 power_of_two(unsigned x)
 {
diff --git a/src/gallium/drivers/i965simple/brw_tex_layout.c b/src/gallium/drivers/i965simple/brw_tex_layout.c
index 8aea8c0..998ffae 100644
--- a/src/gallium/drivers/i965simple/brw_tex_layout.c
+++ b/src/gallium/drivers/i965simple/brw_tex_layout.c
@@ -65,11 +65,6 @@ unsigned intel_compressed_alignment(unsigned internalFormat)
 }
 #endif
 
-static unsigned minify( unsigned d )
-{
-   return MAX2(1, d>>1);
-}
-
 
 static void intel_miptree_set_image_offset(struct brw_texture *tex,
                                            unsigned level,
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index 0164f05..5900525 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -22,13 +22,6 @@
 
 #include "r300_texture.h"
 
-/* XXX maths need to go to util */
-
-static int minify(int i)
-{
-    return MAX2(1, i >> 1);
-}
-
 static void r300_setup_texture_state(struct r300_texture* tex,
                                      unsigned width,
                                      unsigned height,
diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c
index 4af520e..b7e52af 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -48,11 +48,6 @@
 /* Simple, maximally packed layout.
  */
 
-static unsigned minify( unsigned d )
-{
-   return MAX2(1, d>>1);
-}
-
 
 /* Conventional allocation path for non-display textures:
  */




More information about the mesa-commit mailing list