diff options
author | Kenneth Graunke <[email protected]> | 2018-06-24 00:27:58 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2019-02-21 10:26:07 -0800 |
commit | eef0d33cee9f3891984e2dac1d7a77c988df7de1 (patch) | |
tree | 6640008ac557a095f24e5de52f4a10a299824c08 /src/gallium | |
parent | 419fac2fc6edad75b96288a1956ca6dc60a948ff (diff) |
iris: better boxing on maps
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/iris/iris_resource.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index df910a5b213..67772a3317f 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -399,6 +399,8 @@ struct iris_transfer { struct pipe_debug_callback *dbg; void *buffer; void *ptr; + // XXX: why do we have this, pipe_transfer already has one... + // XXX: but it's different for tiled memcpy and I don't recall why int stride; void (*unmap)(struct iris_transfer *); @@ -460,7 +462,7 @@ iris_map_tiled_memcpy(struct iris_transfer *map) struct iris_resource *res = (struct iris_resource *) xfer->resource; struct isl_surf *surf = &res->surf; - unsigned int x1, x2, y1, y2; + unsigned x1, x2, y1, y2; tile_extents(surf, &xfer->box, xfer->level, &x1, &x2, &y1, &y2); map->stride = ALIGN(surf->row_pitch_B, 16); @@ -487,6 +489,25 @@ iris_map_tiled_memcpy(struct iris_transfer *map) map->unmap = iris_unmap_tiled_memcpy; } +static void +iris_map_direct(struct iris_transfer *map) +{ + struct pipe_transfer *xfer = &map->base; + struct pipe_box *box = &xfer->box; + struct iris_resource *res = (struct iris_resource *) xfer->resource; + struct isl_surf *surf = &res->surf; + const struct isl_format_layout *fmtl = isl_format_get_layout(surf->format); + const unsigned cpp = fmtl->bpb / 8; + + 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; +} + static void * iris_transfer_map(struct pipe_context *ctx, struct pipe_resource *resource, @@ -539,8 +560,7 @@ iris_transfer_map(struct pipe_context *ctx, if (surf->tiling != ISL_TILING_LINEAR) { iris_map_tiled_memcpy(map); } else { - // XXX: apply box - map->ptr = iris_bo_map(&ice->dbg, res->bo, xfer->usage); + iris_map_direct(map); } return map->ptr; |