xref: /openbmc/linux/include/uapi/drm/tegra_drm.h (revision 762f99f4f3cb41a775b5157dd761217beba65873)
1*57e20395SMikko Perttunen /* SPDX-License-Identifier: MIT */
2*57e20395SMikko Perttunen /* Copyright (c) 2012-2020 NVIDIA Corporation */
3d43f81cbSTerje Bergstrom 
4d43f81cbSTerje Bergstrom #ifndef _UAPI_TEGRA_DRM_H_
5d43f81cbSTerje Bergstrom #define _UAPI_TEGRA_DRM_H_
6d43f81cbSTerje Bergstrom 
7678205a6SGabriel Laskar #include "drm.h"
8a191e48dSEmil Goode 
97aa8ceebSEmil Velikov #if defined(__cplusplus)
107aa8ceebSEmil Velikov extern "C" {
117aa8ceebSEmil Velikov #endif
127aa8ceebSEmil Velikov 
13*57e20395SMikko Perttunen /* Tegra DRM legacy UAPI. Only enabled with STAGING */
14*57e20395SMikko Perttunen 
15773af77fSThierry Reding #define DRM_TEGRA_GEM_CREATE_TILED     (1 << 0)
16db7fbdfdSThierry Reding #define DRM_TEGRA_GEM_CREATE_BOTTOM_UP (1 << 1)
17773af77fSThierry Reding 
186134534cSThierry Reding /**
196134534cSThierry Reding  * struct drm_tegra_gem_create - parameters for the GEM object creation IOCTL
206134534cSThierry Reding  */
21d43f81cbSTerje Bergstrom struct drm_tegra_gem_create {
226134534cSThierry Reding 	/**
236134534cSThierry Reding 	 * @size:
246134534cSThierry Reding 	 *
256134534cSThierry Reding 	 * The size, in bytes, of the buffer object to be created.
266134534cSThierry Reding 	 */
27d43f81cbSTerje Bergstrom 	__u64 size;
286134534cSThierry Reding 
296134534cSThierry Reding 	/**
306134534cSThierry Reding 	 * @flags:
316134534cSThierry Reding 	 *
326134534cSThierry Reding 	 * A bitmask of flags that influence the creation of GEM objects:
336134534cSThierry Reding 	 *
346134534cSThierry Reding 	 * DRM_TEGRA_GEM_CREATE_TILED
356134534cSThierry Reding 	 *   Use the 16x16 tiling format for this buffer.
366134534cSThierry Reding 	 *
376134534cSThierry Reding 	 * DRM_TEGRA_GEM_CREATE_BOTTOM_UP
386134534cSThierry Reding 	 *   The buffer has a bottom-up layout.
396134534cSThierry Reding 	 */
40d43f81cbSTerje Bergstrom 	__u32 flags;
416134534cSThierry Reding 
426134534cSThierry Reding 	/**
436134534cSThierry Reding 	 * @handle:
446134534cSThierry Reding 	 *
456134534cSThierry Reding 	 * The handle of the created GEM object. Set by the kernel upon
466134534cSThierry Reding 	 * successful completion of the IOCTL.
476134534cSThierry Reding 	 */
48d43f81cbSTerje Bergstrom 	__u32 handle;
49d43f81cbSTerje Bergstrom };
50d43f81cbSTerje Bergstrom 
516134534cSThierry Reding /**
526134534cSThierry Reding  * struct drm_tegra_gem_mmap - parameters for the GEM mmap IOCTL
536134534cSThierry Reding  */
54d43f81cbSTerje Bergstrom struct drm_tegra_gem_mmap {
556134534cSThierry Reding 	/**
566134534cSThierry Reding 	 * @handle:
576134534cSThierry Reding 	 *
586134534cSThierry Reding 	 * Handle of the GEM object to obtain an mmap offset for.
596134534cSThierry Reding 	 */
60d43f81cbSTerje Bergstrom 	__u32 handle;
616134534cSThierry Reding 
626134534cSThierry Reding 	/**
636134534cSThierry Reding 	 * @pad:
646134534cSThierry Reding 	 *
656134534cSThierry Reding 	 * Structure padding that may be used in the future. Must be 0.
666134534cSThierry Reding 	 */
67bdf76507SSean Paul 	__u32 pad;
686134534cSThierry Reding 
696134534cSThierry Reding 	/**
706134534cSThierry Reding 	 * @offset:
716134534cSThierry Reding 	 *
726134534cSThierry Reding 	 * The mmap offset for the given GEM object. Set by the kernel upon
736134534cSThierry Reding 	 * successful completion of the IOCTL.
746134534cSThierry Reding 	 */
75bdf76507SSean Paul 	__u64 offset;
76d43f81cbSTerje Bergstrom };
77d43f81cbSTerje Bergstrom 
786134534cSThierry Reding /**
796134534cSThierry Reding  * struct drm_tegra_syncpt_read - parameters for the read syncpoint IOCTL
806134534cSThierry Reding  */
81d43f81cbSTerje Bergstrom struct drm_tegra_syncpt_read {
826134534cSThierry Reding 	/**
836134534cSThierry Reding 	 * @id:
846134534cSThierry Reding 	 *
856134534cSThierry Reding 	 * ID of the syncpoint to read the current value from.
866134534cSThierry Reding 	 */
87d43f81cbSTerje Bergstrom 	__u32 id;
886134534cSThierry Reding 
896134534cSThierry Reding 	/**
906134534cSThierry Reding 	 * @value:
916134534cSThierry Reding 	 *
926134534cSThierry Reding 	 * The current syncpoint value. Set by the kernel upon successful
936134534cSThierry Reding 	 * completion of the IOCTL.
946134534cSThierry Reding 	 */
95d43f81cbSTerje Bergstrom 	__u32 value;
96d43f81cbSTerje Bergstrom };
97d43f81cbSTerje Bergstrom 
986134534cSThierry Reding /**
996134534cSThierry Reding  * struct drm_tegra_syncpt_incr - parameters for the increment syncpoint IOCTL
1006134534cSThierry Reding  */
101d43f81cbSTerje Bergstrom struct drm_tegra_syncpt_incr {
1026134534cSThierry Reding 	/**
1036134534cSThierry Reding 	 * @id:
1046134534cSThierry Reding 	 *
1056134534cSThierry Reding 	 * ID of the syncpoint to increment.
1066134534cSThierry Reding 	 */
107d43f81cbSTerje Bergstrom 	__u32 id;
1086134534cSThierry Reding 
1096134534cSThierry Reding 	/**
1106134534cSThierry Reding 	 * @pad:
1116134534cSThierry Reding 	 *
1126134534cSThierry Reding 	 * Structure padding that may be used in the future. Must be 0.
1136134534cSThierry Reding 	 */
114d43f81cbSTerje Bergstrom 	__u32 pad;
115d43f81cbSTerje Bergstrom };
116d43f81cbSTerje Bergstrom 
1176134534cSThierry Reding /**
1186134534cSThierry Reding  * struct drm_tegra_syncpt_wait - parameters for the wait syncpoint IOCTL
1196134534cSThierry Reding  */
120d43f81cbSTerje Bergstrom struct drm_tegra_syncpt_wait {
1216134534cSThierry Reding 	/**
1226134534cSThierry Reding 	 * @id:
1236134534cSThierry Reding 	 *
1246134534cSThierry Reding 	 * ID of the syncpoint to wait on.
1256134534cSThierry Reding 	 */
126d43f81cbSTerje Bergstrom 	__u32 id;
1276134534cSThierry Reding 
1286134534cSThierry Reding 	/**
1296134534cSThierry Reding 	 * @thresh:
1306134534cSThierry Reding 	 *
1316134534cSThierry Reding 	 * Threshold value for which to wait.
1326134534cSThierry Reding 	 */
133d43f81cbSTerje Bergstrom 	__u32 thresh;
1346134534cSThierry Reding 
1356134534cSThierry Reding 	/**
1366134534cSThierry Reding 	 * @timeout:
1376134534cSThierry Reding 	 *
1386134534cSThierry Reding 	 * Timeout, in milliseconds, to wait.
1396134534cSThierry Reding 	 */
140d43f81cbSTerje Bergstrom 	__u32 timeout;
1416134534cSThierry Reding 
1426134534cSThierry Reding 	/**
1436134534cSThierry Reding 	 * @value:
1446134534cSThierry Reding 	 *
1456134534cSThierry Reding 	 * The new syncpoint value after the wait. Set by the kernel upon
1466134534cSThierry Reding 	 * successful completion of the IOCTL.
1476134534cSThierry Reding 	 */
148d43f81cbSTerje Bergstrom 	__u32 value;
149d43f81cbSTerje Bergstrom };
150d43f81cbSTerje Bergstrom 
151d43f81cbSTerje Bergstrom #define DRM_TEGRA_NO_TIMEOUT	(0xffffffff)
152d43f81cbSTerje Bergstrom 
1536134534cSThierry Reding /**
1546134534cSThierry Reding  * struct drm_tegra_open_channel - parameters for the open channel IOCTL
1556134534cSThierry Reding  */
156d43f81cbSTerje Bergstrom struct drm_tegra_open_channel {
1576134534cSThierry Reding 	/**
1586134534cSThierry Reding 	 * @client:
1596134534cSThierry Reding 	 *
1606134534cSThierry Reding 	 * The client ID for this channel.
1616134534cSThierry Reding 	 */
162d43f81cbSTerje Bergstrom 	__u32 client;
1636134534cSThierry Reding 
1646134534cSThierry Reding 	/**
1656134534cSThierry Reding 	 * @pad:
1666134534cSThierry Reding 	 *
1676134534cSThierry Reding 	 * Structure padding that may be used in the future. Must be 0.
1686134534cSThierry Reding 	 */
169d43f81cbSTerje Bergstrom 	__u32 pad;
1706134534cSThierry Reding 
1716134534cSThierry Reding 	/**
1726134534cSThierry Reding 	 * @context:
1736134534cSThierry Reding 	 *
1746134534cSThierry Reding 	 * The application context of this channel. Set by the kernel upon
1756134534cSThierry Reding 	 * successful completion of the IOCTL. This context needs to be passed
1766134534cSThierry Reding 	 * to the DRM_TEGRA_CHANNEL_CLOSE or the DRM_TEGRA_SUBMIT IOCTLs.
1776134534cSThierry Reding 	 */
178d43f81cbSTerje Bergstrom 	__u64 context;
179d43f81cbSTerje Bergstrom };
180d43f81cbSTerje Bergstrom 
1816134534cSThierry Reding /**
1826134534cSThierry Reding  * struct drm_tegra_close_channel - parameters for the close channel IOCTL
1836134534cSThierry Reding  */
184d43f81cbSTerje Bergstrom struct drm_tegra_close_channel {
1856134534cSThierry Reding 	/**
1866134534cSThierry Reding 	 * @context:
1876134534cSThierry Reding 	 *
1886134534cSThierry Reding 	 * The application context of this channel. This is obtained from the
1896134534cSThierry Reding 	 * DRM_TEGRA_OPEN_CHANNEL IOCTL.
1906134534cSThierry Reding 	 */
191d43f81cbSTerje Bergstrom 	__u64 context;
192d43f81cbSTerje Bergstrom };
193d43f81cbSTerje Bergstrom 
1946134534cSThierry Reding /**
1956134534cSThierry Reding  * struct drm_tegra_get_syncpt - parameters for the get syncpoint IOCTL
1966134534cSThierry Reding  */
197d43f81cbSTerje Bergstrom struct drm_tegra_get_syncpt {
1986134534cSThierry Reding 	/**
1996134534cSThierry Reding 	 * @context:
2006134534cSThierry Reding 	 *
2016134534cSThierry Reding 	 * The application context identifying the channel for which to obtain
2026134534cSThierry Reding 	 * the syncpoint ID.
2036134534cSThierry Reding 	 */
204d43f81cbSTerje Bergstrom 	__u64 context;
2056134534cSThierry Reding 
2066134534cSThierry Reding 	/**
2076134534cSThierry Reding 	 * @index:
2086134534cSThierry Reding 	 *
2096134534cSThierry Reding 	 * Index of the client syncpoint for which to obtain the ID.
2106134534cSThierry Reding 	 */
211d43f81cbSTerje Bergstrom 	__u32 index;
2126134534cSThierry Reding 
2136134534cSThierry Reding 	/**
2146134534cSThierry Reding 	 * @id:
2156134534cSThierry Reding 	 *
2166134534cSThierry Reding 	 * The ID of the given syncpoint. Set by the kernel upon successful
2176134534cSThierry Reding 	 * completion of the IOCTL.
2186134534cSThierry Reding 	 */
219d43f81cbSTerje Bergstrom 	__u32 id;
220d43f81cbSTerje Bergstrom };
221d43f81cbSTerje Bergstrom 
2226134534cSThierry Reding /**
2236134534cSThierry Reding  * struct drm_tegra_get_syncpt_base - parameters for the get wait base IOCTL
2246134534cSThierry Reding  */
225c54a169bSArto Merilainen struct drm_tegra_get_syncpt_base {
2266134534cSThierry Reding 	/**
2276134534cSThierry Reding 	 * @context:
2286134534cSThierry Reding 	 *
2296134534cSThierry Reding 	 * The application context identifying for which channel to obtain the
2306134534cSThierry Reding 	 * wait base.
2316134534cSThierry Reding 	 */
232c54a169bSArto Merilainen 	__u64 context;
2336134534cSThierry Reding 
2346134534cSThierry Reding 	/**
2356134534cSThierry Reding 	 * @syncpt:
2366134534cSThierry Reding 	 *
2376134534cSThierry Reding 	 * ID of the syncpoint for which to obtain the wait base.
2386134534cSThierry Reding 	 */
239c54a169bSArto Merilainen 	__u32 syncpt;
2406134534cSThierry Reding 
2416134534cSThierry Reding 	/**
2426134534cSThierry Reding 	 * @id:
2436134534cSThierry Reding 	 *
2446134534cSThierry Reding 	 * The ID of the wait base corresponding to the client syncpoint. Set
2456134534cSThierry Reding 	 * by the kernel upon successful completion of the IOCTL.
2466134534cSThierry Reding 	 */
247c54a169bSArto Merilainen 	__u32 id;
248c54a169bSArto Merilainen };
249c54a169bSArto Merilainen 
2506134534cSThierry Reding /**
2516134534cSThierry Reding  * struct drm_tegra_syncpt - syncpoint increment operation
2526134534cSThierry Reding  */
253d43f81cbSTerje Bergstrom struct drm_tegra_syncpt {
2546134534cSThierry Reding 	/**
2556134534cSThierry Reding 	 * @id:
2566134534cSThierry Reding 	 *
2576134534cSThierry Reding 	 * ID of the syncpoint to operate on.
2586134534cSThierry Reding 	 */
259d43f81cbSTerje Bergstrom 	__u32 id;
2606134534cSThierry Reding 
2616134534cSThierry Reding 	/**
2626134534cSThierry Reding 	 * @incrs:
2636134534cSThierry Reding 	 *
2646134534cSThierry Reding 	 * Number of increments to perform for the syncpoint.
2656134534cSThierry Reding 	 */
266d43f81cbSTerje Bergstrom 	__u32 incrs;
267d43f81cbSTerje Bergstrom };
268d43f81cbSTerje Bergstrom 
2696134534cSThierry Reding /**
2706134534cSThierry Reding  * struct drm_tegra_cmdbuf - structure describing a command buffer
2716134534cSThierry Reding  */
272d43f81cbSTerje Bergstrom struct drm_tegra_cmdbuf {
2736134534cSThierry Reding 	/**
2746134534cSThierry Reding 	 * @handle:
2756134534cSThierry Reding 	 *
2766134534cSThierry Reding 	 * Handle to a GEM object containing the command buffer.
2776134534cSThierry Reding 	 */
278d43f81cbSTerje Bergstrom 	__u32 handle;
2796134534cSThierry Reding 
2806134534cSThierry Reding 	/**
2816134534cSThierry Reding 	 * @offset:
2826134534cSThierry Reding 	 *
2836134534cSThierry Reding 	 * Offset, in bytes, into the GEM object identified by @handle at
2846134534cSThierry Reding 	 * which the command buffer starts.
2856134534cSThierry Reding 	 */
286d43f81cbSTerje Bergstrom 	__u32 offset;
2876134534cSThierry Reding 
2886134534cSThierry Reding 	/**
2896134534cSThierry Reding 	 * @words:
2906134534cSThierry Reding 	 *
2916134534cSThierry Reding 	 * Number of 32-bit words in this command buffer.
2926134534cSThierry Reding 	 */
293d43f81cbSTerje Bergstrom 	__u32 words;
2946134534cSThierry Reding 
2956134534cSThierry Reding 	/**
2966134534cSThierry Reding 	 * @pad:
2976134534cSThierry Reding 	 *
2986134534cSThierry Reding 	 * Structure padding that may be used in the future. Must be 0.
2996134534cSThierry Reding 	 */
300d43f81cbSTerje Bergstrom 	__u32 pad;
301d43f81cbSTerje Bergstrom };
302d43f81cbSTerje Bergstrom 
3036134534cSThierry Reding /**
3046134534cSThierry Reding  * struct drm_tegra_reloc - GEM object relocation structure
3056134534cSThierry Reding  */
306d43f81cbSTerje Bergstrom struct drm_tegra_reloc {
307d43f81cbSTerje Bergstrom 	struct {
3086134534cSThierry Reding 		/**
3096134534cSThierry Reding 		 * @cmdbuf.handle:
3106134534cSThierry Reding 		 *
3116134534cSThierry Reding 		 * Handle to the GEM object containing the command buffer for
3126134534cSThierry Reding 		 * which to perform this GEM object relocation.
3136134534cSThierry Reding 		 */
314d43f81cbSTerje Bergstrom 		__u32 handle;
3156134534cSThierry Reding 
3166134534cSThierry Reding 		/**
3176134534cSThierry Reding 		 * @cmdbuf.offset:
3186134534cSThierry Reding 		 *
3196134534cSThierry Reding 		 * Offset, in bytes, into the command buffer at which to
3206134534cSThierry Reding 		 * insert the relocated address.
3216134534cSThierry Reding 		 */
322d43f81cbSTerje Bergstrom 		__u32 offset;
323d43f81cbSTerje Bergstrom 	} cmdbuf;
324d43f81cbSTerje Bergstrom 	struct {
3256134534cSThierry Reding 		/**
3266134534cSThierry Reding 		 * @target.handle:
3276134534cSThierry Reding 		 *
3286134534cSThierry Reding 		 * Handle to the GEM object to be relocated.
3296134534cSThierry Reding 		 */
330d43f81cbSTerje Bergstrom 		__u32 handle;
3316134534cSThierry Reding 
3326134534cSThierry Reding 		/**
3336134534cSThierry Reding 		 * @target.offset:
3346134534cSThierry Reding 		 *
3356134534cSThierry Reding 		 * Offset, in bytes, into the target GEM object at which the
3366134534cSThierry Reding 		 * relocated data starts.
3376134534cSThierry Reding 		 */
338d43f81cbSTerje Bergstrom 		__u32 offset;
339d43f81cbSTerje Bergstrom 	} target;
3406134534cSThierry Reding 
3416134534cSThierry Reding 	/**
3426134534cSThierry Reding 	 * @shift:
3436134534cSThierry Reding 	 *
3446134534cSThierry Reding 	 * The number of bits by which to shift relocated addresses.
3456134534cSThierry Reding 	 */
346d43f81cbSTerje Bergstrom 	__u32 shift;
3476134534cSThierry Reding 
3486134534cSThierry Reding 	/**
3496134534cSThierry Reding 	 * @pad:
3506134534cSThierry Reding 	 *
3516134534cSThierry Reding 	 * Structure padding that may be used in the future. Must be 0.
3526134534cSThierry Reding 	 */
353d43f81cbSTerje Bergstrom 	__u32 pad;
354d43f81cbSTerje Bergstrom };
355d43f81cbSTerje Bergstrom 
3566134534cSThierry Reding /**
3576134534cSThierry Reding  * struct drm_tegra_waitchk - wait check structure
3586134534cSThierry Reding  */
359d43f81cbSTerje Bergstrom struct drm_tegra_waitchk {
3606134534cSThierry Reding 	/**
3616134534cSThierry Reding 	 * @handle:
3626134534cSThierry Reding 	 *
3636134534cSThierry Reding 	 * Handle to the GEM object containing a command stream on which to
3646134534cSThierry Reding 	 * perform the wait check.
3656134534cSThierry Reding 	 */
366d43f81cbSTerje Bergstrom 	__u32 handle;
3676134534cSThierry Reding 
3686134534cSThierry Reding 	/**
3696134534cSThierry Reding 	 * @offset:
3706134534cSThierry Reding 	 *
3716134534cSThierry Reding 	 * Offset, in bytes, of the location in the command stream to perform
3726134534cSThierry Reding 	 * the wait check on.
3736134534cSThierry Reding 	 */
374d43f81cbSTerje Bergstrom 	__u32 offset;
3756134534cSThierry Reding 
3766134534cSThierry Reding 	/**
3776134534cSThierry Reding 	 * @syncpt:
3786134534cSThierry Reding 	 *
3796134534cSThierry Reding 	 * ID of the syncpoint to wait check.
3806134534cSThierry Reding 	 */
381d43f81cbSTerje Bergstrom 	__u32 syncpt;
3826134534cSThierry Reding 
3836134534cSThierry Reding 	/**
3846134534cSThierry Reding 	 * @thresh:
3856134534cSThierry Reding 	 *
3866134534cSThierry Reding 	 * Threshold value for which to check.
3876134534cSThierry Reding 	 */
388d43f81cbSTerje Bergstrom 	__u32 thresh;
389d43f81cbSTerje Bergstrom };
390d43f81cbSTerje Bergstrom 
3916134534cSThierry Reding /**
3926134534cSThierry Reding  * struct drm_tegra_submit - job submission structure
3936134534cSThierry Reding  */
394d43f81cbSTerje Bergstrom struct drm_tegra_submit {
3956134534cSThierry Reding 	/**
3966134534cSThierry Reding 	 * @context:
3976134534cSThierry Reding 	 *
3986134534cSThierry Reding 	 * The application context identifying the channel to use for the
3996134534cSThierry Reding 	 * execution of this job.
4006134534cSThierry Reding 	 */
401d43f81cbSTerje Bergstrom 	__u64 context;
402d43f81cbSTerje Bergstrom 
4036134534cSThierry Reding 	/**
4046134534cSThierry Reding 	 * @num_syncpts:
4056134534cSThierry Reding 	 *
4066134534cSThierry Reding 	 * The number of syncpoints operated on by this job. This defines the
4076134534cSThierry Reding 	 * length of the array pointed to by @syncpts.
4086134534cSThierry Reding 	 */
4096134534cSThierry Reding 	__u32 num_syncpts;
4106134534cSThierry Reding 
4116134534cSThierry Reding 	/**
4126134534cSThierry Reding 	 * @num_cmdbufs:
4136134534cSThierry Reding 	 *
4146134534cSThierry Reding 	 * The number of command buffers to execute as part of this job. This
4156134534cSThierry Reding 	 * defines the length of the array pointed to by @cmdbufs.
4166134534cSThierry Reding 	 */
4176134534cSThierry Reding 	__u32 num_cmdbufs;
4186134534cSThierry Reding 
4196134534cSThierry Reding 	/**
4206134534cSThierry Reding 	 * @num_relocs:
4216134534cSThierry Reding 	 *
4226134534cSThierry Reding 	 * The number of relocations to perform before executing this job.
4236134534cSThierry Reding 	 * This defines the length of the array pointed to by @relocs.
4246134534cSThierry Reding 	 */
4256134534cSThierry Reding 	__u32 num_relocs;
4266134534cSThierry Reding 
4276134534cSThierry Reding 	/**
4286134534cSThierry Reding 	 * @num_waitchks:
4296134534cSThierry Reding 	 *
4306134534cSThierry Reding 	 * The number of wait checks to perform as part of this job. This
4316134534cSThierry Reding 	 * defines the length of the array pointed to by @waitchks.
4326134534cSThierry Reding 	 */
4336134534cSThierry Reding 	__u32 num_waitchks;
4346134534cSThierry Reding 
4356134534cSThierry Reding 	/**
4366134534cSThierry Reding 	 * @waitchk_mask:
4376134534cSThierry Reding 	 *
4386134534cSThierry Reding 	 * Bitmask of valid wait checks.
4396134534cSThierry Reding 	 */
4406134534cSThierry Reding 	__u32 waitchk_mask;
4416134534cSThierry Reding 
4426134534cSThierry Reding 	/**
4436134534cSThierry Reding 	 * @timeout:
4446134534cSThierry Reding 	 *
4456134534cSThierry Reding 	 * Timeout, in milliseconds, before this job is cancelled.
4466134534cSThierry Reding 	 */
4476134534cSThierry Reding 	__u32 timeout;
4486134534cSThierry Reding 
4496134534cSThierry Reding 	/**
4506134534cSThierry Reding 	 * @syncpts:
4516134534cSThierry Reding 	 *
4526134534cSThierry Reding 	 * A pointer to an array of &struct drm_tegra_syncpt structures that
4536134534cSThierry Reding 	 * specify the syncpoint operations performed as part of this job.
4546134534cSThierry Reding 	 * The number of elements in the array must be equal to the value
4556134534cSThierry Reding 	 * given by @num_syncpts.
4566134534cSThierry Reding 	 */
4576134534cSThierry Reding 	__u64 syncpts;
4586134534cSThierry Reding 
4596134534cSThierry Reding 	/**
4606134534cSThierry Reding 	 * @cmdbufs:
4616134534cSThierry Reding 	 *
4626134534cSThierry Reding 	 * A pointer to an array of &struct drm_tegra_cmdbuf structures that
4636134534cSThierry Reding 	 * define the command buffers to execute as part of this job. The
4646134534cSThierry Reding 	 * number of elements in the array must be equal to the value given
4656134534cSThierry Reding 	 * by @num_syncpts.
4666134534cSThierry Reding 	 */
4676134534cSThierry Reding 	__u64 cmdbufs;
4686134534cSThierry Reding 
4696134534cSThierry Reding 	/**
4706134534cSThierry Reding 	 * @relocs:
4716134534cSThierry Reding 	 *
4726134534cSThierry Reding 	 * A pointer to an array of &struct drm_tegra_reloc structures that
4736134534cSThierry Reding 	 * specify the relocations that need to be performed before executing
4746134534cSThierry Reding 	 * this job. The number of elements in the array must be equal to the
4756134534cSThierry Reding 	 * value given by @num_relocs.
4766134534cSThierry Reding 	 */
4776134534cSThierry Reding 	__u64 relocs;
4786134534cSThierry Reding 
4796134534cSThierry Reding 	/**
4806134534cSThierry Reding 	 * @waitchks:
4816134534cSThierry Reding 	 *
4826134534cSThierry Reding 	 * A pointer to an array of &struct drm_tegra_waitchk structures that
4836134534cSThierry Reding 	 * specify the wait checks to be performed while executing this job.
4846134534cSThierry Reding 	 * The number of elements in the array must be equal to the value
4856134534cSThierry Reding 	 * given by @num_waitchks.
4866134534cSThierry Reding 	 */
4876134534cSThierry Reding 	__u64 waitchks;
4886134534cSThierry Reding 
4896134534cSThierry Reding 	/**
4906134534cSThierry Reding 	 * @fence:
4916134534cSThierry Reding 	 *
4926134534cSThierry Reding 	 * The threshold of the syncpoint associated with this job after it
4936134534cSThierry Reding 	 * has been completed. Set by the kernel upon successful completion of
4946134534cSThierry Reding 	 * the IOCTL. This can be used with the DRM_TEGRA_SYNCPT_WAIT IOCTL to
4956134534cSThierry Reding 	 * wait for this job to be finished.
4966134534cSThierry Reding 	 */
4976134534cSThierry Reding 	__u32 fence;
4986134534cSThierry Reding 
4996134534cSThierry Reding 	/**
5006134534cSThierry Reding 	 * @reserved:
5016134534cSThierry Reding 	 *
5026134534cSThierry Reding 	 * This field is reserved for future use. Must be 0.
5036134534cSThierry Reding 	 */
5046134534cSThierry Reding 	__u32 reserved[5];
505d43f81cbSTerje Bergstrom };
506d43f81cbSTerje Bergstrom 
5077678d71fSThierry Reding #define DRM_TEGRA_GEM_TILING_MODE_PITCH 0
5087678d71fSThierry Reding #define DRM_TEGRA_GEM_TILING_MODE_TILED 1
5097678d71fSThierry Reding #define DRM_TEGRA_GEM_TILING_MODE_BLOCK 2
5107678d71fSThierry Reding 
5116134534cSThierry Reding /**
5126134534cSThierry Reding  * struct drm_tegra_gem_set_tiling - parameters for the set tiling IOCTL
5136134534cSThierry Reding  */
5147678d71fSThierry Reding struct drm_tegra_gem_set_tiling {
5156134534cSThierry Reding 	/**
5166134534cSThierry Reding 	 * @handle:
5176134534cSThierry Reding 	 *
5186134534cSThierry Reding 	 * Handle to the GEM object for which to set the tiling parameters.
5196134534cSThierry Reding 	 */
5207678d71fSThierry Reding 	__u32 handle;
5216134534cSThierry Reding 
5226134534cSThierry Reding 	/**
5236134534cSThierry Reding 	 * @mode:
5246134534cSThierry Reding 	 *
5256134534cSThierry Reding 	 * The tiling mode to set. Must be one of:
5266134534cSThierry Reding 	 *
5276134534cSThierry Reding 	 * DRM_TEGRA_GEM_TILING_MODE_PITCH
5286134534cSThierry Reding 	 *   pitch linear format
5296134534cSThierry Reding 	 *
5306134534cSThierry Reding 	 * DRM_TEGRA_GEM_TILING_MODE_TILED
5316134534cSThierry Reding 	 *   16x16 tiling format
5326134534cSThierry Reding 	 *
5336134534cSThierry Reding 	 * DRM_TEGRA_GEM_TILING_MODE_BLOCK
5346134534cSThierry Reding 	 *   16Bx2 tiling format
5356134534cSThierry Reding 	 */
5367678d71fSThierry Reding 	__u32 mode;
5376134534cSThierry Reding 
5386134534cSThierry Reding 	/**
5396134534cSThierry Reding 	 * @value:
5406134534cSThierry Reding 	 *
5416134534cSThierry Reding 	 * The value to set for the tiling mode parameter.
5426134534cSThierry Reding 	 */
5437678d71fSThierry Reding 	__u32 value;
5446134534cSThierry Reding 
5456134534cSThierry Reding 	/**
5466134534cSThierry Reding 	 * @pad:
5476134534cSThierry Reding 	 *
5486134534cSThierry Reding 	 * Structure padding that may be used in the future. Must be 0.
5496134534cSThierry Reding 	 */
5507678d71fSThierry Reding 	__u32 pad;
5517678d71fSThierry Reding };
5527678d71fSThierry Reding 
5536134534cSThierry Reding /**
5546134534cSThierry Reding  * struct drm_tegra_gem_get_tiling - parameters for the get tiling IOCTL
5556134534cSThierry Reding  */
5567678d71fSThierry Reding struct drm_tegra_gem_get_tiling {
5576134534cSThierry Reding 	/**
5586134534cSThierry Reding 	 * @handle:
5596134534cSThierry Reding 	 *
5606134534cSThierry Reding 	 * Handle to the GEM object for which to query the tiling parameters.
5616134534cSThierry Reding 	 */
5627678d71fSThierry Reding 	__u32 handle;
5636134534cSThierry Reding 
5646134534cSThierry Reding 	/**
5656134534cSThierry Reding 	 * @mode:
5666134534cSThierry Reding 	 *
5676134534cSThierry Reding 	 * The tiling mode currently associated with the GEM object. Set by
5686134534cSThierry Reding 	 * the kernel upon successful completion of the IOCTL.
5696134534cSThierry Reding 	 */
5707678d71fSThierry Reding 	__u32 mode;
5716134534cSThierry Reding 
5726134534cSThierry Reding 	/**
5736134534cSThierry Reding 	 * @value:
5746134534cSThierry Reding 	 *
5756134534cSThierry Reding 	 * The tiling mode parameter currently associated with the GEM object.
5766134534cSThierry Reding 	 * Set by the kernel upon successful completion of the IOCTL.
5776134534cSThierry Reding 	 */
5787678d71fSThierry Reding 	__u32 value;
5796134534cSThierry Reding 
5806134534cSThierry Reding 	/**
5816134534cSThierry Reding 	 * @pad:
5826134534cSThierry Reding 	 *
5836134534cSThierry Reding 	 * Structure padding that may be used in the future. Must be 0.
5846134534cSThierry Reding 	 */
5857678d71fSThierry Reding 	__u32 pad;
5867678d71fSThierry Reding };
5877678d71fSThierry Reding 
5887b129087SThierry Reding #define DRM_TEGRA_GEM_BOTTOM_UP		(1 << 0)
5897b129087SThierry Reding #define DRM_TEGRA_GEM_FLAGS		(DRM_TEGRA_GEM_BOTTOM_UP)
5907b129087SThierry Reding 
5916134534cSThierry Reding /**
5926134534cSThierry Reding  * struct drm_tegra_gem_set_flags - parameters for the set flags IOCTL
5936134534cSThierry Reding  */
5947b129087SThierry Reding struct drm_tegra_gem_set_flags {
5956134534cSThierry Reding 	/**
5966134534cSThierry Reding 	 * @handle:
5976134534cSThierry Reding 	 *
5986134534cSThierry Reding 	 * Handle to the GEM object for which to set the flags.
5996134534cSThierry Reding 	 */
6007b129087SThierry Reding 	__u32 handle;
6016134534cSThierry Reding 
6026134534cSThierry Reding 	/**
6036134534cSThierry Reding 	 * @flags:
6046134534cSThierry Reding 	 *
6056134534cSThierry Reding 	 * The flags to set for the GEM object.
6066134534cSThierry Reding 	 */
6077b129087SThierry Reding 	__u32 flags;
6087b129087SThierry Reding };
6097b129087SThierry Reding 
6106134534cSThierry Reding /**
6116134534cSThierry Reding  * struct drm_tegra_gem_get_flags - parameters for the get flags IOCTL
6126134534cSThierry Reding  */
6137b129087SThierry Reding struct drm_tegra_gem_get_flags {
6146134534cSThierry Reding 	/**
6156134534cSThierry Reding 	 * @handle:
6166134534cSThierry Reding 	 *
6176134534cSThierry Reding 	 * Handle to the GEM object for which to query the flags.
6186134534cSThierry Reding 	 */
6197b129087SThierry Reding 	__u32 handle;
6206134534cSThierry Reding 
6216134534cSThierry Reding 	/**
6226134534cSThierry Reding 	 * @flags:
6236134534cSThierry Reding 	 *
6246134534cSThierry Reding 	 * The flags currently associated with the GEM object. Set by the
6256134534cSThierry Reding 	 * kernel upon successful completion of the IOCTL.
6266134534cSThierry Reding 	 */
6277b129087SThierry Reding 	__u32 flags;
6287b129087SThierry Reding };
6297b129087SThierry Reding 
630d43f81cbSTerje Bergstrom #define DRM_TEGRA_GEM_CREATE		0x00
631d43f81cbSTerje Bergstrom #define DRM_TEGRA_GEM_MMAP		0x01
632d43f81cbSTerje Bergstrom #define DRM_TEGRA_SYNCPT_READ		0x02
633d43f81cbSTerje Bergstrom #define DRM_TEGRA_SYNCPT_INCR		0x03
634d43f81cbSTerje Bergstrom #define DRM_TEGRA_SYNCPT_WAIT		0x04
635d43f81cbSTerje Bergstrom #define DRM_TEGRA_OPEN_CHANNEL	        0x05
636d43f81cbSTerje Bergstrom #define DRM_TEGRA_CLOSE_CHANNEL	        0x06
637d43f81cbSTerje Bergstrom #define DRM_TEGRA_GET_SYNCPT		0x07
638d43f81cbSTerje Bergstrom #define DRM_TEGRA_SUBMIT		0x08
639c54a169bSArto Merilainen #define DRM_TEGRA_GET_SYNCPT_BASE	0x09
6407678d71fSThierry Reding #define DRM_TEGRA_GEM_SET_TILING	0x0a
6417678d71fSThierry Reding #define DRM_TEGRA_GEM_GET_TILING	0x0b
6427b129087SThierry Reding #define DRM_TEGRA_GEM_SET_FLAGS		0x0c
6437b129087SThierry Reding #define DRM_TEGRA_GEM_GET_FLAGS		0x0d
644d43f81cbSTerje Bergstrom 
645d43f81cbSTerje Bergstrom #define DRM_IOCTL_TEGRA_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_CREATE, struct drm_tegra_gem_create)
646d43f81cbSTerje Bergstrom #define DRM_IOCTL_TEGRA_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_MMAP, struct drm_tegra_gem_mmap)
647d43f81cbSTerje Bergstrom #define DRM_IOCTL_TEGRA_SYNCPT_READ DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_READ, struct drm_tegra_syncpt_read)
648d43f81cbSTerje Bergstrom #define DRM_IOCTL_TEGRA_SYNCPT_INCR DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_INCR, struct drm_tegra_syncpt_incr)
649d43f81cbSTerje Bergstrom #define DRM_IOCTL_TEGRA_SYNCPT_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_WAIT, struct drm_tegra_syncpt_wait)
650d43f81cbSTerje Bergstrom #define DRM_IOCTL_TEGRA_OPEN_CHANNEL DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_OPEN_CHANNEL, struct drm_tegra_open_channel)
651c850ece7SThierry Reding #define DRM_IOCTL_TEGRA_CLOSE_CHANNEL DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_CLOSE_CHANNEL, struct drm_tegra_close_channel)
652d43f81cbSTerje Bergstrom #define DRM_IOCTL_TEGRA_GET_SYNCPT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT, struct drm_tegra_get_syncpt)
653d43f81cbSTerje Bergstrom #define DRM_IOCTL_TEGRA_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SUBMIT, struct drm_tegra_submit)
654c54a169bSArto Merilainen #define DRM_IOCTL_TEGRA_GET_SYNCPT_BASE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT_BASE, struct drm_tegra_get_syncpt_base)
6557678d71fSThierry Reding #define DRM_IOCTL_TEGRA_GEM_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_SET_TILING, struct drm_tegra_gem_set_tiling)
6567678d71fSThierry Reding #define DRM_IOCTL_TEGRA_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_GET_TILING, struct drm_tegra_gem_get_tiling)
6577b129087SThierry Reding #define DRM_IOCTL_TEGRA_GEM_SET_FLAGS DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_SET_FLAGS, struct drm_tegra_gem_set_flags)
6587b129087SThierry Reding #define DRM_IOCTL_TEGRA_GEM_GET_FLAGS DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_GET_FLAGS, struct drm_tegra_gem_get_flags)
659d43f81cbSTerje Bergstrom 
660*57e20395SMikko Perttunen /* New Tegra DRM UAPI */
661*57e20395SMikko Perttunen 
662*57e20395SMikko Perttunen /*
663*57e20395SMikko Perttunen  * Reported by the driver in the `capabilities` field.
664*57e20395SMikko Perttunen  *
665*57e20395SMikko Perttunen  * DRM_TEGRA_CHANNEL_CAP_CACHE_COHERENT: If set, the engine is cache coherent
666*57e20395SMikko Perttunen  * with regard to the system memory.
667*57e20395SMikko Perttunen  */
668*57e20395SMikko Perttunen #define DRM_TEGRA_CHANNEL_CAP_CACHE_COHERENT (1 << 0)
669*57e20395SMikko Perttunen 
670*57e20395SMikko Perttunen struct drm_tegra_channel_open {
671*57e20395SMikko Perttunen 	/**
672*57e20395SMikko Perttunen 	 * @host1x_class: [in]
673*57e20395SMikko Perttunen 	 *
674*57e20395SMikko Perttunen 	 * Host1x class of the engine that will be programmed using this
675*57e20395SMikko Perttunen 	 * channel.
676*57e20395SMikko Perttunen 	 */
677*57e20395SMikko Perttunen 	__u32 host1x_class;
678*57e20395SMikko Perttunen 
679*57e20395SMikko Perttunen 	/**
680*57e20395SMikko Perttunen 	 * @flags: [in]
681*57e20395SMikko Perttunen 	 *
682*57e20395SMikko Perttunen 	 * Flags.
683*57e20395SMikko Perttunen 	 */
684*57e20395SMikko Perttunen 	__u32 flags;
685*57e20395SMikko Perttunen 
686*57e20395SMikko Perttunen 	/**
687*57e20395SMikko Perttunen 	 * @context: [out]
688*57e20395SMikko Perttunen 	 *
689*57e20395SMikko Perttunen 	 * Opaque identifier corresponding to the opened channel.
690*57e20395SMikko Perttunen 	 */
691*57e20395SMikko Perttunen 	__u32 context;
692*57e20395SMikko Perttunen 
693*57e20395SMikko Perttunen 	/**
694*57e20395SMikko Perttunen 	 * @version: [out]
695*57e20395SMikko Perttunen 	 *
696*57e20395SMikko Perttunen 	 * Version of the engine hardware. This can be used by userspace
697*57e20395SMikko Perttunen 	 * to determine how the engine needs to be programmed.
698*57e20395SMikko Perttunen 	 */
699*57e20395SMikko Perttunen 	__u32 version;
700*57e20395SMikko Perttunen 
701*57e20395SMikko Perttunen 	/**
702*57e20395SMikko Perttunen 	 * @capabilities: [out]
703*57e20395SMikko Perttunen 	 *
704*57e20395SMikko Perttunen 	 * Flags describing the hardware capabilities.
705*57e20395SMikko Perttunen 	 */
706*57e20395SMikko Perttunen 	__u32 capabilities;
707*57e20395SMikko Perttunen 	__u32 padding;
708*57e20395SMikko Perttunen };
709*57e20395SMikko Perttunen 
710*57e20395SMikko Perttunen struct drm_tegra_channel_close {
711*57e20395SMikko Perttunen 	/**
712*57e20395SMikko Perttunen 	 * @context: [in]
713*57e20395SMikko Perttunen 	 *
714*57e20395SMikko Perttunen 	 * Identifier of the channel to close.
715*57e20395SMikko Perttunen 	 */
716*57e20395SMikko Perttunen 	__u32 context;
717*57e20395SMikko Perttunen 	__u32 padding;
718*57e20395SMikko Perttunen };
719*57e20395SMikko Perttunen 
720*57e20395SMikko Perttunen /*
721*57e20395SMikko Perttunen  * Mapping flags that can be used to influence how the mapping is created.
722*57e20395SMikko Perttunen  *
723*57e20395SMikko Perttunen  * DRM_TEGRA_CHANNEL_MAP_READ: create mapping that allows HW read access
724*57e20395SMikko Perttunen  * DRM_TEGRA_CHANNEL_MAP_WRITE: create mapping that allows HW write access
725*57e20395SMikko Perttunen  */
726*57e20395SMikko Perttunen #define DRM_TEGRA_CHANNEL_MAP_READ  (1 << 0)
727*57e20395SMikko Perttunen #define DRM_TEGRA_CHANNEL_MAP_WRITE (1 << 1)
728*57e20395SMikko Perttunen #define DRM_TEGRA_CHANNEL_MAP_READ_WRITE (DRM_TEGRA_CHANNEL_MAP_READ | \
729*57e20395SMikko Perttunen 					  DRM_TEGRA_CHANNEL_MAP_WRITE)
730*57e20395SMikko Perttunen 
731*57e20395SMikko Perttunen struct drm_tegra_channel_map {
732*57e20395SMikko Perttunen 	/**
733*57e20395SMikko Perttunen 	 * @context: [in]
734*57e20395SMikko Perttunen 	 *
735*57e20395SMikko Perttunen 	 * Identifier of the channel to which make memory available for.
736*57e20395SMikko Perttunen 	 */
737*57e20395SMikko Perttunen 	__u32 context;
738*57e20395SMikko Perttunen 
739*57e20395SMikko Perttunen 	/**
740*57e20395SMikko Perttunen 	 * @handle: [in]
741*57e20395SMikko Perttunen 	 *
742*57e20395SMikko Perttunen 	 * GEM handle of the memory to map.
743*57e20395SMikko Perttunen 	 */
744*57e20395SMikko Perttunen 	__u32 handle;
745*57e20395SMikko Perttunen 
746*57e20395SMikko Perttunen 	/**
747*57e20395SMikko Perttunen 	 * @flags: [in]
748*57e20395SMikko Perttunen 	 *
749*57e20395SMikko Perttunen 	 * Flags.
750*57e20395SMikko Perttunen 	 */
751*57e20395SMikko Perttunen 	__u32 flags;
752*57e20395SMikko Perttunen 
753*57e20395SMikko Perttunen 	/**
754*57e20395SMikko Perttunen 	 * @mapping: [out]
755*57e20395SMikko Perttunen 	 *
756*57e20395SMikko Perttunen 	 * Identifier corresponding to the mapping, to be used for
757*57e20395SMikko Perttunen 	 * relocations or unmapping later.
758*57e20395SMikko Perttunen 	 */
759*57e20395SMikko Perttunen 	__u32 mapping;
760*57e20395SMikko Perttunen };
761*57e20395SMikko Perttunen 
762*57e20395SMikko Perttunen struct drm_tegra_channel_unmap {
763*57e20395SMikko Perttunen 	/**
764*57e20395SMikko Perttunen 	 * @context: [in]
765*57e20395SMikko Perttunen 	 *
766*57e20395SMikko Perttunen 	 * Channel identifier of the channel to unmap memory from.
767*57e20395SMikko Perttunen 	 */
768*57e20395SMikko Perttunen 	__u32 context;
769*57e20395SMikko Perttunen 
770*57e20395SMikko Perttunen 	/**
771*57e20395SMikko Perttunen 	 * @mapping: [in]
772*57e20395SMikko Perttunen 	 *
773*57e20395SMikko Perttunen 	 * Mapping identifier of the memory mapping to unmap.
774*57e20395SMikko Perttunen 	 */
775*57e20395SMikko Perttunen 	__u32 mapping;
776*57e20395SMikko Perttunen };
777*57e20395SMikko Perttunen 
778*57e20395SMikko Perttunen /* Submission */
779*57e20395SMikko Perttunen 
780*57e20395SMikko Perttunen /**
781*57e20395SMikko Perttunen  * Specify that bit 39 of the patched-in address should be set to switch
782*57e20395SMikko Perttunen  * swizzling between Tegra and non-Tegra sector layout on systems that store
783*57e20395SMikko Perttunen  * surfaces in system memory in non-Tegra sector layout.
784*57e20395SMikko Perttunen  */
785*57e20395SMikko Perttunen #define DRM_TEGRA_SUBMIT_RELOC_SECTOR_LAYOUT (1 << 0)
786*57e20395SMikko Perttunen 
787*57e20395SMikko Perttunen struct drm_tegra_submit_buf {
788*57e20395SMikko Perttunen 	/**
789*57e20395SMikko Perttunen 	 * @mapping: [in]
790*57e20395SMikko Perttunen 	 *
791*57e20395SMikko Perttunen 	 * Identifier of the mapping to use in the submission.
792*57e20395SMikko Perttunen 	 */
793*57e20395SMikko Perttunen 	__u32 mapping;
794*57e20395SMikko Perttunen 
795*57e20395SMikko Perttunen 	/**
796*57e20395SMikko Perttunen 	 * @flags: [in]
797*57e20395SMikko Perttunen 	 *
798*57e20395SMikko Perttunen 	 * Flags.
799*57e20395SMikko Perttunen 	 */
800*57e20395SMikko Perttunen 	__u32 flags;
801*57e20395SMikko Perttunen 
802*57e20395SMikko Perttunen 	/**
803*57e20395SMikko Perttunen 	 * Information for relocation patching.
804*57e20395SMikko Perttunen 	 */
805*57e20395SMikko Perttunen 	struct {
806*57e20395SMikko Perttunen 		/**
807*57e20395SMikko Perttunen 		 * @target_offset: [in]
808*57e20395SMikko Perttunen 		 *
809*57e20395SMikko Perttunen 		 * Offset from the start of the mapping of the data whose
810*57e20395SMikko Perttunen 		 * address is to be patched into the gather.
811*57e20395SMikko Perttunen 		 */
812*57e20395SMikko Perttunen 		__u64 target_offset;
813*57e20395SMikko Perttunen 
814*57e20395SMikko Perttunen 		/**
815*57e20395SMikko Perttunen 		 * @gather_offset_words: [in]
816*57e20395SMikko Perttunen 		 *
817*57e20395SMikko Perttunen 		 * Offset in words from the start of the gather data to
818*57e20395SMikko Perttunen 		 * where the address should be patched into.
819*57e20395SMikko Perttunen 		 */
820*57e20395SMikko Perttunen 		__u32 gather_offset_words;
821*57e20395SMikko Perttunen 
822*57e20395SMikko Perttunen 		/**
823*57e20395SMikko Perttunen 		 * @shift: [in]
824*57e20395SMikko Perttunen 		 *
825*57e20395SMikko Perttunen 		 * Number of bits the address should be shifted right before
826*57e20395SMikko Perttunen 		 * patching in.
827*57e20395SMikko Perttunen 		 */
828*57e20395SMikko Perttunen 		__u32 shift;
829*57e20395SMikko Perttunen 	} reloc;
830*57e20395SMikko Perttunen };
831*57e20395SMikko Perttunen 
832*57e20395SMikko Perttunen /**
833*57e20395SMikko Perttunen  * Execute `words` words of Host1x opcodes specified in the `gather_data_ptr`
834*57e20395SMikko Perttunen  * buffer. Each GATHER_UPTR command uses successive words from the buffer.
835*57e20395SMikko Perttunen  */
836*57e20395SMikko Perttunen #define DRM_TEGRA_SUBMIT_CMD_GATHER_UPTR		0
837*57e20395SMikko Perttunen /**
838*57e20395SMikko Perttunen  * Wait for a syncpoint to reach a value before continuing with further
839*57e20395SMikko Perttunen  * commands.
840*57e20395SMikko Perttunen  */
841*57e20395SMikko Perttunen #define DRM_TEGRA_SUBMIT_CMD_WAIT_SYNCPT		1
842*57e20395SMikko Perttunen /**
843*57e20395SMikko Perttunen  * Wait for a syncpoint to reach a value before continuing with further
844*57e20395SMikko Perttunen  * commands. The threshold is calculated relative to the start of the job.
845*57e20395SMikko Perttunen  */
846*57e20395SMikko Perttunen #define DRM_TEGRA_SUBMIT_CMD_WAIT_SYNCPT_RELATIVE	2
847*57e20395SMikko Perttunen 
848*57e20395SMikko Perttunen struct drm_tegra_submit_cmd_gather_uptr {
849*57e20395SMikko Perttunen 	__u32 words;
850*57e20395SMikko Perttunen 	__u32 reserved[3];
851*57e20395SMikko Perttunen };
852*57e20395SMikko Perttunen 
853*57e20395SMikko Perttunen struct drm_tegra_submit_cmd_wait_syncpt {
854*57e20395SMikko Perttunen 	__u32 id;
855*57e20395SMikko Perttunen 	__u32 value;
856*57e20395SMikko Perttunen 	__u32 reserved[2];
857*57e20395SMikko Perttunen };
858*57e20395SMikko Perttunen 
859*57e20395SMikko Perttunen struct drm_tegra_submit_cmd {
860*57e20395SMikko Perttunen 	/**
861*57e20395SMikko Perttunen 	 * @type: [in]
862*57e20395SMikko Perttunen 	 *
863*57e20395SMikko Perttunen 	 * Command type to execute. One of the DRM_TEGRA_SUBMIT_CMD*
864*57e20395SMikko Perttunen 	 * defines.
865*57e20395SMikko Perttunen 	 */
866*57e20395SMikko Perttunen 	__u32 type;
867*57e20395SMikko Perttunen 
868*57e20395SMikko Perttunen 	/**
869*57e20395SMikko Perttunen 	 * @flags: [in]
870*57e20395SMikko Perttunen 	 *
871*57e20395SMikko Perttunen 	 * Flags.
872*57e20395SMikko Perttunen 	 */
873*57e20395SMikko Perttunen 	__u32 flags;
874*57e20395SMikko Perttunen 
875*57e20395SMikko Perttunen 	union {
876*57e20395SMikko Perttunen 		struct drm_tegra_submit_cmd_gather_uptr gather_uptr;
877*57e20395SMikko Perttunen 		struct drm_tegra_submit_cmd_wait_syncpt wait_syncpt;
878*57e20395SMikko Perttunen 		__u32 reserved[4];
879*57e20395SMikko Perttunen 	};
880*57e20395SMikko Perttunen };
881*57e20395SMikko Perttunen 
882*57e20395SMikko Perttunen struct drm_tegra_submit_syncpt {
883*57e20395SMikko Perttunen 	/**
884*57e20395SMikko Perttunen 	 * @id: [in]
885*57e20395SMikko Perttunen 	 *
886*57e20395SMikko Perttunen 	 * ID of the syncpoint that the job will increment.
887*57e20395SMikko Perttunen 	 */
888*57e20395SMikko Perttunen 	__u32 id;
889*57e20395SMikko Perttunen 
890*57e20395SMikko Perttunen 	/**
891*57e20395SMikko Perttunen 	 * @flags: [in]
892*57e20395SMikko Perttunen 	 *
893*57e20395SMikko Perttunen 	 * Flags.
894*57e20395SMikko Perttunen 	 */
895*57e20395SMikko Perttunen 	__u32 flags;
896*57e20395SMikko Perttunen 
897*57e20395SMikko Perttunen 	/**
898*57e20395SMikko Perttunen 	 * @increments: [in]
899*57e20395SMikko Perttunen 	 *
900*57e20395SMikko Perttunen 	 * Number of times the job will increment this syncpoint.
901*57e20395SMikko Perttunen 	 */
902*57e20395SMikko Perttunen 	__u32 increments;
903*57e20395SMikko Perttunen 
904*57e20395SMikko Perttunen 	/**
905*57e20395SMikko Perttunen 	 * @value: [out]
906*57e20395SMikko Perttunen 	 *
907*57e20395SMikko Perttunen 	 * Value the syncpoint will have once the job has completed all
908*57e20395SMikko Perttunen 	 * its specified syncpoint increments.
909*57e20395SMikko Perttunen 	 *
910*57e20395SMikko Perttunen 	 * Note that the kernel may increment the syncpoint before or after
911*57e20395SMikko Perttunen 	 * the job. These increments are not reflected in this field.
912*57e20395SMikko Perttunen 	 *
913*57e20395SMikko Perttunen 	 * If the job hangs or times out, not all of the increments may
914*57e20395SMikko Perttunen 	 * get executed.
915*57e20395SMikko Perttunen 	 */
916*57e20395SMikko Perttunen 	__u32 value;
917*57e20395SMikko Perttunen };
918*57e20395SMikko Perttunen 
919*57e20395SMikko Perttunen struct drm_tegra_channel_submit {
920*57e20395SMikko Perttunen 	/**
921*57e20395SMikko Perttunen 	 * @context: [in]
922*57e20395SMikko Perttunen 	 *
923*57e20395SMikko Perttunen 	 * Identifier of the channel to submit this job to.
924*57e20395SMikko Perttunen 	 */
925*57e20395SMikko Perttunen 	__u32 context;
926*57e20395SMikko Perttunen 
927*57e20395SMikko Perttunen 	/**
928*57e20395SMikko Perttunen 	 * @num_bufs: [in]
929*57e20395SMikko Perttunen 	 *
930*57e20395SMikko Perttunen 	 * Number of elements in the `bufs_ptr` array.
931*57e20395SMikko Perttunen 	 */
932*57e20395SMikko Perttunen 	__u32 num_bufs;
933*57e20395SMikko Perttunen 
934*57e20395SMikko Perttunen 	/**
935*57e20395SMikko Perttunen 	 * @num_cmds: [in]
936*57e20395SMikko Perttunen 	 *
937*57e20395SMikko Perttunen 	 * Number of elements in the `cmds_ptr` array.
938*57e20395SMikko Perttunen 	 */
939*57e20395SMikko Perttunen 	__u32 num_cmds;
940*57e20395SMikko Perttunen 
941*57e20395SMikko Perttunen 	/**
942*57e20395SMikko Perttunen 	 * @gather_data_words: [in]
943*57e20395SMikko Perttunen 	 *
944*57e20395SMikko Perttunen 	 * Number of 32-bit words in the `gather_data_ptr` array.
945*57e20395SMikko Perttunen 	 */
946*57e20395SMikko Perttunen 	__u32 gather_data_words;
947*57e20395SMikko Perttunen 
948*57e20395SMikko Perttunen 	/**
949*57e20395SMikko Perttunen 	 * @bufs_ptr: [in]
950*57e20395SMikko Perttunen 	 *
951*57e20395SMikko Perttunen 	 * Pointer to an array of drm_tegra_submit_buf structures.
952*57e20395SMikko Perttunen 	 */
953*57e20395SMikko Perttunen 	__u64 bufs_ptr;
954*57e20395SMikko Perttunen 
955*57e20395SMikko Perttunen 	/**
956*57e20395SMikko Perttunen 	 * @cmds_ptr: [in]
957*57e20395SMikko Perttunen 	 *
958*57e20395SMikko Perttunen 	 * Pointer to an array of drm_tegra_submit_cmd structures.
959*57e20395SMikko Perttunen 	 */
960*57e20395SMikko Perttunen 	__u64 cmds_ptr;
961*57e20395SMikko Perttunen 
962*57e20395SMikko Perttunen 	/**
963*57e20395SMikko Perttunen 	 * @gather_data_ptr: [in]
964*57e20395SMikko Perttunen 	 *
965*57e20395SMikko Perttunen 	 * Pointer to an array of Host1x opcodes to be used by GATHER_UPTR
966*57e20395SMikko Perttunen 	 * commands.
967*57e20395SMikko Perttunen 	 */
968*57e20395SMikko Perttunen 	__u64 gather_data_ptr;
969*57e20395SMikko Perttunen 
970*57e20395SMikko Perttunen 	/**
971*57e20395SMikko Perttunen 	 * @syncobj_in: [in]
972*57e20395SMikko Perttunen 	 *
973*57e20395SMikko Perttunen 	 * Handle for DRM syncobj that will be waited before submission.
974*57e20395SMikko Perttunen 	 * Ignored if zero.
975*57e20395SMikko Perttunen 	 */
976*57e20395SMikko Perttunen 	__u32 syncobj_in;
977*57e20395SMikko Perttunen 
978*57e20395SMikko Perttunen 	/**
979*57e20395SMikko Perttunen 	 * @syncobj_out: [in]
980*57e20395SMikko Perttunen 	 *
981*57e20395SMikko Perttunen 	 * Handle for DRM syncobj that will have its fence replaced with
982*57e20395SMikko Perttunen 	 * the job's completion fence. Ignored if zero.
983*57e20395SMikko Perttunen 	 */
984*57e20395SMikko Perttunen 	__u32 syncobj_out;
985*57e20395SMikko Perttunen 
986*57e20395SMikko Perttunen 	/**
987*57e20395SMikko Perttunen 	 * @syncpt_incr: [in,out]
988*57e20395SMikko Perttunen 	 *
989*57e20395SMikko Perttunen 	 * Information about the syncpoint the job will increment.
990*57e20395SMikko Perttunen 	 */
991*57e20395SMikko Perttunen 	struct drm_tegra_submit_syncpt syncpt;
992*57e20395SMikko Perttunen };
993*57e20395SMikko Perttunen 
994*57e20395SMikko Perttunen struct drm_tegra_syncpoint_allocate {
995*57e20395SMikko Perttunen 	/**
996*57e20395SMikko Perttunen 	 * @id: [out]
997*57e20395SMikko Perttunen 	 *
998*57e20395SMikko Perttunen 	 * ID of allocated syncpoint.
999*57e20395SMikko Perttunen 	 */
1000*57e20395SMikko Perttunen 	__u32 id;
1001*57e20395SMikko Perttunen 	__u32 padding;
1002*57e20395SMikko Perttunen };
1003*57e20395SMikko Perttunen 
1004*57e20395SMikko Perttunen struct drm_tegra_syncpoint_free {
1005*57e20395SMikko Perttunen 	/**
1006*57e20395SMikko Perttunen 	 * @id: [in]
1007*57e20395SMikko Perttunen 	 *
1008*57e20395SMikko Perttunen 	 * ID of syncpoint to free.
1009*57e20395SMikko Perttunen 	 */
1010*57e20395SMikko Perttunen 	__u32 id;
1011*57e20395SMikko Perttunen 	__u32 padding;
1012*57e20395SMikko Perttunen };
1013*57e20395SMikko Perttunen 
1014*57e20395SMikko Perttunen struct drm_tegra_syncpoint_wait {
1015*57e20395SMikko Perttunen 	/**
1016*57e20395SMikko Perttunen 	 * @timeout: [in]
1017*57e20395SMikko Perttunen 	 *
1018*57e20395SMikko Perttunen 	 * Absolute timestamp at which the wait will time out.
1019*57e20395SMikko Perttunen 	 */
1020*57e20395SMikko Perttunen 	__s64 timeout_ns;
1021*57e20395SMikko Perttunen 
1022*57e20395SMikko Perttunen 	/**
1023*57e20395SMikko Perttunen 	 * @id: [in]
1024*57e20395SMikko Perttunen 	 *
1025*57e20395SMikko Perttunen 	 * ID of syncpoint to wait on.
1026*57e20395SMikko Perttunen 	 */
1027*57e20395SMikko Perttunen 	__u32 id;
1028*57e20395SMikko Perttunen 
1029*57e20395SMikko Perttunen 	/**
1030*57e20395SMikko Perttunen 	 * @threshold: [in]
1031*57e20395SMikko Perttunen 	 *
1032*57e20395SMikko Perttunen 	 * Threshold to wait for.
1033*57e20395SMikko Perttunen 	 */
1034*57e20395SMikko Perttunen 	__u32 threshold;
1035*57e20395SMikko Perttunen 
1036*57e20395SMikko Perttunen 	/**
1037*57e20395SMikko Perttunen 	 * @value: [out]
1038*57e20395SMikko Perttunen 	 *
1039*57e20395SMikko Perttunen 	 * Value of the syncpoint upon wait completion.
1040*57e20395SMikko Perttunen 	 */
1041*57e20395SMikko Perttunen 	__u32 value;
1042*57e20395SMikko Perttunen 
1043*57e20395SMikko Perttunen 	__u32 padding;
1044*57e20395SMikko Perttunen };
1045*57e20395SMikko Perttunen 
1046*57e20395SMikko Perttunen #define DRM_IOCTL_TEGRA_CHANNEL_OPEN DRM_IOWR(DRM_COMMAND_BASE + 0x10, struct drm_tegra_channel_open)
1047*57e20395SMikko Perttunen #define DRM_IOCTL_TEGRA_CHANNEL_CLOSE DRM_IOWR(DRM_COMMAND_BASE + 0x11, struct drm_tegra_channel_close)
1048*57e20395SMikko Perttunen #define DRM_IOCTL_TEGRA_CHANNEL_MAP DRM_IOWR(DRM_COMMAND_BASE + 0x12, struct drm_tegra_channel_map)
1049*57e20395SMikko Perttunen #define DRM_IOCTL_TEGRA_CHANNEL_UNMAP DRM_IOWR(DRM_COMMAND_BASE + 0x13, struct drm_tegra_channel_unmap)
1050*57e20395SMikko Perttunen #define DRM_IOCTL_TEGRA_CHANNEL_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + 0x14, struct drm_tegra_channel_submit)
1051*57e20395SMikko Perttunen 
1052*57e20395SMikko Perttunen #define DRM_IOCTL_TEGRA_SYNCPOINT_ALLOCATE DRM_IOWR(DRM_COMMAND_BASE + 0x20, struct drm_tegra_syncpoint_allocate)
1053*57e20395SMikko Perttunen #define DRM_IOCTL_TEGRA_SYNCPOINT_FREE DRM_IOWR(DRM_COMMAND_BASE + 0x21, struct drm_tegra_syncpoint_free)
1054*57e20395SMikko Perttunen #define DRM_IOCTL_TEGRA_SYNCPOINT_WAIT DRM_IOWR(DRM_COMMAND_BASE + 0x22, struct drm_tegra_syncpoint_wait)
1055*57e20395SMikko Perttunen 
10567aa8ceebSEmil Velikov #if defined(__cplusplus)
10577aa8ceebSEmil Velikov }
10587aa8ceebSEmil Velikov #endif
10597aa8ceebSEmil Velikov 
1060d43f81cbSTerje Bergstrom #endif
1061