iris: handle level/layer in direct maps
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 23 Aug 2018 09:36:18 +0000 (02:36 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:08 +0000 (10:26 -0800)
needed now that we do 1D linear

src/gallium/drivers/iris/iris_resource.c

index 3f797ffbc9457cef03f7366b451a246cefceb244..34908d85a10fa55b46537adfd0c472c75b3c8818 100644 (file)
@@ -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 *