diff --git a/rpcsx/gpu/DeviceCtl.cpp b/rpcsx/gpu/DeviceCtl.cpp index 49fb6acc9..9a8c5ffda 100644 --- a/rpcsx/gpu/DeviceCtl.cpp +++ b/rpcsx/gpu/DeviceCtl.cpp @@ -172,10 +172,18 @@ void DeviceCtl::mapComputeQueue(int vmId, std::uint32_t meId, orbis::uint64_t readPtrAddress, orbis::uint64_t doorbell, orbis::uint64_t ringSize) { - if (meId != 1) { + if (meId != 1 && meId != 2) { rx::die("unexpected ME %d", meId); } + if (meId == 2) { + pipeId += 4; + } + + if (queueId >= ComputePipe::kQueueCount) { + rx::die("unexpected queueId %d", queueId); + } + auto &pipe = mDevice->computePipes[pipeId]; auto lock = pipe.lockQueue(queueId); auto memory = RemoteMemory{vmId}; @@ -201,10 +209,18 @@ void DeviceCtl::mapComputeQueue(int vmId, std::uint32_t meId, void DeviceCtl::submitComputeQueue(std::uint32_t meId, std::uint32_t pipeId, std::uint32_t queueId, std::uint64_t offset) { - if (meId != 1) { + if (meId != 1 && meId != 2) { rx::die("unexpected ME %d", meId); } + if (queueId >= ComputePipe::kQueueCount) { + rx::die("unexpected queueId %d", queueId); + } + + if (meId == 2) { + pipeId += 4; + } + auto &pipe = mDevice->computePipes[pipeId]; pipe.submit(queueId, offset); } diff --git a/rpcsx/gpu/Pipe.hpp b/rpcsx/gpu/Pipe.hpp index 94da4d1f2..1d46a2631 100644 --- a/rpcsx/gpu/Pipe.hpp +++ b/rpcsx/gpu/Pipe.hpp @@ -35,15 +35,17 @@ struct Ring { }; struct ComputePipe { + static constexpr auto kRingsPerQueue = 2; + static constexpr auto kQueueCount = 8; Device *device; Scheduler scheduler; using CommandHandler = bool (ComputePipe::*)(Ring &); CommandHandler commandHandlers[255]; - orbis::shared_mutex queueMtx[8]; + orbis::shared_mutex queueMtx[kQueueCount]; int index; int currentQueueId; - Ring queues[2][8]; + Ring queues[kRingsPerQueue][kQueueCount]; std::uint64_t drawIndexIndirPatchBase = 0; ComputePipe(int index);