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>
This commit is contained in:
Yiwei Zhang 2021-05-11 21:31:19 +00:00 committed by Marge Bot
parent 494255c821
commit 47eabd0e6b
1 changed files with 7 additions and 0 deletions

View File

@ -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) {