IPC refactor part 3+4: New server HIPC message processor (#4188)
* IPC refactor part 3 + 4: New server HIPC message processor with source generator based serialization * Make types match on calls to AlignUp/AlignDown * Formatting * Address some PR feedback * Move BitfieldExtensions to Ryujinx.Common.Utilities and consolidate implementations * Rename Reader/Writer to SpanReader/SpanWriter and move to Ryujinx.Common.Memory * Implement EventType * Address more PR feedback * Log request processing errors since they are not normal * Rename waitable to multiwait and add missing lock * PR feedback * Ac_K PR feedback
This commit is contained in:
parent
c6a139a6e7
commit
08831eecf7
213 changed files with 9762 additions and 1010 deletions
|
@ -1,39 +0,0 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Graphics.Vic.Types
|
||||
{
|
||||
static class BitfieldExtensions
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool Extract(this int value, int lsb)
|
||||
{
|
||||
return ((value >> (lsb & 0x1f)) & 1) != 0;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static int Extract(this int value, int lsb, int length)
|
||||
{
|
||||
return (value >> (lsb & 0x1f)) & (int)(uint.MaxValue >> (32 - length));
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool Extract(this long value, int lsb)
|
||||
{
|
||||
return ((int)(value >> (lsb & 0x3f)) & 1) != 0;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static int Extract(this long value, int lsb, int length)
|
||||
{
|
||||
return (int)(value >> (lsb & 0x3f)) & (int)(uint.MaxValue >> (32 - length));
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static int ExtractSx(this long value, int lsb, int length)
|
||||
{
|
||||
int shift = lsb & 0x3f;
|
||||
|
||||
return (int)((value << (64 - (shift + length))) >> (64 - length));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,20 +1,22 @@
|
|||
namespace Ryujinx.Graphics.Vic.Types
|
||||
using Ryujinx.Common.Utilities;
|
||||
|
||||
namespace Ryujinx.Graphics.Vic.Types
|
||||
{
|
||||
struct BlendingSlotStruct
|
||||
{
|
||||
private long _word0;
|
||||
private long _word1;
|
||||
|
||||
public int AlphaK1 => _word0.Extract(0, 10);
|
||||
public int AlphaK2 => _word0.Extract(16, 10);
|
||||
public int SrcFactCMatchSelect => _word0.Extract(32, 3);
|
||||
public int DstFactCMatchSelect => _word0.Extract(36, 3);
|
||||
public int SrcFactAMatchSelect => _word0.Extract(40, 3);
|
||||
public int DstFactAMatchSelect => _word0.Extract(44, 3);
|
||||
public int OverrideR => _word1.Extract(66, 10);
|
||||
public int OverrideG => _word1.Extract(76, 10);
|
||||
public int OverrideB => _word1.Extract(86, 10);
|
||||
public int OverrideA => _word1.Extract(96, 10);
|
||||
public int AlphaK1 => (int)_word0.Extract(0, 10);
|
||||
public int AlphaK2 => (int)_word0.Extract(16, 10);
|
||||
public int SrcFactCMatchSelect => (int)_word0.Extract(32, 3);
|
||||
public int DstFactCMatchSelect => (int)_word0.Extract(36, 3);
|
||||
public int SrcFactAMatchSelect => (int)_word0.Extract(40, 3);
|
||||
public int DstFactAMatchSelect => (int)_word0.Extract(44, 3);
|
||||
public int OverrideR => (int)_word1.Extract(66, 10);
|
||||
public int OverrideG => (int)_word1.Extract(76, 10);
|
||||
public int OverrideB => (int)_word1.Extract(86, 10);
|
||||
public int OverrideA => (int)_word1.Extract(96, 10);
|
||||
public bool UseOverrideR => _word1.Extract(108);
|
||||
public bool UseOverrideG => _word1.Extract(109);
|
||||
public bool UseOverrideB => _word1.Extract(110);
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
namespace Ryujinx.Graphics.Vic.Types
|
||||
using Ryujinx.Common.Utilities;
|
||||
|
||||
namespace Ryujinx.Graphics.Vic.Types
|
||||
{
|
||||
struct ClearRectStruct
|
||||
{
|
||||
|
@ -7,13 +9,13 @@
|
|||
private long _word1;
|
||||
#pragma warning restore CS0649
|
||||
|
||||
public int ClearRect0Left => _word0.Extract(0, 14);
|
||||
public int ClearRect0Right => _word0.Extract(16, 14);
|
||||
public int ClearRect0Top => _word0.Extract(32, 14);
|
||||
public int ClearRect0Bottom => _word0.Extract(48, 14);
|
||||
public int ClearRect1Left => _word1.Extract(64, 14);
|
||||
public int ClearRect1Right => _word1.Extract(80, 14);
|
||||
public int ClearRect1Top => _word1.Extract(96, 14);
|
||||
public int ClearRect1Bottom => _word1.Extract(112, 14);
|
||||
public int ClearRect0Left => (int)_word0.Extract(0, 14);
|
||||
public int ClearRect0Right => (int)_word0.Extract(16, 14);
|
||||
public int ClearRect0Top => (int)_word0.Extract(32, 14);
|
||||
public int ClearRect0Bottom => (int)_word0.Extract(48, 14);
|
||||
public int ClearRect1Left => (int)_word1.Extract(64, 14);
|
||||
public int ClearRect1Right => (int)_word1.Extract(80, 14);
|
||||
public int ClearRect1Top => (int)_word1.Extract(96, 14);
|
||||
public int ClearRect1Bottom => (int)_word1.Extract(112, 14);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
namespace Ryujinx.Graphics.Vic.Types
|
||||
using Ryujinx.Common.Utilities;
|
||||
|
||||
namespace Ryujinx.Graphics.Vic.Types
|
||||
{
|
||||
struct LumaKeyStruct
|
||||
{
|
||||
private long _word0;
|
||||
private long _word1;
|
||||
|
||||
public int LumaCoeff0 => _word0.Extract(0, 20);
|
||||
public int LumaCoeff1 => _word0.Extract(20, 20);
|
||||
public int LumaCoeff2 => _word0.Extract(40, 20);
|
||||
public int LumaRShift => _word0.Extract(60, 4);
|
||||
public int LumaCoeff3 => _word1.Extract(64, 20);
|
||||
public int LumaKeyLower => _word1.Extract(84, 10);
|
||||
public int LumaKeyUpper => _word1.Extract(94, 10);
|
||||
public int LumaCoeff0 => (int)_word0.Extract(0, 20);
|
||||
public int LumaCoeff1 => (int)_word0.Extract(20, 20);
|
||||
public int LumaCoeff2 => (int)_word0.Extract(40, 20);
|
||||
public int LumaRShift => (int)_word0.Extract(60, 4);
|
||||
public int LumaCoeff3 => (int)_word1.Extract(64, 20);
|
||||
public int LumaKeyLower => (int)_word1.Extract(84, 10);
|
||||
public int LumaKeyUpper => (int)_word1.Extract(94, 10);
|
||||
public bool LumaKeyEnabled => _word1.Extract(104);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
namespace Ryujinx.Graphics.Vic.Types
|
||||
using Ryujinx.Common.Utilities;
|
||||
|
||||
namespace Ryujinx.Graphics.Vic.Types
|
||||
{
|
||||
struct MatrixStruct
|
||||
{
|
||||
|
@ -7,19 +9,19 @@
|
|||
private long _word2;
|
||||
private long _word3;
|
||||
|
||||
public int MatrixCoeff00 => _word0.ExtractSx(0, 20);
|
||||
public int MatrixCoeff10 => _word0.ExtractSx(20, 20);
|
||||
public int MatrixCoeff20 => _word0.ExtractSx(40, 20);
|
||||
public int MatrixRShift => _word0.Extract(60, 4);
|
||||
public int MatrixCoeff01 => _word1.ExtractSx(64, 20);
|
||||
public int MatrixCoeff11 => _word1.ExtractSx(84, 20);
|
||||
public int MatrixCoeff21 => _word1.ExtractSx(104, 20);
|
||||
public int MatrixCoeff00 => (int)_word0.ExtractSx(0, 20);
|
||||
public int MatrixCoeff10 => (int)_word0.ExtractSx(20, 20);
|
||||
public int MatrixCoeff20 => (int)_word0.ExtractSx(40, 20);
|
||||
public int MatrixRShift => (int)_word0.Extract(60, 4);
|
||||
public int MatrixCoeff01 => (int)_word1.ExtractSx(64, 20);
|
||||
public int MatrixCoeff11 => (int)_word1.ExtractSx(84, 20);
|
||||
public int MatrixCoeff21 => (int)_word1.ExtractSx(104, 20);
|
||||
public bool MatrixEnable => _word1.Extract(127);
|
||||
public int MatrixCoeff02 => _word2.ExtractSx(128, 20);
|
||||
public int MatrixCoeff12 => _word2.ExtractSx(148, 20);
|
||||
public int MatrixCoeff22 => _word2.ExtractSx(168, 20);
|
||||
public int MatrixCoeff03 => _word3.ExtractSx(192, 20);
|
||||
public int MatrixCoeff13 => _word3.ExtractSx(212, 20);
|
||||
public int MatrixCoeff23 => _word3.ExtractSx(232, 20);
|
||||
public int MatrixCoeff02 => (int)_word2.ExtractSx(128, 20);
|
||||
public int MatrixCoeff12 => (int)_word2.ExtractSx(148, 20);
|
||||
public int MatrixCoeff22 => (int)_word2.ExtractSx(168, 20);
|
||||
public int MatrixCoeff03 => (int)_word3.ExtractSx(192, 20);
|
||||
public int MatrixCoeff13 => (int)_word3.ExtractSx(212, 20);
|
||||
public int MatrixCoeff23 => (int)_word3.ExtractSx(232, 20);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
namespace Ryujinx.Graphics.Vic.Types
|
||||
using Ryujinx.Common.Utilities;
|
||||
|
||||
namespace Ryujinx.Graphics.Vic.Types
|
||||
{
|
||||
struct OutputConfig
|
||||
{
|
||||
|
@ -7,19 +9,19 @@
|
|||
private long _word1;
|
||||
#pragma warning restore CS0649
|
||||
|
||||
public int AlphaFillMode => _word0.Extract(0, 3);
|
||||
public int AlphaFillSlot => _word0.Extract(3, 3);
|
||||
public int BackgroundAlpha => _word0.Extract(6, 10);
|
||||
public int BackgroundR => _word0.Extract(16, 10);
|
||||
public int BackgroundG => _word0.Extract(26, 10);
|
||||
public int BackgroundB => _word0.Extract(36, 10);
|
||||
public int RegammaMode => _word0.Extract(46, 2);
|
||||
public int AlphaFillMode => (int)_word0.Extract(0, 3);
|
||||
public int AlphaFillSlot => (int)_word0.Extract(3, 3);
|
||||
public int BackgroundAlpha => (int)_word0.Extract(6, 10);
|
||||
public int BackgroundR => (int)_word0.Extract(16, 10);
|
||||
public int BackgroundG => (int)_word0.Extract(26, 10);
|
||||
public int BackgroundB => (int)_word0.Extract(36, 10);
|
||||
public int RegammaMode => (int)_word0.Extract(46, 2);
|
||||
public bool OutputFlipX => _word0.Extract(48);
|
||||
public bool OutputFlipY => _word0.Extract(49);
|
||||
public bool OutputTranspose => _word0.Extract(50);
|
||||
public int TargetRectLeft => _word1.Extract(64, 14);
|
||||
public int TargetRectRight => _word1.Extract(80, 14);
|
||||
public int TargetRectTop => _word1.Extract(96, 14);
|
||||
public int TargetRectBottom => _word1.Extract(112, 14);
|
||||
public int TargetRectLeft => (int)_word1.Extract(64, 14);
|
||||
public int TargetRectRight => (int)_word1.Extract(80, 14);
|
||||
public int TargetRectTop => (int)_word1.Extract(96, 14);
|
||||
public int TargetRectBottom => (int)_word1.Extract(112, 14);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
namespace Ryujinx.Graphics.Vic.Types
|
||||
using Ryujinx.Common.Utilities;
|
||||
|
||||
namespace Ryujinx.Graphics.Vic.Types
|
||||
{
|
||||
struct OutputSurfaceConfig
|
||||
{
|
||||
|
@ -8,15 +10,15 @@
|
|||
#pragma warning restore CS0649
|
||||
|
||||
public PixelFormat OutPixelFormat => (PixelFormat)_word0.Extract(0, 7);
|
||||
public int OutChromaLocHoriz => _word0.Extract(7, 2);
|
||||
public int OutChromaLocVert => _word0.Extract(9, 2);
|
||||
public int OutBlkKind => _word0.Extract(11, 4);
|
||||
public int OutBlkHeight => _word0.Extract(15, 4);
|
||||
public int OutSurfaceWidth => _word0.Extract(32, 14);
|
||||
public int OutSurfaceHeight => _word0.Extract(46, 14);
|
||||
public int OutLumaWidth => _word1.Extract(64, 14);
|
||||
public int OutLumaHeight => _word1.Extract(78, 14);
|
||||
public int OutChromaWidth => _word1.Extract(96, 14);
|
||||
public int OutChromaHeight => _word1.Extract(110, 14);
|
||||
public int OutChromaLocHoriz => (int)_word0.Extract(7, 2);
|
||||
public int OutChromaLocVert => (int)_word0.Extract(9, 2);
|
||||
public int OutBlkKind => (int)_word0.Extract(11, 4);
|
||||
public int OutBlkHeight => (int)_word0.Extract(15, 4);
|
||||
public int OutSurfaceWidth => (int)_word0.Extract(32, 14);
|
||||
public int OutSurfaceHeight => (int)_word0.Extract(46, 14);
|
||||
public int OutLumaWidth => (int)_word1.Extract(64, 14);
|
||||
public int OutLumaHeight => (int)_word1.Extract(78, 14);
|
||||
public int OutChromaWidth => (int)_word1.Extract(96, 14);
|
||||
public int OutChromaHeight => (int)_word1.Extract(110, 14);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
namespace Ryujinx.Graphics.Vic.Types
|
||||
using Ryujinx.Common.Utilities;
|
||||
|
||||
namespace Ryujinx.Graphics.Vic.Types
|
||||
{
|
||||
struct PipeConfig
|
||||
{
|
||||
|
@ -7,7 +9,7 @@
|
|||
private long _word1;
|
||||
#pragma warning restore CS0169, CS0649
|
||||
|
||||
public int DownsampleHoriz => _word0.Extract(0, 11);
|
||||
public int DownsampleVert => _word0.Extract(16, 11);
|
||||
public int DownsampleHoriz => (int)_word0.Extract(0, 11);
|
||||
public int DownsampleVert => (int)_word0.Extract(16, 11);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
namespace Ryujinx.Graphics.Vic.Types
|
||||
using Ryujinx.Common.Utilities;
|
||||
|
||||
namespace Ryujinx.Graphics.Vic.Types
|
||||
{
|
||||
struct SlotConfig
|
||||
{
|
||||
|
@ -28,36 +30,36 @@
|
|||
public bool PpMotionFieldEnable => _word0.Extract(14);
|
||||
public bool CombMotionFieldEnable => _word0.Extract(15);
|
||||
public FrameFormat FrameFormat => (FrameFormat)_word0.Extract(16, 4);
|
||||
public int FilterLengthY => _word0.Extract(20, 2);
|
||||
public int FilterLengthX => _word0.Extract(22, 2);
|
||||
public int Panoramic => _word0.Extract(24, 12);
|
||||
public int DetailFltClamp => _word0.Extract(58, 6);
|
||||
public int FilterNoise => _word1.Extract(64, 10);
|
||||
public int FilterDetail => _word1.Extract(74, 10);
|
||||
public int ChromaNoise => _word1.Extract(84, 10);
|
||||
public int ChromaDetail => _word1.Extract(94, 10);
|
||||
public int FilterLengthY => (int)_word0.Extract(20, 2);
|
||||
public int FilterLengthX => (int)_word0.Extract(22, 2);
|
||||
public int Panoramic => (int)_word0.Extract(24, 12);
|
||||
public int DetailFltClamp => (int)_word0.Extract(58, 6);
|
||||
public int FilterNoise => (int)_word1.Extract(64, 10);
|
||||
public int FilterDetail => (int)_word1.Extract(74, 10);
|
||||
public int ChromaNoise => (int)_word1.Extract(84, 10);
|
||||
public int ChromaDetail => (int)_word1.Extract(94, 10);
|
||||
public DeinterlaceMode DeinterlaceMode => (DeinterlaceMode)_word1.Extract(104, 4);
|
||||
public int MotionAccumWeight => _word1.Extract(108, 3);
|
||||
public int NoiseIir => _word1.Extract(111, 11);
|
||||
public int LightLevel => _word1.Extract(122, 4);
|
||||
public int SoftClampLow => _word2.Extract(128, 10);
|
||||
public int SoftClampHigh => _word2.Extract(138, 10);
|
||||
public int PlanarAlpha => _word2.Extract(160, 10);
|
||||
public int MotionAccumWeight => (int)_word1.Extract(108, 3);
|
||||
public int NoiseIir => (int)_word1.Extract(111, 11);
|
||||
public int LightLevel => (int)_word1.Extract(122, 4);
|
||||
public int SoftClampLow => (int)_word2.Extract(128, 10);
|
||||
public int SoftClampHigh => (int)_word2.Extract(138, 10);
|
||||
public int PlanarAlpha => (int)_word2.Extract(160, 10);
|
||||
public bool ConstantAlpha => _word2.Extract(170);
|
||||
public int StereoInterleave => _word2.Extract(171, 3);
|
||||
public int StereoInterleave => (int)_word2.Extract(171, 3);
|
||||
public bool ClipEnabled => _word2.Extract(174);
|
||||
public int ClearRectMask => _word2.Extract(175, 8);
|
||||
public int DegammaMode => _word2.Extract(183, 2);
|
||||
public int ClearRectMask => (int)_word2.Extract(175, 8);
|
||||
public int DegammaMode => (int)_word2.Extract(183, 2);
|
||||
public bool DecompressEnable => _word2.Extract(186);
|
||||
public int DecompressCtbCount => _word3.Extract(192, 8);
|
||||
public int DecompressZbcColor => _word3.Extract(200, 32);
|
||||
public int SourceRectLeft => _word4.Extract(256, 30);
|
||||
public int SourceRectRight => _word4.Extract(288, 30);
|
||||
public int SourceRectTop => _word5.Extract(320, 30);
|
||||
public int SourceRectBottom => _word5.Extract(352, 30);
|
||||
public int DstRectLeft => _word6.Extract(384, 14);
|
||||
public int DstRectRight => _word6.Extract(400, 14);
|
||||
public int DstRectTop => _word6.Extract(416, 14);
|
||||
public int DstRectBottom => _word6.Extract(432, 14);
|
||||
public int DecompressCtbCount => (int)_word3.Extract(192, 8);
|
||||
public int DecompressZbcColor => (int)_word3.Extract(200, 32);
|
||||
public int SourceRectLeft => (int)_word4.Extract(256, 30);
|
||||
public int SourceRectRight => (int)_word4.Extract(288, 30);
|
||||
public int SourceRectTop => (int)_word5.Extract(320, 30);
|
||||
public int SourceRectBottom => (int)_word5.Extract(352, 30);
|
||||
public int DstRectLeft => (int)_word6.Extract(384, 14);
|
||||
public int DstRectRight => (int)_word6.Extract(400, 14);
|
||||
public int DstRectTop => (int)_word6.Extract(416, 14);
|
||||
public int DstRectBottom => (int)_word6.Extract(432, 14);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
namespace Ryujinx.Graphics.Vic.Types
|
||||
using Ryujinx.Common.Utilities;
|
||||
|
||||
namespace Ryujinx.Graphics.Vic.Types
|
||||
{
|
||||
struct SlotSurfaceConfig
|
||||
{
|
||||
|
@ -6,16 +8,16 @@
|
|||
private long _word1;
|
||||
|
||||
public PixelFormat SlotPixelFormat => (PixelFormat)_word0.Extract(0, 7);
|
||||
public int SlotChromaLocHoriz => _word0.Extract(7, 2);
|
||||
public int SlotChromaLocVert => _word0.Extract(9, 2);
|
||||
public int SlotBlkKind => _word0.Extract(11, 4);
|
||||
public int SlotBlkHeight => _word0.Extract(15, 4);
|
||||
public int SlotCacheWidth => _word0.Extract(19, 3);
|
||||
public int SlotSurfaceWidth => _word0.Extract(32, 14);
|
||||
public int SlotSurfaceHeight => _word0.Extract(46, 14);
|
||||
public int SlotLumaWidth => _word1.Extract(64, 14);
|
||||
public int SlotLumaHeight => _word1.Extract(78, 14);
|
||||
public int SlotChromaWidth => _word1.Extract(96, 14);
|
||||
public int SlotChromaHeight => _word1.Extract(110, 14);
|
||||
public int SlotChromaLocHoriz => (int)_word0.Extract(7, 2);
|
||||
public int SlotChromaLocVert => (int)_word0.Extract(9, 2);
|
||||
public int SlotBlkKind => (int)_word0.Extract(11, 4);
|
||||
public int SlotBlkHeight => (int)_word0.Extract(15, 4);
|
||||
public int SlotCacheWidth => (int)_word0.Extract(19, 3);
|
||||
public int SlotSurfaceWidth => (int)_word0.Extract(32, 14);
|
||||
public int SlotSurfaceHeight => (int)_word0.Extract(46, 14);
|
||||
public int SlotLumaWidth => (int)_word1.Extract(64, 14);
|
||||
public int SlotLumaHeight => (int)_word1.Extract(78, 14);
|
||||
public int SlotChromaWidth => (int)_word1.Extract(96, 14);
|
||||
public int SlotChromaHeight => (int)_word1.Extract(110, 14);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue