Mesa (master): i915g: Remove broken power of two function
Jakob Bornecrantz
wallbraker at kemper.freedesktop.org
Sun Apr 18 01:56:30 UTC 2010
Module: Mesa
Branch: master
Commit: 5db285b742c9e38ff110c72ab45ed1f6a9200c8d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5db285b742c9e38ff110c72ab45ed1f6a9200c8d
Author: Jakob Bornecrantz <wallbraker at gmail.com>
Date: Sat Apr 17 23:43:41 2010 +0100
i915g: Remove broken power of two function
---
src/gallium/drivers/i915/i915_resource_texture.c | 24 +++++++--------------
1 files changed, 8 insertions(+), 16 deletions(-)
diff --git a/src/gallium/drivers/i915/i915_resource_texture.c b/src/gallium/drivers/i915/i915_resource_texture.c
index 141bf44..17fcdee 100644
--- a/src/gallium/drivers/i915/i915_resource_texture.c
+++ b/src/gallium/drivers/i915/i915_resource_texture.c
@@ -87,19 +87,6 @@ static const int bottom_offsets[6] = {
[PIPE_TEX_FACE_NEG_Z] = 16 + 5 * 8,
};
-
-/* XXX really need twice the size if x is already pot?
- Otherwise just use util_next_power_of_two?
-*/
-static unsigned
-power_of_two(unsigned x)
-{
- unsigned value = 1;
- while (value < x)
- value = value << 1;
- return value;
-}
-
static INLINE unsigned
align_nblocksx(enum pipe_format format, unsigned width, unsigned align_to)
{
@@ -112,6 +99,11 @@ align_nblocksy(enum pipe_format format, unsigned width, unsigned align_to)
return align(util_format_get_nblocksy(format, width), align_to);
}
+static INLINE unsigned
+get_pot_stride(enum pipe_format format, unsigned width)
+{
+ return util_next_power_of_two(util_format_get_stride(format, width));
+}
/*
* More advanced helper funcs
@@ -170,11 +162,11 @@ i9x5_scanout_layout(struct i915_texture *tex)
i915_texture_set_image_offset(tex, 0, 0, 0, 0);
if (pt->width0 >= 240) {
- tex->stride = power_of_two(util_format_get_stride(pt->format, pt->width0));
+ tex->stride = get_pot_stride(pt->format, pt->width0);
tex->total_nblocksy = align_nblocksy(pt->format, pt->height0, 8);
tex->hw_tiled = I915_TILE_X;
} else if (pt->width0 == 64 && pt->height0 == 64) {
- tex->stride = power_of_two(util_format_get_stride(pt->format, pt->width0));
+ tex->stride = get_pot_stride(pt->format, pt->width0);
tex->total_nblocksy = align_nblocksy(pt->format, pt->height0, 8);
} else {
return FALSE;
@@ -207,7 +199,7 @@ i9x5_display_target_layout(struct i915_texture *tex)
i915_texture_set_level_info(tex, 0, 1);
i915_texture_set_image_offset(tex, 0, 0, 0, 0);
- tex->stride = power_of_two(util_format_get_stride(pt->format, pt->width0));
+ tex->stride = get_pot_stride(pt->format, pt->width0);
tex->total_nblocksy = align_nblocksy(pt->format, pt->height0, 8);
tex->hw_tiled = I915_TILE_X;
More information about the mesa-commit
mailing list