Line 7: |
Line 7: |
| | | |
| Each service is used by: | | Each service is used by: |
− | * "nvdrv": regular applications | + | * "nvdrv": Applications. |
− | * "nvdrv:a": applets | + | ** [[#Permissions|Permission]] mask is [3.0.0+] 0xA82B ([1.0.0-2.3.0] 0x2B). |
− | * "nvdrv:s": sysmodules | + | * "nvdrv:a": Applets. |
− | * "nvdrv:t": factory titles | + | ** [[#Permissions|Permission]] mask is [3.0.0+] 0x10A9 ([1.0.0-2.3.0] 0xA9). |
| + | * "nvdrv:s": Sysmodules. |
| + | ** [[#Permissions|Permission]] mask is [3.0.0+] 0x439E ([1.0.0-2.3.0] 0x39E). |
| + | * "nvdrv:t": Factory. |
| + | ** [[#Permissions|Permission]] mask is 0xFFFFFFFF. |
| | | |
| {| class="wikitable" border="1" | | {| class="wikitable" border="1" |
Line 30: |
Line 34: |
| | 6 || [[#GetStatus]] | | | 6 || [[#GetStatus]] |
| |- | | |- |
− | | 7 || [[#SetAruid]] | + | | 7 || [[#SetAruidForTest]] |
| |- | | |- |
− | | 8 || [[#SetAruidByPID]] | + | | 8 || [[#SetAruid]] |
| |- | | |- |
| | 9 || [[#DumpGraphicsMemoryInfo]] | | | 9 || [[#DumpGraphicsMemoryInfo]] |
Line 42: |
Line 46: |
| | 12 || [3.0.0+] [[#Ioctl3]] | | | 12 || [3.0.0+] [[#Ioctl3]] |
| |- | | |- |
− | | 13 || [3.0.0+] [[#FinishInitialize]] | + | | 13 || [3.0.0+] [[#SetGraphicsFirmwareMemoryMarginEnabled]] |
| |} | | |} |
| | | |
Line 84: |
Line 88: |
| Takes no input. Returns 0x10-bytes and an output u32 ('''error_code'''). | | Takes no input. Returns 0x10-bytes and an output u32 ('''error_code'''). |
| | | |
− | == SetAruid == | + | == SetAruidForTest == |
| Takes an input u64 which must [[IPC_Marshalling|match]] the user-process PID ([[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]). Returns an output u32 ('''error_code'''). | | Takes an input u64 which must [[IPC_Marshalling|match]] the user-process PID ([[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]). Returns an output u32 ('''error_code'''). |
| | | |
− | == SetAruidByPID == | + | == SetAruid == |
| Takes a PID-descriptor and an u64 which must [[IPC_Marshalling|match]] the user-process PID ([[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]). Returns an output u32 ('''error_code'''). | | Takes a PID-descriptor and an u64 which must [[IPC_Marshalling|match]] the user-process PID ([[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]). Returns an output u32 ('''error_code'''). |
| | | |
| == DumpGraphicsMemoryInfo == | | == DumpGraphicsMemoryInfo == |
− | No input or output. Does nothing. | + | No input or output. |
| | | |
| == InitializeDevtools == | | == InitializeDevtools == |
− | Takes a copy-handle and an input u32. Returns an output u32 ('''error_code'''). | + | Takes a copy-handle ('''transfer_memory''') and an input u32 ('''transfer_memory_size'''). Returns an output u32 ('''error_code'''). |
| | | |
| == Ioctl2 == | | == Ioctl2 == |
Line 103: |
Line 107: |
| Cmdhdr_word1 is 0x100B instead of 0xC0B. | | Cmdhdr_word1 is 0x100B instead of 0xC0B. |
| | | |
− | == FinishInitialize == | + | == SetGraphicsFirmwareMemoryMarginEnabled == |
| Takes an input u64. No output. | | Takes an input u64. No output. |
| | | |
Line 109: |
Line 113: |
| | | |
| Official user-processes starting with 3.0.0 now use this at the end of nvdrv service init with value 0x1. | | Official user-processes starting with 3.0.0 now use this at the end of nvdrv service init with value 0x1. |
| + | |
| + | = Permissions = |
| + | Each nvdrv service is initialized with a bitfield that controls access to nodes and other operations. |
| + | |
| + | {| class="wikitable" border="1" |
| + | ! Bits |
| + | ! Description |
| + | |- |
| + | | 0 |
| + | | Can access [[#Channels|/dev/nvhost-gpu]], [[#/dev/nvhost-ctrl-gpu|/dev/nvhost-ctrl-gpu]] and [[#/dev/nvhost-as-gpu|/dev/nvhost-as-gpu]]. |
| + | |- |
| + | | 1 |
| + | | Can access [[#/dev/nvhost-dbg-gpu|/dev/nvhost-dbg-gpu]] and [[#/dev/nvhost-prof-gpu|/dev/nvhost-prof-gpu]]. |
| + | |- |
| + | | 2 |
| + | | Can access [[#/dev/nvsched-ctrl|/dev/nvsched-ctrl]]. |
| + | |- |
| + | | 3 |
| + | | Can access [[#Channels|/dev/nvhost-vic]]. |
| + | |- |
| + | | 4 |
| + | | Can access [[#Channels|/dev/nvhost-msenc]]. |
| + | |- |
| + | | 5 |
| + | | Can access [[#Channels|/dev/nvhost-nvdec]]. |
| + | |- |
| + | | 6 |
| + | | |
| + | |- |
| + | | 7 |
| + | | Can access [[#Channels|/dev/nvhost-nvjpg]]. |
| + | |- |
| + | | 8 |
| + | | Can access [[#Channels|/dev/nvhost-display]], [[#/dev/nvcec-ctrl|/dev/nvcec-ctrl]], [[#/dev/nvhdcp_up-ctrl|/dev/nvhdcp_up-ctrl]], [[#/dev/nvdisp-ctrl|/dev/nvdisp-ctrl]], [[#/dev/nvdisp-disp0, /dev/nvdisp-disp1|/dev/nvdisp-disp0]], [[#/dev/nvdisp-disp0, /dev/nvdisp-disp1|/dev/nvdisp-disp1]], [[#/dev/nvdcutil-disp0, /dev/nvdcutil-disp1|/dev/nvdcutil-disp0]] and [[#/dev/nvdcutil-disp0, /dev/nvdcutil-disp1|/dev/nvdcutil-disp1]]. |
| + | |- |
| + | | 9 |
| + | | Can duplicate [[#/dev/nvmap|nvmap]] handles from other processes with [[#NVMAP_IOC_FROM_ID|NVMAP_IOC_FROM_ID]]. |
| + | |- |
| + | | 10 |
| + | | Can use [[#SetAruidForTest|SetAruidForTest]]. |
| + | |- |
| + | | 11 |
| + | | Can use [[#SetGraphicsFirmwareMemoryMarginEnabled|SetGraphicsFirmwareMemoryMarginEnabled]]. |
| + | |- |
| + | | 12 |
| + | | Can duplicate exported [[#/dev/nvmap|nvmap]] handles from other processes with [[#NVMAP_IOC_FROM_ID|NVMAP_IOC_FROM_ID]]. |
| + | |- |
| + | | 13 |
| + | | |
| + | |- |
| + | | 14 |
| + | | Can use [[#NVMAP_IOC_EXPORT_FOR_ARUID|NVMAP_IOC_EXPORT_FOR_ARUID]] and [[#NVMAP_IOC_REMOVE_EXPORT_FOR_ARUID|NVMAP_IOC_REMOVE_EXPORT_FOR_ARUID]]. |
| + | |- |
| + | | 15 |
| + | | |
| + | |- |
| + | | 16-31 |
| + | | Unused. |
| + | |} |
| + | |
| + | Nodes [[#/dev/nvmap|/dev/nvmap]], [[#/dev/nvhost-ctrl|/dev/nvhost-ctrl]] and [[#/dev/nverpt-ctrl|/dev/nverpt-ctrl]] are always accessible. |
| | | |
| = Ioctls = | | = Ioctls = |
Line 718: |
Line 783: |
| struct { | | struct { |
| __in u32 fence_id; | | __in u32 fence_id; |
− | __in u32 fence_value; | + | __in u32 fence_thresh; |
| __in u32 swap_interval; | | __in u32 swap_interval; |
| }; | | }; |
Line 930: |
Line 995: |
| __in u32 flags; // passes 0 | | __in u32 flags; // passes 0 |
| __in u32 reserved; // ignored; passes 0 | | __in u32 reserved; // ignored; passes 0 |
− | __in u64 unk0; | + | __in u64 va_range_start; |
− | __in u64 unk1; | + | __in u64 va_range_end; |
− | __in u64 unk2; | + | __in u64 va_range_split; |
| }; | | }; |
| | | |
Line 1,390: |
Line 1,455: |
| ! Value || Size || Description | | ! Value || Size || Description |
| |- | | |- |
− | | 0xC0??0001 || Variable || NVHOST_IOCTL_CHANNEL_SUBMIT | + | | 0xC0??0001 || Variable || [[#NVHOST_IOCTL_CHANNEL_SUBMIT]] |
| |- | | |- |
| | 0xC0080002 || 8 || [[#NVHOST_IOCTL_CHANNEL_GET_SYNCPOINT]] | | | 0xC0080002 || 8 || [[#NVHOST_IOCTL_CHANNEL_GET_SYNCPOINT]] |
Line 1,410: |
Line 1,475: |
| | 0xC0080023</br>([1.0.0-7.0.1] 0xC0080014) || 8 || [[#NVHOST_IOCTL_CHANNEL_GET_CLK_RATE]] | | | 0xC0080023</br>([1.0.0-7.0.1] 0xC0080014) || 8 || [[#NVHOST_IOCTL_CHANNEL_GET_CLK_RATE]] |
| |- | | |- |
− | | 0xC0??0024 || Variable || NVHOST_IOCTL_CHANNEL_SUBMIT_EX | + | | 0xC0??0024 || Variable || [[#NVHOST_IOCTL_CHANNEL_SUBMIT_EX]] |
| |- | | |- |
| | 0xC0??0025 || Variable || [[#NVHOST_IOCTL_CHANNEL_MAP_CMD_BUFFER_EX]] | | | 0xC0??0025 || Variable || [[#NVHOST_IOCTL_CHANNEL_MAP_CMD_BUFFER_EX]] |
Line 1,470: |
Line 1,535: |
| | 0x80084715 || 8 || [[#NVGPU_IOCTL_CHANNEL_GET_USER_DATA]] | | | 0x80084715 || 8 || [[#NVGPU_IOCTL_CHANNEL_GET_USER_DATA]] |
| |} | | |} |
| + | |
| + | === NVHOST_IOCTL_CHANNEL_SUBMIT === |
| + | Submits data to the channel. |
| + | |
| + | struct cmdbuf { |
| + | u32 mem; |
| + | u32 offset; |
| + | u32 words; |
| + | }; |
| + | |
| + | struct reloc { |
| + | u32 cmdbuf_mem; |
| + | u32 cmdbuf_offset; |
| + | u32 target; |
| + | u32 target_offset; |
| + | }; |
| + | |
| + | struct reloc_shift { |
| + | u32 shift; |
| + | }; |
| + | |
| + | struct syncpt_incr { |
| + | u32 syncpt_id; |
| + | u32 syncpt_incrs; |
| + | }; |
| + | |
| + | struct fence { |
| + | u32 id; |
| + | u32 thresh; |
| + | }; |
| + | |
| + | struct { |
| + | __in u32 num_cmdbufs; |
| + | __in u32 num_relocs; |
| + | __in u32 num_syncpt_incrs; |
| + | __in u32 num_fences; |
| + | __in struct cmdbuf cmdbufs[]; // depends on num_cmdbufs |
| + | __in struct reloc relocs[]; // depends on num_relocs |
| + | __in struct reloc_shift reloc_shifts[]; // depends on num_relocs |
| + | __in struct syncpt_incr syncpt_incrs[]; // depends on num_syncpt_incrs |
| + | __out struct fence fences[]; // depends on num_fences |
| + | }; |
| | | |
| === NVHOST_IOCTL_CHANNEL_GET_SYNCPOINT === | | === NVHOST_IOCTL_CHANNEL_GET_SYNCPOINT === |
Line 1,552: |
Line 1,659: |
| __in u32 module_id; | | __in u32 module_id; |
| }; | | }; |
| + | |
| + | === NVHOST_IOCTL_CHANNEL_SUBMIT_EX === |
| + | Same as [[#NVHOST_IOCTL_CHANNEL_SUBMIT|NVHOST_IOCTL_CHANNEL_SUBMIT]]. |
| | | |
| === NVHOST_IOCTL_CHANNEL_MAP_CMD_BUFFER_EX === | | === NVHOST_IOCTL_CHANNEL_MAP_CMD_BUFFER_EX === |
Line 1,604: |
Line 1,714: |
| | | |
| struct fence { | | struct fence { |
− | u32 syncpt_id; | + | u32 id; |
− | u32 syncpt_value; | + | u32 thresh; |
| }; | | }; |
| | | |
Line 1,715: |
Line 1,825: |
| | | |
| struct fence { | | struct fence { |
− | u32 syncpt_id;
| + | u32 id; |
− | u32 syncpt_value;
| + | u32 thresh; |
| }; | | }; |
| | | |