From 7c6fb24067ffbc37dae92f362f54ec66e191b277 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Thu, 17 Apr 2025 12:07:42 +0200 Subject: [PATCH] amd/virtio: clear DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Calls to radv_amdgpu_cs_submit will come with either no waits or through vk_queue. vk_queue uses VK_SYNC_WAIT_PENDING which is translated as DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE. WAIT_AVAILABLE will wait for the fence to materialize, so it means it's safe to pass the syncobj in a AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_WAIT chunk without the WAIT_FOR_SUBMIT flag. Tested-by: Dmitry Osipenko Acked-by: Marek Olšák Acked-by: Samuel Pitoiset Part-of: --- src/amd/common/virtio/amdgpu_virtio.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/amd/common/virtio/amdgpu_virtio.c b/src/amd/common/virtio/amdgpu_virtio.c index 065f7a6b3ff..734d4224984 100644 --- a/src/amd/common/virtio/amdgpu_virtio.c +++ b/src/amd/common/virtio/amdgpu_virtio.c @@ -414,7 +414,12 @@ amdvgpu_cs_submit_raw2(amdvgpu_device_handle dev, uint32_t ctx_id, for (int j = 0; j < new_syncobj_count; j++) { if (amd_syncobj) { (*syncobjs)[start + j].handle = amd_syncobj[j].handle; - (*syncobjs)[start + j].flags = amd_syncobj[j].flags; + /* radv uses DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT but vk_queue already used + * WAIT_AVAILABLE, so clear the flag. This is not 100% correct as between + * the wait and the submit the syncobj fence might get changed but since + * virtgpu doesn't support WAIT_FOR_SUBMIT yet, this is the best we can do. + */ + (*syncobjs)[start + j].flags = 0; (*syncobjs)[start + j].point = amd_syncobj[j].point; } else { (*syncobjs)[start + j].handle = amd_sem[j].handle;