mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-19 19:14:48 +00:00
buffer_cache: Do basic slow readbacks
Downloading memory on every page fault is super slow but will suffice to test for now
This commit is contained in:
parent
186ba861fc
commit
c8d13b684f
3 changed files with 15 additions and 1 deletions
|
@ -74,6 +74,7 @@ Liverpool::~Liverpool() {
|
|||
|
||||
void Liverpool::Process(std::stop_token stoken) {
|
||||
Common::SetCurrentThreadName("shadPS4:GpuCommandProcessor");
|
||||
gpu_id = std::this_thread::get_id();
|
||||
|
||||
while (!stoken.stop_requested()) {
|
||||
{
|
||||
|
|
|
@ -1502,6 +1502,7 @@ public:
|
|||
u32 pipe_id;
|
||||
};
|
||||
Common::SlotVector<AscQueueInfo> asc_queues{};
|
||||
std::thread::id gpu_id;
|
||||
|
||||
private:
|
||||
struct Task {
|
||||
|
|
|
@ -46,12 +46,24 @@ void BufferCache::InvalidateMemory(VAddr device_addr, u64 size) {
|
|||
return;
|
||||
}
|
||||
if (memory_tracker->IsRegionGpuModified(device_addr, size)) {
|
||||
memory_tracker->UnmarkRegionAsGpuModified(device_addr, size);
|
||||
ReadMemory(device_addr, size);
|
||||
}
|
||||
memory_tracker->MarkRegionAsCpuModified(device_addr, size);
|
||||
}
|
||||
|
||||
void BufferCache::ReadMemory(VAddr device_addr, u64 size) {
|
||||
if (std::this_thread::get_id() != liverpool->gpu_id) {
|
||||
std::binary_semaphore command_wait{0};
|
||||
liverpool->SendCommand([this, &command_wait, device_addr, size] {
|
||||
Buffer& buffer = slot_buffers[FindBuffer(device_addr, size)];
|
||||
DownloadBufferMemory(buffer, device_addr, size);
|
||||
command_wait.release();
|
||||
});
|
||||
command_wait.acquire();
|
||||
} else {
|
||||
Buffer& buffer = slot_buffers[FindBuffer(device_addr, size)];
|
||||
DownloadBufferMemory(buffer, device_addr, size);
|
||||
}
|
||||
memory_tracker->UnmarkRegionAsGpuModified(device_addr, size);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue