[Mesa-dev] [PATCH 10/15] i965/miptree: Add support for isl based offsets
Topi Pohjolainen
topi.pohjolainen at gmail.com
Tue Jun 13 19:11:01 UTC 2017
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index a2d4fa9d92..c513a69a5c 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -1344,9 +1344,19 @@ uint32_t
intel_miptree_get_aligned_offset(const struct intel_mipmap_tree *mt,
uint32_t x, uint32_t y)
{
- int cpp = mt->cpp;
- uint32_t pitch = mt->pitch;
- uint32_t tiling = mt->tiling;
+ int cpp;
+ uint32_t pitch;
+ uint32_t tiling;
+
+ if (mt->surf.size > 0) {
+ cpp = isl_format_get_layout(mt->surf.format)->bpb / 8;
+ pitch = mt->surf.row_pitch;
+ tiling = isl_tiling_to_bufmgr_tiling(mt->surf.tiling);
+ } else {
+ cpp = mt->cpp;
+ pitch = mt->pitch;
+ tiling = mt->tiling;
+ }
switch (tiling) {
default:
@@ -1382,8 +1392,17 @@ intel_miptree_get_tile_offsets(const struct intel_mipmap_tree *mt,
{
uint32_t x, y;
uint32_t mask_x, mask_y;
+ uint32_t cpp, tiling;
+
+ if (mt->surf.size > 0) {
+ cpp = isl_format_get_layout(mt->surf.format)->bpb / 8;
+ tiling = isl_tiling_to_bufmgr_tiling(mt->surf.tiling);
+ } else {
+ cpp = mt->cpp;
+ tiling = mt->tiling;
+ }
- intel_get_tile_masks(mt->tiling, mt->cpp, &mask_x, &mask_y);
+ intel_get_tile_masks(tiling, cpp, &mask_x, &mask_y);
intel_miptree_get_image_offset(mt, level, slice, &x, &y);
*tile_x = x & mask_x;
--
2.11.0
More information about the mesa-dev
mailing list