drm/rockchip: vop: support afbdc
[firefly-linux-kernel-4.4.55.git] / include / uapi / drm / rockchip_drm.h
1 /*
2  *
3  * Copyright (c) Fuzhou Rockchip Electronics Co.Ltd
4  * Authors:
5  *       Mark Yao <yzq@rock-chips.com>
6  *
7  * base on exynos_drm.h
8  *
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.
13  */
14
15 #ifndef _UAPI_ROCKCHIP_DRM_H
16 #define _UAPI_ROCKCHIP_DRM_H
17
18 #include <drm/drm.h>
19
20 /**
21  * User-desired buffer creation information structure.
22  *
23  * @size: user-desired memory allocation size.
24  * @flags: user request for setting memory type or cache attributes.
25  * @handle: returned a handle to created gem object.
26  *     - this handle will be set by gem module of kernel side.
27  */
28 struct drm_rockchip_gem_create {
29         uint64_t size;
30         uint32_t flags;
31         uint32_t handle;
32 };
33
34 /**
35  * A structure for getting buffer offset.
36  *
37  * @handle: a pointer to gem object created.
38  * @pad: just padding to be 64-bit aligned.
39  * @offset: relatived offset value of the memory region allocated.
40  *     - this value should be set by user.
41  */
42 struct drm_rockchip_gem_map_off {
43         uint32_t handle;
44         uint32_t pad;
45         uint64_t offset;
46 };
47
48 /* acquire type definitions. */
49 enum drm_rockchip_gem_cpu_acquire_type {
50         DRM_ROCKCHIP_GEM_CPU_ACQUIRE_SHARED = 0x0,
51         DRM_ROCKCHIP_GEM_CPU_ACQUIRE_EXCLUSIVE = 0x1,
52 };
53
54 /**
55  * A structure for acquiring buffer for CPU access.
56  *
57  * @handle: a handle to gem object created.
58  * @flags: acquire flag
59  */
60 struct drm_rockchip_gem_cpu_acquire {
61         uint32_t handle;
62         uint32_t flags;
63 };
64
65 /*
66  * A structure for releasing buffer for GPU access.
67  *
68  * @handle: a handle to gem object created.
69  */
70 struct drm_rockchip_gem_cpu_release {
71         uint32_t handle;
72 };
73
74 struct drm_rockchip_rga_get_ver {
75         __u32   major;
76         __u32   minor;
77 };
78
79 struct drm_rockchip_rga_cmd {
80         __u32   offset;
81         __u32   data;
82 };
83
84 enum drm_rockchip_rga_buf_type {
85         RGA_BUF_TYPE_USERPTR = 1 << 31,
86         RGA_BUF_TYPE_GEMFD   = 1 << 30,
87 };
88
89 struct drm_rockchip_rga_set_cmdlist {
90         __u64           cmd;
91         __u64           cmd_buf;
92         __u32           cmd_nr;
93         __u32           cmd_buf_nr;
94         __u64           user_data;
95 };
96
97 struct drm_rockchip_rga_exec {
98         __u64           async;
99 };
100
101 enum rockchip_plane_feture {
102         ROCKCHIP_DRM_PLANE_FEATURE_SCALE,
103         ROCKCHIP_DRM_PLANE_FEATURE_ALPHA,
104         ROCKCHIP_DRM_PLANE_FEATURE_MAX,
105 };
106
107 enum rockchip_crtc_feture {
108         ROCKCHIP_DRM_CRTC_FEATURE_AFBDC,
109 };
110
111 #define DRM_ROCKCHIP_GEM_CREATE         0x00
112 #define DRM_ROCKCHIP_GEM_MAP_OFFSET     0x01
113 #define DRM_ROCKCHIP_GEM_CPU_ACQUIRE    0x02
114 #define DRM_ROCKCHIP_GEM_CPU_RELEASE    0x03
115
116 #define DRM_ROCKCHIP_RGA_GET_VER        0x20
117 #define DRM_ROCKCHIP_RGA_SET_CMDLIST    0x21
118 #define DRM_ROCKCHIP_RGA_EXEC           0x22
119
120 #define DRM_IOCTL_ROCKCHIP_GEM_CREATE   DRM_IOWR(DRM_COMMAND_BASE + \
121                 DRM_ROCKCHIP_GEM_CREATE, struct drm_rockchip_gem_create)
122
123 #define DRM_IOCTL_ROCKCHIP_GEM_MAP_OFFSET       DRM_IOWR(DRM_COMMAND_BASE + \
124                 DRM_ROCKCHIP_GEM_MAP_OFFSET, struct drm_rockchip_gem_map_off)
125
126 #define DRM_IOCTL_ROCKCHIP_GEM_CPU_ACQUIRE      DRM_IOWR(DRM_COMMAND_BASE + \
127                 DRM_ROCKCHIP_GEM_CPU_ACQUIRE, struct drm_rockchip_gem_cpu_acquire)
128
129 #define DRM_IOCTL_ROCKCHIP_GEM_CPU_RELEASE      DRM_IOWR(DRM_COMMAND_BASE + \
130                 DRM_ROCKCHIP_GEM_CPU_RELEASE, struct drm_rockchip_gem_cpu_release)
131
132 #define DRM_IOCTL_ROCKCHIP_RGA_GET_VER          DRM_IOWR(DRM_COMMAND_BASE + \
133                 DRM_ROCKCHIP_RGA_GET_VER, struct drm_rockchip_rga_get_ver)
134
135 #define DRM_IOCTL_ROCKCHIP_RGA_SET_CMDLIST      DRM_IOWR(DRM_COMMAND_BASE + \
136                 DRM_ROCKCHIP_RGA_SET_CMDLIST, struct drm_rockchip_rga_set_cmdlist)
137
138 #define DRM_IOCTL_ROCKCHIP_RGA_EXEC             DRM_IOWR(DRM_COMMAND_BASE + \
139                 DRM_ROCKCHIP_RGA_EXEC, struct drm_rockchip_rga_exec)
140
141 #endif /* _UAPI_ROCKCHIP_DRM_H */