Skip to content

Commit

Permalink
rsx: Do not discard flip notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
elad335 committed Jun 25, 2022
1 parent 133749c commit 5deafde
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 17 deletions.
36 changes: 21 additions & 15 deletions rpcs3/Emu/RSX/RSXThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3254,6 +3254,8 @@ namespace rsx
performance_counters.idle_time += delay_us;
}
}

flip_notification_count = 1;
}
else if (frame_limit == frame_limit_type::_ps3)
{
Expand All @@ -3262,6 +3264,7 @@ namespace rsx
if (vblank_at_flip == umax)
{
vblank_at_flip = +vblank_count;
flip_notification_count = 1;
exit = true;
}

Expand All @@ -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;
Expand All @@ -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();
}
}
}
}
1 change: 1 addition & 0 deletions rpcs3/Emu/RSX/RSXThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
14 changes: 12 additions & 2 deletions rpcs3/Emu/RSX/rsx_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1818,7 +1823,7 @@ namespace rsx
template<u32 index>
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);
}
Expand All @@ -1827,8 +1832,13 @@ namespace rsx
template<u32 index>
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);
}
};
Expand Down

0 comments on commit 5deafde

Please sign in to comment.