Module: Mesa Branch: staging/22.2 Commit: ee37cceabd0a3dd5ad7325c252d050cbd5514e69 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ee37cceabd0a3dd5ad7325c252d050cbd5514e69
Author: Gert Wollny <[email protected]> Date: Thu Aug 25 08:30:53 2022 +0200 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: e87186fc679c146c5d521139bb79c8eafa0a22f0 virgl: add virgl_resource_transfer_prepare Signed-off-by: Gert Wollny <[email protected]> Reviewed-by: Yiwei Zhang <[email protected]> Reviewed-by: Ryan Neph <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18243> (cherry picked from commit 6e2b01e5b806b3b0ec9df896f4ddc842a54f4fa6) --- .pick_status.json | 4 ++-- src/gallium/drivers/virgl/ci/virpipe-gl-fails.txt | 2 -- src/gallium/drivers/virgl/virgl_resource.c | 13 ++++++++----- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 206af0ad751..6cb06e3ad3c 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -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" }, diff --git a/src/gallium/drivers/virgl/ci/virpipe-gl-fails.txt b/src/gallium/drivers/virgl/ci/virpipe-gl-fails.txt index ea3e194d602..f7f035c03b4 100644 --- a/src/gallium/drivers/virgl/ci/virpipe-gl-fails.txt +++ b/src/gallium/drivers/virgl/ci/virpipe-gl-fails.txt @@ -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 diff --git a/src/gallium/drivers/virgl/virgl_resource.c b/src/gallium/drivers/virgl/virgl_resource.c index 461c1768ed8..f8edcc182bc 100644 --- a/src/gallium/drivers/virgl/virgl_resource.c +++ b/src/gallium/drivers/virgl/virgl_resource.c @@ -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)
