mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-14 08:12:16 +00:00
Fix copyGpuBuffers when resize invalidates commands in flight (#876)
* Fix copyGpuBuffers when resize invalidates commands in flight * Use _MB macro for size constant
This commit is contained in:
parent
1b12138cda
commit
bc66fe8fb5
3 changed files with 19 additions and 0 deletions
|
@ -2667,6 +2667,10 @@ void RegisterlibSceGnmDriver(Core::Loader::SymbolsResolver* sym) {
|
||||||
sdk_version = 0;
|
sdk_version = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Config::copyGPUCmdBuffers()) {
|
||||||
|
liverpool->reserveCopyBufferSpace();
|
||||||
|
}
|
||||||
|
|
||||||
Platform::IrqC::Instance()->Register(Platform::InterruptId::GpuIdle, ResetSubmissionLock,
|
Platform::IrqC::Instance()->Register(Platform::InterruptId::GpuIdle, ResetSubmissionLock,
|
||||||
nullptr);
|
nullptr);
|
||||||
|
|
||||||
|
|
|
@ -660,6 +660,12 @@ std::pair<std::span<const u32>, std::span<const u32>> Liverpool::CopyCmdBuffers(
|
||||||
std::span<const u32> dcb, std::span<const u32> ccb) {
|
std::span<const u32> dcb, std::span<const u32> ccb) {
|
||||||
auto& queue = mapped_queues[GfxQueueId];
|
auto& queue = mapped_queues[GfxQueueId];
|
||||||
|
|
||||||
|
// std::vector resize can invalidate spans for commands in flight
|
||||||
|
ASSERT_MSG(queue.dcb_buffer.capacity() >= queue.dcb_buffer_offset + dcb.size(),
|
||||||
|
"dcb copy buffer out of reserved space");
|
||||||
|
ASSERT_MSG(queue.ccb_buffer.capacity() >= queue.ccb_buffer_offset + ccb.size(),
|
||||||
|
"ccb copy buffer out of reserved space");
|
||||||
|
|
||||||
queue.dcb_buffer.resize(
|
queue.dcb_buffer.resize(
|
||||||
std::max(queue.dcb_buffer.size(), queue.dcb_buffer_offset + dcb.size()));
|
std::max(queue.dcb_buffer.size(), queue.dcb_buffer_offset + dcb.size()));
|
||||||
queue.ccb_buffer.resize(
|
queue.ccb_buffer.resize(
|
||||||
|
|
|
@ -1088,6 +1088,15 @@ public:
|
||||||
submit_cv.notify_one();
|
submit_cv.notify_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reserveCopyBufferSpace() {
|
||||||
|
GpuQueue& gfx_queue = mapped_queues[GfxQueueId];
|
||||||
|
std::scoped_lock<std::mutex> lk(gfx_queue.m_access);
|
||||||
|
|
||||||
|
constexpr size_t GfxReservedSize = 2_MB >> 2;
|
||||||
|
gfx_queue.ccb_buffer.reserve(GfxReservedSize);
|
||||||
|
gfx_queue.dcb_buffer.reserve(GfxReservedSize);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Task {
|
struct Task {
|
||||||
struct promise_type {
|
struct promise_type {
|
||||||
|
|
Loading…
Add table
Reference in a new issue