diff options
author | Rob Clark | 2012-02-25 11:00:29 -0600 |
---|---|---|
committer | Rob Clark | 2012-03-10 14:42:52 -0600 |
commit | 27386b03f0cf5baecceb768e7ca2474f8a712371 (patch) | |
tree | f536c6b42f4a42c243692b76515cb2a2c2e7c829 | |
download | external-libgbm-27386b03f0cf5baecceb768e7ca2474f8a712371.tar.gz external-libgbm-27386b03f0cf5baecceb768e7ca2474f8a712371.tar.xz external-libgbm-27386b03f0cf5baecceb768e7ca2474f8a712371.zip |
initial commit
-rw-r--r-- | .gitignore | 29 | ||||
-rw-r--r-- | Makefile.am | 23 | ||||
-rw-r--r-- | README | 37 | ||||
-rwxr-xr-x | autogen.sh | 12 | ||||
-rw-r--r-- | backend.c | 93 | ||||
-rw-r--r-- | backend.h | 36 | ||||
-rw-r--r-- | backend_example.c | 135 | ||||
-rw-r--r-- | common.c | 88 | ||||
-rw-r--r-- | common.h | 42 | ||||
-rw-r--r-- | common_drm.h | 49 | ||||
-rw-r--r-- | configure.ac | 42 | ||||
-rw-r--r-- | gbm.c | 190 | ||||
-rw-r--r-- | gbm.h | 109 | ||||
-rw-r--r-- | gbm.pc.in | 10 | ||||
-rw-r--r-- | gbmint.h | 82 |
15 files changed, 977 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..3b7bfb99 --- /dev/null +++ b/.gitignore | |||
@@ -0,0 +1,29 @@ | |||
1 | aclocal.m4 | ||
2 | autom4te.cache | ||
3 | Makefile.in | ||
4 | Makefile | ||
5 | .deps | ||
6 | .libs | ||
7 | *.o | ||
8 | *.lo | ||
9 | *.la | ||
10 | libtool | ||
11 | *.pc | ||
12 | config.log | ||
13 | config.status | ||
14 | config.guess | ||
15 | config.h | ||
16 | config.h.in | ||
17 | config.sub | ||
18 | config | ||
19 | configure | ||
20 | install-sh | ||
21 | ltmain.sh | ||
22 | missing | ||
23 | stamp-h1 | ||
24 | depcomp | ||
25 | .cproject | ||
26 | .project | ||
27 | .settings | ||
28 | dri2test | ||
29 | dri2videotest | ||
diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..740ea6eb --- /dev/null +++ b/Makefile.am | |||
@@ -0,0 +1,23 @@ | |||
1 | lib_LTLIBRARIES = libgbm.la | ||
2 | |||
3 | libgbm_la_SOURCES = \ | ||
4 | gbm.c \ | ||
5 | backend.c \ | ||
6 | common.c | ||
7 | |||
8 | libgbm_la_LIBADD = \ | ||
9 | @UDEV_LIBS@ | ||
10 | |||
11 | libgbm_la_CFLAGS = \ | ||
12 | @UDEV_CFLAGS@ \ | ||
13 | -D_OS_UNIX=1 \ | ||
14 | -DMODULEDIR='"$(exec_prefix)/lib/gbm"' | ||
15 | |||
16 | extdir = $(includedir)/gbm | ||
17 | ext_HEADERS = \ | ||
18 | gbm.h \ | ||
19 | gbmint.h \ | ||
20 | common_drm.h | ||
21 | |||
22 | pkgconfigdir = $(libdir)/pkgconfig | ||
23 | pkgconfig_DATA = gbm.pc | ||
@@ -0,0 +1,37 @@ | |||
1 | This is the gbm frontend used by (for example) weston compositor to | ||
2 | load the GLES stack, and retrieve the backing buffer objects behind | ||
3 | an eglImage (created with EGL_WAYLAND_BUFFER_WL), etc. | ||
4 | |||
5 | The frontend is really just a backend loader and shim. The backend | ||
6 | library must be provided by the GLES implementation. | ||
7 | |||
8 | To get wayland up and running on your GLES stack: | ||
9 | 1) implement gbm backend | ||
10 | 2) implement EGL_WL_bind_wayland_display extension (including | ||
11 | EGL_WAYLAND_BUFFER_WL eglCreateImageKHR target | ||
12 | for compositor-drm it looks like we also need | ||
13 | EGL_KHR_surfaceless_gles2 extension.. | ||
14 | ---- | ||
15 | <robclark> hmm, I don't suppose there is any extension description for EGL_KHR_surfaceless_gles2 ? | ||
16 | <pq> robclark, it should simply mean you can eglMakeCurrent with NULL surface, but a real context. | ||
17 | ---- | ||
18 | 3) implement wayland-egl (must provide wayland-egl.pc) | ||
19 | 4) ??? | ||
20 | 5) PROFIT!! | ||
21 | |||
22 | need this in your eglext.h: | ||
23 | |||
24 | ------------------- | ||
25 | #ifndef EGL_WL_bind_wayland_display | ||
26 | #define EGL_WL_bind_wayland_display 1 | ||
27 | |||
28 | #define EGL_WAYLAND_BUFFER_WL 0x31D5 /* eglCreateImageKHR target */ | ||
29 | struct wl_display; | ||
30 | #ifdef EGL_EGLEXT_PROTOTYPES | ||
31 | EGLAPI EGLBoolean EGLAPIENTRY eglBindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display); | ||
32 | EGLAPI EGLBoolean EGLAPIENTRY eglUnbindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display); | ||
33 | #endif | ||
34 | typedef EGLBoolean (EGLAPIENTRYP PFNEGLBINDWAYLANDDISPLAYWL) (EGLDisplay dpy, struct wl_display *display); | ||
35 | typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNBINDWAYLANDDISPLAYWL) (EGLDisplay dpy, struct wl_display *display); | ||
36 | #endif | ||
37 | ------------------- | ||
diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 00000000..904cd674 --- /dev/null +++ b/autogen.sh | |||
@@ -0,0 +1,12 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | srcdir=`dirname $0` | ||
4 | test -z "$srcdir" && srcdir=. | ||
5 | |||
6 | ORIGDIR=`pwd` | ||
7 | cd $srcdir | ||
8 | |||
9 | autoreconf -v --install || exit 1 | ||
10 | cd $ORIGDIR || exit $? | ||
11 | |||
12 | $srcdir/configure --enable-maintainer-mode "$@" | ||
diff --git a/backend.c b/backend.c new file mode 100644 index 00000000..29d31517 --- /dev/null +++ b/backend.c | |||
@@ -0,0 +1,93 @@ | |||
1 | /* | ||
2 | * Copyright © 2011 Intel Corporation | ||
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, | ||
16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
19 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
20 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
22 | * DEALINGS IN THE SOFTWARE. | ||
23 | * | ||
24 | * Authors: | ||
25 | * Benjamin Franzke <benjaminfranzke@googlemail.com> | ||
26 | */ | ||
27 | |||
28 | #include <stdio.h> | ||
29 | #include <stddef.h> | ||
30 | #include <stdlib.h> | ||
31 | #include <string.h> | ||
32 | #include <limits.h> | ||
33 | #include <dlfcn.h> | ||
34 | |||
35 | #include "backend.h" | ||
36 | |||
37 | #define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) | ||
38 | |||
39 | /* a more clever scheme would be to discover backends in a certain | ||
40 | * directory.. | ||
41 | */ | ||
42 | static const char *backends[] = { | ||
43 | "gbm_dri.so", | ||
44 | "gbm_gallium_drm.so", | ||
45 | "gbm_pvr.so", | ||
46 | }; | ||
47 | |||
48 | static const void * | ||
49 | load_backend(const char *name) | ||
50 | { | ||
51 | char path[PATH_MAX]; | ||
52 | void *module; | ||
53 | const char *entrypoint = "gbm_backend"; | ||
54 | |||
55 | if (name[0] != '/') | ||
56 | snprintf(path, sizeof path, MODULEDIR "/%s", name); | ||
57 | else | ||
58 | snprintf(path, sizeof path, "%s", name); | ||
59 | |||
60 | module = dlopen(path, RTLD_NOW | RTLD_GLOBAL); | ||
61 | if (!module) { | ||
62 | fprintf(stderr, "failed to load module: %s\n", dlerror()); | ||
63 | return NULL; | ||
64 | } | ||
65 | |||
66 | return dlsym(module, entrypoint); | ||
67 | } | ||
68 | |||
69 | struct gbm_device * | ||
70 | _gbm_create_device(int fd) | ||
71 | { | ||
72 | const struct gbm_backend *backend = NULL; | ||
73 | struct gbm_device *dev = NULL; | ||
74 | int i; | ||
75 | const char *b; | ||
76 | |||
77 | b = getenv("GBM_BACKEND"); | ||
78 | if (b) | ||
79 | backend = load_backend(b); | ||
80 | |||
81 | if (backend) | ||
82 | dev = backend->create_device(fd); | ||
83 | |||
84 | for (i = 0; i < ARRAY_SIZE(backends) && dev == NULL; ++i) { | ||
85 | backend = load_backend(backends[i]); | ||
86 | if (backend == NULL) | ||
87 | continue; | ||
88 | fprintf(stderr, "loaded module: %s\n", backends[i]); | ||
89 | dev = backend->create_device(fd); | ||
90 | } | ||
91 | |||
92 | return dev; | ||
93 | } | ||
diff --git a/backend.h b/backend.h new file mode 100644 index 00000000..4a643750 --- /dev/null +++ b/backend.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * Copyright © 2011 Intel Corporation | ||
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, | ||
16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
19 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
20 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
22 | * DEALINGS IN THE SOFTWARE. | ||
23 | * | ||
24 | * Authors: | ||
25 | * Benjamin Franzke <benjaminfranzke@googlemail.com> | ||
26 | */ | ||
27 | |||
28 | #ifndef MODULE_H_ | ||
29 | #define MODULE_H_ | ||
30 | |||
31 | #include "gbmint.h" | ||
32 | |||
33 | struct gbm_device * | ||
34 | _gbm_create_device(int fd); | ||
35 | |||
36 | #endif | ||
diff --git a/backend_example.c b/backend_example.c new file mode 100644 index 00000000..3854d6eb --- /dev/null +++ b/backend_example.c | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2012 Texas Instruments | ||
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, | ||
16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
19 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
20 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
22 | * DEALINGS IN THE SOFTWARE. | ||
23 | * | ||
24 | * Authors: | ||
25 | * Rob Clark <rob.clark@linaro.org> | ||
26 | */ | ||
27 | |||
28 | /* This is an example/skeletal backend implementation.. this file isn't | ||
29 | * actually built as part of libgbm, but just intended to be a template | ||
30 | * to help in creating a new gbm backend | ||
31 | */ | ||
32 | |||
33 | #include <stdio.h> | ||
34 | #include <stdlib.h> | ||
35 | #include <stddef.h> | ||
36 | #include <stdint.h> | ||
37 | #include <string.h> | ||
38 | #include <limits.h> | ||
39 | |||
40 | #include <sys/types.h> | ||
41 | #include <unistd.h> | ||
42 | #include <dlfcn.h> | ||
43 | |||
44 | #include "gbmint.h" | ||
45 | #include "common_drm.h" | ||
46 | |||
47 | struct gbm_example_device { | ||
48 | struct gbm_drm_device base; | ||
49 | /* add whatever you need here */ | ||
50 | }; | ||
51 | |||
52 | struct gbm_example_bo { | ||
53 | struct gbm_drm_bo base; | ||
54 | /* add whatever you need here */ | ||
55 | }; | ||
56 | |||
57 | |||
58 | static int | ||
59 | gles_init(struct gbm_example_device *dev) | ||
60 | { | ||
61 | /* this should open/initialize the GLES stack.. for a DRM driver | ||
62 | * at least, dev->base.base.fd will have the already opened device | ||
63 | */ | ||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | static int | ||
68 | gbm_example_is_format_supported(struct gbm_device *gbm, | ||
69 | enum gbm_bo_format format, uint32_t usage) | ||
70 | { | ||
71 | return 0; | ||
72 | } | ||
73 | |||
74 | static void | ||
75 | gbm_example_bo_destroy(struct gbm_bo *_bo) | ||
76 | { | ||
77 | } | ||
78 | |||
79 | static struct gbm_bo * | ||
80 | gbm_example_bo_create_from_egl_image(struct gbm_device *gbm, void *egl_dpy, | ||
81 | void *egl_img, uint32_t width, uint32_t height, uint32_t usage) | ||
82 | { | ||
83 | /* eglimg is created w/ (see weston_buffer_attach()): | ||
84 | * | ||
85 | * struct wl_buffer *buffer = ...; | ||
86 | * eglCreateImageKHR(display, NULL, EGL_WAYLAND_BUFFER_WL, buffer, NULL); | ||
87 | */ | ||
88 | |||
89 | return NULL; | ||
90 | } | ||
91 | |||
92 | static struct gbm_bo * | ||
93 | gbm_example_bo_create(struct gbm_device *gbm, uint32_t width, uint32_t height, | ||
94 | enum gbm_bo_format format, uint32_t usage) | ||
95 | { | ||
96 | return NULL; | ||
97 | } | ||
98 | |||
99 | static void | ||
100 | gbm_example_destroy(struct gbm_device *gbm) | ||
101 | { | ||
102 | } | ||
103 | |||
104 | static struct gbm_device * | ||
105 | example_device_create(int fd) | ||
106 | { | ||
107 | struct gbm_example_device *dev; | ||
108 | int ret; | ||
109 | |||
110 | dev = calloc(1, sizeof *dev); | ||
111 | |||
112 | dev->base.base.fd = fd; | ||
113 | dev->base.base.bo_create = gbm_example_bo_create; | ||
114 | dev->base.base.bo_create_from_egl_image = gbm_example_bo_create_from_egl_image; | ||
115 | dev->base.base.is_format_supported = gbm_example_is_format_supported; | ||
116 | dev->base.base.bo_destroy = gbm_example_bo_destroy; | ||
117 | dev->base.base.destroy = gbm_example_destroy; | ||
118 | |||
119 | dev->base.type = GBM_DRM_DRIVER_TYPE_CUSTOM; | ||
120 | dev->base.base.name = "example"; | ||
121 | |||
122 | ret = gles_init(dev); | ||
123 | if (ret) { | ||
124 | free(dev); | ||
125 | return NULL; | ||
126 | } | ||
127 | |||
128 | return &dev->base.base; | ||
129 | } | ||
130 | |||
131 | /* backend loader looks for symbol "gbm_backend" */ | ||
132 | struct gbm_backend gbm_backend = { | ||
133 | .backend_name = "example", | ||
134 | .create_device = example_device_create, | ||
135 | }; | ||
diff --git a/common.c b/common.c new file mode 100644 index 00000000..f02162df --- /dev/null +++ b/common.c | |||
@@ -0,0 +1,88 @@ | |||
1 | /* | ||
2 | * Copyright © 2011 Intel Corporation | ||
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, | ||
16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
19 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
20 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
22 | * DEALINGS IN THE SOFTWARE. | ||
23 | * | ||
24 | * Authors: | ||
25 | * Benjamin Franzke <benjaminfranzke@googlemail.com> | ||
26 | */ | ||
27 | |||
28 | #include <stdio.h> | ||
29 | #include <string.h> | ||
30 | |||
31 | #include <libudev.h> | ||
32 | #include <sys/types.h> | ||
33 | #include <sys/stat.h> | ||
34 | #include <unistd.h> | ||
35 | |||
36 | #include "common.h" | ||
37 | #include "gbmint.h" | ||
38 | |||
39 | GBM_EXPORT struct udev_device * | ||
40 | _gbm_udev_device_new_from_fd(struct udev *udev, int fd) | ||
41 | { | ||
42 | struct udev_device *device; | ||
43 | struct stat buf; | ||
44 | |||
45 | if (fstat(fd, &buf) < 0) { | ||
46 | fprintf(stderr, "gbm: failed to stat fd %d", fd); | ||
47 | return NULL; | ||
48 | } | ||
49 | |||
50 | device = udev_device_new_from_devnum(udev, 'c', buf.st_rdev); | ||
51 | if (device == NULL) { | ||
52 | fprintf(stderr, | ||
53 | "gbm: could not create udev device for fd %d", fd); | ||
54 | return NULL; | ||
55 | } | ||
56 | |||
57 | return device; | ||
58 | } | ||
59 | |||
60 | GBM_EXPORT char * | ||
61 | _gbm_fd_get_device_name(int fd) | ||
62 | { | ||
63 | struct udev *udev; | ||
64 | struct udev_device *device; | ||
65 | const char *const_device_name; | ||
66 | char *device_name = NULL; | ||
67 | |||
68 | udev = udev_new(); | ||
69 | device = _gbm_udev_device_new_from_fd(udev, fd); | ||
70 | if (device == NULL) | ||
71 | return NULL; | ||
72 | |||
73 | const_device_name = udev_device_get_devnode(device); | ||
74 | if (!const_device_name) | ||
75 | goto out; | ||
76 | device_name = strdup(const_device_name); | ||
77 | |||
78 | out: | ||
79 | udev_device_unref(device); | ||
80 | udev_unref(udev); | ||
81 | |||
82 | return device_name; | ||
83 | } | ||
84 | |||
85 | GBM_EXPORT void | ||
86 | _gbm_log(const char *fmt_str, ...) | ||
87 | { | ||
88 | } | ||
diff --git a/common.h b/common.h new file mode 100644 index 00000000..1fcdfcac --- /dev/null +++ b/common.h | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | * Copyright © 2011 Intel Corporation | ||
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, | ||
16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
19 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
20 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
22 | * DEALINGS IN THE SOFTWARE. | ||
23 | * | ||
24 | * Authors: | ||
25 | * Benjamin Franzke <benjaminfranzke@googlemail.com> | ||
26 | */ | ||
27 | |||
28 | #ifndef _COMMON_H_ | ||
29 | #define _COMMON_H_ | ||
30 | |||
31 | #include <libudev.h> | ||
32 | |||
33 | struct udev_device * | ||
34 | _gbm_udev_device_new_from_fd(struct udev *udev, int fd); | ||
35 | |||
36 | char * | ||
37 | _gbm_fd_get_device_name(int fd); | ||
38 | |||
39 | void | ||
40 | _gbm_log(const char *fmt_str, ...); | ||
41 | |||
42 | #endif | ||
diff --git a/common_drm.h b/common_drm.h new file mode 100644 index 00000000..6b2f74d0 --- /dev/null +++ b/common_drm.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | * Copyright © 2011 Intel Corporation | ||
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, | ||
16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
19 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
20 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
22 | * DEALINGS IN THE SOFTWARE. | ||
23 | * | ||
24 | * Authors: | ||
25 | * Benjamin Franzke <benjaminfranzke@googlemail.com> | ||
26 | */ | ||
27 | |||
28 | #ifndef _COMMON_DRM_H_ | ||
29 | #define _COMMON_DRM_H_ | ||
30 | |||
31 | #include "gbmint.h" | ||
32 | |||
33 | enum gbm_drm_driver_type { | ||
34 | GBM_DRM_DRIVER_TYPE_DRI, | ||
35 | GBM_DRM_DRIVER_TYPE_GALLIUM, | ||
36 | GBM_DRM_DRIVER_TYPE_CUSTOM, /* catch-all for non-mesa drivers */ | ||
37 | }; | ||
38 | |||
39 | struct gbm_drm_device { | ||
40 | struct gbm_device base; | ||
41 | enum gbm_drm_driver_type type; | ||
42 | char *driver_name; | ||
43 | }; | ||
44 | |||
45 | struct gbm_drm_bo { | ||
46 | struct gbm_bo base; | ||
47 | }; | ||
48 | |||
49 | #endif | ||
diff --git a/configure.ac b/configure.ac new file mode 100644 index 00000000..27390922 --- /dev/null +++ b/configure.ac | |||
@@ -0,0 +1,42 @@ | |||
1 | # | ||
2 | # Copyright 2005 Red Hat, Inc. | ||
3 | # | ||
4 | # Permission to use, copy, modify, distribute, and sell this software and its | ||
5 | # documentation for any purpose is hereby granted without fee, provided that | ||
6 | # the above copyright notice appear in all copies and that both that | ||
7 | # copyright notice and this permission notice appear in supporting | ||
8 | # documentation, and that the name of Red Hat not be used in | ||
9 | # advertising or publicity pertaining to distribution of the software without | ||
10 | # specific, written prior permission. Red Hat makes no | ||
11 | # representations about the suitability of this software for any purpose. It | ||
12 | # is provided "as is" without express or implied warranty. | ||
13 | # | ||
14 | # RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | ||
15 | # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO | ||
16 | # EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR | ||
17 | # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, | ||
18 | # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | ||
19 | # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
20 | # PERFORMANCE OF THIS SOFTWARE. | ||
21 | # | ||
22 | |||
23 | # Initialize Autoconf | ||
24 | AC_PREREQ([2.60]) | ||
25 | AC_INIT([libgbm], [1.0.0], | ||
26 | [https://bugs.freedesktop.org/enter_bug.cgi?product=wayland], [libgbm]) | ||
27 | AC_CONFIG_SRCDIR([Makefile.am]) | ||
28 | AC_CONFIG_HEADERS([config.h]) | ||
29 | |||
30 | # Initialize Automake | ||
31 | AM_INIT_AUTOMAKE([foreign dist-bzip2]) | ||
32 | AM_MAINTAINER_MODE | ||
33 | |||
34 | # Initialize libtool | ||
35 | AC_PROG_LIBTOOL | ||
36 | |||
37 | # Obtain compiler/linker options for dependencies | ||
38 | PKG_CHECK_MODULES(UDEV, udev) | ||
39 | PKG_CHECK_MODULES(DRM, libdrm) | ||
40 | |||
41 | AC_CONFIG_FILES([Makefile gbm.pc]) | ||
42 | AC_OUTPUT | ||
@@ -0,0 +1,190 @@ | |||
1 | /* | ||
2 | * Copyright © 2011 Intel Corporation | ||
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, | ||
16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
19 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
20 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
22 | * DEALINGS IN THE SOFTWARE. | ||
23 | * | ||
24 | * Authors: | ||
25 | * Benjamin Franzke <benjaminfranzke@googlemail.com> | ||
26 | */ | ||
27 | |||
28 | #define _BSD_SOURCE | ||
29 | |||
30 | #include <stddef.h> | ||
31 | #include <stdio.h> | ||
32 | #include <stdlib.h> | ||
33 | #include <string.h> | ||
34 | #include <stdint.h> | ||
35 | |||
36 | #include <sys/types.h> | ||
37 | #include <sys/stat.h> | ||
38 | #include <unistd.h> | ||
39 | |||
40 | #include "gbm.h" | ||
41 | #include "gbmint.h" | ||
42 | #include "common.h" | ||
43 | #include "backend.h" | ||
44 | |||
45 | #define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) | ||
46 | |||
47 | struct gbm_device *devices[16]; | ||
48 | |||
49 | static int device_num = 0; | ||
50 | |||
51 | GBM_EXPORT int | ||
52 | gbm_device_get_fd(struct gbm_device *gbm) | ||
53 | { | ||
54 | return gbm->fd; | ||
55 | } | ||
56 | |||
57 | /* FIXME: maybe superfluous, use udev subclass from the fd? */ | ||
58 | GBM_EXPORT const char * | ||
59 | gbm_device_get_backend_name(struct gbm_device *gbm) | ||
60 | { | ||
61 | return gbm->name; | ||
62 | } | ||
63 | |||
64 | int | ||
65 | gbm_device_is_format_supported(struct gbm_device *gbm, | ||
66 | enum gbm_bo_format format, | ||
67 | uint32_t usage) | ||
68 | { | ||
69 | return gbm->is_format_supported(gbm, format, usage); | ||
70 | } | ||
71 | |||
72 | GBM_EXPORT void | ||
73 | gbm_device_destroy(struct gbm_device *gbm) | ||
74 | { | ||
75 | gbm->refcount--; | ||
76 | if (gbm->refcount == 0) | ||
77 | gbm->destroy(gbm); | ||
78 | } | ||
79 | |||
80 | GBM_EXPORT struct gbm_device * | ||
81 | _gbm_mesa_get_device(int fd) | ||
82 | { | ||
83 | struct gbm_device *gbm = NULL; | ||
84 | struct stat buf; | ||
85 | dev_t dev; | ||
86 | int i; | ||
87 | |||
88 | if (fd < 0 || fstat(fd, &buf) < 0 || !S_ISCHR(buf.st_mode)) { | ||
89 | fprintf(stderr, "_gbm_mesa_get_device: invalid fd: %d\n", fd); | ||
90 | return NULL; | ||
91 | } | ||
92 | |||
93 | for (i = 0; i < device_num; ++i) { | ||
94 | dev = devices[i]->stat.st_rdev; | ||
95 | if (major(dev) == major(buf.st_rdev) && | ||
96 | minor(dev) == minor(buf.st_rdev)) { | ||
97 | gbm = devices[i]; | ||
98 | gbm->refcount++; | ||
99 | break; | ||
100 | } | ||
101 | } | ||
102 | |||
103 | return gbm; | ||
104 | } | ||
105 | |||
106 | GBM_EXPORT struct gbm_device * | ||
107 | gbm_create_device(int fd) | ||
108 | { | ||
109 | struct gbm_device *gbm = NULL; | ||
110 | struct stat buf; | ||
111 | |||
112 | if (fd < 0 || fstat(fd, &buf) < 0 || !S_ISCHR(buf.st_mode)) { | ||
113 | fprintf(stderr, "gbm_create_device: invalid fd: %d\n", fd); | ||
114 | return NULL; | ||
115 | } | ||
116 | |||
117 | if (device_num == 0) | ||
118 | memset(devices, 0, sizeof devices); | ||
119 | |||
120 | gbm = _gbm_create_device(fd); | ||
121 | if (gbm == NULL) | ||
122 | return NULL; | ||
123 | |||
124 | gbm->dummy = gbm_create_device; | ||
125 | gbm->stat = buf; | ||
126 | gbm->refcount = 1; | ||
127 | |||
128 | if (device_num < ARRAY_SIZE(devices)-1) | ||
129 | devices[device_num++] = gbm; | ||
130 | |||
131 | return gbm; | ||
132 | } | ||
133 | |||
134 | GBM_EXPORT unsigned int | ||
135 | gbm_bo_get_width(struct gbm_bo *bo) | ||
136 | { | ||
137 | return bo->width; | ||
138 | } | ||
139 | |||
140 | GBM_EXPORT unsigned int | ||
141 | gbm_bo_get_height(struct gbm_bo *bo) | ||
142 | { | ||
143 | return bo->height; | ||
144 | } | ||
145 | |||
146 | GBM_EXPORT uint32_t | ||
147 | gbm_bo_get_pitch(struct gbm_bo *bo) | ||
148 | { | ||
149 | return bo->pitch; | ||
150 | } | ||
151 | |||
152 | GBM_EXPORT union gbm_bo_handle | ||
153 | gbm_bo_get_handle(struct gbm_bo *bo) | ||
154 | { | ||
155 | return bo->handle; | ||
156 | } | ||
157 | |||
158 | GBM_EXPORT void | ||
159 | gbm_bo_destroy(struct gbm_bo *bo) | ||
160 | { | ||
161 | bo->gbm->bo_destroy(bo); | ||
162 | } | ||
163 | |||
164 | GBM_EXPORT struct gbm_bo * | ||
165 | gbm_bo_create(struct gbm_device *gbm, | ||
166 | uint32_t width, uint32_t height, | ||
167 | enum gbm_bo_format format, uint32_t usage) | ||
168 | { | ||
169 | if (width == 0 || height == 0) | ||
170 | return NULL; | ||
171 | |||
172 | if (usage & GBM_BO_USE_CURSOR_64X64 && | ||
173 | (width != 64 || height != 64)) | ||
174 | return NULL; | ||
175 | |||
176 | return gbm->bo_create(gbm, width, height, format, usage); | ||
177 | } | ||
178 | |||
179 | GBM_EXPORT struct gbm_bo * | ||
180 | gbm_bo_create_from_egl_image(struct gbm_device *gbm, | ||
181 | void *egl_dpy, void *egl_image, | ||
182 | uint32_t width, uint32_t height, | ||
183 | uint32_t usage) | ||
184 | { | ||
185 | if (width == 0 || height == 0) | ||
186 | return NULL; | ||
187 | |||
188 | return gbm->bo_create_from_egl_image(gbm, egl_dpy, egl_image, | ||
189 | width, height, usage); | ||
190 | } | ||
@@ -0,0 +1,109 @@ | |||
1 | /* | ||
2 | * Copyright © 2011 Intel Corporation | ||
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, | ||
16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
19 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
20 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
22 | * DEALINGS IN THE SOFTWARE. | ||
23 | * | ||
24 | * Authors: | ||
25 | * Benjamin Franzke <benjaminfranzke@googlemail.com> | ||
26 | */ | ||
27 | |||
28 | #ifndef _GBM_H_ | ||
29 | #define _GBM_H_ | ||
30 | |||
31 | #ifdef __cplusplus | ||
32 | extern "C" { | ||
33 | #endif | ||
34 | |||
35 | |||
36 | #define __GBM__ 1 | ||
37 | |||
38 | #include <stdint.h> | ||
39 | |||
40 | struct gbm_device; | ||
41 | struct gbm_bo; | ||
42 | |||
43 | union gbm_bo_handle { | ||
44 | void *ptr; | ||
45 | int32_t s32; | ||
46 | uint32_t u32; | ||
47 | int64_t s64; | ||
48 | uint64_t u64; | ||
49 | }; | ||
50 | |||
51 | enum gbm_bo_format { | ||
52 | GBM_BO_FORMAT_XRGB8888, | ||
53 | GBM_BO_FORMAT_ARGB8888, | ||
54 | }; | ||
55 | |||
56 | enum gbm_bo_flags { | ||
57 | GBM_BO_USE_SCANOUT = (1 << 0), | ||
58 | GBM_BO_USE_CURSOR_64X64 = (1 << 1), | ||
59 | GBM_BO_USE_RENDERING = (1 << 2), | ||
60 | }; | ||
61 | |||
62 | int | ||
63 | gbm_device_get_fd(struct gbm_device *gbm); | ||
64 | |||
65 | const char * | ||
66 | gbm_device_get_backend_name(struct gbm_device *gbm); | ||
67 | |||
68 | int | ||
69 | gbm_device_is_format_supported(struct gbm_device *gbm, | ||
70 | enum gbm_bo_format format, | ||
71 | uint32_t usage); | ||
72 | |||
73 | void | ||
74 | gbm_device_destroy(struct gbm_device *gbm); | ||
75 | |||
76 | struct gbm_device * | ||
77 | gbm_create_device(int fd); | ||
78 | |||
79 | struct gbm_bo * | ||
80 | gbm_bo_create(struct gbm_device *gbm, | ||
81 | uint32_t width, uint32_t height, | ||
82 | enum gbm_bo_format format, uint32_t flags); | ||
83 | |||
84 | struct gbm_bo * | ||
85 | gbm_bo_create_from_egl_image(struct gbm_device *gbm, | ||
86 | void *egl_dpy, void *egl_img, | ||
87 | uint32_t width, uint32_t height, | ||
88 | uint32_t usage); | ||
89 | |||
90 | uint32_t | ||
91 | gbm_bo_get_width(struct gbm_bo *bo); | ||
92 | |||
93 | uint32_t | ||
94 | gbm_bo_get_height(struct gbm_bo *bo); | ||
95 | |||
96 | uint32_t | ||
97 | gbm_bo_get_pitch(struct gbm_bo *bo); | ||
98 | |||
99 | union gbm_bo_handle | ||
100 | gbm_bo_get_handle(struct gbm_bo *bo); | ||
101 | |||
102 | void | ||
103 | gbm_bo_destroy(struct gbm_bo *bo); | ||
104 | |||
105 | #ifdef __cplusplus | ||
106 | } | ||
107 | #endif | ||
108 | |||
109 | #endif | ||
diff --git a/gbm.pc.in b/gbm.pc.in new file mode 100644 index 00000000..12348412 --- /dev/null +++ b/gbm.pc.in | |||
@@ -0,0 +1,10 @@ | |||
1 | prefix=@prefix@ | ||
2 | exec_prefix=@exec_prefix@ | ||
3 | libdir=@libdir@ | ||
4 | includedir=@includedir@ | ||
5 | |||
6 | Name: gbm | ||
7 | Description: gbm library | ||
8 | Version: @PACKAGE_VERSION@ | ||
9 | Libs: -L${libdir} -lgbm | ||
10 | Cflags: -I${includedir}/gbm | ||
diff --git a/gbmint.h b/gbmint.h new file mode 100644 index 00000000..fb8db804 --- /dev/null +++ b/gbmint.h | |||
@@ -0,0 +1,82 @@ | |||
1 | /* | ||
2 | * Copyright © 2011 Intel Corporation | ||
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, | ||
16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
19 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
20 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
22 | * DEALINGS IN THE SOFTWARE. | ||
23 | * | ||
24 | * Authors: | ||
25 | * Benjamin Franzke <benjaminfranzke@googlemail.com> | ||
26 | */ | ||
27 | |||
28 | #ifndef INTERNAL_H_ | ||
29 | #define INTERNAL_H_ | ||
30 | |||
31 | #include "gbm.h" | ||
32 | #include <sys/stat.h> | ||
33 | |||
34 | /* GCC visibility */ | ||
35 | #if defined(__GNUC__) && __GNUC__ >= 4 | ||
36 | #define GBM_EXPORT __attribute__ ((visibility("default"))) | ||
37 | #else | ||
38 | #define GBM_EXPORT | ||
39 | #endif | ||
40 | |||
41 | struct gbm_device { | ||
42 | /* Hack to make a gbm_device detectable by its first element. */ | ||
43 | struct gbm_device *(*dummy)(int); | ||
44 | |||
45 | int fd; | ||
46 | const char *name; | ||
47 | unsigned int refcount; | ||
48 | struct stat stat; | ||
49 | |||
50 | void (*destroy)(struct gbm_device *gbm); | ||
51 | int (*is_format_supported)(struct gbm_device *gbm, | ||
52 | enum gbm_bo_format format, | ||
53 | uint32_t usage); | ||
54 | |||
55 | struct gbm_bo *(*bo_create)(struct gbm_device *gbm, | ||
56 | uint32_t width, uint32_t height, | ||
57 | enum gbm_bo_format format, | ||
58 | uint32_t usage); | ||
59 | struct gbm_bo *(*bo_create_from_egl_image)(struct gbm_device *gbm, | ||
60 | void *egl_dpy, void *egl_img, | ||
61 | uint32_t width, uint32_t height, | ||
62 | uint32_t usage); | ||
63 | void (*bo_destroy)(struct gbm_bo *bo); | ||
64 | }; | ||
65 | |||
66 | struct gbm_bo { | ||
67 | struct gbm_device *gbm; | ||
68 | uint32_t width; | ||
69 | uint32_t height; | ||
70 | uint32_t pitch; | ||
71 | union gbm_bo_handle handle; | ||
72 | }; | ||
73 | |||
74 | struct gbm_backend { | ||
75 | const char *backend_name; | ||
76 | struct gbm_device *(*create_device)(int fd); | ||
77 | }; | ||
78 | |||
79 | GBM_EXPORT struct gbm_device * | ||
80 | _gbm_mesa_get_device(int fd); | ||
81 | |||
82 | #endif | ||