From 4b3fd9c3debc61e1221a8794454eeb54e21a29d3 Mon Sep 17 00:00:00 2001 From: emmaus Date: Sun, 19 Aug 2018 13:55:51 +0000 Subject: [PATCH] check for vsync signal after queue up framebuffer --- Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs | 10 +++++----- Ryujinx.HLE/Switch.cs | 2 +- Ryujinx/Ui/GLScreen.cs | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs b/Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs index f8ed90fbf8..2a6918c441 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs @@ -166,11 +166,6 @@ namespace Ryujinx.HLE.HOS.Services.Android { Context.Device.Statistics.RecordGameFrameTime(); - if (Context.Device.EnableVsync) - { - Context.Device.VsyncEvent.WaitOne(); - } - //TODO: Errors. int Slot = ParcelReader.ReadInt32(); int Unknown4 = ParcelReader.ReadInt32(); @@ -204,6 +199,11 @@ namespace Ryujinx.HLE.HOS.Services.Android SendFrameBuffer(Context, Slot); + if (Context.Device.EnableDeviceVsync) + { + Context.Device.VsyncEvent.WaitOne(); + } + return MakeReplyParcel(Context, 1280, 720, 0, 0, 0); } diff --git a/Ryujinx.HLE/Switch.cs b/Ryujinx.HLE/Switch.cs index a8c7a5b2b1..0bcc3647f4 100644 --- a/Ryujinx.HLE/Switch.cs +++ b/Ryujinx.HLE/Switch.cs @@ -28,7 +28,7 @@ namespace Ryujinx.HLE public Hid Hid { get; private set; } - public bool EnableVsync { get; set; } = true; + public bool EnableDeviceVsync { get; set; } = true; public AutoResetEvent VsyncEvent { get; private set; } diff --git a/Ryujinx/Ui/GLScreen.cs b/Ryujinx/Ui/GLScreen.cs index 0b2df42129..4b0c8e8ac5 100644 --- a/Ryujinx/Ui/GLScreen.cs +++ b/Ryujinx/Ui/GLScreen.cs @@ -82,8 +82,6 @@ namespace Ryujinx if (Ticks >= TicksPerFrame) { - Device.VsyncEvent.Set(); - RenderFrame(); //Queue max. 1 vsync @@ -261,13 +259,15 @@ namespace Ryujinx double GameFps = Device.Statistics.GetGameFrameRate(); NewTitle = $"Ryujinx | Host FPS: {HostFps:0.0} | Game FPS: {GameFps:0.0} | Game Vsync: " + - (Device.EnableVsync ? "On" : "Off"); + (Device.EnableDeviceVsync ? "On" : "Off"); TitleEvent = true; SwapBuffers(); Device.System.SignalVsync(); + + Device.VsyncEvent.Set(); } protected override void OnUnload(EventArgs e) @@ -315,7 +315,7 @@ namespace Ryujinx Keyboard = e.Keyboard; if (e.Key == Key.Tab) - Device.EnableVsync = !Device.EnableVsync; + Device.EnableDeviceVsync = !Device.EnableDeviceVsync; } protected override void OnMouseDown(MouseButtonEventArgs e)