xref: /openbmc/linux/include/uapi/drm/exynos_drm.h (revision 4cff79e9)
1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2 /* exynos_drm.h
3  *
4  * Copyright (c) 2011 Samsung Electronics Co., Ltd.
5  * Authors:
6  *	Inki Dae <inki.dae@samsung.com>
7  *	Joonyoung Shim <jy0922.shim@samsung.com>
8  *	Seung-Woo Kim <sw0312.kim@samsung.com>
9  *
10  * This program is free software; you can redistribute  it and/or modify it
11  * under  the terms of  the GNU General  Public License as published by the
12  * Free Software Foundation;  either version 2 of the  License, or (at your
13  * option) any later version.
14  */
15 
16 #ifndef _UAPI_EXYNOS_DRM_H_
17 #define _UAPI_EXYNOS_DRM_H_
18 
19 #include "drm.h"
20 
21 #if defined(__cplusplus)
22 extern "C" {
23 #endif
24 
25 /**
26  * User-desired buffer creation information structure.
27  *
28  * @size: user-desired memory allocation size.
29  *	- this size value would be page-aligned internally.
30  * @flags: user request for setting memory type or cache attributes.
31  * @handle: returned a handle to created gem object.
32  *	- this handle will be set by gem module of kernel side.
33  */
34 struct drm_exynos_gem_create {
35 	__u64 size;
36 	__u32 flags;
37 	__u32 handle;
38 };
39 
40 /**
41  * A structure for getting a fake-offset that can be used with mmap.
42  *
43  * @handle: handle of gem object.
44  * @reserved: just padding to be 64-bit aligned.
45  * @offset: a fake-offset of gem object.
46  */
47 struct drm_exynos_gem_map {
48 	__u32 handle;
49 	__u32 reserved;
50 	__u64 offset;
51 };
52 
53 /**
54  * A structure to gem information.
55  *
56  * @handle: a handle to gem object created.
57  * @flags: flag value including memory type and cache attribute and
58  *	this value would be set by driver.
59  * @size: size to memory region allocated by gem and this size would
60  *	be set by driver.
61  */
62 struct drm_exynos_gem_info {
63 	__u32 handle;
64 	__u32 flags;
65 	__u64 size;
66 };
67 
68 /**
69  * A structure for user connection request of virtual display.
70  *
71  * @connection: indicate whether doing connetion or not by user.
72  * @extensions: if this value is 1 then the vidi driver would need additional
73  *	128bytes edid data.
74  * @edid: the edid data pointer from user side.
75  */
76 struct drm_exynos_vidi_connection {
77 	__u32 connection;
78 	__u32 extensions;
79 	__u64 edid;
80 };
81 
82 /* memory type definitions. */
83 enum e_drm_exynos_gem_mem_type {
84 	/* Physically Continuous memory and used as default. */
85 	EXYNOS_BO_CONTIG	= 0 << 0,
86 	/* Physically Non-Continuous memory. */
87 	EXYNOS_BO_NONCONTIG	= 1 << 0,
88 	/* non-cachable mapping and used as default. */
89 	EXYNOS_BO_NONCACHABLE	= 0 << 1,
90 	/* cachable mapping. */
91 	EXYNOS_BO_CACHABLE	= 1 << 1,
92 	/* write-combine mapping. */
93 	EXYNOS_BO_WC		= 1 << 2,
94 	EXYNOS_BO_MASK		= EXYNOS_BO_NONCONTIG | EXYNOS_BO_CACHABLE |
95 					EXYNOS_BO_WC
96 };
97 
98 struct drm_exynos_g2d_get_ver {
99 	__u32	major;
100 	__u32	minor;
101 };
102 
103 struct drm_exynos_g2d_cmd {
104 	__u32	offset;
105 	__u32	data;
106 };
107 
108 enum drm_exynos_g2d_buf_type {
109 	G2D_BUF_USERPTR = 1 << 31,
110 };
111 
112 enum drm_exynos_g2d_event_type {
113 	G2D_EVENT_NOT,
114 	G2D_EVENT_NONSTOP,
115 	G2D_EVENT_STOP,		/* not yet */
116 };
117 
118 struct drm_exynos_g2d_userptr {
119 	unsigned long userptr;
120 	unsigned long size;
121 };
122 
123 struct drm_exynos_g2d_set_cmdlist {
124 	__u64					cmd;
125 	__u64					cmd_buf;
126 	__u32					cmd_nr;
127 	__u32					cmd_buf_nr;
128 
129 	/* for g2d event */
130 	__u64					event_type;
131 	__u64					user_data;
132 };
133 
134 struct drm_exynos_g2d_exec {
135 	__u64					async;
136 };
137 
138 #define DRM_EXYNOS_GEM_CREATE		0x00
139 #define DRM_EXYNOS_GEM_MAP		0x01
140 /* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */
141 #define DRM_EXYNOS_GEM_GET		0x04
142 #define DRM_EXYNOS_VIDI_CONNECTION	0x07
143 
144 /* G2D */
145 #define DRM_EXYNOS_G2D_GET_VER		0x20
146 #define DRM_EXYNOS_G2D_SET_CMDLIST	0x21
147 #define DRM_EXYNOS_G2D_EXEC		0x22
148 
149 /* Reserved 0x30 ~ 0x33 for obsolete Exynos IPP ioctls */
150 
151 #define DRM_IOCTL_EXYNOS_GEM_CREATE		DRM_IOWR(DRM_COMMAND_BASE + \
152 		DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create)
153 #define DRM_IOCTL_EXYNOS_GEM_MAP		DRM_IOWR(DRM_COMMAND_BASE + \
154 		DRM_EXYNOS_GEM_MAP, struct drm_exynos_gem_map)
155 #define DRM_IOCTL_EXYNOS_GEM_GET	DRM_IOWR(DRM_COMMAND_BASE + \
156 		DRM_EXYNOS_GEM_GET,	struct drm_exynos_gem_info)
157 
158 #define DRM_IOCTL_EXYNOS_VIDI_CONNECTION	DRM_IOWR(DRM_COMMAND_BASE + \
159 		DRM_EXYNOS_VIDI_CONNECTION, struct drm_exynos_vidi_connection)
160 
161 #define DRM_IOCTL_EXYNOS_G2D_GET_VER		DRM_IOWR(DRM_COMMAND_BASE + \
162 		DRM_EXYNOS_G2D_GET_VER, struct drm_exynos_g2d_get_ver)
163 #define DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST	DRM_IOWR(DRM_COMMAND_BASE + \
164 		DRM_EXYNOS_G2D_SET_CMDLIST, struct drm_exynos_g2d_set_cmdlist)
165 #define DRM_IOCTL_EXYNOS_G2D_EXEC		DRM_IOWR(DRM_COMMAND_BASE + \
166 		DRM_EXYNOS_G2D_EXEC, struct drm_exynos_g2d_exec)
167 
168 /* EXYNOS specific events */
169 #define DRM_EXYNOS_G2D_EVENT		0x80000000
170 
171 struct drm_exynos_g2d_event {
172 	struct drm_event	base;
173 	__u64			user_data;
174 	__u32			tv_sec;
175 	__u32			tv_usec;
176 	__u32			cmdlist_no;
177 	__u32			reserved;
178 };
179 
180 #if defined(__cplusplus)
181 }
182 #endif
183 
184 #endif /* _UAPI_EXYNOS_DRM_H_ */
185