From 7de7b559adc1924d3ff31cc58b281f70e468155f Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sun, 23 Sep 2018 15:11:46 -0300 Subject: Improve kernel events implementation (#430) * Improve kernel events implementation * Some cleanup * Address PR feedback --- Ryujinx.HLE/HOS/Services/Vi/IApplicationDisplayService.cs | 7 ++++++- Ryujinx.HLE/HOS/Services/Vi/IHOSBinderDriver.cs | 7 +++++-- Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) (limited to 'Ryujinx.HLE/HOS/Services/Vi') diff --git a/Ryujinx.HLE/HOS/Services/Vi/IApplicationDisplayService.cs b/Ryujinx.HLE/HOS/Services/Vi/IApplicationDisplayService.cs index 54238279..33a1dee9 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/IApplicationDisplayService.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/IApplicationDisplayService.cs @@ -1,6 +1,8 @@ using ChocolArm64.Memory; using Ryujinx.HLE.HOS.Ipc; +using Ryujinx.HLE.HOS.Kernel; using System.Collections.Generic; +using System; using System.IO; using System.Text; @@ -178,7 +180,10 @@ namespace Ryujinx.HLE.HOS.Services.Vi { string Name = GetDisplayName(Context); - int Handle = Context.Process.HandleTable.OpenHandle(Context.Device.System.VsyncEvent); + if (Context.Process.HandleTable.GenerateHandle(Context.Device.System.VsyncEvent.ReadableEvent, out int Handle) != KernelResult.Success) + { + throw new InvalidOperationException("Out of handles!"); + } Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle); diff --git a/Ryujinx.HLE/HOS/Services/Vi/IHOSBinderDriver.cs b/Ryujinx.HLE/HOS/Services/Vi/IHOSBinderDriver.cs index d47fc30a..09a37b0f 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/IHOSBinderDriver.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/IHOSBinderDriver.cs @@ -29,7 +29,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi BinderEvent = new KEvent(System); - BinderEvent.Signal(); + BinderEvent.ReadableEvent.Signal(); Flinger = new NvFlinger(Renderer, BinderEvent); } @@ -77,7 +77,10 @@ namespace Ryujinx.HLE.HOS.Services.Vi int Id = Context.RequestData.ReadInt32(); uint Unk = Context.RequestData.ReadUInt32(); - int Handle = Context.Process.HandleTable.OpenHandle(BinderEvent); + if (Context.Process.HandleTable.GenerateHandle(BinderEvent.ReadableEvent, out int Handle) != KernelResult.Success) + { + throw new InvalidOperationException("Out of handles!"); + } Context.Response.HandleDesc = IpcHandleDesc.MakeMove(Handle); diff --git a/Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs b/Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs index dcdf5d17..c5f38211 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs @@ -338,7 +338,7 @@ namespace Ryujinx.HLE.HOS.Services.Android { BufferQueue[Slot].State = BufferState.Free; - BinderEvent.Signal(); + BinderEvent.ReadableEvent.Signal(); WaitBufferFree.Set(); } -- cgit v1.2.3