diff options
| author | Arto Merilainen <amerilainen@nvidia.com> | 2016-09-04 11:12:46 -0400 |
|---|---|---|
| committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2016-09-19 19:47:23 -0400 |
| commit | 8195e0445f758de6bc1b4f7f03f36e67ee59bd73 (patch) | |
| tree | fdf7d3727e74029b487c880fb152b5868b2dd570 /include/uapi/linux | |
| parent | 57f8216523a932bd137226771d752b1adc847170 (diff) | |
video: tegra: host: pva: Implement PVA submit ioctl
This patch implements ioctl interface for submitting tasks. Since
the hardware support is not yet available, the software simply
creates fences that already have been expired and marks the task
as failed.
JIRA PVA-45
Change-Id: Ied95f7a072b73e771b73a00fd595ff55baca94cb
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-on: http://git-master/r/1215616
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Diffstat (limited to 'include/uapi/linux')
| -rw-r--r-- | include/uapi/linux/nvhost_pva_ioctl.h | 167 |
1 files changed, 166 insertions, 1 deletions
diff --git a/include/uapi/linux/nvhost_pva_ioctl.h b/include/uapi/linux/nvhost_pva_ioctl.h index 1631f5cf8..1ffa220e6 100644 --- a/include/uapi/linux/nvhost_pva_ioctl.h +++ b/include/uapi/linux/nvhost_pva_ioctl.h | |||
| @@ -80,15 +80,180 @@ struct pva_pin_unpin_args { | |||
| 80 | __u32 reserved; | 80 | __u32 reserved; |
| 81 | }; | 81 | }; |
| 82 | 82 | ||
| 83 | /** | ||
| 84 | * struct pva_ioctl_status_handle - A handle to a status structure | ||
| 85 | * | ||
| 86 | * @handle: Handle to a dmabuf that holds the status buffer | ||
| 87 | * @offset: An offset within the buffer to the status structure. | ||
| 88 | */ | ||
| 89 | struct pva_status_handle { | ||
| 90 | __u32 handle; | ||
| 91 | __u32 offset; | ||
| 92 | }; | ||
| 93 | |||
| 94 | /** | ||
| 95 | * struct pva_ioctl_surface - The surface descriptor | ||
| 96 | * | ||
| 97 | * @format: Surface pixel format | ||
| 98 | * @surface_handle: Memory handle that holds the surface | ||
| 99 | * @surface_offset: Offset within the surface memory buffer to the surface | ||
| 100 | * @roi_handle: Memory handle that holds the ROI | ||
| 101 | * @roi_offset: Offset within the ROI memory buffer to the ROI | ||
| 102 | * @surface_stride: Offset between planes in bytes | ||
| 103 | * @line_stride: Offset between two consequent lines in bytes. | ||
| 104 | * @depth: Number of planes in the surface | ||
| 105 | * @width: Width of the surface | ||
| 106 | * @height: Height of the surface | ||
| 107 | * @layout: Surface layout (pitch linear, block linear) | ||
| 108 | * | ||
| 109 | * This structure defines a list of surfaces to be delivered for | ||
| 110 | * PVA. | ||
| 111 | */ | ||
| 112 | struct pva_surface { | ||
| 113 | __u64 format; | ||
| 114 | __u32 surface_handle; | ||
| 115 | __u32 surface_offset; | ||
| 116 | __u32 roi_handle; | ||
| 117 | __u32 roi_offset; | ||
| 118 | __u32 surface_stride; | ||
| 119 | __u32 line_stride; | ||
| 120 | __u32 depth; | ||
| 121 | __u32 width; | ||
| 122 | __u32 height; | ||
| 123 | __u32 layout; | ||
| 124 | }; | ||
| 125 | |||
| 126 | /** | ||
| 127 | * struct pva_ioct_task_parameter - Parameter structure for a task | ||
| 128 | * | ||
| 129 | * @handle: Memory handle including the parameter array. This field shall be | ||
| 130 | * used in cases where the UMD prepares the data in advance to a | ||
| 131 | * shared buffer or the input data is prepared by the upstream engine. | ||
| 132 | * @offset: Offset within the memory handle to the parameter array | ||
| 133 | * | ||
| 134 | * The parameter descriptor defines a single parameter array that is | ||
| 135 | * received. The handle and offset is translated into IOVA by the kernel | ||
| 136 | * driver and delivered to PVA. | ||
| 137 | */ | ||
| 138 | struct pva_task_parameter { | ||
| 139 | __u32 handle; | ||
| 140 | __u32 offset; | ||
| 141 | }; | ||
| 142 | |||
| 143 | /** | ||
| 144 | * struct pva_ioctl_fence structure for passing fence information | ||
| 145 | * | ||
| 146 | * @type: Type of the fence (syncpoint, sync fd or semaphore) | ||
| 147 | * @syncpoint_index: Syncpoint id | ||
| 148 | * @syncpoint_value: Value of syncpoint id | ||
| 149 | * @sync_fd: Linux sync FD handle | ||
| 150 | * @semaphore_handle: File handle to the semaphore memory buffer | ||
| 151 | * @semaphore_offset: Offset to the semaphore within the buffer | ||
| 152 | * @semaphore_value: Value of the semaphore | ||
| 153 | */ | ||
| 154 | struct pva_fence { | ||
| 155 | __u32 type; | ||
| 156 | #define PVA_FENCE_TYPE_SYNCPT 0 | ||
| 157 | #define PVA_FENCE_TYPE_SYNC_FD 1 | ||
| 158 | #define PVA_FENCE_TYPE_SEMAPHORE 2 | ||
| 159 | __u32 syncpoint_index; | ||
| 160 | __u32 syncpoint_value; | ||
| 161 | __u32 sync_fd; | ||
| 162 | __u32 semaphore_handle; | ||
| 163 | __u32 semaphore_offset; | ||
| 164 | __u32 semaphore_value; | ||
| 165 | }; | ||
| 166 | |||
| 167 | #define PVA_MAX_TASKS 16 | ||
| 168 | #define PVA_MAX_PREFENCES 8 | ||
| 169 | #define PVA_MAX_POSTFENCES 8 | ||
| 170 | #define PVA_MAX_INPUT_STATUS 8 | ||
| 171 | #define PVA_MAX_OUTPUT_STATUS 8 | ||
| 172 | #define PVA_MAX_INPUT_SURFACES 4 | ||
| 173 | #define PVA_MAX_OUTPUT_SURFACES 4 | ||
| 174 | |||
| 175 | /** | ||
| 176 | * struct pva_ioctl_submit_task - Describe a task for PVA | ||
| 177 | * | ||
| 178 | * @num_prefences: Number of pre-fences in this task | ||
| 179 | * @num_postfences: Number of post-fences in this task | ||
| 180 | * @num_input_surfaces: Number of input surfaces | ||
| 181 | * @num_output_surfaces: Number of output surfaces | ||
| 182 | * @num_input_task_status: Number of input task status structures | ||
| 183 | * @num_output_task_status: Number of output task status structures | ||
| 184 | * @reserved: Reserved for future usage. | ||
| 185 | * @timeout: Latest Unix time when the task must complete. 0 if disabled. | ||
| 186 | * @prefences: Pointer to pre-fence structures | ||
| 187 | * @postfences: Pointer to post-fence structures | ||
| 188 | * @input_surfaces: Pointer to input surfaces | ||
| 189 | * @input_scalars: Information for input scalars | ||
| 190 | * @input_2dpoint: Information for input 2d points | ||
| 191 | * @input_rois: Pointer to input ROIs | ||
| 192 | * @output_surfaces: Pointer to output surfaces | ||
| 193 | * @output_scalars: Information for output scalars | ||
| 194 | * @output_2dpoint: Information for output 2d points | ||
| 195 | * @output_rois: Pointer to output ROIs | ||
| 196 | * @input_task_status: Pointer to input status structure | ||
| 197 | * @output_task_status: Pointer to output status structure | ||
| 198 | * | ||
| 199 | * This structure is used for delivering information that is required to | ||
| 200 | * finish a single task on PVA. | ||
| 201 | * | ||
| 202 | */ | ||
| 203 | struct pva_ioctl_submit_task { | ||
| 204 | __u8 num_prefences; | ||
| 205 | __u8 num_postfences; | ||
| 206 | __u8 num_input_surfaces; | ||
| 207 | __u8 num_output_surfaces; | ||
| 208 | __u8 num_input_task_status; | ||
| 209 | __u8 num_output_task_status; | ||
| 210 | __u8 reserved[14]; | ||
| 211 | __u32 operation; | ||
| 212 | __u64 timeout; | ||
| 213 | __u64 prefences; | ||
| 214 | __u64 postfences; | ||
| 215 | __u64 input_surfaces; | ||
| 216 | struct pva_task_parameter input_scalars; | ||
| 217 | struct pva_task_parameter input_2dpoint; | ||
| 218 | struct pva_task_parameter input_rois; | ||
| 219 | __u64 output_surfaces; | ||
| 220 | struct pva_task_parameter output_scalars; | ||
| 221 | struct pva_task_parameter output_2dpoint; | ||
| 222 | struct pva_task_parameter output_rois; | ||
| 223 | __u64 input_task_status; | ||
| 224 | __u64 output_task_status; | ||
| 225 | }; | ||
| 226 | |||
| 227 | /** | ||
| 228 | * struct pva_submit_args - submit tasks to PVA | ||
| 229 | * | ||
| 230 | * @tasks: Pointer to a list of tasks structures | ||
| 231 | * @flags: Flags for the given tasks | ||
| 232 | * @num_tasks: Number of tasks in the list | ||
| 233 | * @version: Version of the task structure. | ||
| 234 | * | ||
| 235 | * This ioctl is used for submitting tasks to PVA. The given structures | ||
| 236 | * are modified to include information about post-fences. | ||
| 237 | * | ||
| 238 | */ | ||
| 239 | struct pva_ioctl_submit_args { | ||
| 240 | __u64 tasks; | ||
| 241 | __u16 flags; | ||
| 242 | __u16 num_tasks; | ||
| 243 | __u32 version; | ||
| 244 | }; | ||
| 245 | |||
| 83 | #define PVA_IOCTL_CHARACTERISTICS \ | 246 | #define PVA_IOCTL_CHARACTERISTICS \ |
| 84 | _IOWR(NVHOST_PVA_IOCTL_MAGIC, 1, struct pva_characteristics_req) | 247 | _IOWR(NVHOST_PVA_IOCTL_MAGIC, 1, struct pva_characteristics_req) |
| 85 | #define PVA_IOCTL_PIN \ | 248 | #define PVA_IOCTL_PIN \ |
| 86 | _IOW(NVHOST_PVA_IOCTL_MAGIC, 2, struct pva_pin_unpin_args) | 249 | _IOW(NVHOST_PVA_IOCTL_MAGIC, 2, struct pva_pin_unpin_args) |
| 87 | #define PVA_IOCTL_UNPIN \ | 250 | #define PVA_IOCTL_UNPIN \ |
| 88 | _IOW(NVHOST_PVA_IOCTL_MAGIC, 3, struct pva_pin_unpin_args) | 251 | _IOW(NVHOST_PVA_IOCTL_MAGIC, 3, struct pva_pin_unpin_args) |
| 252 | #define PVA_IOCTL_SUBMIT \ | ||
| 253 | _IOW(NVHOST_PVA_IOCTL_MAGIC, 4, struct pva_ioctl_submit_args) | ||
| 89 | 254 | ||
| 90 | 255 | ||
| 91 | #define NVHOST_PVA_IOCTL_LAST _IOC_NR(PVA_IOCTL_UNPIN) | 256 | #define NVHOST_PVA_IOCTL_LAST _IOC_NR(PVA_IOCTL_SUBMIT) |
| 92 | #define NVHOST_PVA_IOCTL_MAX_ARG_SIZE sizeof(struct pva_characteristics_req) | 257 | #define NVHOST_PVA_IOCTL_MAX_ARG_SIZE sizeof(struct pva_characteristics_req) |
| 93 | 258 | ||
| 94 | #endif /* __LINUX_NVHOST_PVA_IOCTL_H */ | 259 | #endif /* __LINUX_NVHOST_PVA_IOCTL_H */ |
