vk: Offload garbage collection to offloader thread

This commit is contained in:
kd-11 2021-01-27 20:19:36 +03:00 committed by kd-11
parent bec91aab7b
commit 0a34fc4bcd
4 changed files with 20 additions and 4 deletions

View File

@ -8,7 +8,8 @@ namespace vk
enum // callback commands
{
rctrl_queue_submit = 0x80000000
rctrl_queue_submit = 0x80000000,
rctrl_run_gc = 0x80000001
};
struct submit_packet

View File

@ -2233,6 +2233,12 @@ void VKGSRender::renderctl(u32 request_code, void* args)
free(packet);
break;
}
case vk::rctrl_run_gc:
{
auto eid = reinterpret_cast<u64>(args);
vk::on_event_completed(eid, true);
break;
}
default:
fmt::throw_exception("Unhandled request code 0x%x", request_code);
}

View File

@ -1,6 +1,7 @@
#include "stdafx.h"
#include "VKResourceManager.h"
#include "VKGSRender.h"
#include "VKCommandStream.h"
namespace vk
{
@ -27,9 +28,17 @@ namespace vk
return g_event_ctr.load();
}
void on_event_completed(u64 event_id)
void on_event_completed(u64 event_id, bool flush)
{
// TODO: Offload this to a secondary thread
if (!flush && g_cfg.video.multithreaded_rsx)
{
auto offloader_thread = g_fxo->get<rsx::dma_manager>();
ensure(!offloader_thread->is_current_thread());
offloader_thread->backend_ctrl(rctrl_run_gc, reinterpret_cast<void*>(event_id));
return;
}
g_resource_manager.eid_completed(event_id);
}

View File

@ -11,7 +11,7 @@ namespace vk
{
u64 get_event_id();
u64 current_event_id();
void on_event_completed(u64 event_id);
void on_event_completed(u64 event_id, bool flush = false);
struct eid_scope_t
{