示例#1
0
        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 <SyncptIncr>    waitChecks     = GetSpanAndSkip <SyncptIncr>(ref arguments, submitHeader.SyncptIncrsCount); // ?
            Span <Fence>         fences         = GetSpanAndSkip <Fence>(ref arguments, submitHeader.FencesCount);

            lock (_device)
            {
                for (int i = 0; i < syncptIncrs.Length; i++)
                {
                    SyncptIncr syncptIncr = syncptIncrs[i];

                    uint id = syncptIncr.Id;

                    fences[i].Id     = id;
                    fences[i].Thresh = Context.Device.System.HostSyncpoint.IncrementSyncpointMax(id, syncptIncr.Incrs);
                }

                foreach (CommandBuffer commandBuffer in commandBuffers)
                {
                    NvMapHandle map = NvMapDeviceFile.GetMapFromHandle(Owner, commandBuffer.Mem);

                    var data = _memory.GetSpan((ulong)map.Address + commandBuffer.Offset, commandBuffer.WordsCount * 4);

                    _device.Host1x.Submit(MemoryMarshal.Cast <byte, int>(data));
                }
            }

            fences[0].Thresh = Context.Device.System.HostSyncpoint.IncrementSyncpointMax(fences[0].Id, 1);

            Span <int> tmpCmdBuff = stackalloc int[1];

            tmpCmdBuff[0] = (4 << 28) | (int)fences[0].Id;

            _device.Host1x.Submit(tmpCmdBuff);

            return(NvInternalResult.Success);
        }
示例#2
0
 /// <summary>
 /// Gets a span of data from the application process.
 /// </summary>
 /// <param name="address">Start address of the range</param>
 /// <param name="size">Size in bytes to be range</param>
 /// <param name="tracked">True if read tracking is triggered on the span</param>
 /// <returns>A read only span of the data at the specified memory location</returns>
 public ReadOnlySpan <byte> GetSpan(ulong address, int size, bool tracked = false)
 {
     return(_cpuMemory.GetSpan(address, size, tracked));
 }
示例#3
0
 /// <summary>
 /// Gets a span of data from the application process.
 /// </summary>
 /// <param name="address">Start address of the range</param>
 /// <param name="size">Size in bytes to be range</param>
 /// <returns>A read only span of the data at the specified memory location</returns>
 public ReadOnlySpan <byte> GetSpan(ulong address, int size)
 {
     return(_cpuMemory.GetSpan(address, size));
 }