When we're mapping temp-resources, we clip the resource to the
transfer-box, which means the stride might not be correct any more.

So let's update the stride from the temp-resource, and recompute the
layer-stride.

This fixes crashes when running dEQP with --deqp-gl-config-name=rgba8888d24s8ms4

Signed-off-by: Erik Faye-Lund <erik.faye-l...@collabora.com>
Fixes: a8987b88ff1 "virgl: add driver for virtio-gpu 3D (v2)"
---
I noticed this crash while testing this patch:
https://patchwork.freedesktop.org/patch/248805/

 src/gallium/drivers/virgl/virgl_texture.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/drivers/virgl/virgl_texture.c 
b/src/gallium/drivers/virgl/virgl_texture.c
index 0902f9b817..9edf0ced0c 100644
--- a/src/gallium/drivers/virgl/virgl_texture.c
+++ b/src/gallium/drivers/virgl/virgl_texture.c
@@ -176,6 +176,8 @@ static void *virgl_texture_transfer_map(struct pipe_context 
*ctx,
       /* we want to do a resolve blit into the temporary */
       hw_res = trans->resolve_tmp->hw_res;
       offset = 0;
+      trans->base.stride = ((struct 
virgl_texture*)trans->resolve_tmp)->stride[level];
+      trans->base.layer_stride = trans->base.stride * nblocksy;
    } else {
       offset = vrend_get_tex_image_offset(vtex, level, box->z);
 
-- 
2.17.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to