blob: 787cbb2a0343bd574c7bffde994014c6e47d7a37 [file] [log] [blame]
From 47eabd0e6b926535a68a7173eba2ceeb4ed9747e Mon Sep 17 00:00:00 2001
From: Yiwei Zhang <zzyiwei@chromium.org>
Date: Tue, 11 May 2021 21:31:19 +0000
Subject: [PATCH] virgl: do not use winsys info for guest storage of classic
resource
winsys_stride is the stride of the host storage of the classic resource,
and using that breaks the readback on the guest storage.
v2: move the scrubbing to virgl_resource_from_handle
The returned modifier also points directly to the host driver's real
modifier but not a virtualized one. Leave plane_offset as zero here
matches the prior behavior before introducing winsys info.
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> (v1)
Reviewed-by: Chia-I Wu <olvaffe@gmail.com> (v2)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10757>
---
src/gallium/drivers/virgl/virgl_resource.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/gallium/drivers/virgl/virgl_resource.c b/src/gallium/drivers/virgl/virgl_resource.c
index 76f0741cc03..4fc2eab8cfb 100644
--- a/src/gallium/drivers/virgl/virgl_resource.c
+++ b/src/gallium/drivers/virgl/virgl_resource.c
@@ -575,6 +575,13 @@ static struct pipe_resource *virgl_resource_from_handle(struct pipe_screen *scre
&modifier,
&res->blob_mem);
+ /* do not use winsys returns for guest storage info of classic resource */
+ if (!res->blob_mem) {
+ winsys_stride = 0;
+ plane_offset = 0;
+ modifier = 0;
+ }
+
virgl_resource_layout(&res->u.b, &res->metadata, plane, winsys_stride,
plane_offset, modifier);
if (!res->hw_res) {
--
2.31.1.607.g51e8a6a459-goog