blob: ad77bf47773bbbaf11e03386c4c333b4c1216756 [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Ben Cheng655a7c02013-10-16 16:09:24 -07007#ifndef _UAPI_TEGRA_DRM_H_
8#define _UAPI_TEGRA_DRM_H_
Christopher Ferris106b3a82016-08-24 12:15:38 -07009#include "drm.h"
10#ifdef __cplusplus
Christopher Ferris48fe0ae2019-01-10 15:59:33 -080011extern "C" {
Christopher Ferris106b3a82016-08-24 12:15:38 -070012#endif
13#define DRM_TEGRA_GEM_CREATE_TILED (1 << 0)
Christopher Ferris38062f92014-07-09 15:33:25 -070014#define DRM_TEGRA_GEM_CREATE_BOTTOM_UP (1 << 1)
Ben Cheng655a7c02013-10-16 16:09:24 -070015struct drm_tegra_gem_create {
Tao Baod7db5942015-01-28 10:07:51 -080016 __u64 size;
17 __u32 flags;
Tao Baod7db5942015-01-28 10:07:51 -080018 __u32 handle;
Ben Cheng655a7c02013-10-16 16:09:24 -070019};
Ben Cheng655a7c02013-10-16 16:09:24 -070020struct drm_tegra_gem_mmap {
Tao Baod7db5942015-01-28 10:07:51 -080021 __u32 handle;
Christopher Ferris05d08e92016-02-04 13:16:38 -080022 __u32 pad;
23 __u64 offset;
Ben Cheng655a7c02013-10-16 16:09:24 -070024};
Ben Cheng655a7c02013-10-16 16:09:24 -070025struct drm_tegra_syncpt_read {
Christopher Ferris05d08e92016-02-04 13:16:38 -080026 __u32 id;
Tao Baod7db5942015-01-28 10:07:51 -080027 __u32 value;
Ben Cheng655a7c02013-10-16 16:09:24 -070028};
Ben Cheng655a7c02013-10-16 16:09:24 -070029struct drm_tegra_syncpt_incr {
Christopher Ferris05d08e92016-02-04 13:16:38 -080030 __u32 id;
Tao Baod7db5942015-01-28 10:07:51 -080031 __u32 pad;
Ben Cheng655a7c02013-10-16 16:09:24 -070032};
Ben Cheng655a7c02013-10-16 16:09:24 -070033struct drm_tegra_syncpt_wait {
Christopher Ferris05d08e92016-02-04 13:16:38 -080034 __u32 id;
Tao Baod7db5942015-01-28 10:07:51 -080035 __u32 thresh;
36 __u32 timeout;
37 __u32 value;
Christopher Ferris05d08e92016-02-04 13:16:38 -080038};
Ben Cheng655a7c02013-10-16 16:09:24 -070039#define DRM_TEGRA_NO_TIMEOUT (0xffffffff)
40struct drm_tegra_open_channel {
Tao Baod7db5942015-01-28 10:07:51 -080041 __u32 client;
Christopher Ferris05d08e92016-02-04 13:16:38 -080042 __u32 pad;
Tao Baod7db5942015-01-28 10:07:51 -080043 __u64 context;
Ben Cheng655a7c02013-10-16 16:09:24 -070044};
Ben Cheng655a7c02013-10-16 16:09:24 -070045struct drm_tegra_close_channel {
Christopher Ferris05d08e92016-02-04 13:16:38 -080046 __u64 context;
Ben Cheng655a7c02013-10-16 16:09:24 -070047};
48struct drm_tegra_get_syncpt {
Tao Baod7db5942015-01-28 10:07:51 -080049 __u64 context;
Christopher Ferris05d08e92016-02-04 13:16:38 -080050 __u32 index;
Tao Baod7db5942015-01-28 10:07:51 -080051 __u32 id;
Christopher Ferris38062f92014-07-09 15:33:25 -070052};
53struct drm_tegra_get_syncpt_base {
Christopher Ferris05d08e92016-02-04 13:16:38 -080054 __u64 context;
Tao Baod7db5942015-01-28 10:07:51 -080055 __u32 syncpt;
56 __u32 id;
Ben Cheng655a7c02013-10-16 16:09:24 -070057};
Christopher Ferris05d08e92016-02-04 13:16:38 -080058struct drm_tegra_syncpt {
Tao Baod7db5942015-01-28 10:07:51 -080059 __u32 id;
60 __u32 incrs;
Ben Cheng655a7c02013-10-16 16:09:24 -070061};
Christopher Ferris05d08e92016-02-04 13:16:38 -080062struct drm_tegra_cmdbuf {
Tao Baod7db5942015-01-28 10:07:51 -080063 __u32 handle;
64 __u32 offset;
65 __u32 words;
Christopher Ferris05d08e92016-02-04 13:16:38 -080066 __u32 pad;
Ben Cheng655a7c02013-10-16 16:09:24 -070067};
68struct drm_tegra_reloc {
Tao Baod7db5942015-01-28 10:07:51 -080069 struct {
Christopher Ferris05d08e92016-02-04 13:16:38 -080070 __u32 handle;
Tao Baod7db5942015-01-28 10:07:51 -080071 __u32 offset;
72 } cmdbuf;
73 struct {
Christopher Ferris05d08e92016-02-04 13:16:38 -080074 __u32 handle;
Tao Baod7db5942015-01-28 10:07:51 -080075 __u32 offset;
76 } target;
77 __u32 shift;
Christopher Ferris05d08e92016-02-04 13:16:38 -080078 __u32 pad;
Ben Cheng655a7c02013-10-16 16:09:24 -070079};
80struct drm_tegra_waitchk {
Tao Baod7db5942015-01-28 10:07:51 -080081 __u32 handle;
Christopher Ferris05d08e92016-02-04 13:16:38 -080082 __u32 offset;
Tao Baod7db5942015-01-28 10:07:51 -080083 __u32 syncpt;
84 __u32 thresh;
Ben Cheng655a7c02013-10-16 16:09:24 -070085};
Christopher Ferris05d08e92016-02-04 13:16:38 -080086struct drm_tegra_submit {
Tao Baod7db5942015-01-28 10:07:51 -080087 __u64 context;
88 __u32 num_syncpts;
89 __u32 num_cmdbufs;
Christopher Ferris05d08e92016-02-04 13:16:38 -080090 __u32 num_relocs;
Tao Baod7db5942015-01-28 10:07:51 -080091 __u32 num_waitchks;
92 __u32 waitchk_mask;
93 __u32 timeout;
Christopher Ferris05d08e92016-02-04 13:16:38 -080094 __u64 syncpts;
Tao Baod7db5942015-01-28 10:07:51 -080095 __u64 cmdbufs;
96 __u64 relocs;
97 __u64 waitchks;
Christopher Ferris05d08e92016-02-04 13:16:38 -080098 __u32 fence;
Tao Baod7db5942015-01-28 10:07:51 -080099 __u32 reserved[5];
Ben Cheng655a7c02013-10-16 16:09:24 -0700100};
Christopher Ferris82d75042015-01-26 10:57:07 -0800101#define DRM_TEGRA_GEM_TILING_MODE_PITCH 0
Christopher Ferris05d08e92016-02-04 13:16:38 -0800102#define DRM_TEGRA_GEM_TILING_MODE_TILED 1
Christopher Ferris82d75042015-01-26 10:57:07 -0800103#define DRM_TEGRA_GEM_TILING_MODE_BLOCK 2
104struct drm_tegra_gem_set_tiling {
Tao Baod7db5942015-01-28 10:07:51 -0800105 __u32 handle;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800106 __u32 mode;
Tao Baod7db5942015-01-28 10:07:51 -0800107 __u32 value;
108 __u32 pad;
Christopher Ferris82d75042015-01-26 10:57:07 -0800109};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800110struct drm_tegra_gem_get_tiling {
Tao Baod7db5942015-01-28 10:07:51 -0800111 __u32 handle;
112 __u32 mode;
113 __u32 value;
Christopher Ferris05d08e92016-02-04 13:16:38 -0800114 __u32 pad;
Christopher Ferris82d75042015-01-26 10:57:07 -0800115};
116#define DRM_TEGRA_GEM_BOTTOM_UP (1 << 0)
117#define DRM_TEGRA_GEM_FLAGS (DRM_TEGRA_GEM_BOTTOM_UP)
118struct drm_tegra_gem_set_flags {
Tao Baod7db5942015-01-28 10:07:51 -0800119 __u32 handle;
120 __u32 flags;
Christopher Ferris82d75042015-01-26 10:57:07 -0800121};
122struct drm_tegra_gem_get_flags {
Tao Baod7db5942015-01-28 10:07:51 -0800123 __u32 handle;
124 __u32 flags;
Christopher Ferris82d75042015-01-26 10:57:07 -0800125};
Christopher Ferris05d08e92016-02-04 13:16:38 -0800126#define DRM_TEGRA_GEM_CREATE 0x00
Christopher Ferris82d75042015-01-26 10:57:07 -0800127#define DRM_TEGRA_GEM_MMAP 0x01
Ben Cheng655a7c02013-10-16 16:09:24 -0700128#define DRM_TEGRA_SYNCPT_READ 0x02
129#define DRM_TEGRA_SYNCPT_INCR 0x03
Christopher Ferris05d08e92016-02-04 13:16:38 -0800130#define DRM_TEGRA_SYNCPT_WAIT 0x04
Christopher Ferris82d75042015-01-26 10:57:07 -0800131#define DRM_TEGRA_OPEN_CHANNEL 0x05
Ben Cheng655a7c02013-10-16 16:09:24 -0700132#define DRM_TEGRA_CLOSE_CHANNEL 0x06
133#define DRM_TEGRA_GET_SYNCPT 0x07
Christopher Ferris05d08e92016-02-04 13:16:38 -0800134#define DRM_TEGRA_SUBMIT 0x08
Christopher Ferris82d75042015-01-26 10:57:07 -0800135#define DRM_TEGRA_GET_SYNCPT_BASE 0x09
136#define DRM_TEGRA_GEM_SET_TILING 0x0a
137#define DRM_TEGRA_GEM_GET_TILING 0x0b
Christopher Ferris05d08e92016-02-04 13:16:38 -0800138#define DRM_TEGRA_GEM_SET_FLAGS 0x0c
Christopher Ferris82d75042015-01-26 10:57:07 -0800139#define DRM_TEGRA_GEM_GET_FLAGS 0x0d
Ben Cheng655a7c02013-10-16 16:09:24 -0700140#define DRM_IOCTL_TEGRA_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_CREATE, struct drm_tegra_gem_create)
141#define DRM_IOCTL_TEGRA_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_MMAP, struct drm_tegra_gem_mmap)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800142#define DRM_IOCTL_TEGRA_SYNCPT_READ DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_READ, struct drm_tegra_syncpt_read)
Christopher Ferris82d75042015-01-26 10:57:07 -0800143#define DRM_IOCTL_TEGRA_SYNCPT_INCR DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_INCR, struct drm_tegra_syncpt_incr)
Ben Cheng655a7c02013-10-16 16:09:24 -0700144#define DRM_IOCTL_TEGRA_SYNCPT_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_WAIT, struct drm_tegra_syncpt_wait)
145#define DRM_IOCTL_TEGRA_OPEN_CHANNEL DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_OPEN_CHANNEL, struct drm_tegra_open_channel)
Christopher Ferris9ce28842018-10-25 12:11:39 -0700146#define DRM_IOCTL_TEGRA_CLOSE_CHANNEL DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_CLOSE_CHANNEL, struct drm_tegra_close_channel)
Christopher Ferris82d75042015-01-26 10:57:07 -0800147#define DRM_IOCTL_TEGRA_GET_SYNCPT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT, struct drm_tegra_get_syncpt)
Ben Cheng655a7c02013-10-16 16:09:24 -0700148#define DRM_IOCTL_TEGRA_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SUBMIT, struct drm_tegra_submit)
Christopher Ferris38062f92014-07-09 15:33:25 -0700149#define DRM_IOCTL_TEGRA_GET_SYNCPT_BASE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT_BASE, struct drm_tegra_get_syncpt_base)
Christopher Ferris05d08e92016-02-04 13:16:38 -0800150#define DRM_IOCTL_TEGRA_GEM_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_SET_TILING, struct drm_tegra_gem_set_tiling)
Christopher Ferris82d75042015-01-26 10:57:07 -0800151#define DRM_IOCTL_TEGRA_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_GET_TILING, struct drm_tegra_gem_get_tiling)
152#define DRM_IOCTL_TEGRA_GEM_SET_FLAGS DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_SET_FLAGS, struct drm_tegra_gem_set_flags)
153#define DRM_IOCTL_TEGRA_GEM_GET_FLAGS DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_GET_FLAGS, struct drm_tegra_gem_get_flags)
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700154#define DRM_TEGRA_CHANNEL_CAP_CACHE_COHERENT (1 << 0)
155struct drm_tegra_channel_open {
156 __u32 host1x_class;
157 __u32 flags;
158 __u32 context;
159 __u32 version;
160 __u32 capabilities;
161 __u32 padding;
162};
163struct drm_tegra_channel_close {
164 __u32 context;
165 __u32 padding;
166};
167#define DRM_TEGRA_CHANNEL_MAP_READ (1 << 0)
168#define DRM_TEGRA_CHANNEL_MAP_WRITE (1 << 1)
169#define DRM_TEGRA_CHANNEL_MAP_READ_WRITE (DRM_TEGRA_CHANNEL_MAP_READ | DRM_TEGRA_CHANNEL_MAP_WRITE)
170struct drm_tegra_channel_map {
171 __u32 context;
172 __u32 handle;
173 __u32 flags;
174 __u32 mapping;
175};
176struct drm_tegra_channel_unmap {
177 __u32 context;
178 __u32 mapping;
179};
180#define DRM_TEGRA_SUBMIT_RELOC_SECTOR_LAYOUT (1 << 0)
181struct drm_tegra_submit_buf {
182 __u32 mapping;
183 __u32 flags;
184 struct {
185 __u64 target_offset;
186 __u32 gather_offset_words;
187 __u32 shift;
188 } reloc;
189};
190#define DRM_TEGRA_SUBMIT_CMD_GATHER_UPTR 0
191#define DRM_TEGRA_SUBMIT_CMD_WAIT_SYNCPT 1
192#define DRM_TEGRA_SUBMIT_CMD_WAIT_SYNCPT_RELATIVE 2
193struct drm_tegra_submit_cmd_gather_uptr {
194 __u32 words;
195 __u32 reserved[3];
196};
197struct drm_tegra_submit_cmd_wait_syncpt {
198 __u32 id;
199 __u32 value;
200 __u32 reserved[2];
201};
202struct drm_tegra_submit_cmd {
203 __u32 type;
204 __u32 flags;
205 union {
206 struct drm_tegra_submit_cmd_gather_uptr gather_uptr;
207 struct drm_tegra_submit_cmd_wait_syncpt wait_syncpt;
208 __u32 reserved[4];
209 };
210};
211struct drm_tegra_submit_syncpt {
212 __u32 id;
213 __u32 flags;
214 __u32 increments;
215 __u32 value;
216};
217struct drm_tegra_channel_submit {
218 __u32 context;
219 __u32 num_bufs;
220 __u32 num_cmds;
221 __u32 gather_data_words;
222 __u64 bufs_ptr;
223 __u64 cmds_ptr;
224 __u64 gather_data_ptr;
225 __u32 syncobj_in;
226 __u32 syncobj_out;
227 struct drm_tegra_submit_syncpt syncpt;
228};
229struct drm_tegra_syncpoint_allocate {
230 __u32 id;
231 __u32 padding;
232};
233struct drm_tegra_syncpoint_free {
234 __u32 id;
235 __u32 padding;
236};
237struct drm_tegra_syncpoint_wait {
238 __s64 timeout_ns;
239 __u32 id;
240 __u32 threshold;
241 __u32 value;
242 __u32 padding;
243};
244#define DRM_IOCTL_TEGRA_CHANNEL_OPEN DRM_IOWR(DRM_COMMAND_BASE + 0x10, struct drm_tegra_channel_open)
245#define DRM_IOCTL_TEGRA_CHANNEL_CLOSE DRM_IOWR(DRM_COMMAND_BASE + 0x11, struct drm_tegra_channel_close)
246#define DRM_IOCTL_TEGRA_CHANNEL_MAP DRM_IOWR(DRM_COMMAND_BASE + 0x12, struct drm_tegra_channel_map)
247#define DRM_IOCTL_TEGRA_CHANNEL_UNMAP DRM_IOWR(DRM_COMMAND_BASE + 0x13, struct drm_tegra_channel_unmap)
248#define DRM_IOCTL_TEGRA_CHANNEL_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + 0x14, struct drm_tegra_channel_submit)
249#define DRM_IOCTL_TEGRA_SYNCPOINT_ALLOCATE DRM_IOWR(DRM_COMMAND_BASE + 0x20, struct drm_tegra_syncpoint_allocate)
250#define DRM_IOCTL_TEGRA_SYNCPOINT_FREE DRM_IOWR(DRM_COMMAND_BASE + 0x21, struct drm_tegra_syncpoint_free)
251#define DRM_IOCTL_TEGRA_SYNCPOINT_WAIT DRM_IOWR(DRM_COMMAND_BASE + 0x22, struct drm_tegra_syncpoint_wait)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700252#ifdef __cplusplus
Christopher Ferris48fe0ae2019-01-10 15:59:33 -0800253}
Christopher Ferris106b3a82016-08-24 12:15:38 -0700254#endif
Christopher Ferris05d08e92016-02-04 13:16:38 -0800255#endif