freedreno: do not leak drmVersion
[platform/upstream/libdrm.git] / exynos / exynos_drmif.h
1 /*
2  * Copyright (C) 2012 Samsung Electronics Co., Ltd.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21  * SOFTWARE.
22  *
23  * Authors:
24  *    Inki Dae <inki.dae@samsung.com>
25  */
26
27 #ifndef EXYNOS_DRMIF_H_
28 #define EXYNOS_DRMIF_H_
29
30 #include <xf86drm.h>
31 #include <stdint.h>
32 #include "exynos_drm.h"
33
34 struct exynos_device {
35         int fd;
36 };
37
38 /*
39  * Exynos Buffer Object structure.
40  *
41  * @dev: exynos device object allocated.
42  * @handle: a gem handle to gem object created.
43  * @flags: indicate memory allocation and cache attribute types.
44  * @fd: file descriptor exported into dmabuf.
45  * @size: size to the buffer created.
46  * @vaddr: user space address to a gem buffer mmaped.
47  * @name: a gem global handle from flink request.
48  */
49 struct exynos_bo {
50         struct exynos_device    *dev;
51         uint32_t                handle;
52         uint32_t                flags;
53         int                     fd;
54         size_t                  size;
55         void                    *vaddr;
56         uint32_t                name;
57 };
58
59 /*
60  * device related functions:
61  */
62 struct exynos_device * exynos_device_create(int fd);
63 void exynos_device_destroy(struct exynos_device *dev);
64
65 /*
66  * buffer-object related functions:
67  */
68 struct exynos_bo * exynos_bo_create(struct exynos_device *dev,
69                 size_t size, uint32_t flags);
70 int exynos_bo_get_info(struct exynos_device *dev, uint32_t handle,
71                         size_t *size, uint32_t *flags);
72 void exynos_bo_destroy(struct exynos_bo *bo);
73 struct exynos_bo * exynos_bo_from_name(struct exynos_device *dev, uint32_t name);
74 int exynos_bo_get_name(struct exynos_bo *bo, uint32_t *name);
75 uint32_t exynos_bo_handle(struct exynos_bo *bo);
76 void * exynos_bo_map(struct exynos_bo *bo);
77 int exynos_prime_handle_to_fd(struct exynos_device *dev, uint32_t handle,
78                                         int *fd);
79 int exynos_prime_fd_to_handle(struct exynos_device *dev, int fd,
80                                         uint32_t *handle);
81
82 /*
83  * Virtual Display related functions:
84  */
85 int exynos_vidi_connection(struct exynos_device *dev, uint32_t connect,
86                                 uint32_t ext, void *edid);
87
88 #endif /* EXYNOS_DRMIF_H_ */