summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/panfrost/pan_resource.c
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-06-18 10:48:43 -0700
committerAlyssa Rosenzweig <[email protected]>2019-06-20 08:22:38 -0700
commit546236e27ff7d5be1b8442a62f669926bd244a95 (patch)
tree736a6894b5ed2ac71c107981d32dfe065dc3d949 /src/gallium/drivers/panfrost/pan_resource.c
parent035a07c0ae82b01b6df3315d2865aa82de915906 (diff)
panfrost: Load from tiled images
Now that we have lima tiling code available, use it to load from a tiled source. Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium/drivers/panfrost/pan_resource.c')
-rw-r--r--src/gallium/drivers/panfrost/pan_resource.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index 5b84daf3a3f..a99840e4a52 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -506,9 +506,22 @@ panfrost_transfer_map(struct pipe_context *pctx,
transfer->base.stride = box->width * bytes_per_pixel;
transfer->base.layer_stride = transfer->base.stride * box->height;
-
- /* TODO: Reads */
transfer->map = rzalloc_size(transfer, transfer->base.layer_stride * box->depth);
+ assert(box->depth == 1);
+
+ if (usage & PIPE_TRANSFER_READ) {
+ if (bo->layout == PAN_AFBC) {
+ DBG("Unimplemented: reads from AFBC");
+ } else if (bo->layout == PAN_TILED) {
+ panfrost_load_tiled_image(
+ transfer->map,
+ bo->cpu + bo->slices[level].offset,
+ box,
+ transfer->base.stride,
+ bo->slices[level].stride,
+ util_format_get_blocksize(resource->format));
+ }
+ }
return transfer->map;
} else {