[WIP] Add support for events (#60)
* Add support for events, move concept of domains to IpcService * Support waiting for KThread, remove some test code, other tweaks * Use move handle on NIFM since I can't test that now, it's better to leave it how it was
This commit is contained in:
@@ -1,19 +1,17 @@
|
||||
using ChocolArm64.Memory;
|
||||
using Ryujinx.Core.OsHle.Handles;
|
||||
using Ryujinx.Core.OsHle.Ipc;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
using static Ryujinx.Core.OsHle.IpcServices.Android.Parcel;
|
||||
using static Ryujinx.Core.OsHle.IpcServices.ObjHelper;
|
||||
|
||||
namespace Ryujinx.Core.OsHle.IpcServices.Vi
|
||||
{
|
||||
class IApplicationDisplayService : IIpcService
|
||||
class IApplicationDisplayService : IpcService
|
||||
{
|
||||
private Dictionary<int, ServiceProcessRequest> m_Commands;
|
||||
|
||||
public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
|
||||
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
|
||||
|
||||
private IdDictionary Displays;
|
||||
|
||||
@@ -145,7 +143,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.Vi
|
||||
{
|
||||
string Name = GetDisplayName(Context);
|
||||
|
||||
int Handle = Context.Process.HandleTable.OpenHandle(new HEvent());
|
||||
int Handle = Context.Process.HandleTable.OpenHandle(Context.Ns.Os.VsyncEvent);
|
||||
|
||||
Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using ChocolArm64.Memory;
|
||||
using Ryujinx.Core.OsHle.Handles;
|
||||
using Ryujinx.Core.OsHle.Ipc;
|
||||
using Ryujinx.Core.OsHle.IpcServices.Android;
|
||||
using Ryujinx.Graphics.Gal;
|
||||
@@ -7,11 +8,13 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Ryujinx.Core.OsHle.IpcServices.Vi
|
||||
{
|
||||
class IHOSBinderDriver : IIpcService, IDisposable
|
||||
class IHOSBinderDriver : IpcService, IDisposable
|
||||
{
|
||||
private Dictionary<int, ServiceProcessRequest> m_Commands;
|
||||
|
||||
public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
|
||||
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
|
||||
|
||||
private KEvent ReleaseEvent;
|
||||
|
||||
private NvFlinger Flinger;
|
||||
|
||||
@@ -24,7 +27,9 @@ namespace Ryujinx.Core.OsHle.IpcServices.Vi
|
||||
{ 2, GetNativeHandle }
|
||||
};
|
||||
|
||||
Flinger = new NvFlinger(Renderer);
|
||||
ReleaseEvent = new KEvent();
|
||||
|
||||
Flinger = new NvFlinger(Renderer, ReleaseEvent);
|
||||
}
|
||||
|
||||
public long TransactParcel(ServiceCtx Context)
|
||||
@@ -56,7 +61,9 @@ namespace Ryujinx.Core.OsHle.IpcServices.Vi
|
||||
int Id = Context.RequestData.ReadInt32();
|
||||
uint Unk = Context.RequestData.ReadUInt32();
|
||||
|
||||
Context.Response.HandleDesc = IpcHandleDesc.MakeMove(0xbadcafe);
|
||||
int Handle = Context.Process.HandleTable.OpenHandle(ReleaseEvent);
|
||||
|
||||
Context.Response.HandleDesc = IpcHandleDesc.MakeMove(Handle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -70,6 +77,8 @@ namespace Ryujinx.Core.OsHle.IpcServices.Vi
|
||||
{
|
||||
if (Disposing)
|
||||
{
|
||||
ReleaseEvent.Dispose();
|
||||
|
||||
Flinger.Dispose();
|
||||
}
|
||||
}
|
||||
|
@@ -3,11 +3,11 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Ryujinx.Core.OsHle.IpcServices.Vi
|
||||
{
|
||||
class IManagerDisplayService : IIpcService
|
||||
class IManagerDisplayService : IpcService
|
||||
{
|
||||
private Dictionary<int, ServiceProcessRequest> m_Commands;
|
||||
|
||||
public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
|
||||
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
|
||||
|
||||
public IManagerDisplayService()
|
||||
{
|
||||
|
@@ -3,11 +3,11 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Ryujinx.Core.OsHle.IpcServices.Vi
|
||||
{
|
||||
class ISystemDisplayService : IIpcService
|
||||
class ISystemDisplayService : IpcService
|
||||
{
|
||||
private Dictionary<int, ServiceProcessRequest> m_Commands;
|
||||
|
||||
public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
|
||||
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
|
||||
|
||||
public ISystemDisplayService()
|
||||
{
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using ChocolArm64.Memory;
|
||||
using Ryujinx.Core.OsHle.Handles;
|
||||
using Ryujinx.Core.OsHle.IpcServices.NvServices;
|
||||
using Ryujinx.Graphics.Gal;
|
||||
using System;
|
||||
@@ -17,6 +18,10 @@ namespace Ryujinx.Core.OsHle.IpcServices.Android
|
||||
|
||||
private Dictionary<(string, int), ServiceProcessParcel> Commands;
|
||||
|
||||
private KEvent ReleaseEvent;
|
||||
|
||||
private IGalRenderer Renderer;
|
||||
|
||||
private const int BufferQueueCount = 0x40;
|
||||
private const int BufferQueueMask = BufferQueueCount - 1;
|
||||
|
||||
@@ -55,8 +60,6 @@ namespace Ryujinx.Core.OsHle.IpcServices.Android
|
||||
public GbpBuffer Data;
|
||||
}
|
||||
|
||||
private IGalRenderer Renderer;
|
||||
|
||||
private BufferEntry[] BufferQueue;
|
||||
|
||||
private ManualResetEvent WaitBufferFree;
|
||||
@@ -69,7 +72,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.Android
|
||||
|
||||
private bool KeepRunning;
|
||||
|
||||
public NvFlinger(IGalRenderer Renderer)
|
||||
public NvFlinger(IGalRenderer Renderer, KEvent ReleaseEvent)
|
||||
{
|
||||
Commands = new Dictionary<(string, int), ServiceProcessParcel>()
|
||||
{
|
||||
@@ -83,8 +86,9 @@ namespace Ryujinx.Core.OsHle.IpcServices.Android
|
||||
{ ("android.gui.IGraphicBufferProducer", 0xb), GbpDisconnect },
|
||||
{ ("android.gui.IGraphicBufferProducer", 0xe), GbpPreallocBuffer }
|
||||
};
|
||||
|
||||
this.Renderer = Renderer;
|
||||
|
||||
this.Renderer = Renderer;
|
||||
this.ReleaseEvent = ReleaseEvent;
|
||||
|
||||
BufferQueue = new BufferEntry[0x40];
|
||||
|
||||
@@ -293,6 +297,8 @@ namespace Ryujinx.Core.OsHle.IpcServices.Android
|
||||
|
||||
BufferQueue[Slot].State = BufferState.Free;
|
||||
|
||||
ReleaseEvent.Handle.Set();
|
||||
|
||||
WaitBufferFree.Set();
|
||||
|
||||
return;
|
||||
@@ -377,6 +383,8 @@ namespace Ryujinx.Core.OsHle.IpcServices.Android
|
||||
|
||||
Interlocked.Decrement(ref RenderQueueCount);
|
||||
|
||||
ReleaseEvent.Handle.Set();
|
||||
|
||||
lock (WaitBufferFree)
|
||||
{
|
||||
WaitBufferFree.Set();
|
||||
@@ -397,9 +405,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.Android
|
||||
NvMapHandle = BitConverter.ToInt32(RawValue, 0);
|
||||
}
|
||||
|
||||
ServiceNvDrv NvDrv = (ServiceNvDrv)Context.Process.Services.GetService("nvdrv");
|
||||
|
||||
return NvDrv.GetNvMap(NvMapHandle);
|
||||
return ServiceNvDrv.NvMaps.GetData<NvMap>(Context.Process, NvMapHandle);
|
||||
}
|
||||
|
||||
private int GetFreeSlotBlocking(int Width, int Height)
|
||||
|
@@ -1,15 +1,13 @@
|
||||
using Ryujinx.Core.OsHle.Ipc;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using static Ryujinx.Core.OsHle.IpcServices.ObjHelper;
|
||||
|
||||
namespace Ryujinx.Core.OsHle.IpcServices.Vi
|
||||
{
|
||||
class ServiceVi : IIpcService
|
||||
class ServiceVi : IpcService
|
||||
{
|
||||
private Dictionary<int, ServiceProcessRequest> m_Commands;
|
||||
|
||||
public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
|
||||
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
|
||||
|
||||
public ServiceVi()
|
||||
{
|
||||
|
Reference in New Issue
Block a user