From 83332618c1e178c0ead93afc1d7cfc0a33438874 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 24 Jul 2018 06:03:03 +1000 Subject: Revert "virgl: remove unused stride-arguments" This reverts commit dc938b8398c0dafb60507e41685f7518b681c24d. This adds warnings in vtest, and possibly breaks it. --- src/gallium/drivers/virgl/virgl_buffer.c | 4 ++-- src/gallium/drivers/virgl/virgl_context.c | 2 +- src/gallium/drivers/virgl/virgl_texture.c | 24 ++++++++++++++++++++++-- src/gallium/drivers/virgl/virgl_winsys.h | 2 ++ 4 files changed, 27 insertions(+), 5 deletions(-) (limited to 'src/gallium/drivers') diff --git a/src/gallium/drivers/virgl/virgl_buffer.c b/src/gallium/drivers/virgl/virgl_buffer.c index 48fbef09a1e..3288bb20bd1 100644 --- a/src/gallium/drivers/virgl/virgl_buffer.c +++ b/src/gallium/drivers/virgl/virgl_buffer.c @@ -77,7 +77,7 @@ static void *virgl_buffer_transfer_map(struct pipe_context *ctx, readback = virgl_res_needs_readback(vctx, &vbuf->base, usage); if (readback) - vs->vws->transfer_get(vs->vws, vbuf->base.hw_res, box, offset, level); + vs->vws->transfer_get(vs->vws, vbuf->base.hw_res, box, trans->base.stride, trans->base.layer_stride, offset, level); if (!(usage & PIPE_TRANSFER_UNSYNCHRONIZED)) doflushwait = true; @@ -109,7 +109,7 @@ static void virgl_buffer_transfer_unmap(struct pipe_context *ctx, vbuf->base.clean = FALSE; vctx->num_transfers++; vs->vws->transfer_put(vs->vws, vbuf->base.hw_res, - &transfer->box, trans->offset, transfer->level); + &transfer->box, trans->base.stride, trans->base.layer_stride, trans->offset, transfer->level); } } diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c index 159a7b2814c..74b232fe6cf 100644 --- a/src/gallium/drivers/virgl/virgl_context.c +++ b/src/gallium/drivers/virgl/virgl_context.c @@ -71,7 +71,7 @@ static void virgl_buffer_flush(struct virgl_context *vctx, vctx->num_transfers++; rs->vws->transfer_put(rs->vws, vbuf->base.hw_res, - &box, box.x, 0); + &box, 0, 0, box.x, 0); util_range_set_empty(&vbuf->valid_buffer_range); } diff --git a/src/gallium/drivers/virgl/virgl_texture.c b/src/gallium/drivers/virgl/virgl_texture.c index 485b7cf1a73..150a5ebd8c7 100644 --- a/src/gallium/drivers/virgl/virgl_texture.c +++ b/src/gallium/drivers/virgl/virgl_texture.c @@ -138,6 +138,7 @@ static void *virgl_texture_transfer_map(struct pipe_context *ctx, const unsigned h = u_minify(vtex->base.u.b.height0, level); const unsigned nblocksy = util_format_get_nblocksy(format, h); bool is_depth = util_format_has_depth(util_format_description(resource->format)); + uint32_t l_stride; bool doflushwait; doflushwait = virgl_res_needs_flush_wait(vctx, &vtex->base, usage); @@ -155,6 +156,15 @@ static void *virgl_texture_transfer_map(struct pipe_context *ctx, trans->base.stride = vtex->stride[level]; trans->base.layer_stride = trans->base.stride * nblocksy; + if (resource->target != PIPE_TEXTURE_3D && + resource->target != PIPE_TEXTURE_CUBE && + resource->target != PIPE_TEXTURE_1D_ARRAY && + resource->target != PIPE_TEXTURE_2D_ARRAY && + resource->target != PIPE_TEXTURE_CUBE_ARRAY) + l_stride = 0; + else + l_stride = trans->base.layer_stride; + if (is_depth && resource->nr_samples > 1) { struct pipe_resource tmp_resource; virgl_init_temp_resource_from_box(&tmp_resource, resource, box, @@ -178,7 +188,7 @@ static void *virgl_texture_transfer_map(struct pipe_context *ctx, readback = virgl_res_needs_readback(vctx, &vtex->base, usage); if (readback) - vs->vws->transfer_get(vs->vws, hw_res, box, offset, level); + vs->vws->transfer_get(vs->vws, hw_res, box, trans->base.stride, l_stride, offset, level); if (doflushwait || readback) vs->vws->resource_wait(vs->vws, vtex->base.hw_res); @@ -200,6 +210,16 @@ static void virgl_texture_transfer_unmap(struct pipe_context *ctx, struct virgl_context *vctx = virgl_context(ctx); struct virgl_transfer *trans = virgl_transfer(transfer); struct virgl_texture *vtex = virgl_texture(transfer->resource); + uint32_t l_stride; + + if (transfer->resource->target != PIPE_TEXTURE_3D && + transfer->resource->target != PIPE_TEXTURE_CUBE && + transfer->resource->target != PIPE_TEXTURE_1D_ARRAY && + transfer->resource->target != PIPE_TEXTURE_2D_ARRAY && + transfer->resource->target != PIPE_TEXTURE_CUBE_ARRAY) + l_stride = 0; + else + l_stride = trans->base.layer_stride; if (trans->base.usage & PIPE_TRANSFER_WRITE) { if (!(transfer->usage & PIPE_TRANSFER_FLUSH_EXPLICIT)) { @@ -207,7 +227,7 @@ static void virgl_texture_transfer_unmap(struct pipe_context *ctx, vtex->base.clean = FALSE; vctx->num_transfers++; vs->vws->transfer_put(vs->vws, vtex->base.hw_res, - &transfer->box, trans->offset, transfer->level); + &transfer->box, trans->base.stride, l_stride, trans->offset, transfer->level); } } diff --git a/src/gallium/drivers/virgl/virgl_winsys.h b/src/gallium/drivers/virgl/virgl_winsys.h index 232437e861e..6346c21fafc 100644 --- a/src/gallium/drivers/virgl/virgl_winsys.h +++ b/src/gallium/drivers/virgl/virgl_winsys.h @@ -50,11 +50,13 @@ struct virgl_winsys { int (*transfer_put)(struct virgl_winsys *vws, struct virgl_hw_res *res, const struct pipe_box *box, + uint32_t stride, uint32_t layer_stride, uint32_t buf_offset, uint32_t level); int (*transfer_get)(struct virgl_winsys *vws, struct virgl_hw_res *res, const struct pipe_box *box, + uint32_t stride, uint32_t layer_stride, uint32_t buf_offset, uint32_t level); struct virgl_hw_res *(*resource_create)(struct virgl_winsys *vws, -- cgit v1.2.3