From 62fd72009b785c1be5e160eb5f8381a3f0bf2977 Mon Sep 17 00:00:00 2001 From: psucien Date: Wed, 22 May 2024 20:22:42 +0200 Subject: [PATCH] video_core: a fix for multi submits processing (temporary code) --- src/core/libraries/gnmdriver/gnmdriver.cpp | 7 +++++-- src/video_core/amdgpu/liverpool.cpp | 11 ++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/core/libraries/gnmdriver/gnmdriver.cpp b/src/core/libraries/gnmdriver/gnmdriver.cpp index b1181647..a3cf2a98 100644 --- a/src/core/libraries/gnmdriver/gnmdriver.cpp +++ b/src/core/libraries/gnmdriver/gnmdriver.cpp @@ -1429,9 +1429,12 @@ s32 PS4_SYSV_ABI sceGnmSubmitCommandBuffers(u32 count, const u32* dcb_gpu_addrs[ for (auto cbpair = 0u; cbpair < count; ++cbpair) { const auto* ccb = ccb_gpu_addrs ? ccb_gpu_addrs[cbpair] : nullptr; - const auto ccb_size = ccb_sizes_in_bytes ? ccb_sizes_in_bytes[cbpair] : 0; + const auto ccb_size_in_bytes = ccb_sizes_in_bytes ? ccb_sizes_in_bytes[cbpair] : 0; - liverpool->SubmitGfx({dcb_gpu_addrs[cbpair], dcb_sizes_in_bytes[cbpair]}, {ccb, ccb_size}); + const auto dcb_size_dw = dcb_sizes_in_bytes[cbpair] >> 2; + const auto ccb_size_dw = ccb_size_in_bytes >> 2; + + liverpool->SubmitGfx({dcb_gpu_addrs[cbpair], dcb_size_dw}, {ccb, ccb_size_dw}); } return ORBIS_OK; diff --git a/src/video_core/amdgpu/liverpool.cpp b/src/video_core/amdgpu/liverpool.cpp index c125f3ea..09c1cb66 100644 --- a/src/video_core/amdgpu/liverpool.cpp +++ b/src/video_core/amdgpu/liverpool.cpp @@ -34,10 +34,15 @@ void Liverpool::Process(std::stop_token stoken) { gfx_ring.pop(); } - ASSERT_MSG(dcb.size() != 0, "Empty command list received"); - ProcessCmdList(dcb.data(), dcb.size()); + ASSERT_MSG(!dcb.empty(), "Empty command list received"); + ProcessCmdList(dcb.data(), dcb.size_bytes()); - cv_complete.notify_all(); + { + std::unique_lock lock{m_ring_access}; + if (gfx_ring.empty()) { + cv_complete.notify_all(); + } + } } }