138062f954c637861348dd8078cefb73554e6f12cChristopher Ferris/****************************************************************************
238062f954c637861348dd8078cefb73554e6f12cChristopher Ferris ****************************************************************************
338062f954c637861348dd8078cefb73554e6f12cChristopher Ferris ***
438062f954c637861348dd8078cefb73554e6f12cChristopher Ferris ***   This header was automatically generated from a Linux kernel header
538062f954c637861348dd8078cefb73554e6f12cChristopher Ferris ***   of the same name, to make information necessary for userspace to
638062f954c637861348dd8078cefb73554e6f12cChristopher Ferris ***   call into the kernel available to libc.  It contains only constants,
738062f954c637861348dd8078cefb73554e6f12cChristopher Ferris ***   structures, and macros generated from the original header, and thus,
838062f954c637861348dd8078cefb73554e6f12cChristopher Ferris ***   contains no copyrightable information.
938062f954c637861348dd8078cefb73554e6f12cChristopher Ferris ***
1038062f954c637861348dd8078cefb73554e6f12cChristopher Ferris ***   To edit the content of this header, modify the corresponding
1138062f954c637861348dd8078cefb73554e6f12cChristopher Ferris ***   source file (e.g. under external/kernel-headers/original/) then
1238062f954c637861348dd8078cefb73554e6f12cChristopher Ferris ***   run bionic/libc/kernel/tools/update_all.py
1338062f954c637861348dd8078cefb73554e6f12cChristopher Ferris ***
1438062f954c637861348dd8078cefb73554e6f12cChristopher Ferris ***   Any manual change here will be lost the next time this script will
1538062f954c637861348dd8078cefb73554e6f12cChristopher Ferris ***   be run. You've been warned!
1638062f954c637861348dd8078cefb73554e6f12cChristopher Ferris ***
1738062f954c637861348dd8078cefb73554e6f12cChristopher Ferris ****************************************************************************
1838062f954c637861348dd8078cefb73554e6f12cChristopher Ferris ****************************************************************************/
1938062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#ifndef __MSM_DRM_H__
2038062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define __MSM_DRM_H__
21106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris#include "drm.h"
22106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris#ifdef __cplusplus
23106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris#endif
2438062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define MSM_PIPE_NONE 0x00
2538062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define MSM_PIPE_2D0 0x01
2638062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define MSM_PIPE_2D1 0x02
27106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris#define MSM_PIPE_3D0 0x10
286a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris#define MSM_PIPE_ID_MASK 0xffff
296a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris#define MSM_PIPE_ID(x) ((x) & MSM_PIPE_ID_MASK)
306a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris#define MSM_PIPE_FLAGS(x) ((x) & ~MSM_PIPE_ID_MASK)
3138062f954c637861348dd8078cefb73554e6f12cChristopher Ferrisstruct drm_msm_timespec {
3205d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __s64 tv_sec;
3305d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __s64 tv_nsec;
34106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris};
3538062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define MSM_PARAM_GPU_ID 0x01
3638062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define MSM_PARAM_GMEM_SIZE 0x02
37ba8d4f460b51161eb82cf1006cb34a3cc1389f47Christopher Ferris#define MSM_PARAM_CHIP_ID 0x03
38106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris#define MSM_PARAM_MAX_FREQ 0x04
39106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris#define MSM_PARAM_TIMESTAMP 0x05
40525ce914edf136d2bd02ac8c404d56c52e737f4dChristopher Ferris#define MSM_PARAM_GMEM_BASE 0x06
41934ec9495505d234b2c2fa284470c2f44aae9de9Christopher Ferris#define MSM_PARAM_NR_RINGS 0x07
42106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferrisstruct drm_msm_param {
4305d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 pipe;
4405d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 param;
4505d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 value;
4638062f954c637861348dd8078cefb73554e6f12cChristopher Ferris};
47ba8d4f460b51161eb82cf1006cb34a3cc1389f47Christopher Ferris#define MSM_BO_SCANOUT 0x00000001
4838062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define MSM_BO_GPU_READONLY 0x00000002
4938062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define MSM_BO_CACHE_MASK 0x000f0000
5038062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define MSM_BO_CACHED 0x00010000
51ba8d4f460b51161eb82cf1006cb34a3cc1389f47Christopher Ferris#define MSM_BO_WC 0x00020000
5238062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define MSM_BO_UNCACHED 0x00040000
53d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao#define MSM_BO_FLAGS (MSM_BO_SCANOUT | MSM_BO_GPU_READONLY | MSM_BO_CACHED | MSM_BO_WC | MSM_BO_UNCACHED)
5438062f954c637861348dd8078cefb73554e6f12cChristopher Ferrisstruct drm_msm_gem_new {
5505d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 size;
5605d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 flags;
5705d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 handle;
5838062f954c637861348dd8078cefb73554e6f12cChristopher Ferris};
591308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris#define MSM_INFO_IOVA 0x01
601308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris#define MSM_INFO_FLAGS (MSM_INFO_IOVA)
6138062f954c637861348dd8078cefb73554e6f12cChristopher Ferrisstruct drm_msm_gem_info {
6205d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 handle;
631308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  __u32 flags;
6405d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 offset;
6538062f954c637861348dd8078cefb73554e6f12cChristopher Ferris};
6638062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define MSM_PREP_READ 0x01
6738062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define MSM_PREP_WRITE 0x02
6838062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define MSM_PREP_NOSYNC 0x04
69ba8d4f460b51161eb82cf1006cb34a3cc1389f47Christopher Ferris#define MSM_PREP_FLAGS (MSM_PREP_READ | MSM_PREP_WRITE | MSM_PREP_NOSYNC)
7038062f954c637861348dd8078cefb73554e6f12cChristopher Ferrisstruct drm_msm_gem_cpu_prep {
7105d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 handle;
7205d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 op;
73d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  struct drm_msm_timespec timeout;
7438062f954c637861348dd8078cefb73554e6f12cChristopher Ferris};
7538062f954c637861348dd8078cefb73554e6f12cChristopher Ferrisstruct drm_msm_gem_cpu_fini {
7605d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 handle;
7738062f954c637861348dd8078cefb73554e6f12cChristopher Ferris};
7838062f954c637861348dd8078cefb73554e6f12cChristopher Ferrisstruct drm_msm_gem_submit_reloc {
7905d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 submit_offset;
8005d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 or;
8105d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __s32 shift;
8205d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 reloc_idx;
8305d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 reloc_offset;
8438062f954c637861348dd8078cefb73554e6f12cChristopher Ferris};
8538062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define MSM_SUBMIT_CMD_BUF 0x0001
8638062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define MSM_SUBMIT_CMD_IB_TARGET_BUF 0x0002
8738062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define MSM_SUBMIT_CMD_CTX_RESTORE_BUF 0x0003
8838062f954c637861348dd8078cefb73554e6f12cChristopher Ferrisstruct drm_msm_gem_submit_cmd {
8905d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 type;
9005d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 submit_idx;
9105d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 submit_offset;
9205d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 size;
9305d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 pad;
9405d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 nr_relocs;
951308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  __u64 relocs;
9638062f954c637861348dd8078cefb73554e6f12cChristopher Ferris};
9738062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define MSM_SUBMIT_BO_READ 0x0001
9838062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define MSM_SUBMIT_BO_WRITE 0x0002
99ba8d4f460b51161eb82cf1006cb34a3cc1389f47Christopher Ferris#define MSM_SUBMIT_BO_FLAGS (MSM_SUBMIT_BO_READ | MSM_SUBMIT_BO_WRITE)
10038062f954c637861348dd8078cefb73554e6f12cChristopher Ferrisstruct drm_msm_gem_submit_bo {
10105d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 flags;
10205d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 handle;
10305d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u64 presumed;
10438062f954c637861348dd8078cefb73554e6f12cChristopher Ferris};
1056a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris#define MSM_SUBMIT_NO_IMPLICIT 0x80000000
1066a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris#define MSM_SUBMIT_FENCE_FD_IN 0x40000000
1076a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris#define MSM_SUBMIT_FENCE_FD_OUT 0x20000000
1086a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris#define MSM_SUBMIT_FLAGS (MSM_SUBMIT_NO_IMPLICIT | MSM_SUBMIT_FENCE_FD_IN | MSM_SUBMIT_FENCE_FD_OUT | 0)
10938062f954c637861348dd8078cefb73554e6f12cChristopher Ferrisstruct drm_msm_gem_submit {
1106a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  __u32 flags;
11105d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 fence;
11205d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 nr_bos;
11305d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 nr_cmds;
1141308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  __u64 bos;
1151308ad3ab33294c3abfd96da12b6df58b381ce52Christopher Ferris  __u64 cmds;
1166a9755d20a995756487bb1aafb7e954f4fd868a7Christopher Ferris  __s32 fence_fd;
117934ec9495505d234b2c2fa284470c2f44aae9de9Christopher Ferris  __u32 queueid;
11838062f954c637861348dd8078cefb73554e6f12cChristopher Ferris};
11938062f954c637861348dd8078cefb73554e6f12cChristopher Ferrisstruct drm_msm_wait_fence {
12005d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 fence;
12105d08e9716b5974d6ed08973f44930804890b902Christopher Ferris  __u32 pad;
122d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao  struct drm_msm_timespec timeout;
123934ec9495505d234b2c2fa284470c2f44aae9de9Christopher Ferris  __u32 queueid;
12438062f954c637861348dd8078cefb73554e6f12cChristopher Ferris};
12549f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define MSM_MADV_WILLNEED 0
12649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define MSM_MADV_DONTNEED 1
12749f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define __MSM_MADV_PURGED 2
12849f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferrisstruct drm_msm_gem_madvise {
12949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __u32 handle;
13049f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __u32 madv;
13149f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris  __u32 retained;
13249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris};
133934ec9495505d234b2c2fa284470c2f44aae9de9Christopher Ferris#define MSM_SUBMITQUEUE_FLAGS (0)
134934ec9495505d234b2c2fa284470c2f44aae9de9Christopher Ferrisstruct drm_msm_submitqueue {
135934ec9495505d234b2c2fa284470c2f44aae9de9Christopher Ferris  __u32 flags;
136934ec9495505d234b2c2fa284470c2f44aae9de9Christopher Ferris  __u32 prio;
137934ec9495505d234b2c2fa284470c2f44aae9de9Christopher Ferris  __u32 id;
138934ec9495505d234b2c2fa284470c2f44aae9de9Christopher Ferris};
13938062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define DRM_MSM_GET_PARAM 0x00
14038062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define DRM_MSM_GEM_NEW 0x02
14138062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define DRM_MSM_GEM_INFO 0x03
14238062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define DRM_MSM_GEM_CPU_PREP 0x04
14338062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define DRM_MSM_GEM_CPU_FINI 0x05
14438062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define DRM_MSM_GEM_SUBMIT 0x06
14538062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define DRM_MSM_WAIT_FENCE 0x07
14649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define DRM_MSM_GEM_MADVISE 0x08
147934ec9495505d234b2c2fa284470c2f44aae9de9Christopher Ferris#define DRM_MSM_SUBMITQUEUE_NEW 0x0A
148934ec9495505d234b2c2fa284470c2f44aae9de9Christopher Ferris#define DRM_MSM_SUBMITQUEUE_CLOSE 0x0B
14938062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define DRM_IOCTL_MSM_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GET_PARAM, struct drm_msm_param)
15038062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define DRM_IOCTL_MSM_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_NEW, struct drm_msm_gem_new)
15138062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define DRM_IOCTL_MSM_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_INFO, struct drm_msm_gem_info)
15249f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define DRM_IOCTL_MSM_GEM_CPU_PREP DRM_IOW(DRM_COMMAND_BASE + DRM_MSM_GEM_CPU_PREP, struct drm_msm_gem_cpu_prep)
153d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao#define DRM_IOCTL_MSM_GEM_CPU_FINI DRM_IOW(DRM_COMMAND_BASE + DRM_MSM_GEM_CPU_FINI, struct drm_msm_gem_cpu_fini)
15438062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#define DRM_IOCTL_MSM_GEM_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_SUBMIT, struct drm_msm_gem_submit)
155d7db594b8d1dab36b711bd887a9dd21675c87243Tao Bao#define DRM_IOCTL_MSM_WAIT_FENCE DRM_IOW(DRM_COMMAND_BASE + DRM_MSM_WAIT_FENCE, struct drm_msm_wait_fence)
15649f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#define DRM_IOCTL_MSM_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_MADVISE, struct drm_msm_gem_madvise)
157934ec9495505d234b2c2fa284470c2f44aae9de9Christopher Ferris#define DRM_IOCTL_MSM_SUBMITQUEUE_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_SUBMITQUEUE_NEW, struct drm_msm_submitqueue)
158934ec9495505d234b2c2fa284470c2f44aae9de9Christopher Ferris#define DRM_IOCTL_MSM_SUBMITQUEUE_CLOSE DRM_IOW(DRM_COMMAND_BASE + DRM_MSM_SUBMITQUEUE_CLOSE, __u32)
15949f525c47bd383cd6a87db8f067cddb3ab620d17Christopher Ferris#ifdef __cplusplus
16038062f954c637861348dd8078cefb73554e6f12cChristopher Ferris#endif
161106b3a8a7dc03c19a45e322de425ac56aafac358Christopher Ferris#endif
162