xref: /OK3568_Linux_fs/external/security/librkcrypto/third_party/libdrm/include/rockchip_drm.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright (c) Fuzhou Rockchip Electronics Co.Ltd
3  * Authors:
4  *       Mark Yao <yzq@rock-chips.com>
5  *
6  * based on exynos_drm.h
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a
9  * copy of this software and associated documentation files (the "Software"),
10  * to deal in the Software without restriction, including without limitation
11  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12  * and/or sell copies of the Software, and to permit persons to whom the
13  * Software is furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice (including the next
16  * paragraph) shall be included in all copies or substantial portions of the
17  * Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
22  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25  * SOFTWARE.
26  *
27  */
28 
29 #ifndef _ROCKCHIP_DRM_H_
30 #define _ROCKCHIP_DRM_H_
31 
32 #include <stdint.h>
33 #include "drm.h"
34 
35 /**
36  * User-desired buffer creation information structure.
37  *
38  * @size: user-desired memory allocation size.
39  *	- this size value would be page-aligned internally.
40  * @flags: user request for setting memory type or cache attributes.
41  * @handle: returned a handle to created gem object.
42  *	- this handle will be set by gem module of kernel side.
43  */
44 struct drm_rockchip_gem_create {
45 	uint64_t size;
46 	uint32_t flags;
47 	uint32_t handle;
48 };
49 
50 /**
51  * A structure for getting buffer offset.
52  *
53  * @handle: a pointer to gem object created.
54  * @pad: just padding to be 64-bit aligned.
55  * @offset: relatived offset value of the memory region allocated.
56  *	- this value should be set by user.
57  */
58 struct drm_rockchip_gem_map_off {
59 	uint32_t handle;
60 	uint32_t pad;
61 	uint64_t offset;
62 };
63 
64 struct drm_rockchip_rga_get_ver {
65 	__u32   major;
66 	__u32   minor;
67 };
68 
69 struct drm_rockchip_rga_cmd {
70 	__u32   offset;
71 	__u32   data;
72 };
73 
74 enum drm_rockchip_rga_buf_type {
75 	RGA_BUF_TYPE_USERPTR = 1 << 31,
76 	RGA_BUF_TYPE_GEMFD   = 1 << 30,
77 };
78 
79 struct drm_rockchip_rga_userptr {
80 	unsigned long userptr;
81 	unsigned long size;
82 };
83 
84 struct drm_rockchip_rga_set_cmdlist {
85 	__u64		cmd;
86 	__u64		cmd_buf;
87 	__u32		cmd_nr;
88 	__u32		cmd_buf_nr;
89 	__u64		user_data;
90 };
91 
92 struct drm_rockchip_rga_exec {
93 	__u64		async;
94 };
95 
96 #define DRM_ROCKCHIP_GEM_CREATE	0x00
97 #define DRM_ROCKCHIP_GEM_MAP_OFFSET	0x01
98 #define DRM_ROCKCHIP_RGA_GET_VER		0x20
99 #define DRM_ROCKCHIP_RGA_SET_CMDLIST		0x21
100 #define DRM_ROCKCHIP_RGA_EXEC			0x22
101 
102 #define DRM_IOCTL_ROCKCHIP_RGA_GET_VER		DRM_IOWR(DRM_COMMAND_BASE + \
103 		DRM_ROCKCHIP_RGA_GET_VER, struct drm_rockchip_rga_get_ver)
104 
105 #define DRM_IOCTL_ROCKCHIP_RGA_SET_CMDLIST	DRM_IOWR(DRM_COMMAND_BASE + \
106 		DRM_ROCKCHIP_RGA_SET_CMDLIST, struct drm_rockchip_rga_set_cmdlist)
107 
108 #define DRM_IOCTL_ROCKCHIP_RGA_EXEC		DRM_IOWR(DRM_COMMAND_BASE + \
109 		DRM_ROCKCHIP_RGA_EXEC, struct drm_rockchip_rga_exec)
110 
111 #define DRM_IOCTL_ROCKCHIP_GEM_CREATE		DRM_IOWR(DRM_COMMAND_BASE + \
112 		DRM_ROCKCHIP_GEM_CREATE, struct drm_rockchip_gem_create)
113 
114 #define DRM_IOCTL_ROCKCHIP_GEM_MAP_OFFSET	DRM_IOWR(DRM_COMMAND_BASE + \
115 		DRM_ROCKCHIP_GEM_MAP_OFFSET, struct drm_rockchip_gem_map_off)
116 
117 #endif
118