i915g: postpone mipmap/face offset calculation
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Sat, 20 Nov 2010 09:00:38 +0000 (10:00 +0100)
committerJakob Bornecrantz <wallbraker@gmail.com>
Thu, 2 Dec 2010 00:34:13 +0000 (01:34 +0100)
commit6ae6e0c6feacd89a7e3db4db5c4ea800cbe40397
tree4f5cd3d5e1cffe0f3c4d8a960e57ee6bc255c9b0
parentf34fd58ec92b9344982b4a5a4b9e05fe4b151a64
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>
src/gallium/drivers/i915/i915_resource.h
src/gallium/drivers/i915/i915_resource_texture.c
src/gallium/drivers/i915/i915_surface.c