1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
6 * Inki Dae <inki.dae@samsung.com>
7 * Joonyoung Shim <jy0922.shim@samsung.com>
8 * Seung-Woo Kim <sw0312.kim@samsung.com>
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.
16 #ifndef _UAPI_EXYNOS_DRM_H_
17 #define _UAPI_EXYNOS_DRM_H_
21 #if defined(__cplusplus)
26 * User-desired buffer creation information structure.
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.
34 struct drm_exynos_gem_create
{
41 * A structure for getting a fake-offset that can be used with mmap.
43 * @handle: handle of gem object.
44 * @reserved: just padding to be 64-bit aligned.
45 * @offset: a fake-offset of gem object.
47 struct drm_exynos_gem_map
{
54 * A structure to gem information.
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
62 struct drm_exynos_gem_info
{
69 * A structure for user connection request of virtual display.
71 * @connection: indicate whether doing connection or not by user.
72 * @extensions: if this value is 1 then the vidi driver would need additional
74 * @edid: the edid data pointer from user side.
76 struct drm_exynos_vidi_connection
{
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
|
98 struct drm_exynos_g2d_get_ver
{
103 struct drm_exynos_g2d_cmd
{
108 enum drm_exynos_g2d_buf_type
{
109 G2D_BUF_USERPTR
= 1 << 31,
112 enum drm_exynos_g2d_event_type
{
115 G2D_EVENT_STOP
, /* not yet */
118 struct drm_exynos_g2d_userptr
{
119 unsigned long userptr
;
123 struct drm_exynos_g2d_set_cmdlist
{
134 struct drm_exynos_g2d_exec
{
138 /* Exynos DRM IPP v2 API */
141 * Enumerate available IPP hardware modules.
143 * @count_ipps: size of ipp_id array / number of ipp modules (set by driver)
145 * @ipp_id_ptr: pointer to ipp_id array or NULL
147 struct drm_exynos_ioctl_ipp_get_res
{
153 enum drm_exynos_ipp_format_type
{
154 DRM_EXYNOS_IPP_FORMAT_SOURCE
= 0x01,
155 DRM_EXYNOS_IPP_FORMAT_DESTINATION
= 0x02,
158 struct drm_exynos_ipp_format
{
164 enum drm_exynos_ipp_capability
{
165 DRM_EXYNOS_IPP_CAP_CROP
= 0x01,
166 DRM_EXYNOS_IPP_CAP_ROTATE
= 0x02,
167 DRM_EXYNOS_IPP_CAP_SCALE
= 0x04,
168 DRM_EXYNOS_IPP_CAP_CONVERT
= 0x08,
172 * Get IPP hardware capabilities and supported image formats.
174 * @ipp_id: id of IPP module to query
175 * @capabilities: bitmask of drm_exynos_ipp_capability (set by driver)
177 * @formats_count: size of formats array (in entries) / number of filled
178 * formats (set by driver)
179 * @formats_ptr: pointer to formats array or NULL
181 struct drm_exynos_ioctl_ipp_get_caps
{
189 enum drm_exynos_ipp_limit_type
{
190 /* size (horizontal/vertial) limits, in pixels (min, max, alignment) */
191 DRM_EXYNOS_IPP_LIMIT_TYPE_SIZE
= 0x0001,
192 /* scale ratio (horizonta/vertial), 16.16 fixed point (min, max) */
193 DRM_EXYNOS_IPP_LIMIT_TYPE_SCALE
= 0x0002,
195 /* image buffer area */
196 DRM_EXYNOS_IPP_LIMIT_SIZE_BUFFER
= 0x0001 << 16,
197 /* src/dst rectangle area */
198 DRM_EXYNOS_IPP_LIMIT_SIZE_AREA
= 0x0002 << 16,
199 /* src/dst rectangle area when rotation enabled */
200 DRM_EXYNOS_IPP_LIMIT_SIZE_ROTATED
= 0x0003 << 16,
202 DRM_EXYNOS_IPP_LIMIT_TYPE_MASK
= 0x000f,
203 DRM_EXYNOS_IPP_LIMIT_SIZE_MASK
= 0x000f << 16,
206 struct drm_exynos_ipp_limit_val
{
214 * IPP module limitation.
216 * @type: limit type (see drm_exynos_ipp_limit_type enum)
218 * @h: horizontal limits
219 * @v: vertical limits
221 struct drm_exynos_ipp_limit
{
224 struct drm_exynos_ipp_limit_val h
;
225 struct drm_exynos_ipp_limit_val v
;
229 * Get IPP limits for given image format.
231 * @ipp_id: id of IPP module to query
232 * @fourcc: image format code (see DRM_FORMAT_* in drm_fourcc.h)
233 * @modifier: image format modifier (see DRM_FORMAT_MOD_* in drm_fourcc.h)
234 * @type: source/destination identifier (drm_exynos_ipp_format_flag enum)
235 * @limits_count: size of limits array (in entries) / number of filled entries
237 * @limits_ptr: pointer to limits array or NULL
239 struct drm_exynos_ioctl_ipp_get_limits
{
248 enum drm_exynos_ipp_task_id
{
249 /* buffer described by struct drm_exynos_ipp_task_buffer */
250 DRM_EXYNOS_IPP_TASK_BUFFER
= 0x0001,
251 /* rectangle described by struct drm_exynos_ipp_task_rect */
252 DRM_EXYNOS_IPP_TASK_RECTANGLE
= 0x0002,
253 /* transformation described by struct drm_exynos_ipp_task_transform */
254 DRM_EXYNOS_IPP_TASK_TRANSFORM
= 0x0003,
255 /* alpha configuration described by struct drm_exynos_ipp_task_alpha */
256 DRM_EXYNOS_IPP_TASK_ALPHA
= 0x0004,
258 /* source image data (for buffer and rectangle chunks) */
259 DRM_EXYNOS_IPP_TASK_TYPE_SOURCE
= 0x0001 << 16,
260 /* destination image data (for buffer and rectangle chunks) */
261 DRM_EXYNOS_IPP_TASK_TYPE_DESTINATION
= 0x0002 << 16,
265 * Memory buffer with image data.
267 * @id: must be DRM_EXYNOS_IPP_TASK_BUFFER
268 * other parameters are same as for AddFB2 generic DRM ioctl
270 struct drm_exynos_ipp_task_buffer
{
281 * Rectangle for processing.
283 * @id: must be DRM_EXYNOS_IPP_TASK_RECTANGLE
285 * @x,@y: left corner in pixels
286 * @w,@h: width/height in pixels
288 struct drm_exynos_ipp_task_rect
{
298 * Image tranformation description.
300 * @id: must be DRM_EXYNOS_IPP_TASK_TRANSFORM
301 * @rotation: DRM_MODE_ROTATE_* and DRM_MODE_REFLECT_* values
303 struct drm_exynos_ipp_task_transform
{
309 * Image global alpha configuration for formats without alpha values.
311 * @id: must be DRM_EXYNOS_IPP_TASK_ALPHA
312 * @value: global alpha value (0-255)
314 struct drm_exynos_ipp_task_alpha
{
319 enum drm_exynos_ipp_flag
{
320 /* generate DRM event after processing */
321 DRM_EXYNOS_IPP_FLAG_EVENT
= 0x01,
322 /* dry run, only check task parameters */
323 DRM_EXYNOS_IPP_FLAG_TEST_ONLY
= 0x02,
324 /* non-blocking processing */
325 DRM_EXYNOS_IPP_FLAG_NONBLOCK
= 0x04,
328 #define DRM_EXYNOS_IPP_FLAGS (DRM_EXYNOS_IPP_FLAG_EVENT |\
329 DRM_EXYNOS_IPP_FLAG_TEST_ONLY | DRM_EXYNOS_IPP_FLAG_NONBLOCK)
332 * Perform image processing described by array of drm_exynos_ipp_task_*
333 * structures (parameters array).
335 * @ipp_id: id of IPP module to run the task
336 * @flags: bitmask of drm_exynos_ipp_flag values
338 * @params_size: size of parameters array (in bytes)
339 * @params_ptr: pointer to parameters array or NULL
340 * @user_data: (optional) data for drm event
342 struct drm_exynos_ioctl_ipp_commit
{
351 #define DRM_EXYNOS_GEM_CREATE 0x00
352 #define DRM_EXYNOS_GEM_MAP 0x01
353 /* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */
354 #define DRM_EXYNOS_GEM_GET 0x04
355 #define DRM_EXYNOS_VIDI_CONNECTION 0x07
358 #define DRM_EXYNOS_G2D_GET_VER 0x20
359 #define DRM_EXYNOS_G2D_SET_CMDLIST 0x21
360 #define DRM_EXYNOS_G2D_EXEC 0x22
362 /* Reserved 0x30 ~ 0x33 for obsolete Exynos IPP ioctls */
363 /* IPP - Image Post Processing */
364 #define DRM_EXYNOS_IPP_GET_RESOURCES 0x40
365 #define DRM_EXYNOS_IPP_GET_CAPS 0x41
366 #define DRM_EXYNOS_IPP_GET_LIMITS 0x42
367 #define DRM_EXYNOS_IPP_COMMIT 0x43
369 #define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \
370 DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create)
371 #define DRM_IOCTL_EXYNOS_GEM_MAP DRM_IOWR(DRM_COMMAND_BASE + \
372 DRM_EXYNOS_GEM_MAP, struct drm_exynos_gem_map)
373 #define DRM_IOCTL_EXYNOS_GEM_GET DRM_IOWR(DRM_COMMAND_BASE + \
374 DRM_EXYNOS_GEM_GET, struct drm_exynos_gem_info)
376 #define DRM_IOCTL_EXYNOS_VIDI_CONNECTION DRM_IOWR(DRM_COMMAND_BASE + \
377 DRM_EXYNOS_VIDI_CONNECTION, struct drm_exynos_vidi_connection)
379 #define DRM_IOCTL_EXYNOS_G2D_GET_VER DRM_IOWR(DRM_COMMAND_BASE + \
380 DRM_EXYNOS_G2D_GET_VER, struct drm_exynos_g2d_get_ver)
381 #define DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST DRM_IOWR(DRM_COMMAND_BASE + \
382 DRM_EXYNOS_G2D_SET_CMDLIST, struct drm_exynos_g2d_set_cmdlist)
383 #define DRM_IOCTL_EXYNOS_G2D_EXEC DRM_IOWR(DRM_COMMAND_BASE + \
384 DRM_EXYNOS_G2D_EXEC, struct drm_exynos_g2d_exec)
386 #define DRM_IOCTL_EXYNOS_IPP_GET_RESOURCES DRM_IOWR(DRM_COMMAND_BASE + \
387 DRM_EXYNOS_IPP_GET_RESOURCES, \
388 struct drm_exynos_ioctl_ipp_get_res)
389 #define DRM_IOCTL_EXYNOS_IPP_GET_CAPS DRM_IOWR(DRM_COMMAND_BASE + \
390 DRM_EXYNOS_IPP_GET_CAPS, struct drm_exynos_ioctl_ipp_get_caps)
391 #define DRM_IOCTL_EXYNOS_IPP_GET_LIMITS DRM_IOWR(DRM_COMMAND_BASE + \
392 DRM_EXYNOS_IPP_GET_LIMITS, \
393 struct drm_exynos_ioctl_ipp_get_limits)
394 #define DRM_IOCTL_EXYNOS_IPP_COMMIT DRM_IOWR(DRM_COMMAND_BASE + \
395 DRM_EXYNOS_IPP_COMMIT, struct drm_exynos_ioctl_ipp_commit)
397 /* Exynos specific events */
398 #define DRM_EXYNOS_G2D_EVENT 0x80000000
399 #define DRM_EXYNOS_IPP_EVENT 0x80000002
401 struct drm_exynos_g2d_event
{
402 struct drm_event base
;
410 struct drm_exynos_ipp_event
{
411 struct drm_event base
;
420 #if defined(__cplusplus)
424 #endif /* _UAPI_EXYNOS_DRM_H_ */