1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-11-11 21:06:41 +00:00
Ryujinx/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostChannel/NvHostGpuDeviceFile.cs

79 lines
2.6 KiB
C#
Raw Normal View History

using Ryujinx.HLE.HOS.Kernel.Common;
using Ryujinx.HLE.HOS.Kernel.Threading;
using Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel.Types;
using System;
namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostChannel
{
internal class NvHostGpuDeviceFile : NvHostChannelDeviceFile
{
private KEvent _smExceptionBptIntReportEvent;
private KEvent _smExceptionBptPauseReportEvent;
private KEvent _errorNotifierEvent;
public NvHostGpuDeviceFile(ServiceCtx context) : base(context)
{
_smExceptionBptIntReportEvent = new KEvent(context.Device.System);
_smExceptionBptPauseReportEvent = new KEvent(context.Device.System);
_errorNotifierEvent = new KEvent(context.Device.System);
}
public override NvInternalResult Ioctl2(NvIoctl command, Span<byte> arguments, Span<byte> inlineInBuffer)
{
NvInternalResult result = NvInternalResult.NotImplemented;
if (command.Type == NvIoctl.NvHostMagic)
{
switch (command.Number)
{
case 0x1b:
2019-10-13 07:02:07 +01:00
result = CallIoctlMethod<SubmitGpfifoArguments, ulong>(SubmitGpfifoEx, arguments, inlineInBuffer);
break;
}
}
return result;
}
public override NvInternalResult QueryEvent(out int eventHandle, uint eventId)
{
// TODO: accurately represent and implement those events.
KEvent targetEvent = null;
switch (eventId)
{
case 0x1:
targetEvent = _smExceptionBptIntReportEvent;
break;
case 0x2:
targetEvent = _smExceptionBptPauseReportEvent;
break;
case 0x3:
targetEvent = _errorNotifierEvent;
break;
}
if (targetEvent != null)
{
if (Owner.HandleTable.GenerateHandle(targetEvent.ReadableEvent, out eventHandle) != KernelResult.Success)
{
throw new InvalidOperationException("Out of handles!");
}
}
else
{
eventHandle = 0;
return NvInternalResult.InvalidInput;
}
return NvInternalResult.Success;
}
2019-10-13 07:02:07 +01:00
private NvInternalResult SubmitGpfifoEx(ref SubmitGpfifoArguments arguments, Span<ulong> inlineData)
{
return SubmitGpfifo(ref arguments, inlineData);
}
}
}