Lines Matching refs:ptrans
61 static void etna_patch_data(void *buffer, const struct pipe_transfer *ptrans) in etna_patch_data() argument
63 struct pipe_resource *prsc = ptrans->resource; in etna_patch_data()
65 struct etna_resource_level *level = &rsc->levels[ptrans->level]; in etna_patch_data()
77 etna_etc2_calculate_blocks(buffer, ptrans->stride, in etna_patch_data()
78 ptrans->box.width, ptrans->box.height, in etna_patch_data()
87 static void etna_unpatch_data(void *buffer, const struct pipe_transfer *ptrans) in etna_unpatch_data() argument
89 struct pipe_resource *prsc = ptrans->resource; in etna_unpatch_data()
91 struct etna_resource_level *level = &rsc->levels[ptrans->level]; in etna_unpatch_data()
102 etna_transfer_unmap(struct pipe_context *pctx, struct pipe_transfer *ptrans) in etna_transfer_unmap() argument
105 struct etna_transfer *trans = etna_transfer(ptrans); in etna_transfer_unmap()
106 struct etna_resource *rsc = etna_resource(ptrans->resource); in etna_transfer_unmap()
114 assert(ptrans->level <= rsc->base.last_level); in etna_transfer_unmap()
126 if (ptrans->usage & PIPE_MAP_WRITE) { in etna_transfer_unmap()
131 etna_copy_resource_box(pctx, ptrans->resource, trans->rsc, ptrans->level, &ptrans->box); in etna_transfer_unmap()
134 struct etna_resource_level *res_level = &rsc->levels[ptrans->level]; in etna_transfer_unmap()
137 for (unsigned z = 0; z < ptrans->box.depth; z++) { in etna_transfer_unmap()
139 trans->mapped + (ptrans->box.z + z) * res_level->layer_stride, in etna_transfer_unmap()
140 trans->staging + z * ptrans->layer_stride, in etna_transfer_unmap()
141 ptrans->box.x, ptrans->box.y, in etna_transfer_unmap()
142 res_level->stride, ptrans->box.width, ptrans->box.height, in etna_transfer_unmap()
143 ptrans->stride, util_format_get_blocksize(rsc->base.format)); in etna_transfer_unmap()
147 res_level->layer_stride, ptrans->box.x, in etna_transfer_unmap()
148 ptrans->box.y, ptrans->box.z, ptrans->box.width, in etna_transfer_unmap()
149 ptrans->box.height, ptrans->box.depth, in etna_transfer_unmap()
150 trans->staging, ptrans->stride, in etna_transfer_unmap()
151 ptrans->layer_stride, 0, 0, 0 /* src x,y,z */); in etna_transfer_unmap()
167 etna_patch_data(trans->mapped, ptrans); in etna_transfer_unmap()
174 if (!trans->rsc && !(ptrans->usage & PIPE_MAP_UNSYNCHRONIZED)) in etna_transfer_unmap()
177 if ((ptrans->resource->target == PIPE_BUFFER) && in etna_transfer_unmap()
178 (ptrans->usage & PIPE_MAP_WRITE)) { in etna_transfer_unmap()
181 ptrans->box.x, in etna_transfer_unmap()
182 ptrans->box.x + ptrans->box.width); in etna_transfer_unmap()
186 pipe_resource_reference(&ptrans->resource, NULL); in etna_transfer_unmap()
201 struct pipe_transfer *ptrans; in etna_transfer_map() local
236 ptrans = &trans->base; in etna_transfer_map()
237 pipe_resource_reference(&ptrans->resource, prsc); in etna_transfer_map()
238 ptrans->level = level; in etna_transfer_map()
239 ptrans->usage = usage; in etna_transfer_map()
240 ptrans->box = *box; in etna_transfer_map()
308 ptrans->box.width += ptrans->box.x & (w_align - 1); in etna_transfer_map()
309 ptrans->box.x = ptrans->box.x & ~(w_align - 1); in etna_transfer_map()
310 ptrans->box.width = align(ptrans->box.width, (ETNA_RS_WIDTH_MASK + 1)); in etna_transfer_map()
311 ptrans->box.height += ptrans->box.y & (h_align - 1); in etna_transfer_map()
312 ptrans->box.y = ptrans->box.y & ~(h_align - 1); in etna_transfer_map()
313 ptrans->box.height = align(ptrans->box.height, ETNA_RS_HEIGHT_MASK + 1); in etna_transfer_map()
317 etna_copy_resource_box(pctx, trans->rsc, &rsc->base, level, &ptrans->box); in etna_transfer_map()
428 *out_transfer = ptrans; in etna_transfer_map()
431 ptrans->stride = res_level->stride; in etna_transfer_map()
432 ptrans->layer_stride = res_level->layer_stride; in etna_transfer_map()
440 etna_unpatch_data(trans->mapped, ptrans); in etna_transfer_map()
454 …ptrans->stride = align(box->width, divSizeX) * util_format_get_blocksize(format); /* row stride in… in etna_transfer_map()
455 ptrans->layer_stride = align(box->height, divSizeY) * ptrans->stride; in etna_transfer_map()
456 size_t size = ptrans->layer_stride * box->depth; in etna_transfer_map()
464 for (unsigned z = 0; z < ptrans->box.depth; z++) { in etna_transfer_map()
465 etna_texture_untile(trans->staging + z * ptrans->layer_stride, in etna_transfer_map()
466 trans->mapped + (ptrans->box.z + z) * res_level->layer_stride, in etna_transfer_map()
467 ptrans->box.x, ptrans->box.y, res_level->stride, in etna_transfer_map()
468 ptrans->box.width, ptrans->box.height, ptrans->stride, in etna_transfer_map()
472 util_copy_box(trans->staging, rsc->base.format, ptrans->stride, in etna_transfer_map()
473 ptrans->layer_stride, 0, 0, 0, /* dst x,y,z */ in etna_transfer_map()
474 ptrans->box.width, ptrans->box.height, in etna_transfer_map()
475 ptrans->box.depth, trans->mapped, res_level->stride, in etna_transfer_map()
476 res_level->layer_stride, ptrans->box.x, in etna_transfer_map()
477 ptrans->box.y, ptrans->box.z); in etna_transfer_map()
490 etna_transfer_unmap(pctx, ptrans); in etna_transfer_map()
496 struct pipe_transfer *ptrans, in etna_transfer_flush_region() argument
499 struct etna_resource *rsc = etna_resource(ptrans->resource); in etna_transfer_flush_region()
501 if (ptrans->resource->target == PIPE_BUFFER) in etna_transfer_flush_region()
504 ptrans->box.x + box->x, in etna_transfer_flush_region()
505 ptrans->box.x + box->x + box->width); in etna_transfer_flush_region()