/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */1/* exynos_drm.h2*3* Copyright (c) 2011 Samsung Electronics Co., Ltd.4* Authors:5* Inki Dae <[email protected]>6* Joonyoung Shim <[email protected]>7* Seung-Woo Kim <[email protected]>8*9* This program is free software; you can redistribute it and/or modify it10* under the terms of the GNU General Public License as published by the11* Free Software Foundation; either version 2 of the License, or (at your12* option) any later version.13*/1415#ifndef _UAPI_EXYNOS_DRM_H_16#define _UAPI_EXYNOS_DRM_H_1718#include "drm.h"1920#if defined(__cplusplus)21extern "C" {22#endif2324/**25* User-desired buffer creation information structure.26*27* @size: user-desired memory allocation size.28* - this size value would be page-aligned internally.29* @flags: user request for setting memory type or cache attributes.30* @handle: returned a handle to created gem object.31* - this handle will be set by gem module of kernel side.32*/33struct drm_exynos_gem_create {34__u64 size;35__u32 flags;36__u32 handle;37};3839/**40* A structure for getting a fake-offset that can be used with mmap.41*42* @handle: handle of gem object.43* @reserved: just padding to be 64-bit aligned.44* @offset: a fake-offset of gem object.45*/46struct drm_exynos_gem_map {47__u32 handle;48__u32 reserved;49__u64 offset;50};5152/**53* A structure to gem information.54*55* @handle: a handle to gem object created.56* @flags: flag value including memory type and cache attribute and57* this value would be set by driver.58* @size: size to memory region allocated by gem and this size would59* be set by driver.60*/61struct drm_exynos_gem_info {62__u32 handle;63__u32 flags;64__u64 size;65};6667/**68* A structure for user connection request of virtual display.69*70* @connection: indicate whether doing connection or not by user.71* @extensions: if this value is 1 then the vidi driver would need additional72* 128bytes edid data.73* @edid: the edid data pointer from user side.74*/75struct drm_exynos_vidi_connection {76__u32 connection;77__u32 extensions;78__u64 edid;79};8081/* memory type definitions. */82enum e_drm_exynos_gem_mem_type {83/* Physically Continuous memory and used as default. */84EXYNOS_BO_CONTIG = 0 << 0,85/* Physically Non-Continuous memory. */86EXYNOS_BO_NONCONTIG = 1 << 0,87/* non-cachable mapping and used as default. */88EXYNOS_BO_NONCACHABLE = 0 << 1,89/* cachable mapping. */90EXYNOS_BO_CACHABLE = 1 << 1,91/* write-combine mapping. */92EXYNOS_BO_WC = 1 << 2,93EXYNOS_BO_MASK = EXYNOS_BO_NONCONTIG | EXYNOS_BO_CACHABLE |94EXYNOS_BO_WC95};9697struct drm_exynos_g2d_get_ver {98__u32 major;99__u32 minor;100};101102struct drm_exynos_g2d_cmd {103__u32 offset;104__u32 data;105};106107enum drm_exynos_g2d_buf_type {108G2D_BUF_USERPTR = 1 << 31,109};110111enum drm_exynos_g2d_event_type {112G2D_EVENT_NOT,113G2D_EVENT_NONSTOP,114G2D_EVENT_STOP, /* not yet */115};116117struct drm_exynos_g2d_userptr {118unsigned long userptr;119unsigned long size;120};121122struct drm_exynos_g2d_set_cmdlist {123__u64 cmd;124__u64 cmd_buf;125__u32 cmd_nr;126__u32 cmd_buf_nr;127128/* for g2d event */129__u64 event_type;130__u64 user_data;131};132133struct drm_exynos_g2d_exec {134__u64 async;135};136137/* Exynos DRM IPP v2 API */138139/**140* Enumerate available IPP hardware modules.141*142* @count_ipps: size of ipp_id array / number of ipp modules (set by driver)143* @reserved: padding144* @ipp_id_ptr: pointer to ipp_id array or NULL145*/146struct drm_exynos_ioctl_ipp_get_res {147__u32 count_ipps;148__u32 reserved;149__u64 ipp_id_ptr;150};151152enum drm_exynos_ipp_format_type {153DRM_EXYNOS_IPP_FORMAT_SOURCE = 0x01,154DRM_EXYNOS_IPP_FORMAT_DESTINATION = 0x02,155};156157struct drm_exynos_ipp_format {158__u32 fourcc;159__u32 type;160__u64 modifier;161};162163enum drm_exynos_ipp_capability {164DRM_EXYNOS_IPP_CAP_CROP = 0x01,165DRM_EXYNOS_IPP_CAP_ROTATE = 0x02,166DRM_EXYNOS_IPP_CAP_SCALE = 0x04,167DRM_EXYNOS_IPP_CAP_CONVERT = 0x08,168};169170/**171* Get IPP hardware capabilities and supported image formats.172*173* @ipp_id: id of IPP module to query174* @capabilities: bitmask of drm_exynos_ipp_capability (set by driver)175* @reserved: padding176* @formats_count: size of formats array (in entries) / number of filled177* formats (set by driver)178* @formats_ptr: pointer to formats array or NULL179*/180struct drm_exynos_ioctl_ipp_get_caps {181__u32 ipp_id;182__u32 capabilities;183__u32 reserved;184__u32 formats_count;185__u64 formats_ptr;186};187188enum drm_exynos_ipp_limit_type {189/* size (horizontal/vertial) limits, in pixels (min, max, alignment) */190DRM_EXYNOS_IPP_LIMIT_TYPE_SIZE = 0x0001,191/* scale ratio (horizonta/vertial), 16.16 fixed point (min, max) */192DRM_EXYNOS_IPP_LIMIT_TYPE_SCALE = 0x0002,193194/* image buffer area */195DRM_EXYNOS_IPP_LIMIT_SIZE_BUFFER = 0x0001 << 16,196/* src/dst rectangle area */197DRM_EXYNOS_IPP_LIMIT_SIZE_AREA = 0x0002 << 16,198/* src/dst rectangle area when rotation enabled */199DRM_EXYNOS_IPP_LIMIT_SIZE_ROTATED = 0x0003 << 16,200201DRM_EXYNOS_IPP_LIMIT_TYPE_MASK = 0x000f,202DRM_EXYNOS_IPP_LIMIT_SIZE_MASK = 0x000f << 16,203};204205struct drm_exynos_ipp_limit_val {206__u32 min;207__u32 max;208__u32 align;209__u32 reserved;210};211212/**213* IPP module limitation.214*215* @type: limit type (see drm_exynos_ipp_limit_type enum)216* @reserved: padding217* @h: horizontal limits218* @v: vertical limits219*/220struct drm_exynos_ipp_limit {221__u32 type;222__u32 reserved;223struct drm_exynos_ipp_limit_val h;224struct drm_exynos_ipp_limit_val v;225};226227/**228* Get IPP limits for given image format.229*230* @ipp_id: id of IPP module to query231* @fourcc: image format code (see DRM_FORMAT_* in drm_fourcc.h)232* @modifier: image format modifier (see DRM_FORMAT_MOD_* in drm_fourcc.h)233* @type: source/destination identifier (drm_exynos_ipp_format_flag enum)234* @limits_count: size of limits array (in entries) / number of filled entries235* (set by driver)236* @limits_ptr: pointer to limits array or NULL237*/238struct drm_exynos_ioctl_ipp_get_limits {239__u32 ipp_id;240__u32 fourcc;241__u64 modifier;242__u32 type;243__u32 limits_count;244__u64 limits_ptr;245};246247enum drm_exynos_ipp_task_id {248/* buffer described by struct drm_exynos_ipp_task_buffer */249DRM_EXYNOS_IPP_TASK_BUFFER = 0x0001,250/* rectangle described by struct drm_exynos_ipp_task_rect */251DRM_EXYNOS_IPP_TASK_RECTANGLE = 0x0002,252/* transformation described by struct drm_exynos_ipp_task_transform */253DRM_EXYNOS_IPP_TASK_TRANSFORM = 0x0003,254/* alpha configuration described by struct drm_exynos_ipp_task_alpha */255DRM_EXYNOS_IPP_TASK_ALPHA = 0x0004,256257/* source image data (for buffer and rectangle chunks) */258DRM_EXYNOS_IPP_TASK_TYPE_SOURCE = 0x0001 << 16,259/* destination image data (for buffer and rectangle chunks) */260DRM_EXYNOS_IPP_TASK_TYPE_DESTINATION = 0x0002 << 16,261};262263/**264* Memory buffer with image data.265*266* @id: must be DRM_EXYNOS_IPP_TASK_BUFFER267* other parameters are same as for AddFB2 generic DRM ioctl268*/269struct drm_exynos_ipp_task_buffer {270__u32 id;271__u32 fourcc;272__u32 width, height;273__u32 gem_id[4];274__u32 offset[4];275__u32 pitch[4];276__u64 modifier;277};278279/**280* Rectangle for processing.281*282* @id: must be DRM_EXYNOS_IPP_TASK_RECTANGLE283* @reserved: padding284* @x,@y: left corner in pixels285* @w,@h: width/height in pixels286*/287struct drm_exynos_ipp_task_rect {288__u32 id;289__u32 reserved;290__u32 x;291__u32 y;292__u32 w;293__u32 h;294};295296/**297* Image tranformation description.298*299* @id: must be DRM_EXYNOS_IPP_TASK_TRANSFORM300* @rotation: DRM_MODE_ROTATE_* and DRM_MODE_REFLECT_* values301*/302struct drm_exynos_ipp_task_transform {303__u32 id;304__u32 rotation;305};306307/**308* Image global alpha configuration for formats without alpha values.309*310* @id: must be DRM_EXYNOS_IPP_TASK_ALPHA311* @value: global alpha value (0-255)312*/313struct drm_exynos_ipp_task_alpha {314__u32 id;315__u32 value;316};317318enum drm_exynos_ipp_flag {319/* generate DRM event after processing */320DRM_EXYNOS_IPP_FLAG_EVENT = 0x01,321/* dry run, only check task parameters */322DRM_EXYNOS_IPP_FLAG_TEST_ONLY = 0x02,323/* non-blocking processing */324DRM_EXYNOS_IPP_FLAG_NONBLOCK = 0x04,325};326327#define DRM_EXYNOS_IPP_FLAGS (DRM_EXYNOS_IPP_FLAG_EVENT |\328DRM_EXYNOS_IPP_FLAG_TEST_ONLY | DRM_EXYNOS_IPP_FLAG_NONBLOCK)329330/**331* Perform image processing described by array of drm_exynos_ipp_task_*332* structures (parameters array).333*334* @ipp_id: id of IPP module to run the task335* @flags: bitmask of drm_exynos_ipp_flag values336* @reserved: padding337* @params_size: size of parameters array (in bytes)338* @params_ptr: pointer to parameters array or NULL339* @user_data: (optional) data for drm event340*/341struct drm_exynos_ioctl_ipp_commit {342__u32 ipp_id;343__u32 flags;344__u32 reserved;345__u32 params_size;346__u64 params_ptr;347__u64 user_data;348};349350#define DRM_EXYNOS_GEM_CREATE 0x00351#define DRM_EXYNOS_GEM_MAP 0x01352/* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */353#define DRM_EXYNOS_GEM_GET 0x04354#define DRM_EXYNOS_VIDI_CONNECTION 0x07355356/* G2D */357#define DRM_EXYNOS_G2D_GET_VER 0x20358#define DRM_EXYNOS_G2D_SET_CMDLIST 0x21359#define DRM_EXYNOS_G2D_EXEC 0x22360361/* Reserved 0x30 ~ 0x33 for obsolete Exynos IPP ioctls */362/* IPP - Image Post Processing */363#define DRM_EXYNOS_IPP_GET_RESOURCES 0x40364#define DRM_EXYNOS_IPP_GET_CAPS 0x41365#define DRM_EXYNOS_IPP_GET_LIMITS 0x42366#define DRM_EXYNOS_IPP_COMMIT 0x43367368#define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \369DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create)370#define DRM_IOCTL_EXYNOS_GEM_MAP DRM_IOWR(DRM_COMMAND_BASE + \371DRM_EXYNOS_GEM_MAP, struct drm_exynos_gem_map)372#define DRM_IOCTL_EXYNOS_GEM_GET DRM_IOWR(DRM_COMMAND_BASE + \373DRM_EXYNOS_GEM_GET, struct drm_exynos_gem_info)374375#define DRM_IOCTL_EXYNOS_VIDI_CONNECTION DRM_IOWR(DRM_COMMAND_BASE + \376DRM_EXYNOS_VIDI_CONNECTION, struct drm_exynos_vidi_connection)377378#define DRM_IOCTL_EXYNOS_G2D_GET_VER DRM_IOWR(DRM_COMMAND_BASE + \379DRM_EXYNOS_G2D_GET_VER, struct drm_exynos_g2d_get_ver)380#define DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST DRM_IOWR(DRM_COMMAND_BASE + \381DRM_EXYNOS_G2D_SET_CMDLIST, struct drm_exynos_g2d_set_cmdlist)382#define DRM_IOCTL_EXYNOS_G2D_EXEC DRM_IOWR(DRM_COMMAND_BASE + \383DRM_EXYNOS_G2D_EXEC, struct drm_exynos_g2d_exec)384385#define DRM_IOCTL_EXYNOS_IPP_GET_RESOURCES DRM_IOWR(DRM_COMMAND_BASE + \386DRM_EXYNOS_IPP_GET_RESOURCES, \387struct drm_exynos_ioctl_ipp_get_res)388#define DRM_IOCTL_EXYNOS_IPP_GET_CAPS DRM_IOWR(DRM_COMMAND_BASE + \389DRM_EXYNOS_IPP_GET_CAPS, struct drm_exynos_ioctl_ipp_get_caps)390#define DRM_IOCTL_EXYNOS_IPP_GET_LIMITS DRM_IOWR(DRM_COMMAND_BASE + \391DRM_EXYNOS_IPP_GET_LIMITS, \392struct drm_exynos_ioctl_ipp_get_limits)393#define DRM_IOCTL_EXYNOS_IPP_COMMIT DRM_IOWR(DRM_COMMAND_BASE + \394DRM_EXYNOS_IPP_COMMIT, struct drm_exynos_ioctl_ipp_commit)395396/* Exynos specific events */397#define DRM_EXYNOS_G2D_EVENT 0x80000000398#define DRM_EXYNOS_IPP_EVENT 0x80000002399400struct drm_exynos_g2d_event {401struct drm_event base;402__u64 user_data;403__u32 tv_sec;404__u32 tv_usec;405__u32 cmdlist_no;406__u32 reserved;407};408409struct drm_exynos_ipp_event {410struct drm_event base;411__u64 user_data;412__u32 tv_sec;413__u32 tv_usec;414__u32 ipp_id;415__u32 sequence;416__u64 reserved;417};418419#if defined(__cplusplus)420}421#endif422423#endif /* _UAPI_EXYNOS_DRM_H_ */424425426