rsx: Use rpcs3 thread construct for the offloader thread
This commit is contained in:
@@ -10,7 +10,7 @@ namespace rsx
|
|||||||
void dma_manager::init()
|
void dma_manager::init()
|
||||||
{
|
{
|
||||||
m_worker_state = thread_state::created;
|
m_worker_state = thread_state::created;
|
||||||
m_worker_thread = std::thread([this]()
|
thread_ctrl::spawn("RSX offloader", [this]()
|
||||||
{
|
{
|
||||||
if (!g_cfg.video.multithreaded_rsx)
|
if (!g_cfg.video.multithreaded_rsx)
|
||||||
{
|
{
|
||||||
@@ -23,17 +23,10 @@ namespace rsx
|
|||||||
thread_ctrl::set_thread_affinity_mask(thread_ctrl::get_affinity_mask(thread_class::rsx));
|
thread_ctrl::set_thread_affinity_mask(thread_ctrl::get_affinity_mask(thread_class::rsx));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool idle = false;
|
|
||||||
while (m_worker_state != thread_state::finished)
|
while (m_worker_state != thread_state::finished)
|
||||||
{
|
{
|
||||||
if (m_jobs_count)
|
if (m_jobs_count)
|
||||||
{
|
{
|
||||||
if (idle)
|
|
||||||
{
|
|
||||||
thread_ctrl::set_native_priority(0);
|
|
||||||
idle = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto slice = m_work_queue.pop_all(); slice; slice.pop_front())
|
for (auto slice = m_work_queue.pop_all(); slice; slice.pop_front())
|
||||||
{
|
{
|
||||||
auto task = *slice;
|
auto task = *slice;
|
||||||
@@ -61,11 +54,11 @@ namespace rsx
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
idle = true;
|
thread_ctrl::wait_for(500);
|
||||||
thread_ctrl::set_native_priority(-1);
|
|
||||||
std::this_thread::yield();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_jobs_count.store(0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,6 +117,6 @@ namespace rsx
|
|||||||
void dma_manager::join()
|
void dma_manager::join()
|
||||||
{
|
{
|
||||||
m_worker_state = thread_state::finished;
|
m_worker_state = thread_state::finished;
|
||||||
m_worker_thread.join();
|
sync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#include "gcm_enums.h"
|
#include "gcm_enums.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <thread>
|
|
||||||
|
|
||||||
namespace rsx
|
namespace rsx
|
||||||
{
|
{
|
||||||
@@ -44,7 +43,6 @@ namespace rsx
|
|||||||
|
|
||||||
lf_queue<transport_packet> m_work_queue;
|
lf_queue<transport_packet> m_work_queue;
|
||||||
atomic_t<int> m_jobs_count;
|
atomic_t<int> m_jobs_count;
|
||||||
std::thread m_worker_thread;
|
|
||||||
thread_state m_worker_state;
|
thread_state m_worker_state;
|
||||||
|
|
||||||
// TODO: Improved benchmarks here; value determined by profiling on a Ryzen CPU, rounded to the nearest 512 bytes
|
// TODO: Improved benchmarks here; value determined by profiling on a Ryzen CPU, rounded to the nearest 512 bytes
|
||||||
|
|||||||
Reference in New Issue
Block a user