From 8b44eb1c981d7106be37107755c7c71c3c3c0ce4 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Wed, 7 Jul 2021 20:56:06 -0300 Subject: Separate GPU engines and make state follow official docs (part 1/2) (#2422) * Use DeviceState for compute and i2m * Migrate 2D class, more comments * Migrate DMA copy engine * Remove now unused code * Replace GpuState by GpuAccessorState on GpuAcessor, since compute no longer has a GpuState * More comments * Add logging (disabled) * Add back i2m on 3D engine --- .../Engine/GPFifo/GPFifoClassState.cs | 45 ++++++++++++++++++++++ .../Engine/GPFifo/GPFifoProcessor.cs | 21 +++++++++- 2 files changed, 64 insertions(+), 2 deletions(-) (limited to 'Ryujinx.Graphics.Gpu/Engine/GPFifo') diff --git a/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClassState.cs b/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClassState.cs index 28dd15bd..07d062eb 100644 --- a/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClassState.cs +++ b/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoClassState.cs @@ -4,6 +4,9 @@ using Ryujinx.Common.Memory; namespace Ryujinx.Graphics.Gpu.Engine.GPFifo { + /// + /// Semaphore operation. + /// enum SemaphoredOperation { Acquire = 1, @@ -13,24 +16,36 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo Reduction = 16 } + /// + /// Semaphore acquire switch enable. + /// enum SemaphoredAcquireSwitch { Disabled = 0, Enabled = 1 } + /// + /// Semaphore release interrupt wait enable. + /// enum SemaphoredReleaseWfi { En = 0, Dis = 1 } + /// + /// Semaphore release structure size. + /// enum SemaphoredReleaseSize { SixteenBytes = 0, FourBytes = 1 } + /// + /// Semaphore reduction operation. + /// enum SemaphoredReduction { Min = 0, @@ -43,24 +58,36 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo Dec = 7 } + /// + /// Semaphore format. + /// enum SemaphoredFormat { Signed = 0, Unsigned = 1 } + /// + /// Memory Translation Lookaside Buffer Page Directory Buffer invalidation. + /// enum MemOpCTlbInvalidatePdb { One = 0, All = 1 } + /// + /// Memory Translation Lookaside Buffer GPC invalidation enable. + /// enum MemOpCTlbInvalidateGpc { Enable = 0, Disable = 1 } + /// + /// Memory Translation Lookaside Buffer invalidation target. + /// enum MemOpCTlbInvalidateTarget { VidMem = 0, @@ -68,6 +95,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo SysMemNoncoherent = 3 } + /// + /// Memory operation. + /// enum MemOpDOperation { Membar = 5, @@ -78,24 +108,36 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo L2FlushDirty = 16 } + /// + /// Syncpoint operation. + /// enum SyncpointbOperation { Wait = 0, Incr = 1 } + /// + /// Syncpoint wait switch enable. + /// enum SyncpointbWaitSwitch { Dis = 0, En = 1 } + /// + /// Wait for interrupt scope. + /// enum WfiScope { CurrentScgType = 0, All = 1 } + /// + /// Yield operation. + /// enum YieldOp { Nop = 0, @@ -104,6 +146,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo Tsg = 3 } + /// + /// General Purpose FIFO class state. + /// struct GPFifoClassState { #pragma warning disable CS0649 diff --git a/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoProcessor.cs b/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoProcessor.cs index c683d179..d12b6810 100644 --- a/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoProcessor.cs +++ b/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoProcessor.cs @@ -1,4 +1,9 @@ -using Ryujinx.Graphics.Gpu.Memory; +using Ryujinx.Graphics.Device; +using Ryujinx.Graphics.Gpu.Engine.Compute; +using Ryujinx.Graphics.Gpu.Engine.Dma; +using Ryujinx.Graphics.Gpu.Engine.InlineToMemory; +using Ryujinx.Graphics.Gpu.Engine.Twod; +using Ryujinx.Graphics.Gpu.Memory; using Ryujinx.Graphics.Gpu.State; using System; using System.Runtime.CompilerServices; @@ -33,6 +38,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo private DmaState _state; private readonly GpuState[] _subChannels; + private readonly IDeviceState[] _subChannels2; private readonly GPFifoClass _fifoClass; /// @@ -47,10 +53,21 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo _fifoClass = new GPFifoClass(context, this); _subChannels = new GpuState[8]; + _subChannels2 = new IDeviceState[8] + { + null, + new ComputeClass(context, channel), + new InlineToMemoryClass(context, channel), + new TwodClass(channel), + new DmaClass(context, channel), + null, + null, + null + }; for (int index = 0; index < _subChannels.Length; index++) { - _subChannels[index] = new GpuState(channel); + _subChannels[index] = new GpuState(channel, _subChannels2[index]); _context.Methods.RegisterCallbacks(_subChannels[index]); } -- cgit v1.2.3