libdrm_vigs: Fence support added
[platform/upstream/libdrm.git] / include / drm / vigs_drm.h
1 /*
2  * vigs_drm.h
3  */
4
5 /*
6  * Copyright (c) 2013 Samsung Electronics Co., Ltd.
7  * Authors:
8  * Stanislav Vorobiov <s.vorobiov@samsung.com>
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining a
11  * copy of this software and associated documentation files (the "Software"),
12  * to deal in the Software without restriction, including without limitation
13  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  * and/or sell copies of the Software, and to permit persons to whom the
15  * Software is furnished to do so, subject to the following conditions:
16  *
17  * The above copyright notice and this permission notice (including the next
18  * paragraph) shall be included in all copies or substantial portions of the
19  * Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
24  * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27  * OTHER DEALINGS IN THE SOFTWARE.
28  */
29
30 #ifndef _VIGS_DRM_H_
31 #define _VIGS_DRM_H_
32
33 /*
34  * Bump this whenever driver interface changes.
35  */
36 #define DRM_VIGS_DRIVER_VERSION 10
37
38 /*
39  * Surface access flags.
40  */
41 #define DRM_VIGS_SAF_READ 1
42 #define DRM_VIGS_SAF_WRITE 2
43 #define DRM_VIGS_SAF_MASK 3
44
45 struct drm_vigs_get_protocol_version
46 {
47     uint32_t version;
48 };
49
50 struct drm_vigs_create_surface
51 {
52     uint32_t width;
53     uint32_t height;
54     uint32_t stride;
55     uint32_t format;
56     uint32_t handle;
57     uint32_t size;
58     uint32_t id;
59 };
60
61 struct drm_vigs_create_execbuffer
62 {
63     uint32_t size;
64     uint32_t handle;
65 };
66
67 struct drm_vigs_gem_map
68 {
69     uint32_t handle;
70     int track_access;
71     unsigned long address;
72 };
73
74 struct drm_vigs_gem_wait
75 {
76     uint32_t handle;
77 };
78
79 struct drm_vigs_surface_info
80 {
81     uint32_t handle;
82     uint32_t width;
83     uint32_t height;
84     uint32_t stride;
85     uint32_t format;
86     uint32_t size;
87     uint32_t id;
88 };
89
90 struct drm_vigs_exec
91 {
92     uint32_t handle;
93 };
94
95 struct drm_vigs_surface_set_gpu_dirty
96 {
97     uint32_t handle;
98 };
99
100 struct drm_vigs_surface_start_access
101 {
102     unsigned long address;
103     uint32_t saf;
104 };
105
106 struct drm_vigs_surface_end_access
107 {
108     unsigned long address;
109     int sync;
110 };
111
112 struct drm_vigs_create_fence
113 {
114     int send;
115     uint32_t handle;
116     uint32_t seq;
117 };
118
119 struct drm_vigs_fence_wait
120 {
121     uint32_t handle;
122 };
123
124 struct drm_vigs_fence_signaled
125 {
126     uint32_t handle;
127     int signaled;
128 };
129
130 struct drm_vigs_fence_unref
131 {
132     uint32_t handle;
133 };
134
135 #define DRM_VIGS_GET_PROTOCOL_VERSION 0x00
136 #define DRM_VIGS_CREATE_SURFACE 0x01
137 #define DRM_VIGS_CREATE_EXECBUFFER 0x02
138 #define DRM_VIGS_GEM_MAP 0x03
139 #define DRM_VIGS_GEM_WAIT 0x04
140 #define DRM_VIGS_SURFACE_INFO 0x05
141 #define DRM_VIGS_EXEC 0x06
142 #define DRM_VIGS_SURFACE_SET_GPU_DIRTY 0x07
143 #define DRM_VIGS_SURFACE_START_ACCESS 0x08
144 #define DRM_VIGS_SURFACE_END_ACCESS 0x09
145 #define DRM_VIGS_CREATE_FENCE 0x0A
146 #define DRM_VIGS_FENCE_WAIT 0x0B
147 #define DRM_VIGS_FENCE_SIGNALED 0x0C
148 #define DRM_VIGS_FENCE_UNREF 0x0D
149
150 #define DRM_IOCTL_VIGS_GET_PROTOCOL_VERSION DRM_IOR(DRM_COMMAND_BASE + \
151             DRM_VIGS_GET_PROTOCOL_VERSION, struct drm_vigs_get_protocol_version)
152 #define DRM_IOCTL_VIGS_CREATE_SURFACE DRM_IOWR(DRM_COMMAND_BASE + \
153             DRM_VIGS_CREATE_SURFACE, struct drm_vigs_create_surface)
154 #define DRM_IOCTL_VIGS_CREATE_EXECBUFFER DRM_IOWR(DRM_COMMAND_BASE + \
155             DRM_VIGS_CREATE_EXECBUFFER, struct drm_vigs_create_execbuffer)
156 #define DRM_IOCTL_VIGS_GEM_MAP DRM_IOWR(DRM_COMMAND_BASE + \
157             DRM_VIGS_GEM_MAP, struct drm_vigs_gem_map)
158 #define DRM_IOCTL_VIGS_GEM_WAIT DRM_IOW(DRM_COMMAND_BASE + \
159             DRM_VIGS_GEM_WAIT, struct drm_vigs_gem_wait)
160 #define DRM_IOCTL_VIGS_SURFACE_INFO DRM_IOWR(DRM_COMMAND_BASE + \
161             DRM_VIGS_SURFACE_INFO, struct drm_vigs_surface_info)
162 #define DRM_IOCTL_VIGS_EXEC DRM_IOW(DRM_COMMAND_BASE + \
163             DRM_VIGS_EXEC, struct drm_vigs_exec)
164 #define DRM_IOCTL_VIGS_SURFACE_SET_GPU_DIRTY DRM_IOW(DRM_COMMAND_BASE + \
165             DRM_VIGS_SURFACE_SET_GPU_DIRTY, struct drm_vigs_surface_set_gpu_dirty)
166 #define DRM_IOCTL_VIGS_SURFACE_START_ACCESS DRM_IOW(DRM_COMMAND_BASE + \
167             DRM_VIGS_SURFACE_START_ACCESS, struct drm_vigs_surface_start_access)
168 #define DRM_IOCTL_VIGS_SURFACE_END_ACCESS DRM_IOW(DRM_COMMAND_BASE + \
169             DRM_VIGS_SURFACE_END_ACCESS, struct drm_vigs_surface_end_access)
170 #define DRM_IOCTL_VIGS_CREATE_FENCE DRM_IOWR(DRM_COMMAND_BASE + \
171             DRM_VIGS_CREATE_FENCE, struct drm_vigs_create_fence)
172 #define DRM_IOCTL_VIGS_FENCE_WAIT DRM_IOW(DRM_COMMAND_BASE + \
173             DRM_VIGS_FENCE_WAIT, struct drm_vigs_fence_wait)
174 #define DRM_IOCTL_VIGS_FENCE_SIGNALED DRM_IOWR(DRM_COMMAND_BASE + \
175             DRM_VIGS_FENCE_SIGNALED, struct drm_vigs_fence_signaled)
176 #define DRM_IOCTL_VIGS_FENCE_UNREF DRM_IOW(DRM_COMMAND_BASE + \
177             DRM_VIGS_FENCE_UNREF, struct drm_vigs_fence_unref)
178
179 #endif