mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-07-07 11:39:05 +00:00
[Ryujinx.HLE] Address dotnet-format issues (#5380)
* dotnet format style --severity info Some changes were manually reverted. * dotnet format analyzers --serverity info Some changes have been minimally adapted. * Restore a few unused methods and variables * Silence dotnet format IDE0060 warnings * Silence dotnet format IDE0052 warnings * Address or silence dotnet format IDE1006 warnings * Address dotnet format CA1816 warnings * Address or silence dotnet format CA2208 warnings * Address or silence dotnet format CA1806 and a few CA1854 warnings * Address dotnet format CA2211 warnings * Address dotnet format CA1822 warnings * Address or silence dotnet format CA1069 warnings * Make dotnet format succeed in style mode * Address or silence dotnet format CA2211 warnings * Address review comments * Address dotnet format CA2208 warnings properly * Make ProcessResult readonly * Address most dotnet format whitespace warnings * Apply dotnet format whitespace formatting A few of them have been manually reverted and the corresponding warning was silenced * Add previously silenced warnings back I have no clue how these disappeared * Revert formatting changes for while and for-loops * Format if-blocks correctly * Run dotnet format style after rebase * Run dotnet format whitespace after rebase * Run dotnet format style after rebase * Run dotnet format analyzers after rebase * Run dotnet format after rebase and remove unused usings - analyzers - style - whitespace * Disable 'prefer switch expression' rule * Add comments to disabled warnings * Fix a few disabled warnings * Fix naming rule violation, Convert shader properties to auto-property and convert values to const * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Start working on disabled warnings * Fix and silence a few dotnet-format warnings again * Run dotnet format after rebase * Use using declaration instead of block syntax * Address IDE0251 warnings * Address a few disabled IDE0060 warnings * Silence IDE0060 in .editorconfig * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * First dotnet format pass * Fix naming rule violations * Fix typo * Add trailing commas, use targeted new and use array initializer * Fix build issues * Fix remaining build issues * Remove SuppressMessage for CA1069 where possible * Address dotnet format issues * Address formatting issues Co-authored-by: Ac_K <acoustik666@gmail.com> * Add GetHashCode implementation for RenderingSurfaceInfo * Explicitly silence CA1822 for every affected method in Syscall * Address formatting issues in Demangler.cs * Address review feedback Co-authored-by: Ac_K <acoustik666@gmail.com> * Revert marking service methods as static * Next dotnet format pass * Address review feedback --------- Co-authored-by: Ac_K <acoustik666@gmail.com>
This commit is contained in:
@@ -10,14 +10,14 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices
|
||||
abstract class NvDeviceFile
|
||||
{
|
||||
public readonly ServiceCtx Context;
|
||||
public readonly ulong Owner;
|
||||
public readonly ulong Owner;
|
||||
|
||||
public string Path;
|
||||
|
||||
public NvDeviceFile(ServiceCtx context, ulong owner)
|
||||
{
|
||||
Context = context;
|
||||
Owner = owner;
|
||||
Owner = owner;
|
||||
}
|
||||
|
||||
public virtual NvInternalResult QueryEvent(out int eventHandle, uint eventId)
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu
|
||||
private const uint SmallPageSize = 0x1000;
|
||||
private const uint BigPageSize = 0x10000;
|
||||
|
||||
private static readonly uint[] _pageSizes = new uint[] { SmallPageSize, BigPageSize };
|
||||
private static readonly uint[] _pageSizes = { SmallPageSize, BigPageSize };
|
||||
|
||||
private const ulong SmallRegionLimit = 0x400000000UL; // 16 GiB
|
||||
private const ulong DefaultUserSize = 1UL << 37;
|
||||
@@ -32,10 +32,9 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly VmRegion[] _vmRegions = new VmRegion[]
|
||||
{
|
||||
private static readonly VmRegion[] _vmRegions = {
|
||||
new VmRegion((ulong)BigPageSize << 16, SmallRegionLimit),
|
||||
new VmRegion(SmallRegionLimit, DefaultUserSize)
|
||||
new VmRegion(SmallRegionLimit, DefaultUserSize),
|
||||
};
|
||||
|
||||
private readonly AddressSpaceContext _asContext;
|
||||
|
||||
@@ -8,24 +8,24 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types
|
||||
private class Range
|
||||
{
|
||||
public ulong Start { get; }
|
||||
public ulong End { get; }
|
||||
public ulong End { get; }
|
||||
|
||||
public Range(ulong address, ulong size)
|
||||
{
|
||||
Start = address;
|
||||
End = size + Start;
|
||||
End = size + Start;
|
||||
}
|
||||
}
|
||||
|
||||
private class MappedMemory : Range
|
||||
{
|
||||
public ulong PhysicalAddress { get; }
|
||||
public bool VaAllocated { get; }
|
||||
public bool VaAllocated { get; }
|
||||
|
||||
public MappedMemory(ulong address, ulong size, ulong physicalAddress, bool vaAllocated) : base(address, size)
|
||||
{
|
||||
PhysicalAddress = physicalAddress;
|
||||
VaAllocated = vaAllocated;
|
||||
VaAllocated = vaAllocated;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types
|
||||
{
|
||||
Gmm = gmm;
|
||||
|
||||
_maps = new SortedList<ulong, Range>();
|
||||
_maps = new SortedList<ulong, Range>();
|
||||
_reservations = new SortedList<ulong, Range>();
|
||||
}
|
||||
|
||||
@@ -123,9 +123,9 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types
|
||||
return _reservations.Remove(gpuVa);
|
||||
}
|
||||
|
||||
private static Range BinarySearch(SortedList<ulong, Range> list, ulong address)
|
||||
private Range BinarySearch(SortedList<ulong, Range> list, ulong address)
|
||||
{
|
||||
int left = 0;
|
||||
int left = 0;
|
||||
int right = list.Count - 1;
|
||||
|
||||
while (left <= right)
|
||||
@@ -154,11 +154,11 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Range BinarySearchLt(SortedList<ulong, Range> list, ulong address)
|
||||
private Range BinarySearchLt(SortedList<ulong, Range> list, ulong address)
|
||||
{
|
||||
Range ltRg = null;
|
||||
|
||||
int left = 0;
|
||||
int left = 0;
|
||||
int right = list.Count - 1;
|
||||
|
||||
while (left <= right)
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types
|
||||
[Flags]
|
||||
enum AddressSpaceFlags : uint
|
||||
{
|
||||
FixedOffset = 1,
|
||||
FixedOffset = 1,
|
||||
RemapSubRange = 0x100,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct AllocSpaceArguments
|
||||
{
|
||||
public uint Pages;
|
||||
public uint PageSize;
|
||||
public uint Pages;
|
||||
public uint PageSize;
|
||||
public AddressSpaceFlags Flags;
|
||||
public uint Padding;
|
||||
public ulong Offset;
|
||||
public uint Padding;
|
||||
public ulong Offset;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types
|
||||
struct FreeSpaceArguments
|
||||
{
|
||||
public ulong Offset;
|
||||
public uint Pages;
|
||||
public uint PageSize;
|
||||
public uint Pages;
|
||||
public uint PageSize;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct InitializeExArguments
|
||||
{
|
||||
public uint Flags;
|
||||
public int AsFd;
|
||||
public uint BigPageSize;
|
||||
public uint Reserved;
|
||||
public uint Flags;
|
||||
public int AsFd;
|
||||
public uint BigPageSize;
|
||||
public uint Reserved;
|
||||
public ulong Unknown0;
|
||||
public ulong Unknown1;
|
||||
public ulong Unknown2;
|
||||
|
||||
@@ -6,11 +6,11 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types
|
||||
struct MapBufferExArguments
|
||||
{
|
||||
public AddressSpaceFlags Flags;
|
||||
public int Kind;
|
||||
public int NvMapHandle;
|
||||
public int PageSize;
|
||||
public ulong BufferOffset;
|
||||
public ulong MappingSize;
|
||||
public ulong Offset;
|
||||
public int Kind;
|
||||
public int NvMapHandle;
|
||||
public int PageSize;
|
||||
public ulong BufferOffset;
|
||||
public ulong MappingSize;
|
||||
public ulong Offset;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types
|
||||
{
|
||||
public ushort Flags;
|
||||
public ushort Kind;
|
||||
public int NvMapHandle;
|
||||
public uint MapOffset;
|
||||
public uint GpuOffset;
|
||||
public uint Pages;
|
||||
public int NvMapHandle;
|
||||
public uint MapOffset;
|
||||
public uint GpuOffset;
|
||||
public uint Pages;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
struct UnmapBufferArguments
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public ulong Offset;
|
||||
#pragma warning restore CS0649
|
||||
}
|
||||
|
||||
@@ -1358,4 +1358,4 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel
|
||||
channel.Write(ClassId.Twod, 0x24C, 0x100);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,9 +19,11 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel
|
||||
|
||||
private const uint MaxModuleSyncpoint = 16;
|
||||
|
||||
#pragma warning disable IDE0052 // Remove unread private member
|
||||
private uint _timeout;
|
||||
private uint _submitTimeout;
|
||||
private uint _timeslice;
|
||||
#pragma warning restore IDE0052
|
||||
|
||||
private readonly Switch _device;
|
||||
|
||||
@@ -34,7 +36,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel
|
||||
public enum ResourcePolicy
|
||||
{
|
||||
Device,
|
||||
Channel
|
||||
Channel,
|
||||
}
|
||||
|
||||
protected static uint[] DeviceSyncpoints = new uint[MaxModuleSyncpoint];
|
||||
@@ -47,14 +49,14 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel
|
||||
|
||||
public NvHostChannelDeviceFile(ServiceCtx context, IVirtualMemoryManager memory, ulong owner) : base(context, owner)
|
||||
{
|
||||
_device = context.Device;
|
||||
_memory = memory;
|
||||
_timeout = 3000;
|
||||
_device = context.Device;
|
||||
_memory = memory;
|
||||
_timeout = 3000;
|
||||
_submitTimeout = 0;
|
||||
_timeslice = 0;
|
||||
_timeslice = 0;
|
||||
_host1xContext = GetHost1XContext(context.Device.Gpu, owner);
|
||||
_contextId = _host1xContext.Host1x.CreateContext();
|
||||
Channel = _device.Gpu.CreateChannel();
|
||||
_contextId = _host1xContext.Host1x.CreateContext();
|
||||
Channel = _device.Gpu.CreateChannel();
|
||||
|
||||
ChannelInitialization.InitializeState(Channel);
|
||||
|
||||
@@ -143,12 +145,14 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel
|
||||
|
||||
private NvInternalResult Submit(Span<byte> arguments)
|
||||
{
|
||||
SubmitArguments submitHeader = GetSpanAndSkip<SubmitArguments>(ref arguments, 1)[0];
|
||||
Span<CommandBuffer> commandBuffers = GetSpanAndSkip<CommandBuffer>(ref arguments, submitHeader.CmdBufsCount);
|
||||
Span<Reloc> relocs = GetSpanAndSkip<Reloc>(ref arguments, submitHeader.RelocsCount);
|
||||
Span<uint> relocShifts = GetSpanAndSkip<uint>(ref arguments, submitHeader.RelocsCount);
|
||||
Span<SyncptIncr> syncptIncrs = GetSpanAndSkip<SyncptIncr>(ref arguments, submitHeader.SyncptIncrsCount);
|
||||
Span<uint> fenceThresholds = GetSpanAndSkip<uint>(ref arguments, submitHeader.FencesCount);
|
||||
SubmitArguments submitHeader = GetSpanAndSkip<SubmitArguments>(ref arguments, 1)[0];
|
||||
Span<CommandBuffer> commandBuffers = GetSpanAndSkip<CommandBuffer>(ref arguments, submitHeader.CmdBufsCount);
|
||||
#pragma warning disable IDE0059 // Remove unnecessary value assignment
|
||||
Span<Reloc> relocs = GetSpanAndSkip<Reloc>(ref arguments, submitHeader.RelocsCount);
|
||||
Span<uint> relocShifts = GetSpanAndSkip<uint>(ref arguments, submitHeader.RelocsCount);
|
||||
#pragma warning restore IDE0059
|
||||
Span<SyncptIncr> syncptIncrs = GetSpanAndSkip<SyncptIncr>(ref arguments, submitHeader.SyncptIncrsCount);
|
||||
Span<uint> fenceThresholds = GetSpanAndSkip<uint>(ref arguments, submitHeader.FencesCount);
|
||||
|
||||
lock (_device)
|
||||
{
|
||||
@@ -176,9 +180,9 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel
|
||||
|
||||
private Span<T> GetSpanAndSkip<T>(ref Span<byte> arguments, int count) where T : unmanaged
|
||||
{
|
||||
Span<T> output = MemoryMarshal.Cast<byte, T>(arguments).Slice(0, count);
|
||||
Span<T> output = MemoryMarshal.Cast<byte, T>(arguments)[..count];
|
||||
|
||||
arguments = arguments.Slice(Unsafe.SizeOf<T>() * count);
|
||||
arguments = arguments[(Unsafe.SizeOf<T>() * count)..];
|
||||
|
||||
return output;
|
||||
}
|
||||
@@ -227,9 +231,9 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel
|
||||
|
||||
private NvInternalResult MapCommandBuffer(Span<byte> arguments)
|
||||
{
|
||||
int headerSize = Unsafe.SizeOf<MapCommandBufferArguments>();
|
||||
MapCommandBufferArguments commandBufferHeader = MemoryMarshal.Cast<byte, MapCommandBufferArguments>(arguments)[0];
|
||||
Span<CommandBufferHandle> commandBufferEntries = MemoryMarshal.Cast<byte, CommandBufferHandle>(arguments.Slice(headerSize)).Slice(0, commandBufferHeader.NumEntries);
|
||||
int headerSize = Unsafe.SizeOf<MapCommandBufferArguments>();
|
||||
MapCommandBufferArguments commandBufferHeader = MemoryMarshal.Cast<byte, MapCommandBufferArguments>(arguments)[0];
|
||||
Span<CommandBufferHandle> commandBufferEntries = MemoryMarshal.Cast<byte, CommandBufferHandle>(arguments[headerSize..])[..commandBufferHeader.NumEntries];
|
||||
|
||||
foreach (ref CommandBufferHandle commandBufferEntry in commandBufferEntries)
|
||||
{
|
||||
@@ -269,9 +273,9 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel
|
||||
|
||||
private NvInternalResult UnmapCommandBuffer(Span<byte> arguments)
|
||||
{
|
||||
int headerSize = Unsafe.SizeOf<MapCommandBufferArguments>();
|
||||
MapCommandBufferArguments commandBufferHeader = MemoryMarshal.Cast<byte, MapCommandBufferArguments>(arguments)[0];
|
||||
Span<CommandBufferHandle> commandBufferEntries = MemoryMarshal.Cast<byte, CommandBufferHandle>(arguments.Slice(headerSize)).Slice(0, commandBufferHeader.NumEntries);
|
||||
int headerSize = Unsafe.SizeOf<MapCommandBufferArguments>();
|
||||
MapCommandBufferArguments commandBufferHeader = MemoryMarshal.Cast<byte, MapCommandBufferArguments>(arguments)[0];
|
||||
Span<CommandBufferHandle> commandBufferEntries = MemoryMarshal.Cast<byte, CommandBufferHandle>(arguments[headerSize..])[..commandBufferHeader.NumEntries];
|
||||
|
||||
foreach (ref CommandBufferHandle commandBufferEntry in commandBufferEntries)
|
||||
{
|
||||
@@ -320,9 +324,9 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel
|
||||
|
||||
private NvInternalResult SubmitGpfifo(Span<byte> arguments)
|
||||
{
|
||||
int headerSize = Unsafe.SizeOf<SubmitGpfifoArguments>();
|
||||
int headerSize = Unsafe.SizeOf<SubmitGpfifoArguments>();
|
||||
SubmitGpfifoArguments gpfifoSubmissionHeader = MemoryMarshal.Cast<byte, SubmitGpfifoArguments>(arguments)[0];
|
||||
Span<ulong> gpfifoEntries = MemoryMarshal.Cast<byte, ulong>(arguments.Slice(headerSize)).Slice(0, gpfifoSubmissionHeader.NumEntries);
|
||||
Span<ulong> gpfifoEntries = MemoryMarshal.Cast<byte, ulong>(arguments[headerSize..])[..gpfifoSubmissionHeader.NumEntries];
|
||||
|
||||
return SubmitGpfifo(ref gpfifoSubmissionHeader, gpfifoEntries);
|
||||
}
|
||||
@@ -473,7 +477,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel
|
||||
return ChannelSyncpoints[index];
|
||||
}
|
||||
|
||||
public static uint GetSyncpointDevice(NvHostSyncpt syncpointManager, uint index, bool isClientManaged)
|
||||
public uint GetSyncpointDevice(NvHostSyncpt syncpointManager, uint index, bool isClientManaged)
|
||||
{
|
||||
if (DeviceSyncpoints[index] != 0)
|
||||
{
|
||||
|
||||
@@ -8,9 +8,11 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel
|
||||
{
|
||||
internal class NvHostGpuDeviceFile : NvHostChannelDeviceFile
|
||||
{
|
||||
private KEvent _smExceptionBptIntReportEvent;
|
||||
private KEvent _smExceptionBptPauseReportEvent;
|
||||
private KEvent _errorNotifierEvent;
|
||||
#pragma warning disable IDE0052 // Remove unread private member
|
||||
private readonly KEvent _smExceptionBptIntReportEvent;
|
||||
private readonly KEvent _smExceptionBptPauseReportEvent;
|
||||
private readonly KEvent _errorNotifierEvent;
|
||||
#pragma warning restore IDE0052
|
||||
|
||||
private int _smExceptionBptIntReportEventHandle;
|
||||
private int _smExceptionBptPauseReportEventHandle;
|
||||
@@ -18,14 +20,14 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel
|
||||
|
||||
public NvHostGpuDeviceFile(ServiceCtx context, IVirtualMemoryManager memory, ulong owner) : base(context, memory, owner)
|
||||
{
|
||||
_smExceptionBptIntReportEvent = CreateEvent(context, out _smExceptionBptIntReportEventHandle);
|
||||
_smExceptionBptIntReportEvent = CreateEvent(context, out _smExceptionBptIntReportEventHandle);
|
||||
_smExceptionBptPauseReportEvent = CreateEvent(context, out _smExceptionBptPauseReportEventHandle);
|
||||
_errorNotifierEvent = CreateEvent(context, out _errorNotifierEventHandle);
|
||||
_errorNotifierEvent = CreateEvent(context, out _errorNotifierEventHandle);
|
||||
}
|
||||
|
||||
private static KEvent CreateEvent(ServiceCtx context, out int handle)
|
||||
private KEvent CreateEvent(ServiceCtx context, out int handle)
|
||||
{
|
||||
KEvent evnt = new KEvent(context.Device.System.KernelContext);
|
||||
KEvent evnt = new(context.Device.System.KernelContext);
|
||||
|
||||
if (context.Process.HandleTable.GenerateHandle(evnt.ReadableEvent, out handle) != Result.Success)
|
||||
{
|
||||
@@ -55,22 +57,13 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel
|
||||
public override NvInternalResult QueryEvent(out int eventHandle, uint eventId)
|
||||
{
|
||||
// TODO: accurately represent and implement those events.
|
||||
switch (eventId)
|
||||
eventHandle = eventId switch
|
||||
{
|
||||
case 0x1:
|
||||
eventHandle = _smExceptionBptIntReportEventHandle;
|
||||
break;
|
||||
case 0x2:
|
||||
eventHandle = _smExceptionBptPauseReportEventHandle;
|
||||
break;
|
||||
case 0x3:
|
||||
eventHandle = _errorNotifierEventHandle;
|
||||
break;
|
||||
default:
|
||||
eventHandle = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
0x1 => _smExceptionBptIntReportEventHandle,
|
||||
0x2 => _smExceptionBptPauseReportEventHandle,
|
||||
0x3 => _errorNotifierEventHandle,
|
||||
_ => 0,
|
||||
};
|
||||
return eventHandle != 0 ? NvInternalResult.Success : NvInternalResult.InvalidInput;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,12 +6,12 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct AllocGpfifoExArguments
|
||||
{
|
||||
public uint NumEntries;
|
||||
public uint NumJobs;
|
||||
public uint Flags;
|
||||
public uint NumEntries;
|
||||
public uint NumJobs;
|
||||
public uint Flags;
|
||||
public NvFence Fence;
|
||||
public uint Reserved1;
|
||||
public uint Reserved2;
|
||||
public uint Reserved3;
|
||||
public uint Reserved1;
|
||||
public uint Reserved2;
|
||||
public uint Reserved3;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct AllocObjCtxArguments
|
||||
{
|
||||
public uint ClassNumber;
|
||||
public uint Flags;
|
||||
public uint ClassNumber;
|
||||
public uint Flags;
|
||||
public ulong ObjectId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,10 +12,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct MapCommandBufferArguments
|
||||
{
|
||||
public int NumEntries;
|
||||
public int DataAddress; // Ignored by the driver.
|
||||
public bool AttachHostChDas;
|
||||
public byte Padding1;
|
||||
public int NumEntries;
|
||||
public int DataAddress; // Ignored by the driver.
|
||||
public bool AttachHostChDas;
|
||||
public byte Padding1;
|
||||
public short Padding2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel
|
||||
{
|
||||
class NvChannel
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public int Timeout;
|
||||
public int SubmitTimeout;
|
||||
public int Timeslice;
|
||||
#pragma warning restore CS0649
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
{
|
||||
enum NvChannelPriority : uint
|
||||
{
|
||||
Low = 50,
|
||||
Low = 50,
|
||||
Medium = 100,
|
||||
High = 150
|
||||
High = 150,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types
|
||||
{
|
||||
public ulong Offset;
|
||||
public ulong Size;
|
||||
public uint Mem;
|
||||
public uint Reserved;
|
||||
public uint Mem;
|
||||
public uint Reserved;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct SubmitGpfifoArguments
|
||||
{
|
||||
public long Address;
|
||||
public int NumEntries;
|
||||
public long Address;
|
||||
public int NumEntries;
|
||||
public SubmitGpfifoFlags Flags;
|
||||
public NvFence Fence;
|
||||
public NvFence Fence;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types
|
||||
enum SubmitGpfifoFlags : uint
|
||||
{
|
||||
None,
|
||||
FenceWait = 1 << 0,
|
||||
FenceIncrement = 1 << 1,
|
||||
HwFormat = 1 << 2,
|
||||
SuppressWfi = 1 << 4,
|
||||
FenceWait = 1 << 0,
|
||||
FenceIncrement = 1 << 1,
|
||||
HwFormat = 1 << 2,
|
||||
SuppressWfi = 1 << 4,
|
||||
IncrementWithValue = 1 << 8,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types
|
||||
struct ZcullBindArguments
|
||||
{
|
||||
public ulong GpuVirtualAddress;
|
||||
public uint Mode;
|
||||
public uint Reserved;
|
||||
public uint Mode;
|
||||
public uint Reserved;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,9 +14,9 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl
|
||||
{
|
||||
public const int EventsCount = 64;
|
||||
|
||||
private bool _isProductionMode;
|
||||
private Switch _device;
|
||||
private NvHostEvent[] _events;
|
||||
private readonly bool _isProductionMode;
|
||||
private readonly Switch _device;
|
||||
private readonly NvHostEvent[] _events;
|
||||
|
||||
public NvHostCtrlDeviceFile(ServiceCtx context, IVirtualMemoryManager memory, ulong owner) : base(context, owner)
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl.Types
|
||||
struct EventWaitArguments
|
||||
{
|
||||
public NvFence Fence;
|
||||
public int Timeout;
|
||||
public uint Value;
|
||||
public int Timeout;
|
||||
public uint Value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,14 +11,14 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl.Types
|
||||
|
||||
public static GetConfigurationArguments FromSpan(Span<byte> span)
|
||||
{
|
||||
string domain = Encoding.ASCII.GetString(span.Slice(0, 0x41));
|
||||
string domain = Encoding.ASCII.GetString(span[..0x41]);
|
||||
string parameter = Encoding.ASCII.GetString(span.Slice(0x41, 0x41));
|
||||
|
||||
GetConfigurationArguments result = new GetConfigurationArguments
|
||||
GetConfigurationArguments result = new()
|
||||
{
|
||||
Domain = domain.Substring(0, domain.IndexOf('\0')),
|
||||
Parameter = parameter.Substring(0, parameter.IndexOf('\0')),
|
||||
Configuration = span.Slice(0x82, 0x101).ToArray()
|
||||
Domain = domain[..domain.IndexOf('\0')],
|
||||
Parameter = parameter[..parameter.IndexOf('\0')],
|
||||
Configuration = span.Slice(0x82, 0x101).ToArray(),
|
||||
};
|
||||
|
||||
return result;
|
||||
@@ -26,7 +26,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl.Types
|
||||
|
||||
public void CopyTo(Span<byte> span)
|
||||
{
|
||||
Encoding.ASCII.GetBytes(Domain + '\0').CopyTo(span.Slice(0, 0x41));
|
||||
Encoding.ASCII.GetBytes(Domain + '\0').CopyTo(span[..0x41]);
|
||||
Encoding.ASCII.GetBytes(Parameter + '\0').CopyTo(span.Slice(0x41, 0x41));
|
||||
Configuration.CopyTo(span.Slice(0x82, 0x101));
|
||||
}
|
||||
|
||||
@@ -12,17 +12,19 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl
|
||||
{
|
||||
class NvHostEvent
|
||||
{
|
||||
public NvFence Fence;
|
||||
public NvFence Fence;
|
||||
public NvHostEventState State;
|
||||
public KEvent Event;
|
||||
public int EventHandle;
|
||||
public KEvent Event;
|
||||
public int EventHandle;
|
||||
|
||||
private uint _eventId;
|
||||
private NvHostSyncpt _syncpointManager;
|
||||
private readonly uint _eventId;
|
||||
#pragma warning disable IDE0052 // Remove unread private member
|
||||
private readonly NvHostSyncpt _syncpointManager;
|
||||
#pragma warning restore IDE0052
|
||||
private SyncpointWaiterHandle _waiterInformation;
|
||||
|
||||
private NvFence _previousFailingFence;
|
||||
private uint _failingCount;
|
||||
private uint _failingCount;
|
||||
|
||||
public readonly object Lock = new();
|
||||
|
||||
@@ -54,9 +56,9 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl
|
||||
|
||||
private void ResetFailingState()
|
||||
{
|
||||
_previousFailingFence.Id = NvFence.InvalidSyncPointId;
|
||||
_previousFailingFence.Id = NvFence.InvalidSyncPointId;
|
||||
_previousFailingFence.Value = 0;
|
||||
_failingCount = 0;
|
||||
_failingCount = 0;
|
||||
}
|
||||
|
||||
private void Signal()
|
||||
@@ -182,4 +184,4 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl
|
||||
{
|
||||
enum NvHostEventState
|
||||
{
|
||||
Available = 0,
|
||||
Waiting = 1,
|
||||
Available = 0,
|
||||
Waiting = 1,
|
||||
Cancelling = 2,
|
||||
Signaling = 3,
|
||||
Signaled = 4,
|
||||
Cancelled = 5
|
||||
Signaling = 3,
|
||||
Signaled = 4,
|
||||
Cancelled = 5,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,22 +10,22 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl
|
||||
public const int VBlank0SyncpointId = 26;
|
||||
public const int VBlank1SyncpointId = 27;
|
||||
|
||||
private int[] _counterMin;
|
||||
private int[] _counterMax;
|
||||
private bool[] _clientManaged;
|
||||
private bool[] _assigned;
|
||||
private readonly int[] _counterMin;
|
||||
private readonly int[] _counterMax;
|
||||
private readonly bool[] _clientManaged;
|
||||
private readonly bool[] _assigned;
|
||||
|
||||
private Switch _device;
|
||||
private readonly Switch _device;
|
||||
|
||||
private readonly object _syncpointAllocatorLock = new();
|
||||
|
||||
public NvHostSyncpt(Switch device)
|
||||
{
|
||||
_device = device;
|
||||
_counterMin = new int[SynchronizationManager.MaxHardwareSyncpoints];
|
||||
_counterMax = new int[SynchronizationManager.MaxHardwareSyncpoints];
|
||||
_device = device;
|
||||
_counterMin = new int[SynchronizationManager.MaxHardwareSyncpoints];
|
||||
_counterMax = new int[SynchronizationManager.MaxHardwareSyncpoints];
|
||||
_clientManaged = new bool[SynchronizationManager.MaxHardwareSyncpoints];
|
||||
_assigned = new bool[SynchronizationManager.MaxHardwareSyncpoints];
|
||||
_assigned = new bool[SynchronizationManager.MaxHardwareSyncpoints];
|
||||
|
||||
// Reserve VBLANK syncpoints
|
||||
ReserveSyncpointLocked(VBlank0SyncpointId, true);
|
||||
@@ -39,7 +39,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl
|
||||
throw new ArgumentOutOfRangeException(nameof(id));
|
||||
}
|
||||
|
||||
_assigned[id] = true;
|
||||
_assigned[id] = true;
|
||||
_clientManaged[id] = isClientManaged;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl
|
||||
throw new ArgumentOutOfRangeException(nameof(id));
|
||||
}
|
||||
|
||||
_assigned[id] = false;
|
||||
_assigned[id] = false;
|
||||
_clientManaged[id] = false;
|
||||
|
||||
SetSyncpointMinEqualSyncpointMax(id);
|
||||
@@ -196,4 +196,4 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,6 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl.Types
|
||||
struct SyncptWaitArguments
|
||||
{
|
||||
public NvFence Fence;
|
||||
public int Timeout;
|
||||
public int Timeout;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl.Types
|
||||
struct SyncptWaitExArguments
|
||||
{
|
||||
public SyncptWaitArguments Input;
|
||||
public uint Value;
|
||||
public uint Value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,15 +10,15 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu
|
||||
{
|
||||
class NvHostCtrlGpuDeviceFile : NvDeviceFile
|
||||
{
|
||||
private static Stopwatch _pTimer = new Stopwatch();
|
||||
private static double _ticksToNs = (1.0 / Stopwatch.Frequency) * 1_000_000_000;
|
||||
private static readonly Stopwatch _pTimer = new();
|
||||
private static readonly double _ticksToNs = (1.0 / Stopwatch.Frequency) * 1_000_000_000;
|
||||
|
||||
private KEvent _errorEvent;
|
||||
private KEvent _unknownEvent;
|
||||
private readonly KEvent _errorEvent;
|
||||
private readonly KEvent _unknownEvent;
|
||||
|
||||
public NvHostCtrlGpuDeviceFile(ServiceCtx context, IVirtualMemoryManager memory, ulong owner) : base(context, owner)
|
||||
{
|
||||
_errorEvent = new KEvent(context.Device.System.KernelContext);
|
||||
_errorEvent = new KEvent(context.Device.System.KernelContext);
|
||||
_unknownEvent = new KEvent(context.Device.System.KernelContext);
|
||||
}
|
||||
|
||||
@@ -125,6 +125,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu
|
||||
|
||||
private NvInternalResult ZcullGetInfo(ref ZcullGetInfoArguments arguments)
|
||||
{
|
||||
#pragma warning disable IDE0055 // Disable formatting
|
||||
arguments.WidthAlignPixels = 0x20;
|
||||
arguments.HeightAlignPixels = 0x20;
|
||||
arguments.PixelSquaresByAliquots = 0x400;
|
||||
@@ -135,6 +136,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu
|
||||
arguments.SubregionWidthAlignPixels = 0x20;
|
||||
arguments.SubregionHeightAlignPixels = 0x40;
|
||||
arguments.SubregionCount = 0x10;
|
||||
#pragma warning restore IDE0055
|
||||
|
||||
return NvInternalResult.Success;
|
||||
}
|
||||
@@ -155,6 +157,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu
|
||||
{
|
||||
arguments.Header.BufferSize = 0xa0;
|
||||
|
||||
#pragma warning disable IDE0055 // Disable formatting
|
||||
characteristics.Arch = 0x120;
|
||||
characteristics.Impl = 0xb;
|
||||
characteristics.Rev = 0xa1;
|
||||
@@ -190,6 +193,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu
|
||||
characteristics.RopL2EnMask1 = 0x0;
|
||||
characteristics.ChipName = 0x6230326d67;
|
||||
characteristics.GrCompbitStoreBaseHw = 0x0;
|
||||
#pragma warning restore IDE0055
|
||||
|
||||
arguments.Characteristics = characteristics;
|
||||
|
||||
@@ -205,7 +209,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu
|
||||
{
|
||||
if (arguments.MaskBufferSize != 0)
|
||||
{
|
||||
tpcMask = 3;
|
||||
tpcMask = 3;
|
||||
arguments.TpcMask = tpcMask;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,46 +5,46 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct GpuCharacteristics
|
||||
{
|
||||
public int Arch;
|
||||
public int Impl;
|
||||
public int Rev;
|
||||
public int NumGpc;
|
||||
public int Arch;
|
||||
public int Impl;
|
||||
public int Rev;
|
||||
public int NumGpc;
|
||||
public long L2CacheSize;
|
||||
public long OnBoardVideoMemorySize;
|
||||
public int NumTpcPerGpc;
|
||||
public int BusType;
|
||||
public int BigPageSize;
|
||||
public int CompressionPageSize;
|
||||
public int PdeCoverageBitCount;
|
||||
public int AvailableBigPageSizes;
|
||||
public int GpcMask;
|
||||
public int SmArchSmVersion;
|
||||
public int SmArchSpaVersion;
|
||||
public int SmArchWarpCount;
|
||||
public int GpuVaBitCount;
|
||||
public int Reserved;
|
||||
public int NumTpcPerGpc;
|
||||
public int BusType;
|
||||
public int BigPageSize;
|
||||
public int CompressionPageSize;
|
||||
public int PdeCoverageBitCount;
|
||||
public int AvailableBigPageSizes;
|
||||
public int GpcMask;
|
||||
public int SmArchSmVersion;
|
||||
public int SmArchSpaVersion;
|
||||
public int SmArchWarpCount;
|
||||
public int GpuVaBitCount;
|
||||
public int Reserved;
|
||||
public long Flags;
|
||||
public int TwodClass;
|
||||
public int ThreedClass;
|
||||
public int ComputeClass;
|
||||
public int GpfifoClass;
|
||||
public int InlineToMemoryClass;
|
||||
public int DmaCopyClass;
|
||||
public int MaxFbpsCount;
|
||||
public int FbpEnMask;
|
||||
public int MaxLtcPerFbp;
|
||||
public int MaxLtsPerLtc;
|
||||
public int MaxTexPerTpc;
|
||||
public int MaxGpcCount;
|
||||
public int RopL2EnMask0;
|
||||
public int RopL2EnMask1;
|
||||
public int TwodClass;
|
||||
public int ThreedClass;
|
||||
public int ComputeClass;
|
||||
public int GpfifoClass;
|
||||
public int InlineToMemoryClass;
|
||||
public int DmaCopyClass;
|
||||
public int MaxFbpsCount;
|
||||
public int FbpEnMask;
|
||||
public int MaxLtcPerFbp;
|
||||
public int MaxLtsPerLtc;
|
||||
public int MaxTexPerTpc;
|
||||
public int MaxGpcCount;
|
||||
public int RopL2EnMask0;
|
||||
public int RopL2EnMask1;
|
||||
public long ChipName;
|
||||
public long GrCompbitStoreBaseHw;
|
||||
}
|
||||
|
||||
struct CharacteristicsHeader
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public long BufferSize;
|
||||
public long BufferAddress;
|
||||
#pragma warning restore CS0649
|
||||
@@ -54,6 +54,6 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types
|
||||
struct GetCharacteristicsArguments
|
||||
{
|
||||
public CharacteristicsHeader Header;
|
||||
public GpuCharacteristics Characteristics;
|
||||
public GpuCharacteristics Characteristics;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct GetTpcMasksArguments
|
||||
{
|
||||
public int MaskBufferSize;
|
||||
public int Reserved;
|
||||
public int MaskBufferSize;
|
||||
public int Reserved;
|
||||
public long MaskBufferAddress;
|
||||
public int TpcMask;
|
||||
public int Padding;
|
||||
public int TpcMask;
|
||||
public int Padding;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Ryujinx.Common.Memory;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrlGpu.Types
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Ryujinx.Memory;
|
||||
using System;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostDbgGpu
|
||||
{
|
||||
class NvHostDbgGpuDeviceFile : NvDeviceFile
|
||||
|
||||
@@ -2,31 +2,31 @@
|
||||
{
|
||||
enum NvInternalResult
|
||||
{
|
||||
Success = 0,
|
||||
Success = 0,
|
||||
OperationNotPermitted = -1,
|
||||
NoEntry = -2,
|
||||
Interrupted = -4,
|
||||
IoError = -5,
|
||||
DeviceNotFound = -6,
|
||||
BadFileNumber = -9,
|
||||
TryAgain = -11,
|
||||
OutOfMemory = -12,
|
||||
AccessDenied = -13,
|
||||
BadAddress = -14,
|
||||
Busy = -16,
|
||||
NotADirectory = -20,
|
||||
InvalidInput = -22,
|
||||
FileTableOverflow = -23,
|
||||
Unknown0x18 = -24,
|
||||
NotSupported = -25,
|
||||
FileTooBig = -27,
|
||||
NoSpaceLeft = -28,
|
||||
ReadOnlyAttribute = -30,
|
||||
NotImplemented = -38,
|
||||
InvalidState = -40,
|
||||
Restart = -85,
|
||||
InvalidAddress = -99,
|
||||
TimedOut = -110,
|
||||
Unknown0x72 = -114,
|
||||
NoEntry = -2,
|
||||
Interrupted = -4,
|
||||
IoError = -5,
|
||||
DeviceNotFound = -6,
|
||||
BadFileNumber = -9,
|
||||
TryAgain = -11,
|
||||
OutOfMemory = -12,
|
||||
AccessDenied = -13,
|
||||
BadAddress = -14,
|
||||
Busy = -16,
|
||||
NotADirectory = -20,
|
||||
InvalidInput = -22,
|
||||
FileTableOverflow = -23,
|
||||
Unknown0x18 = -24,
|
||||
NotSupported = -25,
|
||||
FileTooBig = -27,
|
||||
NoSpaceLeft = -28,
|
||||
ReadOnlyAttribute = -30,
|
||||
NotImplemented = -38,
|
||||
InvalidState = -40,
|
||||
Restart = -85,
|
||||
InvalidAddress = -99,
|
||||
TimedOut = -110,
|
||||
Unknown0x72 = -114,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap
|
||||
{
|
||||
private const int FlagNotFreedYet = 1;
|
||||
|
||||
private static NvMapIdDictionary _maps = new NvMapIdDictionary();
|
||||
private static readonly NvMapIdDictionary _maps = new();
|
||||
|
||||
public NvMapDeviceFile(ServiceCtx context, IVirtualMemoryManager memory, ulong owner) : base(context, owner)
|
||||
{
|
||||
@@ -125,8 +125,8 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap
|
||||
{
|
||||
map.Allocated = true;
|
||||
|
||||
map.Align = arguments.Align;
|
||||
map.Kind = (byte)arguments.Kind;
|
||||
map.Align = arguments.Align;
|
||||
map.Kind = (byte)arguments.Kind;
|
||||
|
||||
int size = BitUtils.AlignUp(map.Size, (int)MemoryManager.PageSize);
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap
|
||||
|
||||
if (result == NvInternalResult.Success)
|
||||
{
|
||||
map.Size = size;
|
||||
map.Size = size;
|
||||
map.Address = address;
|
||||
}
|
||||
}
|
||||
@@ -164,12 +164,12 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap
|
||||
if (DecrementMapRefCount(Owner, arguments.Handle))
|
||||
{
|
||||
arguments.Address = map.Address;
|
||||
arguments.Flags = 0;
|
||||
arguments.Flags = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
arguments.Address = 0;
|
||||
arguments.Flags = FlagNotFreedYet;
|
||||
arguments.Flags = FlagNotFreedYet;
|
||||
}
|
||||
|
||||
arguments.Size = map.Size;
|
||||
@@ -190,15 +190,26 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap
|
||||
|
||||
switch (arguments.Param)
|
||||
{
|
||||
case NvMapHandleParam.Size: arguments.Result = map.Size; break;
|
||||
case NvMapHandleParam.Align: arguments.Result = map.Align; break;
|
||||
case NvMapHandleParam.Heap: arguments.Result = 0x40000000; break;
|
||||
case NvMapHandleParam.Kind: arguments.Result = map.Kind; break;
|
||||
case NvMapHandleParam.Compr: arguments.Result = 0; break;
|
||||
case NvMapHandleParam.Size:
|
||||
arguments.Result = map.Size;
|
||||
break;
|
||||
case NvMapHandleParam.Align:
|
||||
arguments.Result = map.Align;
|
||||
break;
|
||||
case NvMapHandleParam.Heap:
|
||||
arguments.Result = 0x40000000;
|
||||
break;
|
||||
case NvMapHandleParam.Kind:
|
||||
arguments.Result = map.Kind;
|
||||
break;
|
||||
case NvMapHandleParam.Compr:
|
||||
arguments.Result = 0;
|
||||
break;
|
||||
|
||||
// Note: Base is not supported and returns an error.
|
||||
// Any other value also returns an error.
|
||||
default: return NvInternalResult.InvalidInput;
|
||||
default:
|
||||
return NvInternalResult.InvalidInput;
|
||||
}
|
||||
|
||||
return NvInternalResult.Success;
|
||||
|
||||
@@ -5,11 +5,11 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct NvMapAlloc
|
||||
{
|
||||
public int Handle;
|
||||
public int HeapMask;
|
||||
public int Flags;
|
||||
public int Align;
|
||||
public long Kind;
|
||||
public int Handle;
|
||||
public int HeapMask;
|
||||
public int Flags;
|
||||
public int Align;
|
||||
public long Kind;
|
||||
public ulong Address;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap
|
||||
public int Size;
|
||||
public int Handle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct NvMapFree
|
||||
{
|
||||
public int Handle;
|
||||
public int Padding;
|
||||
public int Handle;
|
||||
public int Padding;
|
||||
public ulong Address;
|
||||
public int Size;
|
||||
public int Flags;
|
||||
public int Size;
|
||||
public int Flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap
|
||||
public int Id;
|
||||
public int Handle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap
|
||||
public int Id;
|
||||
public int Handle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,15 +4,15 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap
|
||||
{
|
||||
class NvMapHandle
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
public int Handle;
|
||||
public int Id;
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public int Handle;
|
||||
public int Id;
|
||||
#pragma warning restore CS0649
|
||||
public int Size;
|
||||
public int Align;
|
||||
public int Kind;
|
||||
public int Size;
|
||||
public int Align;
|
||||
public int Kind;
|
||||
public ulong Address;
|
||||
public bool Allocated;
|
||||
public bool Allocated;
|
||||
public ulong DmaMapAddress;
|
||||
|
||||
private long _dupes;
|
||||
@@ -37,4 +37,4 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap
|
||||
return Interlocked.Decrement(ref _dupes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap
|
||||
{
|
||||
enum NvMapHandleParam
|
||||
{
|
||||
Size = 1,
|
||||
Size = 1,
|
||||
Align = 2,
|
||||
Base = 3,
|
||||
Heap = 4,
|
||||
Kind = 5,
|
||||
Compr = 6
|
||||
Base = 3,
|
||||
Heap = 4,
|
||||
Kind = 5,
|
||||
Compr = 6,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,4 +58,4 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap
|
||||
return values;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct NvMapParam
|
||||
{
|
||||
public int Handle;
|
||||
public int Handle;
|
||||
public NvMapHandleParam Param;
|
||||
public int Result;
|
||||
public int Result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user