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>
This commit is contained in:
Gert Wollny
2022-08-25 08:30:53 +02:00
committed by Marge Bot
parent 1614364281
commit 6e2b01e5b8
2 changed files with 8 additions and 7 deletions
@@ -434,8 +434,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
+8 -5
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)