summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorJakob Bornecrantz <jakob@tungstengraphics.com>2008-06-13 20:46:14 +0200
committerJakob Bornecrantz <jakob@tungstengraphics.com>2008-06-13 20:46:14 +0200
commit3da77b33bb0093ff27c16833ed93a3a114c3e95e (patch)
treefb8993940f9b545019da9c0bdf700ff85c877782 /src/gallium
parentd89b1e4a037b4facb84b056d2fdcd383de78b311 (diff)
i915: Improved the not used tile code
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/i915simple/i915_state_emit.c21
-rw-r--r--src/gallium/drivers/i915simple/i915_texture.c33
2 files changed, 36 insertions, 18 deletions
diff --git a/src/gallium/drivers/i915simple/i915_state_emit.c b/src/gallium/drivers/i915simple/i915_state_emit.c
index 480b0b54c4..bc801a82f0 100644
--- a/src/gallium/drivers/i915simple/i915_state_emit.c
+++ b/src/gallium/drivers/i915simple/i915_state_emit.c
@@ -211,14 +211,18 @@ i915_emit_hardware_state(struct i915_context *i915 )
struct pipe_surface *depth_surface = i915->framebuffer.zsbuf;
if (cbuf_surface) {
- unsigned pitch = (cbuf_surface->pitch * cbuf_surface->cpp);
+ unsigned cpitch = (cbuf_surface->pitch * cbuf_surface->cpp);
+ unsigned ctile = BUF_3D_USE_FENCE;
+#if 0
+ if (!((cpitch - 1) & cpitch) && cpitch >= 512)
+ ctile = BUF_3D_TILED_SURFACE;
+#endif
OUT_BATCH(_3DSTATE_BUF_INFO_CMD);
OUT_BATCH(BUF_3D_ID_COLOR_BACK |
- BUF_3D_PITCH(pitch) | /* pitch in bytes */
-// BUF_3D_TILED_SURFACE); /* JB: Used to force tileing */
- BUF_3D_USE_FENCE);
+ BUF_3D_PITCH(cpitch) | /* pitch in bytes */
+ ctile);
OUT_RELOC(cbuf_surface->buffer,
I915_BUFFER_ACCESS_WRITE,
@@ -229,12 +233,17 @@ i915_emit_hardware_state(struct i915_context *i915 )
*/
if (depth_surface) {
unsigned zpitch = (depth_surface->pitch * depth_surface->cpp);
-
+ unsigned ztile = BUF_3D_USE_FENCE;
+#if 0
+ if (!((zpitch - 1) & zpitch) && zpitch >= 512)
+ ztile = BUF_3D_TILED_SURFACE;
+#endif
+
OUT_BATCH(_3DSTATE_BUF_INFO_CMD);
OUT_BATCH(BUF_3D_ID_DEPTH |
BUF_3D_PITCH(zpitch) | /* pitch in bytes */
- BUF_3D_USE_FENCE);
+ ztile);
OUT_RELOC(depth_surface->buffer,
I915_BUFFER_ACCESS_WRITE,
diff --git a/src/gallium/drivers/i915simple/i915_texture.c b/src/gallium/drivers/i915simple/i915_texture.c
index 7a1665d48b..d591b09e3c 100644
--- a/src/gallium/drivers/i915simple/i915_texture.c
+++ b/src/gallium/drivers/i915simple/i915_texture.c
@@ -104,16 +104,14 @@ i915_miptree_set_image_offset(struct i915_texture *tex,
*/
}
-#if 0
static unsigned
power_of_two(unsigned x)
{
- int value = 1;
+ unsigned value = 1;
while (value <= x)
value = value << 1;
return value;
}
-#endif
static unsigned
round_up(unsigned n, unsigned multiple)
@@ -125,8 +123,7 @@ round_up(unsigned n, unsigned multiple)
* Special case to deal with display targets.
*/
static boolean
-i915_displaytarget_layout(struct pipe_screen *screen,
- struct i915_texture *tex)
+i915_displaytarget_layout(struct i915_texture *tex)
{
struct pipe_texture *pt = &tex->base;
@@ -139,13 +136,19 @@ i915_displaytarget_layout(struct pipe_screen *screen,
1 );
i915_miptree_set_image_offset( tex, 0, 0, 0, 0 );
-#if 0
- tex->pitch = MAX2(512, power_of_two(tex->base.width[0] * pt->cpp)) / pt->cpp;
- tex->total_height = round_up(tex->base.height[0], 8);
-#else
- tex->pitch = round_up(tex->base.width[0], 64 / pt->cpp);
- tex->total_height = tex->base.height[0];
-#endif
+ if (tex->base.width[0] >= 128) {
+ tex->pitch = power_of_two(tex->base.width[0] * pt->cpp) / pt->cpp;
+ tex->total_height = round_up(tex->base.height[0], 8);
+ } else {
+ tex->pitch = round_up(tex->base.width[0], 64 / pt->cpp);
+ tex->total_height = tex->base.height[0];
+ }
+
+/*
+ printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__,
+ tex->base.width[0], tex->base.height[0], pt->cpp,
+ tex->pitch, tex->total_height, tex->pitch * tex->total_height * 4);
+*/
return 1;
}
@@ -161,6 +164,12 @@ i945_miptree_layout_2d( struct i915_texture *tex )
unsigned width = pt->width[0];
unsigned height = pt->height[0];
+#if 0 /* used for tiled display targets */
+ if (pt->last_level == 0 && pt->cpp == 4)
+ if (i915_displaytarget_layout(tex))
+ return;
+#endif
+
tex->pitch = pt->width[0];
/* May need to adjust pitch to accomodate the placement of