Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:01:51

0001 /* SPDX-License-Identifier: MIT */
0002 /* Copyright (c) 2012-2020 NVIDIA Corporation */
0003 
0004 #ifndef _UAPI_TEGRA_DRM_H_
0005 #define _UAPI_TEGRA_DRM_H_
0006 
0007 #include "drm.h"
0008 
0009 #if defined(__cplusplus)
0010 extern "C" {
0011 #endif
0012 
0013 /* Tegra DRM legacy UAPI. Only enabled with STAGING */
0014 
0015 #define DRM_TEGRA_GEM_CREATE_TILED     (1 << 0)
0016 #define DRM_TEGRA_GEM_CREATE_BOTTOM_UP (1 << 1)
0017 
0018 /**
0019  * struct drm_tegra_gem_create - parameters for the GEM object creation IOCTL
0020  */
0021 struct drm_tegra_gem_create {
0022     /**
0023      * @size:
0024      *
0025      * The size, in bytes, of the buffer object to be created.
0026      */
0027     __u64 size;
0028 
0029     /**
0030      * @flags:
0031      *
0032      * A bitmask of flags that influence the creation of GEM objects:
0033      *
0034      * DRM_TEGRA_GEM_CREATE_TILED
0035      *   Use the 16x16 tiling format for this buffer.
0036      *
0037      * DRM_TEGRA_GEM_CREATE_BOTTOM_UP
0038      *   The buffer has a bottom-up layout.
0039      */
0040     __u32 flags;
0041 
0042     /**
0043      * @handle:
0044      *
0045      * The handle of the created GEM object. Set by the kernel upon
0046      * successful completion of the IOCTL.
0047      */
0048     __u32 handle;
0049 };
0050 
0051 /**
0052  * struct drm_tegra_gem_mmap - parameters for the GEM mmap IOCTL
0053  */
0054 struct drm_tegra_gem_mmap {
0055     /**
0056      * @handle:
0057      *
0058      * Handle of the GEM object to obtain an mmap offset for.
0059      */
0060     __u32 handle;
0061 
0062     /**
0063      * @pad:
0064      *
0065      * Structure padding that may be used in the future. Must be 0.
0066      */
0067     __u32 pad;
0068 
0069     /**
0070      * @offset:
0071      *
0072      * The mmap offset for the given GEM object. Set by the kernel upon
0073      * successful completion of the IOCTL.
0074      */
0075     __u64 offset;
0076 };
0077 
0078 /**
0079  * struct drm_tegra_syncpt_read - parameters for the read syncpoint IOCTL
0080  */
0081 struct drm_tegra_syncpt_read {
0082     /**
0083      * @id:
0084      *
0085      * ID of the syncpoint to read the current value from.
0086      */
0087     __u32 id;
0088 
0089     /**
0090      * @value:
0091      *
0092      * The current syncpoint value. Set by the kernel upon successful
0093      * completion of the IOCTL.
0094      */
0095     __u32 value;
0096 };
0097 
0098 /**
0099  * struct drm_tegra_syncpt_incr - parameters for the increment syncpoint IOCTL
0100  */
0101 struct drm_tegra_syncpt_incr {
0102     /**
0103      * @id:
0104      *
0105      * ID of the syncpoint to increment.
0106      */
0107     __u32 id;
0108 
0109     /**
0110      * @pad:
0111      *
0112      * Structure padding that may be used in the future. Must be 0.
0113      */
0114     __u32 pad;
0115 };
0116 
0117 /**
0118  * struct drm_tegra_syncpt_wait - parameters for the wait syncpoint IOCTL
0119  */
0120 struct drm_tegra_syncpt_wait {
0121     /**
0122      * @id:
0123      *
0124      * ID of the syncpoint to wait on.
0125      */
0126     __u32 id;
0127 
0128     /**
0129      * @thresh:
0130      *
0131      * Threshold value for which to wait.
0132      */
0133     __u32 thresh;
0134 
0135     /**
0136      * @timeout:
0137      *
0138      * Timeout, in milliseconds, to wait.
0139      */
0140     __u32 timeout;
0141 
0142     /**
0143      * @value:
0144      *
0145      * The new syncpoint value after the wait. Set by the kernel upon
0146      * successful completion of the IOCTL.
0147      */
0148     __u32 value;
0149 };
0150 
0151 #define DRM_TEGRA_NO_TIMEOUT    (0xffffffff)
0152 
0153 /**
0154  * struct drm_tegra_open_channel - parameters for the open channel IOCTL
0155  */
0156 struct drm_tegra_open_channel {
0157     /**
0158      * @client:
0159      *
0160      * The client ID for this channel.
0161      */
0162     __u32 client;
0163 
0164     /**
0165      * @pad:
0166      *
0167      * Structure padding that may be used in the future. Must be 0.
0168      */
0169     __u32 pad;
0170 
0171     /**
0172      * @context:
0173      *
0174      * The application context of this channel. Set by the kernel upon
0175      * successful completion of the IOCTL. This context needs to be passed
0176      * to the DRM_TEGRA_CHANNEL_CLOSE or the DRM_TEGRA_SUBMIT IOCTLs.
0177      */
0178     __u64 context;
0179 };
0180 
0181 /**
0182  * struct drm_tegra_close_channel - parameters for the close channel IOCTL
0183  */
0184 struct drm_tegra_close_channel {
0185     /**
0186      * @context:
0187      *
0188      * The application context of this channel. This is obtained from the
0189      * DRM_TEGRA_OPEN_CHANNEL IOCTL.
0190      */
0191     __u64 context;
0192 };
0193 
0194 /**
0195  * struct drm_tegra_get_syncpt - parameters for the get syncpoint IOCTL
0196  */
0197 struct drm_tegra_get_syncpt {
0198     /**
0199      * @context:
0200      *
0201      * The application context identifying the channel for which to obtain
0202      * the syncpoint ID.
0203      */
0204     __u64 context;
0205 
0206     /**
0207      * @index:
0208      *
0209      * Index of the client syncpoint for which to obtain the ID.
0210      */
0211     __u32 index;
0212 
0213     /**
0214      * @id:
0215      *
0216      * The ID of the given syncpoint. Set by the kernel upon successful
0217      * completion of the IOCTL.
0218      */
0219     __u32 id;
0220 };
0221 
0222 /**
0223  * struct drm_tegra_get_syncpt_base - parameters for the get wait base IOCTL
0224  */
0225 struct drm_tegra_get_syncpt_base {
0226     /**
0227      * @context:
0228      *
0229      * The application context identifying for which channel to obtain the
0230      * wait base.
0231      */
0232     __u64 context;
0233 
0234     /**
0235      * @syncpt:
0236      *
0237      * ID of the syncpoint for which to obtain the wait base.
0238      */
0239     __u32 syncpt;
0240 
0241     /**
0242      * @id:
0243      *
0244      * The ID of the wait base corresponding to the client syncpoint. Set
0245      * by the kernel upon successful completion of the IOCTL.
0246      */
0247     __u32 id;
0248 };
0249 
0250 /**
0251  * struct drm_tegra_syncpt - syncpoint increment operation
0252  */
0253 struct drm_tegra_syncpt {
0254     /**
0255      * @id:
0256      *
0257      * ID of the syncpoint to operate on.
0258      */
0259     __u32 id;
0260 
0261     /**
0262      * @incrs:
0263      *
0264      * Number of increments to perform for the syncpoint.
0265      */
0266     __u32 incrs;
0267 };
0268 
0269 /**
0270  * struct drm_tegra_cmdbuf - structure describing a command buffer
0271  */
0272 struct drm_tegra_cmdbuf {
0273     /**
0274      * @handle:
0275      *
0276      * Handle to a GEM object containing the command buffer.
0277      */
0278     __u32 handle;
0279 
0280     /**
0281      * @offset:
0282      *
0283      * Offset, in bytes, into the GEM object identified by @handle at
0284      * which the command buffer starts.
0285      */
0286     __u32 offset;
0287 
0288     /**
0289      * @words:
0290      *
0291      * Number of 32-bit words in this command buffer.
0292      */
0293     __u32 words;
0294 
0295     /**
0296      * @pad:
0297      *
0298      * Structure padding that may be used in the future. Must be 0.
0299      */
0300     __u32 pad;
0301 };
0302 
0303 /**
0304  * struct drm_tegra_reloc - GEM object relocation structure
0305  */
0306 struct drm_tegra_reloc {
0307     struct {
0308         /**
0309          * @cmdbuf.handle:
0310          *
0311          * Handle to the GEM object containing the command buffer for
0312          * which to perform this GEM object relocation.
0313          */
0314         __u32 handle;
0315 
0316         /**
0317          * @cmdbuf.offset:
0318          *
0319          * Offset, in bytes, into the command buffer at which to
0320          * insert the relocated address.
0321          */
0322         __u32 offset;
0323     } cmdbuf;
0324     struct {
0325         /**
0326          * @target.handle:
0327          *
0328          * Handle to the GEM object to be relocated.
0329          */
0330         __u32 handle;
0331 
0332         /**
0333          * @target.offset:
0334          *
0335          * Offset, in bytes, into the target GEM object at which the
0336          * relocated data starts.
0337          */
0338         __u32 offset;
0339     } target;
0340 
0341     /**
0342      * @shift:
0343      *
0344      * The number of bits by which to shift relocated addresses.
0345      */
0346     __u32 shift;
0347 
0348     /**
0349      * @pad:
0350      *
0351      * Structure padding that may be used in the future. Must be 0.
0352      */
0353     __u32 pad;
0354 };
0355 
0356 /**
0357  * struct drm_tegra_waitchk - wait check structure
0358  */
0359 struct drm_tegra_waitchk {
0360     /**
0361      * @handle:
0362      *
0363      * Handle to the GEM object containing a command stream on which to
0364      * perform the wait check.
0365      */
0366     __u32 handle;
0367 
0368     /**
0369      * @offset:
0370      *
0371      * Offset, in bytes, of the location in the command stream to perform
0372      * the wait check on.
0373      */
0374     __u32 offset;
0375 
0376     /**
0377      * @syncpt:
0378      *
0379      * ID of the syncpoint to wait check.
0380      */
0381     __u32 syncpt;
0382 
0383     /**
0384      * @thresh:
0385      *
0386      * Threshold value for which to check.
0387      */
0388     __u32 thresh;
0389 };
0390 
0391 /**
0392  * struct drm_tegra_submit - job submission structure
0393  */
0394 struct drm_tegra_submit {
0395     /**
0396      * @context:
0397      *
0398      * The application context identifying the channel to use for the
0399      * execution of this job.
0400      */
0401     __u64 context;
0402 
0403     /**
0404      * @num_syncpts:
0405      *
0406      * The number of syncpoints operated on by this job. This defines the
0407      * length of the array pointed to by @syncpts.
0408      */
0409     __u32 num_syncpts;
0410 
0411     /**
0412      * @num_cmdbufs:
0413      *
0414      * The number of command buffers to execute as part of this job. This
0415      * defines the length of the array pointed to by @cmdbufs.
0416      */
0417     __u32 num_cmdbufs;
0418 
0419     /**
0420      * @num_relocs:
0421      *
0422      * The number of relocations to perform before executing this job.
0423      * This defines the length of the array pointed to by @relocs.
0424      */
0425     __u32 num_relocs;
0426 
0427     /**
0428      * @num_waitchks:
0429      *
0430      * The number of wait checks to perform as part of this job. This
0431      * defines the length of the array pointed to by @waitchks.
0432      */
0433     __u32 num_waitchks;
0434 
0435     /**
0436      * @waitchk_mask:
0437      *
0438      * Bitmask of valid wait checks.
0439      */
0440     __u32 waitchk_mask;
0441 
0442     /**
0443      * @timeout:
0444      *
0445      * Timeout, in milliseconds, before this job is cancelled.
0446      */
0447     __u32 timeout;
0448 
0449     /**
0450      * @syncpts:
0451      *
0452      * A pointer to an array of &struct drm_tegra_syncpt structures that
0453      * specify the syncpoint operations performed as part of this job.
0454      * The number of elements in the array must be equal to the value
0455      * given by @num_syncpts.
0456      */
0457     __u64 syncpts;
0458 
0459     /**
0460      * @cmdbufs:
0461      *
0462      * A pointer to an array of &struct drm_tegra_cmdbuf structures that
0463      * define the command buffers to execute as part of this job. The
0464      * number of elements in the array must be equal to the value given
0465      * by @num_syncpts.
0466      */
0467     __u64 cmdbufs;
0468 
0469     /**
0470      * @relocs:
0471      *
0472      * A pointer to an array of &struct drm_tegra_reloc structures that
0473      * specify the relocations that need to be performed before executing
0474      * this job. The number of elements in the array must be equal to the
0475      * value given by @num_relocs.
0476      */
0477     __u64 relocs;
0478 
0479     /**
0480      * @waitchks:
0481      *
0482      * A pointer to an array of &struct drm_tegra_waitchk structures that
0483      * specify the wait checks to be performed while executing this job.
0484      * The number of elements in the array must be equal to the value
0485      * given by @num_waitchks.
0486      */
0487     __u64 waitchks;
0488 
0489     /**
0490      * @fence:
0491      *
0492      * The threshold of the syncpoint associated with this job after it
0493      * has been completed. Set by the kernel upon successful completion of
0494      * the IOCTL. This can be used with the DRM_TEGRA_SYNCPT_WAIT IOCTL to
0495      * wait for this job to be finished.
0496      */
0497     __u32 fence;
0498 
0499     /**
0500      * @reserved:
0501      *
0502      * This field is reserved for future use. Must be 0.
0503      */
0504     __u32 reserved[5];
0505 };
0506 
0507 #define DRM_TEGRA_GEM_TILING_MODE_PITCH 0
0508 #define DRM_TEGRA_GEM_TILING_MODE_TILED 1
0509 #define DRM_TEGRA_GEM_TILING_MODE_BLOCK 2
0510 
0511 /**
0512  * struct drm_tegra_gem_set_tiling - parameters for the set tiling IOCTL
0513  */
0514 struct drm_tegra_gem_set_tiling {
0515     /**
0516      * @handle:
0517      *
0518      * Handle to the GEM object for which to set the tiling parameters.
0519      */
0520     __u32 handle;
0521 
0522     /**
0523      * @mode:
0524      *
0525      * The tiling mode to set. Must be one of:
0526      *
0527      * DRM_TEGRA_GEM_TILING_MODE_PITCH
0528      *   pitch linear format
0529      *
0530      * DRM_TEGRA_GEM_TILING_MODE_TILED
0531      *   16x16 tiling format
0532      *
0533      * DRM_TEGRA_GEM_TILING_MODE_BLOCK
0534      *   16Bx2 tiling format
0535      */
0536     __u32 mode;
0537 
0538     /**
0539      * @value:
0540      *
0541      * The value to set for the tiling mode parameter.
0542      */
0543     __u32 value;
0544 
0545     /**
0546      * @pad:
0547      *
0548      * Structure padding that may be used in the future. Must be 0.
0549      */
0550     __u32 pad;
0551 };
0552 
0553 /**
0554  * struct drm_tegra_gem_get_tiling - parameters for the get tiling IOCTL
0555  */
0556 struct drm_tegra_gem_get_tiling {
0557     /**
0558      * @handle:
0559      *
0560      * Handle to the GEM object for which to query the tiling parameters.
0561      */
0562     __u32 handle;
0563 
0564     /**
0565      * @mode:
0566      *
0567      * The tiling mode currently associated with the GEM object. Set by
0568      * the kernel upon successful completion of the IOCTL.
0569      */
0570     __u32 mode;
0571 
0572     /**
0573      * @value:
0574      *
0575      * The tiling mode parameter currently associated with the GEM object.
0576      * Set by the kernel upon successful completion of the IOCTL.
0577      */
0578     __u32 value;
0579 
0580     /**
0581      * @pad:
0582      *
0583      * Structure padding that may be used in the future. Must be 0.
0584      */
0585     __u32 pad;
0586 };
0587 
0588 #define DRM_TEGRA_GEM_BOTTOM_UP     (1 << 0)
0589 #define DRM_TEGRA_GEM_FLAGS     (DRM_TEGRA_GEM_BOTTOM_UP)
0590 
0591 /**
0592  * struct drm_tegra_gem_set_flags - parameters for the set flags IOCTL
0593  */
0594 struct drm_tegra_gem_set_flags {
0595     /**
0596      * @handle:
0597      *
0598      * Handle to the GEM object for which to set the flags.
0599      */
0600     __u32 handle;
0601 
0602     /**
0603      * @flags:
0604      *
0605      * The flags to set for the GEM object.
0606      */
0607     __u32 flags;
0608 };
0609 
0610 /**
0611  * struct drm_tegra_gem_get_flags - parameters for the get flags IOCTL
0612  */
0613 struct drm_tegra_gem_get_flags {
0614     /**
0615      * @handle:
0616      *
0617      * Handle to the GEM object for which to query the flags.
0618      */
0619     __u32 handle;
0620 
0621     /**
0622      * @flags:
0623      *
0624      * The flags currently associated with the GEM object. Set by the
0625      * kernel upon successful completion of the IOCTL.
0626      */
0627     __u32 flags;
0628 };
0629 
0630 #define DRM_TEGRA_GEM_CREATE        0x00
0631 #define DRM_TEGRA_GEM_MMAP      0x01
0632 #define DRM_TEGRA_SYNCPT_READ       0x02
0633 #define DRM_TEGRA_SYNCPT_INCR       0x03
0634 #define DRM_TEGRA_SYNCPT_WAIT       0x04
0635 #define DRM_TEGRA_OPEN_CHANNEL          0x05
0636 #define DRM_TEGRA_CLOSE_CHANNEL         0x06
0637 #define DRM_TEGRA_GET_SYNCPT        0x07
0638 #define DRM_TEGRA_SUBMIT        0x08
0639 #define DRM_TEGRA_GET_SYNCPT_BASE   0x09
0640 #define DRM_TEGRA_GEM_SET_TILING    0x0a
0641 #define DRM_TEGRA_GEM_GET_TILING    0x0b
0642 #define DRM_TEGRA_GEM_SET_FLAGS     0x0c
0643 #define DRM_TEGRA_GEM_GET_FLAGS     0x0d
0644 
0645 #define DRM_IOCTL_TEGRA_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_CREATE, struct drm_tegra_gem_create)
0646 #define DRM_IOCTL_TEGRA_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_MMAP, struct drm_tegra_gem_mmap)
0647 #define DRM_IOCTL_TEGRA_SYNCPT_READ DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_READ, struct drm_tegra_syncpt_read)
0648 #define DRM_IOCTL_TEGRA_SYNCPT_INCR DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_INCR, struct drm_tegra_syncpt_incr)
0649 #define DRM_IOCTL_TEGRA_SYNCPT_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SYNCPT_WAIT, struct drm_tegra_syncpt_wait)
0650 #define DRM_IOCTL_TEGRA_OPEN_CHANNEL DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_OPEN_CHANNEL, struct drm_tegra_open_channel)
0651 #define DRM_IOCTL_TEGRA_CLOSE_CHANNEL DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_CLOSE_CHANNEL, struct drm_tegra_close_channel)
0652 #define DRM_IOCTL_TEGRA_GET_SYNCPT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT, struct drm_tegra_get_syncpt)
0653 #define DRM_IOCTL_TEGRA_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SUBMIT, struct drm_tegra_submit)
0654 #define DRM_IOCTL_TEGRA_GET_SYNCPT_BASE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT_BASE, struct drm_tegra_get_syncpt_base)
0655 #define DRM_IOCTL_TEGRA_GEM_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_SET_TILING, struct drm_tegra_gem_set_tiling)
0656 #define DRM_IOCTL_TEGRA_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_GET_TILING, struct drm_tegra_gem_get_tiling)
0657 #define DRM_IOCTL_TEGRA_GEM_SET_FLAGS DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_SET_FLAGS, struct drm_tegra_gem_set_flags)
0658 #define DRM_IOCTL_TEGRA_GEM_GET_FLAGS DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_GET_FLAGS, struct drm_tegra_gem_get_flags)
0659 
0660 /* New Tegra DRM UAPI */
0661 
0662 /*
0663  * Reported by the driver in the `capabilities` field.
0664  *
0665  * DRM_TEGRA_CHANNEL_CAP_CACHE_COHERENT: If set, the engine is cache coherent
0666  * with regard to the system memory.
0667  */
0668 #define DRM_TEGRA_CHANNEL_CAP_CACHE_COHERENT (1 << 0)
0669 
0670 struct drm_tegra_channel_open {
0671     /**
0672      * @host1x_class: [in]
0673      *
0674      * Host1x class of the engine that will be programmed using this
0675      * channel.
0676      */
0677     __u32 host1x_class;
0678 
0679     /**
0680      * @flags: [in]
0681      *
0682      * Flags.
0683      */
0684     __u32 flags;
0685 
0686     /**
0687      * @context: [out]
0688      *
0689      * Opaque identifier corresponding to the opened channel.
0690      */
0691     __u32 context;
0692 
0693     /**
0694      * @version: [out]
0695      *
0696      * Version of the engine hardware. This can be used by userspace
0697      * to determine how the engine needs to be programmed.
0698      */
0699     __u32 version;
0700 
0701     /**
0702      * @capabilities: [out]
0703      *
0704      * Flags describing the hardware capabilities.
0705      */
0706     __u32 capabilities;
0707     __u32 padding;
0708 };
0709 
0710 struct drm_tegra_channel_close {
0711     /**
0712      * @context: [in]
0713      *
0714      * Identifier of the channel to close.
0715      */
0716     __u32 context;
0717     __u32 padding;
0718 };
0719 
0720 /*
0721  * Mapping flags that can be used to influence how the mapping is created.
0722  *
0723  * DRM_TEGRA_CHANNEL_MAP_READ: create mapping that allows HW read access
0724  * DRM_TEGRA_CHANNEL_MAP_WRITE: create mapping that allows HW write access
0725  */
0726 #define DRM_TEGRA_CHANNEL_MAP_READ  (1 << 0)
0727 #define DRM_TEGRA_CHANNEL_MAP_WRITE (1 << 1)
0728 #define DRM_TEGRA_CHANNEL_MAP_READ_WRITE (DRM_TEGRA_CHANNEL_MAP_READ | \
0729                       DRM_TEGRA_CHANNEL_MAP_WRITE)
0730 
0731 struct drm_tegra_channel_map {
0732     /**
0733      * @context: [in]
0734      *
0735      * Identifier of the channel to which make memory available for.
0736      */
0737     __u32 context;
0738 
0739     /**
0740      * @handle: [in]
0741      *
0742      * GEM handle of the memory to map.
0743      */
0744     __u32 handle;
0745 
0746     /**
0747      * @flags: [in]
0748      *
0749      * Flags.
0750      */
0751     __u32 flags;
0752 
0753     /**
0754      * @mapping: [out]
0755      *
0756      * Identifier corresponding to the mapping, to be used for
0757      * relocations or unmapping later.
0758      */
0759     __u32 mapping;
0760 };
0761 
0762 struct drm_tegra_channel_unmap {
0763     /**
0764      * @context: [in]
0765      *
0766      * Channel identifier of the channel to unmap memory from.
0767      */
0768     __u32 context;
0769 
0770     /**
0771      * @mapping: [in]
0772      *
0773      * Mapping identifier of the memory mapping to unmap.
0774      */
0775     __u32 mapping;
0776 };
0777 
0778 /* Submission */
0779 
0780 /**
0781  * Specify that bit 39 of the patched-in address should be set to switch
0782  * swizzling between Tegra and non-Tegra sector layout on systems that store
0783  * surfaces in system memory in non-Tegra sector layout.
0784  */
0785 #define DRM_TEGRA_SUBMIT_RELOC_SECTOR_LAYOUT (1 << 0)
0786 
0787 struct drm_tegra_submit_buf {
0788     /**
0789      * @mapping: [in]
0790      *
0791      * Identifier of the mapping to use in the submission.
0792      */
0793     __u32 mapping;
0794 
0795     /**
0796      * @flags: [in]
0797      *
0798      * Flags.
0799      */
0800     __u32 flags;
0801 
0802     /**
0803      * Information for relocation patching.
0804      */
0805     struct {
0806         /**
0807          * @target_offset: [in]
0808          *
0809          * Offset from the start of the mapping of the data whose
0810          * address is to be patched into the gather.
0811          */
0812         __u64 target_offset;
0813 
0814         /**
0815          * @gather_offset_words: [in]
0816          *
0817          * Offset in words from the start of the gather data to
0818          * where the address should be patched into.
0819          */
0820         __u32 gather_offset_words;
0821 
0822         /**
0823          * @shift: [in]
0824          *
0825          * Number of bits the address should be shifted right before
0826          * patching in.
0827          */
0828         __u32 shift;
0829     } reloc;
0830 };
0831 
0832 /**
0833  * Execute `words` words of Host1x opcodes specified in the `gather_data_ptr`
0834  * buffer. Each GATHER_UPTR command uses successive words from the buffer.
0835  */
0836 #define DRM_TEGRA_SUBMIT_CMD_GATHER_UPTR        0
0837 /**
0838  * Wait for a syncpoint to reach a value before continuing with further
0839  * commands.
0840  */
0841 #define DRM_TEGRA_SUBMIT_CMD_WAIT_SYNCPT        1
0842 /**
0843  * Wait for a syncpoint to reach a value before continuing with further
0844  * commands. The threshold is calculated relative to the start of the job.
0845  */
0846 #define DRM_TEGRA_SUBMIT_CMD_WAIT_SYNCPT_RELATIVE   2
0847 
0848 struct drm_tegra_submit_cmd_gather_uptr {
0849     __u32 words;
0850     __u32 reserved[3];
0851 };
0852 
0853 struct drm_tegra_submit_cmd_wait_syncpt {
0854     __u32 id;
0855     __u32 value;
0856     __u32 reserved[2];
0857 };
0858 
0859 struct drm_tegra_submit_cmd {
0860     /**
0861      * @type: [in]
0862      *
0863      * Command type to execute. One of the DRM_TEGRA_SUBMIT_CMD*
0864      * defines.
0865      */
0866     __u32 type;
0867 
0868     /**
0869      * @flags: [in]
0870      *
0871      * Flags.
0872      */
0873     __u32 flags;
0874 
0875     union {
0876         struct drm_tegra_submit_cmd_gather_uptr gather_uptr;
0877         struct drm_tegra_submit_cmd_wait_syncpt wait_syncpt;
0878         __u32 reserved[4];
0879     };
0880 };
0881 
0882 struct drm_tegra_submit_syncpt {
0883     /**
0884      * @id: [in]
0885      *
0886      * ID of the syncpoint that the job will increment.
0887      */
0888     __u32 id;
0889 
0890     /**
0891      * @flags: [in]
0892      *
0893      * Flags.
0894      */
0895     __u32 flags;
0896 
0897     /**
0898      * @increments: [in]
0899      *
0900      * Number of times the job will increment this syncpoint.
0901      */
0902     __u32 increments;
0903 
0904     /**
0905      * @value: [out]
0906      *
0907      * Value the syncpoint will have once the job has completed all
0908      * its specified syncpoint increments.
0909      *
0910      * Note that the kernel may increment the syncpoint before or after
0911      * the job. These increments are not reflected in this field.
0912      *
0913      * If the job hangs or times out, not all of the increments may
0914      * get executed.
0915      */
0916     __u32 value;
0917 };
0918 
0919 struct drm_tegra_channel_submit {
0920     /**
0921      * @context: [in]
0922      *
0923      * Identifier of the channel to submit this job to.
0924      */
0925     __u32 context;
0926 
0927     /**
0928      * @num_bufs: [in]
0929      *
0930      * Number of elements in the `bufs_ptr` array.
0931      */
0932     __u32 num_bufs;
0933 
0934     /**
0935      * @num_cmds: [in]
0936      *
0937      * Number of elements in the `cmds_ptr` array.
0938      */
0939     __u32 num_cmds;
0940 
0941     /**
0942      * @gather_data_words: [in]
0943      *
0944      * Number of 32-bit words in the `gather_data_ptr` array.
0945      */
0946     __u32 gather_data_words;
0947 
0948     /**
0949      * @bufs_ptr: [in]
0950      *
0951      * Pointer to an array of drm_tegra_submit_buf structures.
0952      */
0953     __u64 bufs_ptr;
0954 
0955     /**
0956      * @cmds_ptr: [in]
0957      *
0958      * Pointer to an array of drm_tegra_submit_cmd structures.
0959      */
0960     __u64 cmds_ptr;
0961 
0962     /**
0963      * @gather_data_ptr: [in]
0964      *
0965      * Pointer to an array of Host1x opcodes to be used by GATHER_UPTR
0966      * commands.
0967      */
0968     __u64 gather_data_ptr;
0969 
0970     /**
0971      * @syncobj_in: [in]
0972      *
0973      * Handle for DRM syncobj that will be waited before submission.
0974      * Ignored if zero.
0975      */
0976     __u32 syncobj_in;
0977 
0978     /**
0979      * @syncobj_out: [in]
0980      *
0981      * Handle for DRM syncobj that will have its fence replaced with
0982      * the job's completion fence. Ignored if zero.
0983      */
0984     __u32 syncobj_out;
0985 
0986     /**
0987      * @syncpt_incr: [in,out]
0988      *
0989      * Information about the syncpoint the job will increment.
0990      */
0991     struct drm_tegra_submit_syncpt syncpt;
0992 };
0993 
0994 struct drm_tegra_syncpoint_allocate {
0995     /**
0996      * @id: [out]
0997      *
0998      * ID of allocated syncpoint.
0999      */
1000     __u32 id;
1001     __u32 padding;
1002 };
1003 
1004 struct drm_tegra_syncpoint_free {
1005     /**
1006      * @id: [in]
1007      *
1008      * ID of syncpoint to free.
1009      */
1010     __u32 id;
1011     __u32 padding;
1012 };
1013 
1014 struct drm_tegra_syncpoint_wait {
1015     /**
1016      * @timeout: [in]
1017      *
1018      * Absolute timestamp at which the wait will time out.
1019      */
1020     __s64 timeout_ns;
1021 
1022     /**
1023      * @id: [in]
1024      *
1025      * ID of syncpoint to wait on.
1026      */
1027     __u32 id;
1028 
1029     /**
1030      * @threshold: [in]
1031      *
1032      * Threshold to wait for.
1033      */
1034     __u32 threshold;
1035 
1036     /**
1037      * @value: [out]
1038      *
1039      * Value of the syncpoint upon wait completion.
1040      */
1041     __u32 value;
1042 
1043     __u32 padding;
1044 };
1045 
1046 #define DRM_IOCTL_TEGRA_CHANNEL_OPEN DRM_IOWR(DRM_COMMAND_BASE + 0x10, struct drm_tegra_channel_open)
1047 #define DRM_IOCTL_TEGRA_CHANNEL_CLOSE DRM_IOWR(DRM_COMMAND_BASE + 0x11, struct drm_tegra_channel_close)
1048 #define DRM_IOCTL_TEGRA_CHANNEL_MAP DRM_IOWR(DRM_COMMAND_BASE + 0x12, struct drm_tegra_channel_map)
1049 #define DRM_IOCTL_TEGRA_CHANNEL_UNMAP DRM_IOWR(DRM_COMMAND_BASE + 0x13, struct drm_tegra_channel_unmap)
1050 #define DRM_IOCTL_TEGRA_CHANNEL_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + 0x14, struct drm_tegra_channel_submit)
1051 
1052 #define DRM_IOCTL_TEGRA_SYNCPOINT_ALLOCATE DRM_IOWR(DRM_COMMAND_BASE + 0x20, struct drm_tegra_syncpoint_allocate)
1053 #define DRM_IOCTL_TEGRA_SYNCPOINT_FREE DRM_IOWR(DRM_COMMAND_BASE + 0x21, struct drm_tegra_syncpoint_free)
1054 #define DRM_IOCTL_TEGRA_SYNCPOINT_WAIT DRM_IOWR(DRM_COMMAND_BASE + 0x22, struct drm_tegra_syncpoint_wait)
1055 
1056 #if defined(__cplusplus)
1057 }
1058 #endif
1059 
1060 #endif