1d722e3fbSopenharmony_ci/* exynos_drm.h 2d722e3fbSopenharmony_ci * 3d722e3fbSopenharmony_ci * Copyright (c) 2011 Samsung Electronics Co., Ltd. 4d722e3fbSopenharmony_ci * Authors: 5d722e3fbSopenharmony_ci * Inki Dae <inki.dae@samsung.com> 6d722e3fbSopenharmony_ci * Joonyoung Shim <jy0922.shim@samsung.com> 7d722e3fbSopenharmony_ci * Seung-Woo Kim <sw0312.kim@samsung.com> 8d722e3fbSopenharmony_ci * 9d722e3fbSopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 10d722e3fbSopenharmony_ci * copy of this software and associated documentation files (the "Software"), 11d722e3fbSopenharmony_ci * to deal in the Software without restriction, including without limitation 12d722e3fbSopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 13d722e3fbSopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 14d722e3fbSopenharmony_ci * Software is furnished to do so, subject to the following conditions: 15d722e3fbSopenharmony_ci * 16d722e3fbSopenharmony_ci * The above copyright notice and this permission notice (including the next 17d722e3fbSopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 18d722e3fbSopenharmony_ci * Software. 19d722e3fbSopenharmony_ci * 20d722e3fbSopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21d722e3fbSopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22d722e3fbSopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 23d722e3fbSopenharmony_ci * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 24d722e3fbSopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 25d722e3fbSopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26d722e3fbSopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE. 27d722e3fbSopenharmony_ci */ 28d722e3fbSopenharmony_ci 29d722e3fbSopenharmony_ci#ifndef _EXYNOS_DRM_H_ 30d722e3fbSopenharmony_ci#define _EXYNOS_DRM_H_ 31d722e3fbSopenharmony_ci 32d722e3fbSopenharmony_ci#include "drm.h" 33d722e3fbSopenharmony_ci 34d722e3fbSopenharmony_ci/** 35d722e3fbSopenharmony_ci * User-desired buffer creation information structure. 36d722e3fbSopenharmony_ci * 37d722e3fbSopenharmony_ci * @size: user-desired memory allocation size. 38d722e3fbSopenharmony_ci * - this size value would be page-aligned internally. 39d722e3fbSopenharmony_ci * @flags: user request for setting memory type or cache attributes. 40d722e3fbSopenharmony_ci * @handle: returned a handle to created gem object. 41d722e3fbSopenharmony_ci * - this handle will be set by gem module of kernel side. 42d722e3fbSopenharmony_ci */ 43d722e3fbSopenharmony_cistruct drm_exynos_gem_create { 44d722e3fbSopenharmony_ci uint64_t size; 45d722e3fbSopenharmony_ci unsigned int flags; 46d722e3fbSopenharmony_ci unsigned int handle; 47d722e3fbSopenharmony_ci}; 48d722e3fbSopenharmony_ci 49d722e3fbSopenharmony_ci/** 50d722e3fbSopenharmony_ci * A structure to gem information. 51d722e3fbSopenharmony_ci * 52d722e3fbSopenharmony_ci * @handle: a handle to gem object created. 53d722e3fbSopenharmony_ci * @flags: flag value including memory type and cache attribute and 54d722e3fbSopenharmony_ci * this value would be set by driver. 55d722e3fbSopenharmony_ci * @size: size to memory region allocated by gem and this size would 56d722e3fbSopenharmony_ci * be set by driver. 57d722e3fbSopenharmony_ci */ 58d722e3fbSopenharmony_cistruct drm_exynos_gem_info { 59d722e3fbSopenharmony_ci unsigned int handle; 60d722e3fbSopenharmony_ci unsigned int flags; 61d722e3fbSopenharmony_ci uint64_t size; 62d722e3fbSopenharmony_ci}; 63d722e3fbSopenharmony_ci 64d722e3fbSopenharmony_ci/** 65d722e3fbSopenharmony_ci * A structure for user connection request of virtual display. 66d722e3fbSopenharmony_ci * 67d722e3fbSopenharmony_ci * @connection: indicate whether doing connection or not by user. 68d722e3fbSopenharmony_ci * @extensions: if this value is 1 then the vidi driver would need additional 69d722e3fbSopenharmony_ci * 128bytes edid data. 70d722e3fbSopenharmony_ci * @edid: the edid data pointer from user side. 71d722e3fbSopenharmony_ci */ 72d722e3fbSopenharmony_cistruct drm_exynos_vidi_connection { 73d722e3fbSopenharmony_ci unsigned int connection; 74d722e3fbSopenharmony_ci unsigned int extensions; 75d722e3fbSopenharmony_ci uint64_t edid; 76d722e3fbSopenharmony_ci}; 77d722e3fbSopenharmony_ci 78d722e3fbSopenharmony_ci/* memory type definitions. */ 79d722e3fbSopenharmony_cienum e_drm_exynos_gem_mem_type { 80d722e3fbSopenharmony_ci /* Physically Continuous memory and used as default. */ 81d722e3fbSopenharmony_ci EXYNOS_BO_CONTIG = 0 << 0, 82d722e3fbSopenharmony_ci /* Physically Non-Continuous memory. */ 83d722e3fbSopenharmony_ci EXYNOS_BO_NONCONTIG = 1 << 0, 84d722e3fbSopenharmony_ci /* non-cachable mapping and used as default. */ 85d722e3fbSopenharmony_ci EXYNOS_BO_NONCACHABLE = 0 << 1, 86d722e3fbSopenharmony_ci /* cachable mapping. */ 87d722e3fbSopenharmony_ci EXYNOS_BO_CACHABLE = 1 << 1, 88d722e3fbSopenharmony_ci /* write-combine mapping. */ 89d722e3fbSopenharmony_ci EXYNOS_BO_WC = 1 << 2, 90d722e3fbSopenharmony_ci EXYNOS_BO_MASK = EXYNOS_BO_NONCONTIG | EXYNOS_BO_CACHABLE | 91d722e3fbSopenharmony_ci EXYNOS_BO_WC 92d722e3fbSopenharmony_ci}; 93d722e3fbSopenharmony_ci 94d722e3fbSopenharmony_cistruct drm_exynos_g2d_get_ver { 95d722e3fbSopenharmony_ci __u32 major; 96d722e3fbSopenharmony_ci __u32 minor; 97d722e3fbSopenharmony_ci}; 98d722e3fbSopenharmony_ci 99d722e3fbSopenharmony_cistruct drm_exynos_g2d_cmd { 100d722e3fbSopenharmony_ci __u32 offset; 101d722e3fbSopenharmony_ci __u32 data; 102d722e3fbSopenharmony_ci}; 103d722e3fbSopenharmony_ci 104d722e3fbSopenharmony_cienum drm_exynos_g2d_buf_type { 105d722e3fbSopenharmony_ci G2D_BUF_USERPTR = 1 << 31, 106d722e3fbSopenharmony_ci}; 107d722e3fbSopenharmony_ci 108d722e3fbSopenharmony_cienum drm_exynos_g2d_event_type { 109d722e3fbSopenharmony_ci G2D_EVENT_NOT, 110d722e3fbSopenharmony_ci G2D_EVENT_NONSTOP, 111d722e3fbSopenharmony_ci G2D_EVENT_STOP, /* not yet */ 112d722e3fbSopenharmony_ci}; 113d722e3fbSopenharmony_ci 114d722e3fbSopenharmony_cistruct drm_exynos_g2d_userptr { 115d722e3fbSopenharmony_ci unsigned long userptr; 116d722e3fbSopenharmony_ci unsigned long size; 117d722e3fbSopenharmony_ci}; 118d722e3fbSopenharmony_ci 119d722e3fbSopenharmony_cistruct drm_exynos_g2d_set_cmdlist { 120d722e3fbSopenharmony_ci __u64 cmd; 121d722e3fbSopenharmony_ci __u64 cmd_buf; 122d722e3fbSopenharmony_ci __u32 cmd_nr; 123d722e3fbSopenharmony_ci __u32 cmd_buf_nr; 124d722e3fbSopenharmony_ci 125d722e3fbSopenharmony_ci /* for g2d event */ 126d722e3fbSopenharmony_ci __u64 event_type; 127d722e3fbSopenharmony_ci __u64 user_data; 128d722e3fbSopenharmony_ci}; 129d722e3fbSopenharmony_ci 130d722e3fbSopenharmony_cistruct drm_exynos_g2d_exec { 131d722e3fbSopenharmony_ci __u64 async; 132d722e3fbSopenharmony_ci}; 133d722e3fbSopenharmony_ci 134d722e3fbSopenharmony_ci#define DRM_EXYNOS_GEM_CREATE 0x00 135d722e3fbSopenharmony_ci/* Reserved 0x04 ~ 0x05 for exynos specific gem ioctl */ 136d722e3fbSopenharmony_ci#define DRM_EXYNOS_GEM_GET 0x04 137d722e3fbSopenharmony_ci#define DRM_EXYNOS_VIDI_CONNECTION 0x07 138d722e3fbSopenharmony_ci 139d722e3fbSopenharmony_ci/* G2D */ 140d722e3fbSopenharmony_ci#define DRM_EXYNOS_G2D_GET_VER 0x20 141d722e3fbSopenharmony_ci#define DRM_EXYNOS_G2D_SET_CMDLIST 0x21 142d722e3fbSopenharmony_ci#define DRM_EXYNOS_G2D_EXEC 0x22 143d722e3fbSopenharmony_ci 144d722e3fbSopenharmony_ci#define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \ 145d722e3fbSopenharmony_ci DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create) 146d722e3fbSopenharmony_ci 147d722e3fbSopenharmony_ci#define DRM_IOCTL_EXYNOS_GEM_GET DRM_IOWR(DRM_COMMAND_BASE + \ 148d722e3fbSopenharmony_ci DRM_EXYNOS_GEM_GET, struct drm_exynos_gem_info) 149d722e3fbSopenharmony_ci 150d722e3fbSopenharmony_ci#define DRM_IOCTL_EXYNOS_VIDI_CONNECTION DRM_IOWR(DRM_COMMAND_BASE + \ 151d722e3fbSopenharmony_ci DRM_EXYNOS_VIDI_CONNECTION, struct drm_exynos_vidi_connection) 152d722e3fbSopenharmony_ci 153d722e3fbSopenharmony_ci#define DRM_IOCTL_EXYNOS_G2D_GET_VER DRM_IOWR(DRM_COMMAND_BASE + \ 154d722e3fbSopenharmony_ci DRM_EXYNOS_G2D_GET_VER, struct drm_exynos_g2d_get_ver) 155d722e3fbSopenharmony_ci#define DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST DRM_IOWR(DRM_COMMAND_BASE + \ 156d722e3fbSopenharmony_ci DRM_EXYNOS_G2D_SET_CMDLIST, struct drm_exynos_g2d_set_cmdlist) 157d722e3fbSopenharmony_ci#define DRM_IOCTL_EXYNOS_G2D_EXEC DRM_IOWR(DRM_COMMAND_BASE + \ 158d722e3fbSopenharmony_ci DRM_EXYNOS_G2D_EXEC, struct drm_exynos_g2d_exec) 159d722e3fbSopenharmony_ci 160d722e3fbSopenharmony_ci/* EXYNOS specific events */ 161d722e3fbSopenharmony_ci#define DRM_EXYNOS_G2D_EVENT 0x80000000 162d722e3fbSopenharmony_ci 163d722e3fbSopenharmony_cistruct drm_exynos_g2d_event { 164d722e3fbSopenharmony_ci struct drm_event base; 165d722e3fbSopenharmony_ci __u64 user_data; 166d722e3fbSopenharmony_ci __u32 tv_sec; 167d722e3fbSopenharmony_ci __u32 tv_usec; 168d722e3fbSopenharmony_ci __u32 cmdlist_no; 169d722e3fbSopenharmony_ci __u32 reserved; 170d722e3fbSopenharmony_ci}; 171d722e3fbSopenharmony_ci 172d722e3fbSopenharmony_ci#endif 173