mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-24 06:34:16 +00:00
replace ByteMemoryPool usage in Ryujinx.HLE (#6953)
This commit is contained in:
parent
595e514f18
commit
a6dbb2ad2b
3 changed files with 7 additions and 8 deletions
|
@ -474,9 +474,9 @@ namespace Ryujinx.HLE.HOS.Services
|
||||||
{
|
{
|
||||||
const int MessageSize = 0x100;
|
const int MessageSize = 0x100;
|
||||||
|
|
||||||
using IMemoryOwner<byte> reqDataOwner = ByteMemoryPool.Rent(MessageSize);
|
using SpanOwner<byte> reqDataOwner = SpanOwner<byte>.Rent(MessageSize);
|
||||||
|
|
||||||
Span<byte> reqDataSpan = reqDataOwner.Memory.Span;
|
Span<byte> reqDataSpan = reqDataOwner.Span;
|
||||||
|
|
||||||
_selfProcess.CpuMemory.Read(_selfThread.TlsAddress, reqDataSpan);
|
_selfProcess.CpuMemory.Read(_selfThread.TlsAddress, reqDataSpan);
|
||||||
|
|
||||||
|
|
|
@ -85,9 +85,9 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
|
||||||
|
|
||||||
ReadOnlySpan<byte> inputParcel = context.Memory.GetSpan(dataPos, (int)dataSize);
|
ReadOnlySpan<byte> inputParcel = context.Memory.GetSpan(dataPos, (int)dataSize);
|
||||||
|
|
||||||
using IMemoryOwner<byte> outputParcelOwner = ByteMemoryPool.RentCleared(replySize);
|
using SpanOwner<byte> outputParcelOwner = SpanOwner<byte>.RentCleared(checked((int)replySize));
|
||||||
|
|
||||||
Span<byte> outputParcel = outputParcelOwner.Memory.Span;
|
Span<byte> outputParcel = outputParcelOwner.Span;
|
||||||
|
|
||||||
ResultCode result = OnTransact(binderId, code, flags, inputParcel, outputParcel);
|
ResultCode result = OnTransact(binderId, code, flags, inputParcel, outputParcel);
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ using Ryujinx.Common.Memory;
|
||||||
using Ryujinx.Common.Utilities;
|
using Ryujinx.Common.Utilities;
|
||||||
using Ryujinx.HLE.HOS.Services.SurfaceFlinger.Types;
|
using Ryujinx.HLE.HOS.Services.SurfaceFlinger.Types;
|
||||||
using System;
|
using System;
|
||||||
using System.Buffers;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
@ -13,7 +12,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
|
||||||
{
|
{
|
||||||
sealed class Parcel : IDisposable
|
sealed class Parcel : IDisposable
|
||||||
{
|
{
|
||||||
private readonly IMemoryOwner<byte> _rawDataOwner;
|
private readonly MemoryOwner<byte> _rawDataOwner;
|
||||||
|
|
||||||
private Span<byte> Raw => _rawDataOwner.Memory.Span;
|
private Span<byte> Raw => _rawDataOwner.Memory.Span;
|
||||||
|
|
||||||
|
@ -30,7 +29,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
|
||||||
|
|
||||||
public Parcel(ReadOnlySpan<byte> data)
|
public Parcel(ReadOnlySpan<byte> data)
|
||||||
{
|
{
|
||||||
_rawDataOwner = ByteMemoryPool.RentCopy(data);
|
_rawDataOwner = MemoryOwner<byte>.RentCopy(data);
|
||||||
|
|
||||||
_payloadPosition = 0;
|
_payloadPosition = 0;
|
||||||
_objectPosition = 0;
|
_objectPosition = 0;
|
||||||
|
@ -40,7 +39,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
|
||||||
{
|
{
|
||||||
uint headerSize = (uint)Unsafe.SizeOf<ParcelHeader>();
|
uint headerSize = (uint)Unsafe.SizeOf<ParcelHeader>();
|
||||||
|
|
||||||
_rawDataOwner = ByteMemoryPool.RentCleared(BitUtils.AlignUp<uint>(headerSize + payloadSize + objectsSize, 4));
|
_rawDataOwner = MemoryOwner<byte>.RentCleared(checked((int)BitUtils.AlignUp<uint>(headerSize + payloadSize + objectsSize, 4)));
|
||||||
|
|
||||||
Header.PayloadSize = payloadSize;
|
Header.PayloadSize = payloadSize;
|
||||||
Header.ObjectsSize = objectsSize;
|
Header.ObjectsSize = objectsSize;
|
||||||
|
|
Loading…
Reference in a new issue