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;
93 * All functions return 0 on success and < 0 on error, i.e. kernel style:
103 * Returns -EINVAL on driver version mismatch.
105 int vigs_drm_device_create(int fd, struct vigs_drm_device **dev);
107 void vigs_drm_device_destroy(struct vigs_drm_device *dev);
109 int vigs_drm_device_get_protocol_version(struct vigs_drm_device *dev,
110 uint32_t *protocol_version);
122 * Passing NULL won't hurt, this is for convenience.
124 void vigs_drm_gem_ref(struct vigs_drm_gem *gem);
127 * Passing NULL won't hurt, this is for convenience.
129 void vigs_drm_gem_unref(struct vigs_drm_gem *gem);
131 int vigs_drm_gem_get_name(struct vigs_drm_gem *gem);
133 int vigs_drm_gem_map(struct vigs_drm_gem *gem, int track_access);
135 void vigs_drm_gem_unmap(struct vigs_drm_gem *gem);
146 int vigs_drm_surface_create(struct vigs_drm_device *dev,
151 struct vigs_drm_surface **sfc);
153 int vigs_drm_surface_open(struct vigs_drm_device *dev,
155 struct vigs_drm_surface **sfc);
157 int vigs_drm_surface_set_gpu_dirty(struct vigs_drm_surface *sfc);
159 int vigs_drm_surface_start_access(struct vigs_drm_surface *sfc,
162 int vigs_drm_surface_end_access(struct vigs_drm_surface *sfc,
170 * Execbuffer functions.
174 int vigs_drm_execbuffer_create(struct vigs_drm_device *dev,
176 struct vigs_drm_execbuffer **execbuffer);
178 int vigs_drm_execbuffer_open(struct vigs_drm_device *dev,
180 struct vigs_drm_execbuffer **execbuffer);
182 int vigs_drm_execbuffer_exec(struct vigs_drm_execbuffer *execbuffer);
190 #endif /* __cplusplus */