WIP FPC-III support
[linux/fpc-iii.git] / include / uapi / drm / tegra_drm.h
blobc4df3c3668b37db4bd3412a3a9b2fa260b27e2d9
1 /*
2 * Copyright (c) 2012-2013, NVIDIA CORPORATION. All rights reserved.
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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.
23 #ifndef _UAPI_TEGRA_DRM_H_
24 #define _UAPI_TEGRA_DRM_H_
26 #include "drm.h"
28 #if defined(__cplusplus)
29 extern "C" {
30 #endif
32 #define DRM_TEGRA_GEM_CREATE_TILED (1 << 0)
33 #define DRM_TEGRA_GEM_CREATE_BOTTOM_UP (1 << 1)
35 /**
36 * struct drm_tegra_gem_create - parameters for the GEM object creation IOCTL
38 struct drm_tegra_gem_create {
39 /**
40 * @size:
42 * The size, in bytes, of the buffer object to be created.
44 __u64 size;
46 /**
47 * @flags:
49 * A bitmask of flags that influence the creation of GEM objects:
51 * DRM_TEGRA_GEM_CREATE_TILED
52 * Use the 16x16 tiling format for this buffer.
54 * DRM_TEGRA_GEM_CREATE_BOTTOM_UP
55 * The buffer has a bottom-up layout.
57 __u32 flags;
59 /**
60 * @handle:
62 * The handle of the created GEM object. Set by the kernel upon
63 * successful completion of the IOCTL.
65 __u32 handle;
68 /**
69 * struct drm_tegra_gem_mmap - parameters for the GEM mmap IOCTL
71 struct drm_tegra_gem_mmap {
72 /**
73 * @handle:
75 * Handle of the GEM object to obtain an mmap offset for.
77 __u32 handle;
79 /**
80 * @pad:
82 * Structure padding that may be used in the future. Must be 0.
84 __u32 pad;
86 /**
87 * @offset:
89 * The mmap offset for the given GEM object. Set by the kernel upon
90 * successful completion of the IOCTL.
92 __u64 offset;
95 /**
96 * struct drm_tegra_syncpt_read - parameters for the read syncpoint IOCTL
98 struct drm_tegra_syncpt_read {
99 /**
100 * @id:
102 * ID of the syncpoint to read the current value from.
104 __u32 id;
107 * @value:
109 * The current syncpoint value. Set by the kernel upon successful
110 * completion of the IOCTL.
112 __u32 value;
116 * struct drm_tegra_syncpt_incr - parameters for the increment syncpoint IOCTL
118 struct drm_tegra_syncpt_incr {
120 * @id:
122 * ID of the syncpoint to increment.
124 __u32 id;
127 * @pad:
129 * Structure padding that may be used in the future. Must be 0.
131 __u32 pad;
135 * struct drm_tegra_syncpt_wait - parameters for the wait syncpoint IOCTL
137 struct drm_tegra_syncpt_wait {
139 * @id:
141 * ID of the syncpoint to wait on.
143 __u32 id;
146 * @thresh:
148 * Threshold value for which to wait.
150 __u32 thresh;
153 * @timeout:
155 * Timeout, in milliseconds, to wait.
157 __u32 timeout;
160 * @value:
162 * The new syncpoint value after the wait. Set by the kernel upon
163 * successful completion of the IOCTL.
165 __u32 value;
168 #define DRM_TEGRA_NO_TIMEOUT (0xffffffff)
171 * struct drm_tegra_open_channel - parameters for the open channel IOCTL
173 struct drm_tegra_open_channel {
175 * @client:
177 * The client ID for this channel.
179 __u32 client;
182 * @pad:
184 * Structure padding that may be used in the future. Must be 0.
186 __u32 pad;
189 * @context:
191 * The application context of this channel. Set by the kernel upon
192 * successful completion of the IOCTL. This context needs to be passed
193 * to the DRM_TEGRA_CHANNEL_CLOSE or the DRM_TEGRA_SUBMIT IOCTLs.
195 __u64 context;
199 * struct drm_tegra_close_channel - parameters for the close channel IOCTL
201 struct drm_tegra_close_channel {
203 * @context:
205 * The application context of this channel. This is obtained from the
206 * DRM_TEGRA_OPEN_CHANNEL IOCTL.
208 __u64 context;
212 * struct drm_tegra_get_syncpt - parameters for the get syncpoint IOCTL
214 struct drm_tegra_get_syncpt {
216 * @context:
218 * The application context identifying the channel for which to obtain
219 * the syncpoint ID.
221 __u64 context;
224 * @index:
226 * Index of the client syncpoint for which to obtain the ID.
228 __u32 index;
231 * @id:
233 * The ID of the given syncpoint. Set by the kernel upon successful
234 * completion of the IOCTL.
236 __u32 id;
240 * struct drm_tegra_get_syncpt_base - parameters for the get wait base IOCTL
242 struct drm_tegra_get_syncpt_base {
244 * @context:
246 * The application context identifying for which channel to obtain the
247 * wait base.
249 __u64 context;
252 * @syncpt:
254 * ID of the syncpoint for which to obtain the wait base.
256 __u32 syncpt;
259 * @id:
261 * The ID of the wait base corresponding to the client syncpoint. Set
262 * by the kernel upon successful completion of the IOCTL.
264 __u32 id;
268 * struct drm_tegra_syncpt - syncpoint increment operation
270 struct drm_tegra_syncpt {
272 * @id:
274 * ID of the syncpoint to operate on.
276 __u32 id;
279 * @incrs:
281 * Number of increments to perform for the syncpoint.
283 __u32 incrs;
287 * struct drm_tegra_cmdbuf - structure describing a command buffer
289 struct drm_tegra_cmdbuf {
291 * @handle:
293 * Handle to a GEM object containing the command buffer.
295 __u32 handle;
298 * @offset:
300 * Offset, in bytes, into the GEM object identified by @handle at
301 * which the command buffer starts.
303 __u32 offset;
306 * @words:
308 * Number of 32-bit words in this command buffer.
310 __u32 words;
313 * @pad:
315 * Structure padding that may be used in the future. Must be 0.
317 __u32 pad;
321 * struct drm_tegra_reloc - GEM object relocation structure
323 struct drm_tegra_reloc {
324 struct {
326 * @cmdbuf.handle:
328 * Handle to the GEM object containing the command buffer for
329 * which to perform this GEM object relocation.
331 __u32 handle;
334 * @cmdbuf.offset:
336 * Offset, in bytes, into the command buffer at which to
337 * insert the relocated address.
339 __u32 offset;
340 } cmdbuf;
341 struct {
343 * @target.handle:
345 * Handle to the GEM object to be relocated.
347 __u32 handle;
350 * @target.offset:
352 * Offset, in bytes, into the target GEM object at which the
353 * relocated data starts.
355 __u32 offset;
356 } target;
359 * @shift:
361 * The number of bits by which to shift relocated addresses.
363 __u32 shift;
366 * @pad:
368 * Structure padding that may be used in the future. Must be 0.
370 __u32 pad;
374 * struct drm_tegra_waitchk - wait check structure
376 struct drm_tegra_waitchk {
378 * @handle:
380 * Handle to the GEM object containing a command stream on which to
381 * perform the wait check.
383 __u32 handle;
386 * @offset:
388 * Offset, in bytes, of the location in the command stream to perform
389 * the wait check on.
391 __u32 offset;
394 * @syncpt:
396 * ID of the syncpoint to wait check.
398 __u32 syncpt;
401 * @thresh:
403 * Threshold value for which to check.
405 __u32 thresh;
409 * struct drm_tegra_submit - job submission structure
411 struct drm_tegra_submit {
413 * @context:
415 * The application context identifying the channel to use for the
416 * execution of this job.
418 __u64 context;
421 * @num_syncpts:
423 * The number of syncpoints operated on by this job. This defines the
424 * length of the array pointed to by @syncpts.
426 __u32 num_syncpts;
429 * @num_cmdbufs:
431 * The number of command buffers to execute as part of this job. This
432 * defines the length of the array pointed to by @cmdbufs.
434 __u32 num_cmdbufs;
437 * @num_relocs:
439 * The number of relocations to perform before executing this job.
440 * This defines the length of the array pointed to by @relocs.
442 __u32 num_relocs;
445 * @num_waitchks:
447 * The number of wait checks to perform as part of this job. This
448 * defines the length of the array pointed to by @waitchks.
450 __u32 num_waitchks;
453 * @waitchk_mask:
455 * Bitmask of valid wait checks.
457 __u32 waitchk_mask;
460 * @timeout:
462 * Timeout, in milliseconds, before this job is cancelled.
464 __u32 timeout;
467 * @syncpts:
469 * A pointer to an array of &struct drm_tegra_syncpt structures that
470 * specify the syncpoint operations performed as part of this job.
471 * The number of elements in the array must be equal to the value
472 * given by @num_syncpts.
474 __u64 syncpts;
477 * @cmdbufs:
479 * A pointer to an array of &struct drm_tegra_cmdbuf structures that
480 * define the command buffers to execute as part of this job. The
481 * number of elements in the array must be equal to the value given
482 * by @num_syncpts.
484 __u64 cmdbufs;
487 * @relocs:
489 * A pointer to an array of &struct drm_tegra_reloc structures that
490 * specify the relocations that need to be performed before executing
491 * this job. The number of elements in the array must be equal to the
492 * value given by @num_relocs.
494 __u64 relocs;
497 * @waitchks:
499 * A pointer to an array of &struct drm_tegra_waitchk structures that
500 * specify the wait checks to be performed while executing this job.
501 * The number of elements in the array must be equal to the value
502 * given by @num_waitchks.
504 __u64 waitchks;
507 * @fence:
509 * The threshold of the syncpoint associated with this job after it
510 * has been completed. Set by the kernel upon successful completion of
511 * the IOCTL. This can be used with the DRM_TEGRA_SYNCPT_WAIT IOCTL to
512 * wait for this job to be finished.
514 __u32 fence;
517 * @reserved:
519 * This field is reserved for future use. Must be 0.
521 __u32 reserved[5];
524 #define DRM_TEGRA_GEM_TILING_MODE_PITCH 0
525 #define DRM_TEGRA_GEM_TILING_MODE_TILED 1
526 #define DRM_TEGRA_GEM_TILING_MODE_BLOCK 2
529 * struct drm_tegra_gem_set_tiling - parameters for the set tiling IOCTL
531 struct drm_tegra_gem_set_tiling {
533 * @handle:
535 * Handle to the GEM object for which to set the tiling parameters.
537 __u32 handle;
540 * @mode:
542 * The tiling mode to set. Must be one of:
544 * DRM_TEGRA_GEM_TILING_MODE_PITCH
545 * pitch linear format
547 * DRM_TEGRA_GEM_TILING_MODE_TILED
548 * 16x16 tiling format
550 * DRM_TEGRA_GEM_TILING_MODE_BLOCK
551 * 16Bx2 tiling format
553 __u32 mode;
556 * @value:
558 * The value to set for the tiling mode parameter.
560 __u32 value;
563 * @pad:
565 * Structure padding that may be used in the future. Must be 0.
567 __u32 pad;
571 * struct drm_tegra_gem_get_tiling - parameters for the get tiling IOCTL
573 struct drm_tegra_gem_get_tiling {
575 * @handle:
577 * Handle to the GEM object for which to query the tiling parameters.
579 __u32 handle;
582 * @mode:
584 * The tiling mode currently associated with the GEM object. Set by
585 * the kernel upon successful completion of the IOCTL.
587 __u32 mode;
590 * @value:
592 * The tiling mode parameter currently associated with the GEM object.
593 * Set by the kernel upon successful completion of the IOCTL.
595 __u32 value;
598 * @pad:
600 * Structure padding that may be used in the future. Must be 0.
602 __u32 pad;
605 #define DRM_TEGRA_GEM_BOTTOM_UP (1 << 0)
606 #define DRM_TEGRA_GEM_FLAGS (DRM_TEGRA_GEM_BOTTOM_UP)
609 * struct drm_tegra_gem_set_flags - parameters for the set flags IOCTL
611 struct drm_tegra_gem_set_flags {
613 * @handle:
615 * Handle to the GEM object for which to set the flags.
617 __u32 handle;
620 * @flags:
622 * The flags to set for the GEM object.
624 __u32 flags;
628 * struct drm_tegra_gem_get_flags - parameters for the get flags IOCTL
630 struct drm_tegra_gem_get_flags {
632 * @handle:
634 * Handle to the GEM object for which to query the flags.
636 __u32 handle;
639 * @flags:
641 * The flags currently associated with the GEM object. Set by the
642 * kernel upon successful completion of the IOCTL.
644 __u32 flags;
647 #define DRM_TEGRA_GEM_CREATE 0x00
648 #define DRM_TEGRA_GEM_MMAP 0x01
649 #define DRM_TEGRA_SYNCPT_READ 0x02
650 #define DRM_TEGRA_SYNCPT_INCR 0x03
651 #define DRM_TEGRA_SYNCPT_WAIT 0x04
652 #define DRM_TEGRA_OPEN_CHANNEL 0x05
653 #define DRM_TEGRA_CLOSE_CHANNEL 0x06
654 #define DRM_TEGRA_GET_SYNCPT 0x07
655 #define DRM_TEGRA_SUBMIT 0x08
656 #define DRM_TEGRA_GET_SYNCPT_BASE 0x09
657 #define DRM_TEGRA_GEM_SET_TILING 0x0a
658 #define DRM_TEGRA_GEM_GET_TILING 0x0b
659 #define DRM_TEGRA_GEM_SET_FLAGS 0x0c
660 #define DRM_TEGRA_GEM_GET_FLAGS 0x0d
662 #define DRM_IOCTL_TEGRA_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_CREATE, struct drm_tegra_gem_create)
663 #define DRM_IOCTL_TEGRA_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_MMAP, struct drm_tegra_gem_mmap)
664 #define DRM_IOCTL_TEGRA_SYNCPT_READ DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_READ, struct drm_tegra_syncpt_read)
665 #define DRM_IOCTL_TEGRA_SYNCPT_INCR DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_INCR, struct drm_tegra_syncpt_incr)
666 #define DRM_IOCTL_TEGRA_SYNCPT_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_WAIT, struct drm_tegra_syncpt_wait)
667 #define DRM_IOCTL_TEGRA_OPEN_CHANNEL DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_OPEN_CHANNEL, struct drm_tegra_open_channel)
668 #define DRM_IOCTL_TEGRA_CLOSE_CHANNEL DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_CLOSE_CHANNEL, struct drm_tegra_close_channel)
669 #define DRM_IOCTL_TEGRA_GET_SYNCPT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT, struct drm_tegra_get_syncpt)
670 #define DRM_IOCTL_TEGRA_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SUBMIT, struct drm_tegra_submit)
671 #define DRM_IOCTL_TEGRA_GET_SYNCPT_BASE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT_BASE, struct drm_tegra_get_syncpt_base)
672 #define DRM_IOCTL_TEGRA_GEM_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_SET_TILING, struct drm_tegra_gem_set_tiling)
673 #define DRM_IOCTL_TEGRA_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_GET_TILING, struct drm_tegra_gem_get_tiling)
674 #define DRM_IOCTL_TEGRA_GEM_SET_FLAGS DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_SET_FLAGS, struct drm_tegra_gem_set_flags)
675 #define DRM_IOCTL_TEGRA_GEM_GET_FLAGS DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_GET_FLAGS, struct drm_tegra_gem_get_flags)
677 #if defined(__cplusplus)
679 #endif
681 #endif