github.com/racerxdl/gonx@v0.0.0-20210103083128-c5afc43bcbd2/services/gpu/ioc.go (about)

     1  package gpu
     2  
     3  const (
     4  	NVHOST_IOC_CTRL_SYNCPT_READ      = 0xC0080014
     5  	NVHOST_IOC_CTRL_SYNCPT_INCR      = 0x40040015
     6  	NVHOST_IOC_CTRL_SYNCPT_WAIT      = 0xC00C0016
     7  	NVHOST_IOC_CTRL_MODULE_MUTEX     = 0x40080017
     8  	NVHOST_IOC_CTRL_MODULE_REGRDWR   = 0xC0180018
     9  	NVHOST_IOC_CTRL_SYNCPT_WAITEX    = 0xC0100019
    10  	NVHOST_IOC_CTRL_SYNCPT_READ_MAX  = 0xC008001A
    11  	NVHOST_IOC_CTRL_GET_CONFIG       = 0xC183001B
    12  	NVHOST_IOC_CTRL_EVENT_SIGNAL     = 0xC004001C
    13  	NVHOST_IOC_CTRL_EVENT_WAIT       = 0xC010001D
    14  	NVHOST_IOC_CTRL_EVENT_WAIT_ASYNC = 0xC010001E
    15  	NVHOST_IOC_CTRL_EVENT_REGISTER   = 0xC004001F
    16  	NVHOST_IOC_CTRL_EVENT_UNREGISTER = 0xC0040020
    17  	NVHOST_IOC_CTRL_EVENT_KILL       = 0x40080021
    18  
    19  	NVMAP_IOC_CREATE  = 0xC0080101
    20  	NVMAP_IOC_FROM_ID = 0xC0080103
    21  	NVMAP_IOC_ALLOC   = 0xC0200104
    22  	NVMAP_IOC_FREE    = 0xC0180105
    23  	NVMAP_IOC_PARAM   = 0xC00C0109
    24  	NVMAP_IOC_GET_ID  = 0xC008010E
    25  )
    26  
    27  // nvhostIocCtrlSyncPtWaitArgs Arguments to wait on a syncpt
    28  type nvhostIocCtrlSyncPtWaitArgs struct {
    29  	syncptId  uint32 // In
    30  	threshold uint32 // In
    31  	timeout   uint32 // In
    32  }
    33  
    34  // nvhostIocCtrlEventWaitArgs Arguments to wait on a syncpt event
    35  type nvhostIocCtrlEventWaitArgs struct {
    36  	syncptId  uint32 // In
    37  	threshold uint32 // In
    38  	timeout   int32  // In
    39  	value     uint32 // Inout
    40  }
    41  
    42  // nvmapIocCreateArgs Args to create an nvmap object
    43  // Identical to Linux Driver
    44  type nvmapIocCreateArgs struct {
    45  	size   uint32 // In
    46  	handle uint32 // Out
    47  }
    48  
    49  // nvmapIocFromIdArgs Args to get the handle to an existing nvmap object
    50  // Identical to Linux Driver
    51  type nvmapIocFromIdArgs struct {
    52  	id     uint32 // In
    53  	handle uint32 // Out
    54  }
    55  
    56  // nvmapIocAllocArgs Memory allocation args structure for the nvmap object.
    57  // Nintendo extended this one with 16 bytes, and changed it from in to inout.
    58  type nvmapIocAllocArgs struct {
    59  	handle   uint32
    60  	heapmask uint32
    61  	flags    uint32 // 0 = readonly, 1 = readwrite
    62  	align    uint32
    63  	kind     uint8
    64  	pad      [7]uint8
    65  	addr     uint64
    66  }
    67  
    68  // nvmapIocFreeArgs Memory freeing args structure for the nvmap object.
    69  type nvmapIocFreeArgs struct {
    70  	handle   uint32
    71  	pad      uint32
    72  	refcount uint64 // out
    73  	size     uint32 // out
    74  	flags    uint32 // out ( 1 = not freed yet )
    75  }
    76  
    77  // nvmapIocParamArgs Info query args structure for an nvmap object.
    78  // Identical to Linux driver, but extended with further params.
    79  type nvmapIocParamArgs struct {
    80  	handle uint32
    81  	param  uint32 // 1=SIZE, 2=ALIGNMENT, 3=BASE (returns error), 4=HEAP (always 0x40000000), 5=KIND, 6=COMPR (unused)
    82  	value  uint32
    83  }
    84  
    85  // nvmapIocGetIdArgs ID query args structure for an nvmap object.
    86  // Identical to Linux driver.
    87  type nvmapIocGetIdArgs struct {
    88  	id     uint32 // Out ~0 indicates error
    89  	handle uint32 // In
    90  }