diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 7958f7e300..2f8fec2483 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -3254,6 +3254,8 @@ namespace rsx performance_counters.idle_time += delay_us; } } + + flip_notification_count = 1; } else if (frame_limit == frame_limit_type::_ps3) { @@ -3262,6 +3264,7 @@ namespace rsx if (vblank_at_flip == umax) { vblank_at_flip = +vblank_count; + flip_notification_count = 1; exit = true; } @@ -3276,7 +3279,7 @@ namespace rsx vblank_at_flip = umax; } - int_flip_index++; + int_flip_index += flip_notification_count; current_display_buffer = buffer; m_queued_flip.emu_flip = true; @@ -3289,23 +3292,26 @@ namespace rsx flip_status = CELL_GCM_DISPLAY_FLIP_STATUS_DONE; m_queued_flip.in_progress = false; - if (!isHLE) + while (flip_notification_count--) { - sys_rsx_context_attribute(0x55555555, 0xFEC, buffer, 0, 0, 0); - return; - } + if (!isHLE) + { + sys_rsx_context_attribute(0x55555555, 0xFEC, buffer, 0, 0, 0); + continue; + } - if (auto ptr = flip_handler) - { - intr_thread->cmd_list - ({ - { ppu_cmd::set_args, 1 }, u64{ 1 }, - { ppu_cmd::lle_call, ptr }, - { ppu_cmd::sleep, 0 } - }); + if (auto ptr = flip_handler) + { + intr_thread->cmd_list + ({ + { ppu_cmd::set_args, 1 }, u64{ 1 }, + { ppu_cmd::lle_call, ptr }, + { ppu_cmd::sleep, 0 } + }); - intr_thread->cmd_notify++; - intr_thread->cmd_notify.notify_one(); + intr_thread->cmd_notify++; + intr_thread->cmd_notify.notify_one(); + } } } } diff --git a/rpcs3/Emu/RSX/RSXThread.h b/rpcs3/Emu/RSX/RSXThread.h index 814d30449d..f767880058 100644 --- a/rpcs3/Emu/RSX/RSXThread.h +++ b/rpcs3/Emu/RSX/RSXThread.h @@ -646,6 +646,7 @@ namespace rsx bool capture_current_frame = false; u64 vblank_at_flip = umax; + u64 flip_notification_count = 0; void post_vblank_event(u64 post_event_time); public: diff --git a/rpcs3/Emu/RSX/rsx_methods.cpp b/rpcs3/Emu/RSX/rsx_methods.cpp index 06b7baf8ea..43da5a94b7 100644 --- a/rpcs3/Emu/RSX/rsx_methods.cpp +++ b/rpcs3/Emu/RSX/rsx_methods.cpp @@ -1770,6 +1770,11 @@ namespace rsx { ensure(rsx->isHLE); + if (rsx->vblank_at_flip != umax) + { + rsx->flip_notification_count++; + } + if (auto ptr = rsx->queue_handler) { rsx->intr_thread->cmd_list @@ -1818,7 +1823,7 @@ namespace rsx template struct driver_flip { - static void impl(thread*, u32 /*reg*/, u32 arg) + static void impl(thread* rsx, u32 /*reg*/, u32 arg) { sys_rsx_context_attribute(0x55555555, 0x102, index, arg, 0, 0); } @@ -1827,8 +1832,13 @@ namespace rsx template struct queue_flip { - static void impl(thread*, u32 /*reg*/, u32 arg) + static void impl(thread* rsx, u32 /*reg*/, u32 arg) { + if (rsx->vblank_at_flip != umax) + { + rsx->flip_notification_count++; + } + sys_rsx_context_attribute(0x55555555, 0x103, index, arg, 0, 0); } };