struct etna_resource_level *res_level = &rsc->levels[ptrans->level];
if (rsc->layout == ETNA_LAYOUT_TILED) {
- etna_texture_tile(
- trans->mapped + ptrans->box.z * res_level->layer_stride,
- trans->staging, ptrans->box.x, ptrans->box.y,
- res_level->stride, ptrans->box.width, ptrans->box.height,
- ptrans->stride, util_format_get_blocksize(rsc->base.format));
+ for (unsigned z = 0; z < ptrans->box.depth; z++) {
+ etna_texture_tile(
+ trans->mapped + (ptrans->box.z + z) * res_level->layer_stride,
+ trans->staging + z * ptrans->layer_stride,
+ ptrans->box.x, ptrans->box.y,
+ res_level->stride, ptrans->box.width, ptrans->box.height,
+ ptrans->stride, util_format_get_blocksize(rsc->base.format));
+ }
} else if (rsc->layout == ETNA_LAYOUT_LINEAR) {
util_copy_box(trans->mapped, rsc->base.format, res_level->stride,
res_level->layer_stride, ptrans->box.x,
return NULL;
}
- if (prsc->depth0 > 1) {
+ if (prsc->depth0 > 1 && rsc->ts_bo) {
slab_free(&ctx->transfer_pool, trans);
BUG("resource has depth >1 with tile status");
return NULL;
unsigned w_align, h_align;
if (rsc->layout & ETNA_LAYOUT_BIT_SUPER) {
- w_align = h_align = 64;
+ w_align = 64;
+ h_align = 64 * ctx->screen->specs.pixel_pipes;
} else {
w_align = ETNA_RS_WIDTH_MASK + 1;
h_align = ETNA_RS_HEIGHT_MASK + 1;
}
- h_align *= ctx->screen->specs.pixel_pipes;
ptrans->box.width += ptrans->box.x & (w_align - 1);
ptrans->box.x = ptrans->box.x & ~(w_align - 1);
ptrans->box.width = align(ptrans->box.width, (ETNA_RS_WIDTH_MASK + 1));
ptrans->box.height += ptrans->box.y & (h_align - 1);
ptrans->box.y = ptrans->box.y & ~(h_align - 1);
- ptrans->box.height = align(ptrans->box.height,
- (ETNA_RS_HEIGHT_MASK + 1) *
- ctx->screen->specs.pixel_pipes);
+ ptrans->box.height = align(ptrans->box.height, ETNA_RS_HEIGHT_MASK + 1);
}
if (!(usage & PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE))
* transfers without a temporary resource.
*/
if (trans->rsc || !(usage & PIPE_TRANSFER_UNSYNCHRONIZED)) {
+ struct etna_screen *screen = ctx->screen;
uint32_t prep_flags = 0;
/*
* current GPU usage (reads must wait for GPU writes, writes must have
* exclusive access to the buffer).
*/
+ mtx_lock(&screen->lock);
+
if ((trans->rsc && (etna_resource(trans->rsc)->status & ETNA_PENDING_WRITE)) ||
(!trans->rsc &&
(((usage & PIPE_TRANSFER_READ) && (rsc->status & ETNA_PENDING_WRITE)) ||
- ((usage & PIPE_TRANSFER_WRITE) && rsc->status))))
- pctx->flush(pctx, NULL, 0);
+ ((usage & PIPE_TRANSFER_WRITE) && rsc->status)))) {
+ set_foreach(rsc->pending_ctx, entry) {
+ struct etna_context *pend_ctx = (struct etna_context *)entry->key;
+ struct pipe_context *pend_pctx = &pend_ctx->base;
+
+ pend_pctx->flush(pend_pctx, NULL, 0);
+ }
+ }
+
+ mtx_unlock(&screen->lock);
if (usage & PIPE_TRANSFER_READ)
prep_flags |= DRM_ETNA_PREP_READ;
if (usage & PIPE_TRANSFER_READ) {
if (rsc->layout == ETNA_LAYOUT_TILED) {
- etna_texture_untile(trans->staging,
- trans->mapped + ptrans->box.z * res_level->layer_stride,
- ptrans->box.x, ptrans->box.y, res_level->stride,
- ptrans->box.width, ptrans->box.height, ptrans->stride,
- util_format_get_blocksize(rsc->base.format));
+ for (unsigned z = 0; z < ptrans->box.depth; z++) {
+ etna_texture_untile(trans->staging + z * ptrans->layer_stride,
+ trans->mapped + (ptrans->box.z + z) * res_level->layer_stride,
+ ptrans->box.x, ptrans->box.y, res_level->stride,
+ ptrans->box.width, ptrans->box.height, ptrans->stride,
+ util_format_get_blocksize(rsc->base.format));
+ }
} else if (rsc->layout == ETNA_LAYOUT_LINEAR) {
util_copy_box(trans->staging, rsc->base.format, ptrans->stride,
ptrans->layer_stride, 0, 0, 0, /* dst x,y,z */