diff options
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Vi/RootService')
3 files changed, 21 insertions, 14 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Vi/RootService/ApplicationDisplayService/IManagerDisplayService.cs b/Ryujinx.HLE/HOS/Services/Vi/RootService/ApplicationDisplayService/IManagerDisplayService.cs index 012a81ff..6b874722 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/RootService/ApplicationDisplayService/IManagerDisplayService.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/RootService/ApplicationDisplayService/IManagerDisplayService.cs @@ -1,11 +1,10 @@ using Ryujinx.Common.Logging; -using Ryujinx.HLE.HOS.Services.SurfaceFlinger; namespace Ryujinx.HLE.HOS.Services.Vi.RootService.ApplicationDisplayService { class IManagerDisplayService : IpcService { - private static IApplicationDisplayService _applicationDisplayService; + private IApplicationDisplayService _applicationDisplayService; public IManagerDisplayService(IApplicationDisplayService applicationDisplayService) { @@ -16,10 +15,13 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService.ApplicationDisplayService // CreateManagedLayer(u32, u64, nn::applet::AppletResourceUserId) -> u64 public ResultCode CreateManagedLayer(ServiceCtx context) { - long layerFlags = context.RequestData.ReadInt64(); - long displayId = context.RequestData.ReadInt64(); + long layerFlags = context.RequestData.ReadInt64(); + long displayId = context.RequestData.ReadInt64(); + long appletResourceUserId = context.RequestData.ReadInt64(); - context.Device.System.SurfaceFlinger.CreateLayer(context.Process, out long layerId); + long pid = context.Device.System.AppletState.AppletResourceUserIds.GetData<long>((int)appletResourceUserId); + + context.Device.System.SurfaceFlinger.CreateLayer(pid, out long layerId); context.ResponseData.Write(layerId); diff --git a/Ryujinx.HLE/HOS/Services/Vi/RootService/ApplicationDisplayService/ISystemDisplayService.cs b/Ryujinx.HLE/HOS/Services/Vi/RootService/ApplicationDisplayService/ISystemDisplayService.cs index 194bda2d..36f220c6 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/RootService/ApplicationDisplayService/ISystemDisplayService.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/RootService/ApplicationDisplayService/ISystemDisplayService.cs @@ -4,7 +4,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService.ApplicationDisplayService { class ISystemDisplayService : IpcService { - private static IApplicationDisplayService _applicationDisplayService; + private IApplicationDisplayService _applicationDisplayService; public ISystemDisplayService(IApplicationDisplayService applicationDisplayService) { diff --git a/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs b/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs index bd00fc02..a4b9f358 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs @@ -11,7 +11,9 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService { class IApplicationDisplayService : IpcService { - private IdDictionary _displays; + private readonly IdDictionary _displays; + + private int _vsyncEventHandle; public IApplicationDisplayService() { @@ -121,7 +123,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService long userId = context.RequestData.ReadInt64(); long parcelPtr = context.Request.ReceiveBuff[0].Position; - IBinder producer = context.Device.System.SurfaceFlinger.OpenLayer(context.Process, layerId); + IBinder producer = context.Device.System.SurfaceFlinger.OpenLayer(context.Request.HandleDesc.PId, layerId); Parcel parcel = new Parcel(0x28, 0x4); @@ -159,7 +161,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService // TODO: support multi display. Display disp = _displays.GetData<Display>((int)displayId); - IBinder producer = context.Device.System.SurfaceFlinger.CreateLayer(context.Process, out long layerId); + IBinder producer = context.Device.System.SurfaceFlinger.CreateLayer(0, out long layerId); Parcel parcel = new Parcel(0x28, 0x4); @@ -268,8 +270,8 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService const ulong defaultAlignment = 0x1000; const ulong defaultSize = 0x20000; - // NOTE: The official service setup a A8B8G8R8 texture with a linear layout and then query its size. - // As we don't need this texture on the emulator, we can just simplify this logic and directly + // NOTE: The official service setup a A8B8G8R8 texture with a linear layout and then query its size. + // As we don't need this texture on the emulator, we can just simplify this logic and directly // do a linear layout size calculation. (stride * height * bytePerPixel) int pitch = BitUtils.AlignUp(BitUtils.DivRoundUp(width * 32, 8), 64); int memorySize = pitch * BitUtils.AlignUp(height, 64); @@ -289,12 +291,15 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService { string name = GetDisplayName(context); - if (context.Process.HandleTable.GenerateHandle(context.Device.System.VsyncEvent.ReadableEvent, out int handle) != KernelResult.Success) + if (_vsyncEventHandle == 0) { - throw new InvalidOperationException("Out of handles!"); + if (context.Process.HandleTable.GenerateHandle(context.Device.System.VsyncEvent.ReadableEvent, out _vsyncEventHandle) != KernelResult.Success) + { + throw new InvalidOperationException("Out of handles!"); + } } - context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle); + context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_vsyncEventHandle); return ResultCode.Success; } |
