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_
28 #if defined(__cplusplus)
32 #define DRM_TEGRA_GEM_CREATE_TILED (1 << 0)
33 #define DRM_TEGRA_GEM_CREATE_BOTTOM_UP (1 << 1)
36 * struct drm_tegra_gem_create - parameters for the GEM object creation IOCTL
38 struct drm_tegra_gem_create
{
42 * The size, in bytes, of the buffer object to be created.
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.
62 * The handle of the created GEM object. Set by the kernel upon
63 * successful completion of the IOCTL.
69 * struct drm_tegra_gem_mmap - parameters for the GEM mmap IOCTL
71 struct drm_tegra_gem_mmap
{
75 * Handle of the GEM object to obtain an mmap offset for.
82 * Structure padding that may be used in the future. Must be 0.
89 * The mmap offset for the given GEM object. Set by the kernel upon
90 * successful completion of the IOCTL.
96 * struct drm_tegra_syncpt_read - parameters for the read syncpoint IOCTL
98 struct drm_tegra_syncpt_read
{
102 * ID of the syncpoint to read the current value from.
109 * The current syncpoint value. Set by the kernel upon successful
110 * completion of the IOCTL.
116 * struct drm_tegra_syncpt_incr - parameters for the increment syncpoint IOCTL
118 struct drm_tegra_syncpt_incr
{
122 * ID of the syncpoint to increment.
129 * Structure padding that may be used in the future. Must be 0.
135 * struct drm_tegra_syncpt_wait - parameters for the wait syncpoint IOCTL
137 struct drm_tegra_syncpt_wait
{
141 * ID of the syncpoint to wait on.
148 * Threshold value for which to wait.
155 * Timeout, in milliseconds, to wait.
162 * The new syncpoint value after the wait. Set by the kernel upon
163 * successful completion of the IOCTL.
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
{
177 * The client ID for this channel.
184 * Structure padding that may be used in the future. Must be 0.
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.
199 * struct drm_tegra_close_channel - parameters for the close channel IOCTL
201 struct drm_tegra_close_channel
{
205 * The application context of this channel. This is obtained from the
206 * DRM_TEGRA_OPEN_CHANNEL IOCTL.
212 * struct drm_tegra_get_syncpt - parameters for the get syncpoint IOCTL
214 struct drm_tegra_get_syncpt
{
218 * The application context identifying the channel for which to obtain
226 * Index of the client syncpoint for which to obtain the ID.
233 * The ID of the given syncpoint. Set by the kernel upon successful
234 * completion of the IOCTL.
240 * struct drm_tegra_get_syncpt_base - parameters for the get wait base IOCTL
242 struct drm_tegra_get_syncpt_base
{
246 * The application context identifying for which channel to obtain the
254 * ID of the syncpoint for which to obtain the wait base.
261 * The ID of the wait base corresponding to the client syncpoint. Set
262 * by the kernel upon successful completion of the IOCTL.
268 * struct drm_tegra_syncpt - syncpoint increment operation
270 struct drm_tegra_syncpt
{
274 * ID of the syncpoint to operate on.
281 * Number of increments to perform for the syncpoint.
287 * struct drm_tegra_cmdbuf - structure describing a command buffer
289 struct drm_tegra_cmdbuf
{
293 * Handle to a GEM object containing the command buffer.
300 * Offset, in bytes, into the GEM object identified by @handle at
301 * which the command buffer starts.
308 * Number of 32-bit words in this command buffer.
315 * Structure padding that may be used in the future. Must be 0.
321 * struct drm_tegra_reloc - GEM object relocation structure
323 struct drm_tegra_reloc
{
328 * Handle to the GEM object containing the command buffer for
329 * which to perform this GEM object relocation.
336 * Offset, in bytes, into the command buffer at which to
337 * insert the relocated address.
345 * Handle to the GEM object to be relocated.
352 * Offset, in bytes, into the target GEM object at which the
353 * relocated data starts.
361 * The number of bits by which to shift relocated addresses.
368 * Structure padding that may be used in the future. Must be 0.
374 * struct drm_tegra_waitchk - wait check structure
376 struct drm_tegra_waitchk
{
380 * Handle to the GEM object containing a command stream on which to
381 * perform the wait check.
388 * Offset, in bytes, of the location in the command stream to perform
396 * ID of the syncpoint to wait check.
403 * Threshold value for which to check.
409 * struct drm_tegra_submit - job submission structure
411 struct drm_tegra_submit
{
415 * The application context identifying the channel to use for the
416 * execution of this job.
423 * The number of syncpoints operated on by this job. This defines the
424 * length of the array pointed to by @syncpts.
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.
439 * The number of relocations to perform before executing this job.
440 * This defines the length of the array pointed to by @relocs.
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.
455 * Bitmask of valid wait checks.
462 * Timeout, in milliseconds, before this job is cancelled.
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.
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
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.
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.
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.
519 * This field is reserved for future use. Must be 0.
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
{
535 * Handle to the GEM object for which to set the tiling parameters.
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
558 * The value to set for the tiling mode parameter.
565 * Structure padding that may be used in the future. Must be 0.
571 * struct drm_tegra_gem_get_tiling - parameters for the get tiling IOCTL
573 struct drm_tegra_gem_get_tiling
{
577 * Handle to the GEM object for which to query the tiling parameters.
584 * The tiling mode currently associated with the GEM object. Set by
585 * the kernel upon successful completion of the IOCTL.
592 * The tiling mode parameter currently associated with the GEM object.
593 * Set by the kernel upon successful completion of the IOCTL.
600 * Structure padding that may be used in the future. Must be 0.
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
{
615 * Handle to the GEM object for which to set the flags.
622 * The flags to set for the GEM object.
628 * struct drm_tegra_gem_get_flags - parameters for the get flags IOCTL
630 struct drm_tegra_gem_get_flags
{
634 * Handle to the GEM object for which to query the flags.
641 * The flags currently associated with the GEM object. Set by the
642 * kernel upon successful completion of the IOCTL.
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)