aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/SurfaceFlinger/IHOSBinderDriver.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/SurfaceFlinger/IHOSBinderDriver.cs')
-rw-r--r--Ryujinx.HLE/HOS/Services/SurfaceFlinger/IHOSBinderDriver.cs21
1 files changed, 13 insertions, 8 deletions
diff --git a/Ryujinx.HLE/HOS/Services/SurfaceFlinger/IHOSBinderDriver.cs b/Ryujinx.HLE/HOS/Services/SurfaceFlinger/IHOSBinderDriver.cs
index 0724c83e..42fc2761 100644
--- a/Ryujinx.HLE/HOS/Services/SurfaceFlinger/IHOSBinderDriver.cs
+++ b/Ryujinx.HLE/HOS/Services/SurfaceFlinger/IHOSBinderDriver.cs
@@ -1,7 +1,9 @@
-using Ryujinx.HLE.HOS.Ipc;
+using Ryujinx.Common.Memory;
+using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel.Threading;
using Ryujinx.Horizon.Common;
using System;
+using System.Buffers;
namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
{
@@ -83,16 +85,19 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
ReadOnlySpan<byte> inputParcel = context.Memory.GetSpan(dataPos, (int)dataSize);
- Span<byte> outputParcel = new Span<byte>(new byte[replySize]);
+ using (IMemoryOwner<byte> outputParcelOwner = ByteMemoryPool.Shared.RentCleared(replySize))
+ {
+ Span<byte> outputParcel = outputParcelOwner.Memory.Span;
+
+ ResultCode result = OnTransact(binderId, code, flags, inputParcel, outputParcel);
- ResultCode result = OnTransact(binderId, code, flags, inputParcel, outputParcel);
+ if (result == ResultCode.Success)
+ {
+ context.Memory.Write(replyPos, outputParcel);
+ }
- if (result == ResultCode.Success)
- {
- context.Memory.Write(replyPos, outputParcel);
+ return result;
}
-
- return result;
}
protected abstract ResultCode AdjustRefcount(int binderId, int addVal, int type);