Ejemplo n.º 1
0
        private static int Submit(ServiceCtx context)
        {
            long inputPosition  = context.Request.GetBufferType0x21().Position;
            long outputPosition = context.Request.GetBufferType0x22().Position;

            NvHostChannelSubmit args = MemoryHelper.Read <NvHostChannelSubmit>(context.Memory, inputPosition);

            NvGpuVmm vmm = NvGpuASIoctl.GetASCtx(context).Vmm;

            for (int index = 0; index < args.CmdBufsCount; index++)
            {
                long cmdBufOffset = inputPosition + 0x10 + index * 0xc;

                NvHostChannelCmdBuf cmdBuf = MemoryHelper.Read <NvHostChannelCmdBuf>(context.Memory, cmdBufOffset);

                NvMapHandle map = NvMapIoctl.GetNvMap(context, cmdBuf.MemoryId);

                int[] cmdBufData = new int[cmdBuf.WordsCount];

                for (int offset = 0; offset < cmdBufData.Length; offset++)
                {
                    cmdBufData[offset] = context.Memory.ReadInt32(map.Address + cmdBuf.Offset + offset * 4);
                }

                context.Device.Gpu.PushCommandBuffer(vmm, cmdBufData);
            }

            // TODO: Relocation, waitchecks, etc.

            return(NvResult.Success);
        }
Ejemplo n.º 2
0
        private static int Submit(ServiceCtx Context)
        {
            long InputPosition  = Context.Request.GetBufferType0x21().Position;
            long OutputPosition = Context.Request.GetBufferType0x22().Position;

            NvHostChannelSubmit Args = MemoryHelper.Read <NvHostChannelSubmit>(Context.Memory, InputPosition);

            NvGpuVmm Vmm = NvGpuASIoctl.GetASCtx(Context).Vmm;

            for (int Index = 0; Index < Args.CmdBufsCount; Index++)
            {
                long CmdBufOffset = InputPosition + 0x10 + Index * 0xc;

                NvHostChannelCmdBuf CmdBuf = MemoryHelper.Read <NvHostChannelCmdBuf>(Context.Memory, CmdBufOffset);

                NvMapHandle Map = NvMapIoctl.GetNvMap(Context, CmdBuf.MemoryId);

                int[] CmdBufData = new int[CmdBuf.WordsCount];

                for (int Offset = 0; Offset < CmdBufData.Length; Offset++)
                {
                    CmdBufData[Offset] = Context.Memory.ReadInt32(Map.Address + CmdBuf.Offset + Offset * 4);
                }

                Context.Device.Gpu.PushCommandBuffer(Vmm, CmdBufData);
            }

            //TODO: Relocation, waitchecks, etc.

            return(NvResult.Success);
        }