mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-19 05:16:40 +00:00
Lock GbpQueueBuffer till Vsync is signalled (#367)
* Initial Framerate limit implementation * use seperate event for limiter * check for vsync signal after queue up framebuffer * removed ingame toggle * fix nits
This commit is contained in:
parent
fc77b089a6
commit
db1a759c59
5 changed files with 25 additions and 1 deletions
|
@ -199,6 +199,11 @@ namespace Ryujinx.HLE.HOS.Services.Android
|
||||||
|
|
||||||
SendFrameBuffer(Context, Slot);
|
SendFrameBuffer(Context, Slot);
|
||||||
|
|
||||||
|
if (Context.Device.EnableDeviceVsync)
|
||||||
|
{
|
||||||
|
Context.Device.VsyncEvent.WaitOne();
|
||||||
|
}
|
||||||
|
|
||||||
return MakeReplyParcel(Context, 1280, 720, 0, 0, 0);
|
return MakeReplyParcel(Context, 1280, 720, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ using Ryujinx.HLE.Input;
|
||||||
using Ryujinx.HLE.Logging;
|
using Ryujinx.HLE.Logging;
|
||||||
using Ryujinx.HLE.Memory;
|
using Ryujinx.HLE.Memory;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace Ryujinx.HLE
|
namespace Ryujinx.HLE
|
||||||
{
|
{
|
||||||
|
@ -28,6 +29,12 @@ namespace Ryujinx.HLE
|
||||||
|
|
||||||
public Hid Hid { get; private set; }
|
public Hid Hid { get; private set; }
|
||||||
|
|
||||||
|
public bool EnableDeviceVsync { get; set; } = true;
|
||||||
|
|
||||||
|
public AutoResetEvent VsyncEvent { get; private set; }
|
||||||
|
|
||||||
|
public event EventHandler Finish;
|
||||||
|
|
||||||
public Switch(IGalRenderer Renderer, IAalOutput AudioOut)
|
public Switch(IGalRenderer Renderer, IAalOutput AudioOut)
|
||||||
{
|
{
|
||||||
if (Renderer == null)
|
if (Renderer == null)
|
||||||
|
@ -55,6 +62,8 @@ namespace Ryujinx.HLE
|
||||||
Statistics = new PerformanceStatistics();
|
Statistics = new PerformanceStatistics();
|
||||||
|
|
||||||
Hid = new Hid(this, System.HidSharedMem.PA);
|
Hid = new Hid(this, System.HidSharedMem.PA);
|
||||||
|
|
||||||
|
VsyncEvent = new AutoResetEvent(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadCart(string ExeFsDir, string RomFsFile = null)
|
public void LoadCart(string ExeFsDir, string RomFsFile = null)
|
||||||
|
@ -109,6 +118,8 @@ namespace Ryujinx.HLE
|
||||||
if (Disposing)
|
if (Disposing)
|
||||||
{
|
{
|
||||||
System.Dispose();
|
System.Dispose();
|
||||||
|
|
||||||
|
VsyncEvent.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,8 @@ namespace Ryujinx
|
||||||
|
|
||||||
Device.System.State.DockedMode = Convert.ToBoolean(Parser.Value("Docked_Mode"));
|
Device.System.State.DockedMode = Convert.ToBoolean(Parser.Value("Docked_Mode"));
|
||||||
|
|
||||||
|
Device.EnableDeviceVsync = Convert.ToBoolean(Parser.Value("Enable_Vsync"));
|
||||||
|
|
||||||
string[] FilteredLogClasses = Parser.Value("Logging_Filtered_Classes").Split(',', StringSplitOptions.RemoveEmptyEntries);
|
string[] FilteredLogClasses = Parser.Value("Logging_Filtered_Classes").Split(',', StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|
||||||
//When the classes are specified on the list, we only
|
//When the classes are specified on the list, we only
|
||||||
|
|
|
@ -25,6 +25,9 @@ Logging_Filtered_Classes =
|
||||||
#Enable or Disable Docked Mode
|
#Enable or Disable Docked Mode
|
||||||
Docked_Mode = false
|
Docked_Mode = false
|
||||||
|
|
||||||
|
#Enable Game Vsync
|
||||||
|
Enable_Vsync = true
|
||||||
|
|
||||||
#Controller Device Index
|
#Controller Device Index
|
||||||
GamePad_Index = 0
|
GamePad_Index = 0
|
||||||
|
|
||||||
|
|
|
@ -258,13 +258,16 @@ namespace Ryujinx
|
||||||
double HostFps = Device.Statistics.GetSystemFrameRate();
|
double HostFps = Device.Statistics.GetSystemFrameRate();
|
||||||
double GameFps = Device.Statistics.GetGameFrameRate();
|
double GameFps = Device.Statistics.GetGameFrameRate();
|
||||||
|
|
||||||
NewTitle = $"Ryujinx | Host FPS: {HostFps:0.0} | Game FPS: {GameFps:0.0}";
|
NewTitle = $"Ryujinx | Host FPS: {HostFps:0.0} | Game FPS: {GameFps:0.0} | Game Vsync: " +
|
||||||
|
(Device.EnableDeviceVsync ? "On" : "Off");
|
||||||
|
|
||||||
TitleEvent = true;
|
TitleEvent = true;
|
||||||
|
|
||||||
SwapBuffers();
|
SwapBuffers();
|
||||||
|
|
||||||
Device.System.SignalVsync();
|
Device.System.SignalVsync();
|
||||||
|
|
||||||
|
Device.VsyncEvent.Set();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnUnload(EventArgs e)
|
protected override void OnUnload(EventArgs e)
|
||||||
|
|
Loading…
Reference in a new issue