rsx/zcull: Pause the main thread before flushing reports

This commit is contained in:
kd-11 2022-05-15 11:40:30 +03:00 committed by kd-11
parent 9e02471ded
commit e9bf3e13d0
3 changed files with 22 additions and 5 deletions

View File

@ -336,7 +336,7 @@ error_code sys_rsx_context_iomap(cpu_thread& cpu, u32 context_id, u32 io, u32 ea
io >>= 20, ea >>= 20, size >>= 20; io >>= 20, ea >>= 20, size >>= 20;
render->pause(); rsx::eng_lock fifo_lock(render);
std::scoped_lock lock(render->sys_rsx_mtx); std::scoped_lock lock(render->sys_rsx_mtx);
for (u32 i = 0; i < size; i++) for (u32 i = 0; i < size; i++)
@ -350,7 +350,6 @@ error_code sys_rsx_context_iomap(cpu_thread& cpu, u32 context_id, u32 io, u32 ea
table.io[ea + i].release((io + i) << 20); table.io[ea + i].release((io + i) << 20);
} }
render->unpause();
return CELL_OK; return CELL_OK;
} }
@ -429,13 +428,12 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64
{ {
case 0x001: // FIFO case 0x001: // FIFO
{ {
render->pause(); rsx::eng_lock rlock(render);
const u64 get = static_cast<u32>(a3); const u64 get = static_cast<u32>(a3);
const u64 put = static_cast<u32>(a4); const u64 put = static_cast<u32>(a4);
vm::_ref<atomic_be_t<u64>>(render->dma_address + ::offset32(&RsxDmaControl::put)).release(put << 32 | get); vm::_ref<atomic_be_t<u64>>(render->dma_address + ::offset32(&RsxDmaControl::put)).release(put << 32 | get);
render->last_known_code_start = get; render->last_known_code_start = get;
render->sync_point_request.release(true); render->sync_point_request.release(true);
render->unpause();
break; break;
} }

View File

@ -874,4 +874,20 @@ namespace rsx
} }
} }
}; };
class eng_lock
{
rsx::thread* pthr;
public:
eng_lock(rsx::thread* target)
:pthr(target)
{
if (pthr) pthr->pause();
}
~eng_lock()
{
if (pthr) pthr->unpause();
}
};
} }

View File

@ -848,7 +848,10 @@ namespace rsx
// Flush all pending writes // Flush all pending writes
m_critical_reports_in_flight += 0x100000; m_critical_reports_in_flight += 0x100000;
sync(ptimer); {
rsx::eng_lock rlock(ptimer->is_current_thread() ? nullptr : ptimer);
ptimer->sync();
}
m_critical_reports_in_flight -= 0x100000; m_critical_reports_in_flight -= 0x100000;
// Unlock pages // Unlock pages