From 6331b754dfc7300259cf77737feaf4853c71c171 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 23 Aug 2018 02:36:18 -0700 Subject: [PATCH] iris: handle level/layer in direct maps needed now that we do 1D linear --- src/gallium/drivers/iris/iris_resource.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index 3f797ffbc94..34908d85a10 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -769,17 +769,16 @@ iris_map_direct(struct iris_transfer *map) struct isl_surf *surf = &res->surf; const struct isl_format_layout *fmtl = isl_format_get_layout(surf->format); const unsigned cpp = fmtl->bpb / 8; + unsigned x0_el, y0_el; + + get_image_offset_el(surf, xfer->level, box->z, &x0_el, &y0_el); xfer->stride = isl_surf_get_row_pitch_B(surf); xfer->layer_stride = isl_surf_get_array_pitch(surf); void *ptr = iris_bo_map(map->dbg, res->bo, xfer->usage); - // XXX: level, layer, etc - assert(xfer->level == 0); - assert(box->z == 0); - - map->ptr = ptr + box->y * xfer->stride + box->x * cpp; + map->ptr = ptr + (y0_el + box->y) * xfer->stride + (x0_el + box->x) * cpp; } static void * -- 2.30.2