Merge pull request #8413 from behunin/bounded-queue

gpu_thread: Move to bounded queue
This commit is contained in:
bunnei 2022-06-11 00:07:18 -07:00 committed by GitHub
commit 5282efac1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 185 additions and 4 deletions

View file

@ -31,7 +31,8 @@ static void RunThread(std::stop_token stop_token, Core::System& system,
VideoCore::RasterizerInterface* const rasterizer = renderer.ReadRasterizer();
while (!stop_token.stop_requested()) {
CommandDataContainer next = state.queue.PopWait(stop_token);
CommandDataContainer next;
state.queue.Pop(next, stop_token);
if (stop_token.stop_requested()) {
break;
}

View file

@ -10,7 +10,7 @@
#include <thread>
#include <variant>
#include "common/threadsafe_queue.h"
#include "common/bounded_threadsafe_queue.h"
#include "video_core/framebuffer_config.h"
namespace Tegra {
@ -96,9 +96,9 @@ struct CommandDataContainer {
/// Struct used to synchronize the GPU thread
struct SynchState final {
using CommandQueue = Common::SPSCQueue<CommandDataContainer, true>;
using CommandQueue = Common::MPSCQueue<CommandDataContainer>;
std::mutex write_lock;
CommandQueue queue;
CommandQueue queue{512}; // size must be 2^n
u64 last_fence{};
std::atomic<u64> signaled_fence{};
std::condition_variable_any cv;