iris_unmap_s8(struct iris_transfer *map)
{
struct pipe_transfer *xfer = &map->base;
+ const struct pipe_box *box = &xfer->box;
struct iris_resource *res = (struct iris_resource *) xfer->resource;
struct isl_surf *surf = &res->surf;
const bool has_swizzling = false;
uint8_t *tiled_s8_map =
iris_bo_map(map->dbg, res->bo, xfer->usage | MAP_RAW);
- struct pipe_box box = xfer->box;
-
- for (int s = 0; s < box.depth; s++) {
+ for (int s = 0; s < box->depth; s++) {
unsigned x0_el, y0_el;
- get_image_offset_el(surf, xfer->level, box.z, &x0_el, &y0_el);
+ get_image_offset_el(surf, xfer->level, box->z + s, &x0_el, &y0_el);
- for (uint32_t y = 0; y < box.height; y++) {
- for (uint32_t x = 0; x < box.width; x++) {
+ for (uint32_t y = 0; y < box->height; y++) {
+ for (uint32_t x = 0; x < box->width; x++) {
ptrdiff_t offset = s8_offset(surf->row_pitch_B,
- x0_el + box.x + x,
- y0_el + box.y + y,
+ x0_el + box->x + x,
+ y0_el + box->y + y,
has_swizzling);
tiled_s8_map[offset] =
untiled_s8_map[s * xfer->layer_stride + y * xfer->stride + x];
}
}
-
- box.z++;
}
}
iris_map_s8(struct iris_transfer *map)
{
struct pipe_transfer *xfer = &map->base;
+ const struct pipe_box *box = &xfer->box;
struct iris_resource *res = (struct iris_resource *) xfer->resource;
struct isl_surf *surf = &res->surf;
xfer->stride = surf->row_pitch_B;
- xfer->layer_stride = xfer->stride * xfer->box.height;
+ xfer->layer_stride = xfer->stride * box->height;
/* The tiling and detiling functions require that the linear buffer has
* a 16-byte alignment (that is, its `x0` is 16-byte aligned). Here we
* over-allocate the linear buffer to get the proper alignment.
*/
- map->buffer = map->ptr = malloc(xfer->layer_stride * xfer->box.depth);
+ map->buffer = map->ptr = malloc(xfer->layer_stride * box->depth);
assert(map->buffer);
const bool has_swizzling = false;
uint8_t *tiled_s8_map =
iris_bo_map(map->dbg, res->bo, xfer->usage | MAP_RAW);
- struct pipe_box box = xfer->box;
-
- for (int s = 0; s < box.depth; s++) {
+ for (int s = 0; s < box->depth; s++) {
unsigned x0_el, y0_el;
- get_image_offset_el(surf, xfer->level, box.z, &x0_el, &y0_el);
+ get_image_offset_el(surf, xfer->level, box->z + s, &x0_el, &y0_el);
- for (uint32_t y = 0; y < box.height; y++) {
- for (uint32_t x = 0; x < box.width; x++) {
+ for (uint32_t y = 0; y < box->height; y++) {
+ for (uint32_t x = 0; x < box->width; x++) {
ptrdiff_t offset = s8_offset(surf->row_pitch_B,
- x0_el + box.x + x,
- y0_el + box.y + y,
+ x0_el + box->x + x,
+ y0_el + box->y + y,
has_swizzling);
untiled_s8_map[s * xfer->layer_stride + y * xfer->stride + x] =
tiled_s8_map[offset];
}
}
-
- box.z++;
}
}
static inline void
tile_extents(struct isl_surf *surf,
const struct pipe_box *box,
- unsigned level,
+ unsigned level, int z,
unsigned *x1_B, unsigned *x2_B,
unsigned *y1_el, unsigned *y2_el)
{
assert(box->y % fmtl->bh == 0);
unsigned x0_el, y0_el;
- get_image_offset_el(surf, level, box->z, &x0_el, &y0_el);
+ get_image_offset_el(surf, level, box->z + z, &x0_el, &y0_el);
*x1_B = (box->x / fmtl->bw + x0_el) * cpp;
*y1_el = box->y / fmtl->bh + y0_el;
iris_unmap_tiled_memcpy(struct iris_transfer *map)
{
struct pipe_transfer *xfer = &map->base;
- struct pipe_box box = xfer->box;
+ const struct pipe_box *box = &xfer->box;
struct iris_resource *res = (struct iris_resource *) xfer->resource;
struct isl_surf *surf = &res->surf;
if (xfer->usage & PIPE_TRANSFER_WRITE) {
char *dst = iris_bo_map(map->dbg, res->bo, xfer->usage | MAP_RAW);
- for (int s = 0; s < box.depth; s++) {
+ for (int s = 0; s < box->depth; s++) {
unsigned x1, x2, y1, y2;
- tile_extents(surf, &box, xfer->level, &x1, &x2, &y1, &y2);
+ tile_extents(surf, box, xfer->level, s, &x1, &x2, &y1, &y2);
void *ptr = map->ptr + s * xfer->layer_stride;
isl_memcpy_linear_to_tiled(x1, x2, y1, y2, dst, ptr,
surf->row_pitch_B, xfer->stride,
has_swizzling, surf->tiling, ISL_MEMCPY);
- box.z++;
}
}
os_free_aligned(map->buffer);
iris_map_tiled_memcpy(struct iris_transfer *map)
{
struct pipe_transfer *xfer = &map->base;
+ const struct pipe_box *box = &xfer->box;
struct iris_resource *res = (struct iris_resource *) xfer->resource;
struct isl_surf *surf = &res->surf;
xfer->stride = ALIGN(surf->row_pitch_B, 16);
- xfer->layer_stride = xfer->stride * xfer->box.height;
+ xfer->layer_stride = xfer->stride * box->height;
unsigned x1, x2, y1, y2;
- tile_extents(surf, &xfer->box, xfer->level, &x1, &x2, &y1, &y2);
+ tile_extents(surf, box, xfer->level, 0, &x1, &x2, &y1, &y2);
/* The tiling and detiling functions require that the linear buffer has
* a 16-byte alignment (that is, its `x0` is 16-byte aligned). Here we
* over-allocate the linear buffer to get the proper alignment.
*/
map->buffer =
- os_malloc_aligned(xfer->layer_stride * xfer->box.depth, 16);
+ os_malloc_aligned(xfer->layer_stride * box->depth, 16);
assert(map->buffer);
map->ptr = (char *)map->buffer + (x1 & 0xf);
if (!(xfer->usage & PIPE_TRANSFER_DISCARD_RANGE)) {
char *src = iris_bo_map(map->dbg, res->bo, xfer->usage | MAP_RAW);
- struct pipe_box box = xfer->box;
-
- for (int s = 0; s < box.depth; s++) {
+ for (int s = 0; s < box->depth; s++) {
unsigned x1, x2, y1, y2;
- tile_extents(surf, &box, xfer->level, &x1, &x2, &y1, &y2);
+ tile_extents(surf, box, xfer->level, s, &x1, &x2, &y1, &y2);
- /* Use 's' rather than 'box.z' to rebase the first slice to 0. */
+ /* Use 's' rather than 'box->z' to rebase the first slice to 0. */
void *ptr = map->ptr + s * xfer->layer_stride;
isl_memcpy_tiled_to_linear(x1, x2, y1, y2, ptr, src, xfer->stride,
surf->row_pitch_B, has_swizzling,
surf->tiling, ISL_MEMCPY_STREAMING_LOAD);
- box.z++;
}
}