Module: Mesa Branch: master Commit: 9493fe85d1b10efc06e8c34de31971dc6e6a6062 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9493fe85d1b10efc06e8c34de31971dc6e6a6062
Author: Daniel Vetter <[email protected]> Date: Sat Nov 20 11:17:55 2010 +0100 i915g: enable X-tiling for textures Tiling is rather fragile in general and results in pure blackness when unlucky. Hence add a new option to disable tiling. Signed-off-by: Daniel Vetter <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]> Signed-off-by: Jakob Bornecrantz <[email protected]> --- src/gallium/drivers/i915/i915_debug.c | 2 + src/gallium/drivers/i915/i915_debug.h | 1 + src/gallium/drivers/i915/i915_resource_texture.c | 24 ++++++++++++++++++++++ 3 files changed, 27 insertions(+), 0 deletions(-) diff --git a/src/gallium/drivers/i915/i915_debug.c b/src/gallium/drivers/i915/i915_debug.c index 57d3390..d7150c9 100644 --- a/src/gallium/drivers/i915/i915_debug.c +++ b/src/gallium/drivers/i915/i915_debug.c @@ -46,10 +46,12 @@ static const struct debug_named_value debug_options[] = { }; unsigned i915_debug = 0; +boolean i915_tiling = TRUE; void i915_debug_init(struct i915_screen *screen) { i915_debug = debug_get_flags_option("I915_DEBUG", debug_options, 0); + i915_tiling = !debug_get_bool_option("I915_NO_TILING", FALSE); } diff --git a/src/gallium/drivers/i915/i915_debug.h b/src/gallium/drivers/i915/i915_debug.h index fa60799..11af766 100644 --- a/src/gallium/drivers/i915/i915_debug.h +++ b/src/gallium/drivers/i915/i915_debug.h @@ -46,6 +46,7 @@ struct i915_winsys_batchbuffer; #define DBG_CONSTANTS 0x20 extern unsigned i915_debug; +extern boolean i915_tiling; #ifdef DEBUG static INLINE boolean diff --git a/src/gallium/drivers/i915/i915_resource_texture.c b/src/gallium/drivers/i915/i915_resource_texture.c index bb45a42..3a0fc7f 100644 --- a/src/gallium/drivers/i915/i915_resource_texture.c +++ b/src/gallium/drivers/i915/i915_resource_texture.c @@ -154,6 +154,26 @@ i915_texture_set_image_offset(struct i915_texture *tex, #endif } +static enum i915_winsys_buffer_tile +i915_texture_tiling(struct pipe_resource *pt) +{ + if (!i915_tiling) + return I915_TILE_NONE; + + if (pt->target == PIPE_TEXTURE_1D) + return I915_TILE_NONE; + + if (util_format_is_s3tc(pt->format)) + /* XXX X-tiling might make sense */ + return I915_TILE_NONE; + + if ((pt->bind & PIPE_BIND_RENDER_TARGET)) + /* XXX We can't render properly into mipmap'ed textures */ + return I915_TILE_NONE; + + return I915_TILE_X; +} + /* * Shared layout functions @@ -370,6 +390,8 @@ i915_texture_layout(struct i915_texture * tex) { struct pipe_resource *pt = &tex->b.b; + tex->tiling = i915_texture_tiling(pt); + switch (pt->target) { case PIPE_TEXTURE_1D: case PIPE_TEXTURE_2D: @@ -616,6 +638,8 @@ i945_texture_layout(struct i915_texture * tex) { struct pipe_resource *pt = &tex->b.b; + tex->tiling = i915_texture_tiling(pt); + switch (pt->target) { case PIPE_TEXTURE_1D: case PIPE_TEXTURE_2D: _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
