3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
5 * Inki Dae <inki.dae@samsung.com>
6 * Joonyoung Shim <jy0922.shim@samsung.com>
7 * Seung-Woo Kim <sw0312.kim@samsung.com>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
15 #ifndef _UAPI_EXYNOS_DRM_H_
16 #define _UAPI_EXYNOS_DRM_H_
21 * User-desired buffer creation information structure.
23 * @size: user-desired memory allocation size.
24 * - this size value would be page-aligned internally.
25 * @flags: user request for setting memory type or cache attributes.
26 * @handle: returned a handle to created gem object.
27 * - this handle will be set by gem module of kernel side.
29 struct drm_exynos_gem_create
{
36 * A structure for getting buffer offset.
38 * @handle: a pointer to gem object created.
39 * @pad: just padding to be 64-bit aligned.
40 * @offset: relatived offset value of the memory region allocated.
41 * - this value should be set by user.
43 struct drm_exynos_gem_map_off
{
50 * A structure for mapping buffer.
52 * @handle: a handle to gem object created.
53 * @pad: just padding to be 64-bit aligned.
54 * @size: memory size to be mapped.
55 * @mapped: having user virtual address mmaped.
56 * - this variable would be filled by exynos gem module
57 * of kernel side with user virtual address which is allocated
60 struct drm_exynos_gem_mmap
{
68 * A structure to gem information.
70 * @handle: a handle to gem object created.
71 * @flags: flag value including memory type and cache attribute and
72 * this value would be set by driver.
73 * @size: size to memory region allocated by gem and this size would
76 struct drm_exynos_gem_info
{
83 * A structure for user connection request of virtual display.
85 * @connection: indicate whether doing connetion or not by user.
86 * @extensions: if this value is 1 then the vidi driver would need additional
88 * @edid: the edid data pointer from user side.
90 struct drm_exynos_vidi_connection
{
91 unsigned int connection
;
92 unsigned int extensions
;
96 /* memory type definitions. */
97 enum e_drm_exynos_gem_mem_type
{
98 /* Physically Continuous memory and used as default. */
99 EXYNOS_BO_CONTIG
= 0 << 0,
100 /* Physically Non-Continuous memory. */
101 EXYNOS_BO_NONCONTIG
= 1 << 0,
102 /* non-cachable mapping and used as default. */
103 EXYNOS_BO_NONCACHABLE
= 0 << 1,
104 /* cachable mapping. */
105 EXYNOS_BO_CACHABLE
= 1 << 1,
106 /* write-combine mapping. */
107 EXYNOS_BO_WC
= 1 << 2,
108 EXYNOS_BO_MASK
= EXYNOS_BO_NONCONTIG
| EXYNOS_BO_CACHABLE
|
112 struct drm_exynos_g2d_get_ver
{
117 struct drm_exynos_g2d_cmd
{
122 enum drm_exynos_g2d_buf_type
{
123 G2D_BUF_USERPTR
= 1 << 31,
126 enum drm_exynos_g2d_event_type
{
129 G2D_EVENT_STOP
, /* not yet */
132 struct drm_exynos_g2d_userptr
{
133 unsigned long userptr
;
137 struct drm_exynos_g2d_set_cmdlist
{
148 struct drm_exynos_g2d_exec
{
152 enum drm_exynos_ops_id
{
158 struct drm_exynos_sz
{
163 struct drm_exynos_pos
{
170 enum drm_exynos_flip
{
171 EXYNOS_DRM_FLIP_NONE
= (0 << 0),
172 EXYNOS_DRM_FLIP_VERTICAL
= (1 << 0),
173 EXYNOS_DRM_FLIP_HORIZONTAL
= (1 << 1),
174 EXYNOS_DRM_FLIP_BOTH
= EXYNOS_DRM_FLIP_VERTICAL
|
175 EXYNOS_DRM_FLIP_HORIZONTAL
,
178 enum drm_exynos_degree
{
180 EXYNOS_DRM_DEGREE_90
,
181 EXYNOS_DRM_DEGREE_180
,
182 EXYNOS_DRM_DEGREE_270
,
185 enum drm_exynos_planer
{
187 EXYNOS_DRM_PLANAR_CB
,
188 EXYNOS_DRM_PLANAR_CR
,
189 EXYNOS_DRM_PLANAR_MAX
,
193 * A structure for ipp supported property list.
195 * @version: version of this structure.
196 * @ipp_id: id of ipp driver.
197 * @count: count of ipp driver.
198 * @writeback: flag of writeback supporting.
199 * @flip: flag of flip supporting.
200 * @degree: flag of degree information.
201 * @csc: flag of csc supporting.
202 * @crop: flag of crop supporting.
203 * @scale: flag of scale supporting.
204 * @refresh_min: min hz of refresh.
205 * @refresh_max: max hz of refresh.
206 * @crop_min: crop min resolution.
207 * @crop_max: crop max resolution.
208 * @scale_min: scale min resolution.
209 * @scale_max: scale max resolution.
211 struct drm_exynos_ipp_prop_list
{
224 struct drm_exynos_sz crop_min
;
225 struct drm_exynos_sz crop_max
;
226 struct drm_exynos_sz scale_min
;
227 struct drm_exynos_sz scale_max
;
231 * A structure for ipp config.
233 * @ops_id: property of operation directions.
234 * @flip: property of mirror, flip.
235 * @degree: property of rotation degree.
236 * @fmt: property of image format.
237 * @sz: property of image size.
238 * @pos: property of image position(src-cropped,dst-scaler).
240 struct drm_exynos_ipp_config
{
241 enum drm_exynos_ops_id ops_id
;
242 enum drm_exynos_flip flip
;
243 enum drm_exynos_degree degree
;
245 struct drm_exynos_sz sz
;
246 struct drm_exynos_pos pos
;
249 enum drm_exynos_ipp_cmd
{
258 * A structure for ipp property.
260 * @config: source, destination config.
261 * @cmd: definition of command.
262 * @ipp_id: id of ipp driver.
263 * @prop_id: id of property.
264 * @refresh_rate: refresh rate.
266 struct drm_exynos_ipp_property
{
267 struct drm_exynos_ipp_config config
[EXYNOS_DRM_OPS_MAX
];
268 enum drm_exynos_ipp_cmd cmd
;
274 enum drm_exynos_ipp_buf_type
{
280 * A structure for ipp buffer operations.
282 * @ops_id: operation directions.
283 * @buf_type: definition of buffer.
284 * @prop_id: id of property.
285 * @buf_id: id of buffer.
286 * @handle: Y, Cb, Cr each planar handle.
287 * @user_data: user data.
289 struct drm_exynos_ipp_queue_buf
{
290 enum drm_exynos_ops_id ops_id
;
291 enum drm_exynos_ipp_buf_type buf_type
;
294 __u32 handle
[EXYNOS_DRM_PLANAR_MAX
];
299 enum drm_exynos_ipp_ctrl
{
308 * A structure for ipp start/stop operations.
310 * @prop_id: id of property.
311 * @ctrl: definition of control.
313 struct drm_exynos_ipp_cmd_ctrl
{
315 enum drm_exynos_ipp_ctrl ctrl
;
318 #define DRM_EXYNOS_GEM_CREATE 0x00
319 #define DRM_EXYNOS_GEM_MAP_OFFSET 0x01
320 #define DRM_EXYNOS_GEM_MMAP 0x02
321 /* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */
322 #define DRM_EXYNOS_GEM_GET 0x04
323 #define DRM_EXYNOS_VIDI_CONNECTION 0x07
326 #define DRM_EXYNOS_G2D_GET_VER 0x20
327 #define DRM_EXYNOS_G2D_SET_CMDLIST 0x21
328 #define DRM_EXYNOS_G2D_EXEC 0x22
330 /* IPP - Image Post Processing */
331 #define DRM_EXYNOS_IPP_GET_PROPERTY 0x30
332 #define DRM_EXYNOS_IPP_SET_PROPERTY 0x31
333 #define DRM_EXYNOS_IPP_QUEUE_BUF 0x32
334 #define DRM_EXYNOS_IPP_CMD_CTRL 0x33
336 #define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \
337 DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create)
339 #define DRM_IOCTL_EXYNOS_GEM_MAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + \
340 DRM_EXYNOS_GEM_MAP_OFFSET, struct drm_exynos_gem_map_off)
342 #define DRM_IOCTL_EXYNOS_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + \
343 DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap)
345 #define DRM_IOCTL_EXYNOS_GEM_GET DRM_IOWR(DRM_COMMAND_BASE + \
346 DRM_EXYNOS_GEM_GET, struct drm_exynos_gem_info)
348 #define DRM_IOCTL_EXYNOS_VIDI_CONNECTION DRM_IOWR(DRM_COMMAND_BASE + \
349 DRM_EXYNOS_VIDI_CONNECTION, struct drm_exynos_vidi_connection)
351 #define DRM_IOCTL_EXYNOS_G2D_GET_VER DRM_IOWR(DRM_COMMAND_BASE + \
352 DRM_EXYNOS_G2D_GET_VER, struct drm_exynos_g2d_get_ver)
353 #define DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST DRM_IOWR(DRM_COMMAND_BASE + \
354 DRM_EXYNOS_G2D_SET_CMDLIST, struct drm_exynos_g2d_set_cmdlist)
355 #define DRM_IOCTL_EXYNOS_G2D_EXEC DRM_IOWR(DRM_COMMAND_BASE + \
356 DRM_EXYNOS_G2D_EXEC, struct drm_exynos_g2d_exec)
358 #define DRM_IOCTL_EXYNOS_IPP_GET_PROPERTY DRM_IOWR(DRM_COMMAND_BASE + \
359 DRM_EXYNOS_IPP_GET_PROPERTY, struct drm_exynos_ipp_prop_list)
360 #define DRM_IOCTL_EXYNOS_IPP_SET_PROPERTY DRM_IOWR(DRM_COMMAND_BASE + \
361 DRM_EXYNOS_IPP_SET_PROPERTY, struct drm_exynos_ipp_property)
362 #define DRM_IOCTL_EXYNOS_IPP_QUEUE_BUF DRM_IOWR(DRM_COMMAND_BASE + \
363 DRM_EXYNOS_IPP_QUEUE_BUF, struct drm_exynos_ipp_queue_buf)
364 #define DRM_IOCTL_EXYNOS_IPP_CMD_CTRL DRM_IOWR(DRM_COMMAND_BASE + \
365 DRM_EXYNOS_IPP_CMD_CTRL, struct drm_exynos_ipp_cmd_ctrl)
367 /* EXYNOS specific events */
368 #define DRM_EXYNOS_G2D_EVENT 0x80000000
369 #define DRM_EXYNOS_IPP_EVENT 0x80000001
371 struct drm_exynos_g2d_event
{
372 struct drm_event base
;
380 struct drm_exynos_ipp_event
{
381 struct drm_event base
;
387 __u32 buf_id
[EXYNOS_DRM_OPS_MAX
];
390 #endif /* _UAPI_EXYNOS_DRM_H_ */