diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2020-12-01 20:23:43 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-02 00:23:43 +0100 |
| commit | cf6cd714884c41e9550757e364c2f4f5b04fc7f3 (patch) | |
| tree | bea748b4d1a350e5b8075d63ec9d39d49693829d /Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs | |
| parent | 461c24092ae6e148d896c18aa3e86220c89981f8 (diff) | |
IPC refactor part 2: Use ReplyAndReceive on HLE services and remove special handling from kernel (#1458)
* IPC refactor part 2: Use ReplyAndReceive on HLE services and remove special handling from kernel
* Fix for applet transfer memory + some nits
* Keep handles if possible to avoid server handle table exhaustion
* Fix IPC ZeroFill bug
* am: Correctly implement CreateManagedDisplayLayer and implement CreateManagedDisplaySeparableLayer
CreateManagedDisplaySeparableLayer is requires since 10.x+ when appletResourceUserId != 0
* Make it exit properly
* Make ServiceNotImplementedException show the full message again
* Allow yielding execution to avoid starving other threads
* Only wait if active
* Merge IVirtualMemoryManager and IAddressSpaceManager
* Fix Ro loading data from the wrong process
Co-authored-by: Thog <me@thog.eu>
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs')
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs | 21 |
1 files changed, 13 insertions, 8 deletions
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; } |
