summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/i915/i915_resource.h
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2010-11-20 10:00:38 +0100
committerJakob Bornecrantz <wallbraker@gmail.com>2010-12-02 01:34:13 +0100
commit6ae6e0c6feacd89a7e3db4db5c4ea800cbe40397 (patch)
tree4f5cd3d5e1cffe0f3c4d8a960e57ee6bc255c9b0 /src/gallium/drivers/i915/i915_resource.h
parentf34fd58ec92b9344982b4a5a4b9e05fe4b151a64 (diff)
i915g: postpone mipmap/face offset calculation
libdrm-intel can refuse to tile buffers for various reasons. For potentially tiled buffers the stride is therefore only known after the iws->buffer_create_tiled call. Unconditionally rounding up to whatever tiling requires wastes space, so rework the code to not use tex->stride in the layout code. Luckily only the mimap/face offset calculation uses it which can easily be solved by storing an (x, y) coordinate pair. Furthermore this will be usefull later for properly supporting rendering into the different levels of tiled mipmap textures. v2: switch to nblocks(x|y): More in line with gallium and better suited for rendering into mipmap textures. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Jakob Bornecrantz <wallbraker@gmail.com> Signed-off-by: Jakob Bornecrantz <wallbraker@gmail.com>
Diffstat (limited to 'src/gallium/drivers/i915/i915_resource.h')
-rw-r--r--src/gallium/drivers/i915/i915_resource.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/gallium/drivers/i915/i915_resource.h b/src/gallium/drivers/i915/i915_resource.h
index 753bd266b1..578c6bdb42 100644
--- a/src/gallium/drivers/i915/i915_resource.h
+++ b/src/gallium/drivers/i915/i915_resource.h
@@ -49,6 +49,10 @@ struct i915_buffer {
#define I915_MAX_TEXTURE_3D_LEVELS 8 /* max 128x128x128 */
+struct offset_pair {
+ unsigned short nblocksx;
+ unsigned short nblocksy;
+};
struct i915_texture {
struct u_resource b;
@@ -63,14 +67,18 @@ struct i915_texture {
/* Explicitly store the offset of each image for each cube face or
* depth value.
+ *
+ * Array [depth] off offsets.
*/
- unsigned *image_offset[I915_MAX_TEXTURE_2D_LEVELS]; /**< array [depth] of offsets */
+ struct offset_pair *image_offset[I915_MAX_TEXTURE_2D_LEVELS];
/* The data is held here:
*/
struct i915_winsys_buffer *buffer;
};
+unsigned i915_texture_offset(struct i915_texture *tex,
+ unsigned level, unsigned face);
void i915_init_screen_resource_functions(struct i915_screen *is);
void i915_init_resource_functions(struct i915_context *i915);