3 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
5 * Stanislav Vorobiov <s.vorobiov@samsung.com>
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice (including the next
15 * paragraph) shall be included in all copies or substantial portions of the
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
22 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 * OTHER DEALINGS IN THE SOFTWARE.
42 vigs_drm_surface_bgrx8888 = 0x0,
43 vigs_drm_surface_bgra8888 = 0x1,
44 } vigs_drm_surface_format;
47 * Surface access flags.
49 #define VIGS_DRM_SAF_READ 1
50 #define VIGS_DRM_SAF_WRITE 2
52 struct vigs_drm_device
60 /* VIGS device object. */
61 struct vigs_drm_device *dev;
63 /* size of the buffer created. */
66 /* a gem handle to gem object created. */
69 /* a gem global handle from flink request. initially 0. */
72 /* user space address to a gem buffer mmaped. initially NULL. */
76 struct vigs_drm_surface
78 struct vigs_drm_gem gem;
87 struct vigs_drm_execbuffer
89 struct vigs_drm_gem gem;
94 /* VIGS device object. */
95 struct vigs_drm_device *dev;
97 /* a handle to fence object. */
100 /* fence sequence number. */
103 /* is fence signaled ? updated on 'vigs_drm_fence_check'. */
108 * All functions return 0 on success and < 0 on error, i.e. kernel style:
118 * Returns -EINVAL on driver version mismatch.
120 int vigs_drm_device_create(int fd, struct vigs_drm_device **dev);
122 void vigs_drm_device_destroy(struct vigs_drm_device *dev);
124 int vigs_drm_device_get_protocol_version(struct vigs_drm_device *dev,
125 uint32_t *protocol_version);
137 * Passing NULL won't hurt, this is for convenience.
139 void vigs_drm_gem_ref(struct vigs_drm_gem *gem);
142 * Passing NULL won't hurt, this is for convenience.
144 void vigs_drm_gem_unref(struct vigs_drm_gem *gem);
146 int vigs_drm_gem_get_name(struct vigs_drm_gem *gem);
148 int vigs_drm_gem_map(struct vigs_drm_gem *gem, int track_access);
150 void vigs_drm_gem_unmap(struct vigs_drm_gem *gem);
152 int vigs_drm_gem_wait(struct vigs_drm_gem *gem);
163 int vigs_drm_surface_create(struct vigs_drm_device *dev,
168 struct vigs_drm_surface **sfc);
170 int vigs_drm_surface_open(struct vigs_drm_device *dev,
172 struct vigs_drm_surface **sfc);
174 int vigs_drm_surface_set_gpu_dirty(struct vigs_drm_surface *sfc);
176 int vigs_drm_surface_start_access(struct vigs_drm_surface *sfc,
179 int vigs_drm_surface_end_access(struct vigs_drm_surface *sfc,
187 * Execbuffer functions.
191 int vigs_drm_execbuffer_create(struct vigs_drm_device *dev,
193 struct vigs_drm_execbuffer **execbuffer);
195 int vigs_drm_execbuffer_open(struct vigs_drm_device *dev,
197 struct vigs_drm_execbuffer **execbuffer);
199 int vigs_drm_execbuffer_exec(struct vigs_drm_execbuffer *execbuffer);
210 int vigs_drm_fence_create(struct vigs_drm_device *dev,
212 struct vigs_drm_fence **fence);
215 * Passing NULL won't hurt, this is for convenience.
217 void vigs_drm_fence_ref(struct vigs_drm_fence *fence);
220 * Passing NULL won't hurt, this is for convenience.
222 void vigs_drm_fence_unref(struct vigs_drm_fence *fence);
224 int vigs_drm_fence_wait(struct vigs_drm_fence *fence);
226 int vigs_drm_fence_check(struct vigs_drm_fence *fence);
234 #endif /* __cplusplus */