diff options
author | Daniel Vetter <[email protected]> | 2010-11-20 10:00:38 +0100 |
---|---|---|
committer | Jakob Bornecrantz <[email protected]> | 2010-12-02 01:34:13 +0100 |
commit | 6ae6e0c6feacd89a7e3db4db5c4ea800cbe40397 (patch) | |
tree | 4f5cd3d5e1cffe0f3c4d8a960e57ee6bc255c9b0 /src/gallium/drivers/i915/i915_surface.c | |
parent | f34fd58ec92b9344982b4a5a4b9e05fe4b151a64 (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 <[email protected]>
Reviewed-by: Jakob Bornecrantz <[email protected]>
Signed-off-by: Jakob Bornecrantz <[email protected]>
Diffstat (limited to 'src/gallium/drivers/i915/i915_surface.c')
-rw-r--r-- | src/gallium/drivers/i915/i915_surface.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/gallium/drivers/i915/i915_surface.c b/src/gallium/drivers/i915/i915_surface.c index f40876e708e..3a7d9ec407c 100644 --- a/src/gallium/drivers/i915/i915_surface.c +++ b/src/gallium/drivers/i915/i915_surface.c @@ -56,24 +56,24 @@ i915_surface_copy(struct pipe_context *pipe, unsigned dst_offset, src_offset; /* in bytes */ if (dst->target == PIPE_TEXTURE_CUBE) { - dst_offset = dst_tex->image_offset[subdst.level][subdst.face]; + dst_offset = i915_texture_offset(dst_tex, subdst.level, subdst.face); } else if (dst->target == PIPE_TEXTURE_3D) { - dst_offset = dst_tex->image_offset[subdst.level][dstz]; + dst_offset = i915_texture_offset(dst_tex, subdst.level, dstz); } else { - dst_offset = dst_tex->image_offset[subdst.level][0]; + dst_offset = i915_texture_offset(dst_tex, subdst.level, 0); assert(subdst.face == 0); assert(dstz == 0); } if (src->target == PIPE_TEXTURE_CUBE) { - src_offset = src_tex->image_offset[subsrc.level][subsrc.face]; + src_offset = i915_texture_offset(src_tex, subsrc.level, subsrc.face); } else if (src->target == PIPE_TEXTURE_3D) { - src_offset = src_tex->image_offset[subsrc.level][srcz]; + src_offset = i915_texture_offset(src_tex, subsrc.level, srcz); } else { - src_offset = src_tex->image_offset[subsrc.level][0]; + src_offset = i915_texture_offset(src_tex, subsrc.level, 0); assert(subsrc.face == 0); assert(srcz == 0); } @@ -173,13 +173,13 @@ i915_get_tex_surface(struct pipe_screen *screen, unsigned offset; /* in bytes */ if (pt->target == PIPE_TEXTURE_CUBE) { - offset = tex->image_offset[level][face]; + offset = i915_texture_offset(tex, level, face); } else if (pt->target == PIPE_TEXTURE_3D) { - offset = tex->image_offset[level][zslice]; + offset = i915_texture_offset(tex, level, zslice); } else { - offset = tex->image_offset[level][0]; + offset = i915_texture_offset(tex, level, 0); assert(face == 0); assert(zslice == 0); } |