From 55e97959b9720e2efbe2451c38e0610422335603 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Wed, 6 Jul 2022 13:37:36 -0300 Subject: Fix Vi managed and stray layers open/close/destroy (#3438) * Fix Vi managed and stray layers open/close/destroy * OpenLayer should set the state to ManagedOpened --- .../ApplicationDisplayService/IManagerDisplayService.cs | 6 ++---- .../Vi/RootService/IApplicationDisplayService.cs | 17 +++++++++-------- 2 files changed, 11 insertions(+), 12 deletions(-) (limited to 'Ryujinx.HLE/HOS/Services/Vi/RootService') diff --git a/Ryujinx.HLE/HOS/Services/Vi/RootService/ApplicationDisplayService/IManagerDisplayService.cs b/Ryujinx.HLE/HOS/Services/Vi/RootService/ApplicationDisplayService/IManagerDisplayService.cs index 096c7a30..f40a053c 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/RootService/ApplicationDisplayService/IManagerDisplayService.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/RootService/ApplicationDisplayService/IManagerDisplayService.cs @@ -35,7 +35,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService.ApplicationDisplayService ulong pid = context.Device.System.AppletState.AppletResourceUserIds.GetData((int)appletResourceUserId); - context.Device.System.SurfaceFlinger.CreateLayer(pid, out long layerId); + context.Device.System.SurfaceFlinger.CreateLayer(out long layerId, pid); context.Device.System.SurfaceFlinger.SetRenderLayer(layerId); context.ResponseData.Write(layerId); @@ -49,9 +49,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService.ApplicationDisplayService { long layerId = context.RequestData.ReadInt64(); - context.Device.System.SurfaceFlinger.CloseLayer(layerId); - - return ResultCode.Success; + return context.Device.System.SurfaceFlinger.DestroyManagedLayer(layerId); } [CommandHipc(2012)] // 7.0.0+ diff --git a/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs b/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs index da55c116..640e8be4 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/RootService/IApplicationDisplayService.cs @@ -237,7 +237,12 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService long userId = context.RequestData.ReadInt64(); ulong parcelPtr = context.Request.ReceiveBuff[0].Position; - IBinder producer = context.Device.System.SurfaceFlinger.OpenLayer(context.Request.HandleDesc.PId, layerId); + ResultCode result = context.Device.System.SurfaceFlinger.OpenLayer(context.Request.HandleDesc.PId, layerId, out IBinder producer); + + if (result != ResultCode.Success) + { + return result; + } context.Device.System.SurfaceFlinger.SetRenderLayer(layerId); @@ -260,9 +265,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService { long layerId = context.RequestData.ReadInt64(); - context.Device.System.SurfaceFlinger.CloseLayer(layerId); - - return ResultCode.Success; + return context.Device.System.SurfaceFlinger.CloseLayer(layerId); } [CommandHipc(2030)] @@ -275,7 +278,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService ulong parcelPtr = context.Request.ReceiveBuff[0].Position; // TODO: support multi display. - IBinder producer = context.Device.System.SurfaceFlinger.CreateLayer(0, out long layerId); + IBinder producer = context.Device.System.SurfaceFlinger.CreateLayer(out long layerId, 0, LayerState.Stray); context.Device.System.SurfaceFlinger.SetRenderLayer(layerId); @@ -299,9 +302,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService { long layerId = context.RequestData.ReadInt64(); - context.Device.System.SurfaceFlinger.CloseLayer(layerId); - - return ResultCode.Success; + return context.Device.System.SurfaceFlinger.DestroyStrayLayer(layerId); } [CommandHipc(2101)] -- cgit v1.2.3