• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2012-2013, NVIDIA CORPORATION.  All rights reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21  */
22 
23 #ifndef _TEGRA_DRM_H_
24 #define _TEGRA_DRM_H_
25 
26 #include "drm.h"
27 
28 #if defined(__cplusplus)
29 extern "C" {
30 #endif
31 
32 #define DRM_TEGRA_GEM_CREATE_TILED     (1 << 0)
33 #define DRM_TEGRA_GEM_CREATE_BOTTOM_UP (1 << 1)
34 
35 struct drm_tegra_gem_create {
36 	__u64 size;
37 	__u32 flags;
38 	__u32 handle;
39 };
40 
41 struct drm_tegra_gem_mmap {
42 	__u32 handle;
43 	__u32 pad;
44 	__u64 offset;
45 };
46 
47 struct drm_tegra_syncpt_read {
48 	__u32 id;
49 	__u32 value;
50 };
51 
52 struct drm_tegra_syncpt_incr {
53 	__u32 id;
54 	__u32 pad;
55 };
56 
57 struct drm_tegra_syncpt_wait {
58 	__u32 id;
59 	__u32 thresh;
60 	__u32 timeout;
61 	__u32 value;
62 };
63 
64 #define DRM_TEGRA_NO_TIMEOUT	(0xffffffff)
65 
66 struct drm_tegra_open_channel {
67 	__u32 client;
68 	__u32 pad;
69 	__u64 context;
70 };
71 
72 struct drm_tegra_close_channel {
73 	__u64 context;
74 };
75 
76 struct drm_tegra_get_syncpt {
77 	__u64 context;
78 	__u32 index;
79 	__u32 id;
80 };
81 
82 struct drm_tegra_get_syncpt_base {
83 	__u64 context;
84 	__u32 syncpt;
85 	__u32 id;
86 };
87 
88 struct drm_tegra_syncpt {
89 	__u32 id;
90 	__u32 incrs;
91 };
92 
93 struct drm_tegra_cmdbuf {
94 	__u32 handle;
95 	__u32 offset;
96 	__u32 words;
97 	__u32 pad;
98 };
99 
100 struct drm_tegra_reloc {
101 	struct {
102 		__u32 handle;
103 		__u32 offset;
104 	} cmdbuf;
105 	struct {
106 		__u32 handle;
107 		__u32 offset;
108 	} target;
109 	__u32 shift;
110 	__u32 pad;
111 };
112 
113 struct drm_tegra_waitchk {
114 	__u32 handle;
115 	__u32 offset;
116 	__u32 syncpt;
117 	__u32 thresh;
118 };
119 
120 struct drm_tegra_submit {
121 	__u64 context;
122 	__u32 num_syncpts;
123 	__u32 num_cmdbufs;
124 	__u32 num_relocs;
125 	__u32 num_waitchks;
126 	__u32 waitchk_mask;
127 	__u32 timeout;
128 	__u32 pad;
129 	__u64 syncpts;
130 	__u64 cmdbufs;
131 	__u64 relocs;
132 	__u64 waitchks;
133 	__u32 fence;		/* Return value */
134 
135 	__u32 reserved[5];	/* future expansion */
136 };
137 
138 #define DRM_TEGRA_GEM_TILING_MODE_PITCH 0
139 #define DRM_TEGRA_GEM_TILING_MODE_TILED 1
140 #define DRM_TEGRA_GEM_TILING_MODE_BLOCK 2
141 
142 struct drm_tegra_gem_set_tiling {
143 	/* input */
144 	__u32 handle;
145 	__u32 mode;
146 	__u32 value;
147 	__u32 pad;
148 };
149 
150 struct drm_tegra_gem_get_tiling {
151 	/* input */
152 	__u32 handle;
153 	/* output */
154 	__u32 mode;
155 	__u32 value;
156 	__u32 pad;
157 };
158 
159 #define DRM_TEGRA_GEM_BOTTOM_UP		(1 << 0)
160 #define DRM_TEGRA_GEM_FLAGS		(DRM_TEGRA_GEM_BOTTOM_UP)
161 
162 struct drm_tegra_gem_set_flags {
163 	/* input */
164 	__u32 handle;
165 	/* output */
166 	__u32 flags;
167 };
168 
169 struct drm_tegra_gem_get_flags {
170 	/* input */
171 	__u32 handle;
172 	/* output */
173 	__u32 flags;
174 };
175 
176 enum request_type {
177 	DRM_TEGRA_REQ_TYPE_CLK_KHZ = 0,
178 	DRM_TEGRA_REQ_TYPE_BW_KBPS,
179 };
180 
181 struct drm_tegra_get_clk_rate {
182 	/* class ID*/
183 	__u32 id;
184 	/* request type: KBps or KHz */
185 	__u32 type;
186 	/* numeric value for type */
187 	__u64 data;
188 };
189 
190 struct drm_tegra_set_clk_rate {
191 	/* class ID*/
192 	__u32 id;
193 	/* request type: KBps or KHz */
194 	__u32 type;
195 	/* numeric value for type */
196 	__u64 data;
197 };
198 
199 struct drm_tegra_keepon {
200 	/* channel context (from opening a channel) */
201 	__u64 context;
202 };
203 
204 #define DRM_TEGRA_GEM_CREATE		0x00
205 #define DRM_TEGRA_GEM_MMAP		0x01
206 #define DRM_TEGRA_SYNCPT_READ		0x02
207 #define DRM_TEGRA_SYNCPT_INCR		0x03
208 #define DRM_TEGRA_SYNCPT_WAIT		0x04
209 #define DRM_TEGRA_OPEN_CHANNEL		0x05
210 #define DRM_TEGRA_CLOSE_CHANNEL		0x06
211 #define DRM_TEGRA_GET_SYNCPT		0x07
212 #define DRM_TEGRA_SUBMIT		0x08
213 #define DRM_TEGRA_GET_SYNCPT_BASE	0x09
214 #define DRM_TEGRA_GEM_SET_TILING	0x0a
215 #define DRM_TEGRA_GEM_GET_TILING	0x0b
216 #define DRM_TEGRA_GEM_SET_FLAGS		0x0c
217 #define DRM_TEGRA_GEM_GET_FLAGS		0x0d
218 #define DRM_TEGRA_GET_CLK_RATE		0x0e
219 #define DRM_TEGRA_SET_CLK_RATE		0x0f
220 #define DRM_TEGRA_START_KEEPON		0x10
221 #define DRM_TEGRA_STOP_KEEPON		0x11
222 
223 #define DRM_IOCTL_TEGRA_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_CREATE, struct drm_tegra_gem_create)
224 #define DRM_IOCTL_TEGRA_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_MMAP, struct drm_tegra_gem_mmap)
225 #define DRM_IOCTL_TEGRA_SYNCPT_READ DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_READ, struct drm_tegra_syncpt_read)
226 #define DRM_IOCTL_TEGRA_SYNCPT_INCR DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_INCR, struct drm_tegra_syncpt_incr)
227 #define DRM_IOCTL_TEGRA_SYNCPT_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_WAIT, struct drm_tegra_syncpt_wait)
228 #define DRM_IOCTL_TEGRA_OPEN_CHANNEL DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_OPEN_CHANNEL, struct drm_tegra_open_channel)
229 #define DRM_IOCTL_TEGRA_CLOSE_CHANNEL DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_CLOSE_CHANNEL, struct drm_tegra_open_channel)
230 #define DRM_IOCTL_TEGRA_GET_SYNCPT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT, struct drm_tegra_get_syncpt)
231 #define DRM_IOCTL_TEGRA_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SUBMIT, struct drm_tegra_submit)
232 #define DRM_IOCTL_TEGRA_GET_SYNCPT_BASE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT_BASE, struct drm_tegra_get_syncpt_base)
233 #define DRM_IOCTL_TEGRA_GEM_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_SET_TILING, struct drm_tegra_gem_set_tiling)
234 #define DRM_IOCTL_TEGRA_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_GET_TILING, struct drm_tegra_gem_get_tiling)
235 #define DRM_IOCTL_TEGRA_GEM_SET_FLAGS DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_SET_FLAGS, struct drm_tegra_gem_set_flags)
236 #define DRM_IOCTL_TEGRA_GEM_GET_FLAGS DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_GET_FLAGS, struct drm_tegra_gem_get_flags)
237 #define DRM_IOCTL_TEGRA_GET_CLK_RATE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_CLK_RATE, struct drm_tegra_get_clk_rate)
238 #define DRM_IOCTL_TEGRA_SET_CLK_RATE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SET_CLK_RATE, struct drm_tegra_set_clk_rate)
239 #define DRM_IOCTL_TEGRA_START_KEEPON DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_START_KEEPON, struct drm_tegra_keepon)
240 #define DRM_IOCTL_TEGRA_STOP_KEEPON DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_STOP_KEEPON, struct drm_tegra_keepon)
241 
242 #if defined(__cplusplus)
243 }
244 #endif
245 
246 #endif
247