virgl: when reading back wait first, then do the transfer

Otherwise the transfer from the host might not be finished
when we try to read the data.

v2: always wait before readback, but also keep the wait after
  a possible readback, Itherwise TF fails in the CI.

Fixes: e87186fc67
    virgl: add virgl_resource_transfer_prepare

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18243>
(cherry picked from commit 6e2b01e5b8)
This commit is contained in:
Gert Wollny
2022-08-25 08:30:53 +02:00
committed by Dylan Baker
parent 086b44101c
commit ee37cceabd
3 changed files with 10 additions and 9 deletions

View File

@@ -7537,7 +7537,7 @@
"description": "virgl: when reading back wait first, then do the transfer",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "e87186fc679c146c5d521139bb79c8eafa0a22f0"
},
@@ -8293,7 +8293,7 @@
"description": "gallium/u_threaded: buffer sharedness tracking",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "e9c41b321488c23b7d8ec5744f68218bac753505"
},

View File

@@ -421,8 +421,6 @@ spec@arb_point_sprite@arb_point_sprite-mipmap,Fail
spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex,Fail
spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex@'vs_input2[1][0]' on GL_PROGRAM_INPUT,Fail
spec@arb_shader_atomic_counters@fragment-discard,Fail
spec@arb_sample_shading@builtin-gl-sample-position 2,Fail
spec@arb_shader_image_load_store@early-z,Fail
spec@arb_shader_image_load_store@early-z@occlusion query test/early-z pass,Fail

View File

@@ -253,11 +253,6 @@ virgl_resource_transfer_prepare(struct virgl_context *vctx,
else
return VIRGL_TRANSFER_MAP_WRITE_TO_STAGING_WITH_READBACK;
}
/* Readback is yet another command and is transparent to the state
* trackers. It should be waited for in all cases, including when
* PIPE_MAP_UNSYNCHRONIZED is set.
*/
wait = true;
/* When the transfer queue has pending writes to this transfer's region,
* we have to flush before readback.
@@ -281,8 +276,16 @@ virgl_resource_transfer_prepare(struct virgl_context *vctx,
return VIRGL_TRANSFER_MAP_ERROR;
if (readback) {
/* Readback is yet another command and is transparent to the state
* trackers. It should be waited for in all cases, including when
* PIPE_MAP_UNSYNCHRONIZED is set.
*/
vws->resource_wait(vws, res->hw_res);
vws->transfer_get(vws, res->hw_res, &xfer->base.box, xfer->base.stride,
xfer->l_stride, xfer->offset, xfer->base.level);
/* transfer_get puts the resource into a maybe_busy state, so we will have
* to wait another time if we want to use that resource. */
wait = true;
}
if (wait)