virgl/vtest: use correct resource stride in flush_frontbuffer
authorItalo Nicola <italonicola@collabora.com>
Fri, 9 Jul 2021 10:47:29 +0000 (07:47 -0300)
committerMarge Bot <emma+marge@anholt.net>
Sat, 11 Dec 2021 17:49:00 +0000 (17:49 +0000)
The displaytarget's resource stride is alignment is currently 64-bytes,
where the shared resource stride is unaligned.

Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11714>

src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c

index b452637..1d7fb62 100644 (file)
@@ -628,7 +628,8 @@ static void virgl_vtest_flush_frontbuffer(struct virgl_winsys *vws,
 
    if (sub_box) {
       box = *sub_box;
-      offset = box.y / util_format_get_blockheight(res->format) * res->stride +
+      uint32_t shm_stride = util_format_get_stride(res->format, res->width);
+      offset = box.y / util_format_get_blockheight(res->format) * shm_stride +
                box.x / util_format_get_blockwidth(res->format) * util_format_get_blocksize(res->format);
    } else {
       box.z = layer;