1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-26 12:42:41 +01:00

rsx: Write vblank semahpre, minor semaphore acquire optimization

This commit is contained in:
eladash 2019-03-31 18:47:33 +03:00 committed by Ivan
parent 777a99d01b
commit f25587d24c
2 changed files with 12 additions and 7 deletions

View File

@ -459,6 +459,7 @@ error_code sys_rsx_context_attribute(s32 context_id, u32 package_id, u64 a3, u64
case 0xFED: // hack: vblank command
// todo: this is wrong and should be 'second' vblank handler and freq, but since currently everything is reported as being 59.94, this should be fine
vm::_ref<u32>(render->ctxt_addr + 0x30) = 1;
driverInfo.head[a3].vBlankCount++;
driverInfo.head[a3].lastSecondVTime = rsxTimeStamp();
sys_event_port_send(m_sysrsx->rsx_event_port, 0, (1 << 1), 0);

View File

@ -59,19 +59,23 @@ namespace rsx
rsx->ctrl->ref.exchange(arg);
}
void semaphore_acquire(thread* rsx, u32 _reg, u32 arg)
void semaphore_acquire(thread* rsx, u32 /*_reg*/, u32 arg)
{
rsx->sync_point_request = true;
const u32 addr = get_address(method_registers.semaphore_offset_406e(), method_registers.semaphore_context_dma_406e());
if (vm::read32(addr) == arg) return;
#ifdef IS_LE_MACHINE
arg = se_storage<u32>::swap(arg);
const auto& sema = vm::_ref<le_t<u32>>(addr);
#else
const auto& sema = vm::_ref<u32>(addr);
#endif
// TODO: Remove vblank semaphore hack
if (sema == arg || addr == rsx->ctxt_addr + 0x30) return;
u64 start = get_system_time();
while (vm::read32(addr) != arg)
while (sema != arg)
{
// todo: LLE: why does this one keep hanging? is it vsh system semaphore? whats actually pushing this to the command buffer?!
if (addr == get_current_renderer()->ctxt_addr + 0x30)
return;
if (Emu.IsStopped())
return;