Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 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 | * Kristian Høgsberg <krh@bitplanet.net> |
| 26 | */ |
| 27 | |
| 28 | #ifndef EGL_DRI2_INCLUDED |
| 29 | #define EGL_DRI2_INCLUDED |
| 30 | |
Emil Velikov | bf0e4d2 | 2015-02-28 17:12:40 +0000 | [diff] [blame] | 31 | #include <stdint.h> |
| 32 | |
Kristian Høgsberg | 93aea63 | 2011-05-11 13:58:37 -0400 | [diff] [blame] | 33 | #ifdef HAVE_X11_PLATFORM |
Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 34 | #include <xcb/xcb.h> |
| 35 | #include <xcb/dri2.h> |
| 36 | #include <xcb/xfixes.h> |
| 37 | #include <X11/Xlib-xcb.h> |
Kristian Høgsberg | 93aea63 | 2011-05-11 13:58:37 -0400 | [diff] [blame] | 38 | #endif |
Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 39 | |
Benjamin Franzke | 93aea84 | 2011-02-04 12:39:40 +0100 | [diff] [blame] | 40 | #ifdef HAVE_WAYLAND_PLATFORM |
| 41 | #include <wayland-client.h> |
| 42 | #include "wayland-egl-priv.h" |
| 43 | #endif |
| 44 | |
Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 45 | #include <GL/gl.h> |
| 46 | #include <GL/internal/dri_interface.h> |
| 47 | |
Benjamin Franzke | b2d6375 | 2011-07-02 13:41:35 +0200 | [diff] [blame] | 48 | #ifdef HAVE_DRM_PLATFORM |
Benjamin Franzke | e5fc4c8 | 2011-05-30 10:50:52 +0200 | [diff] [blame] | 49 | #include <gbm_driint.h> |
Benjamin Franzke | b2d6375 | 2011-07-02 13:41:35 +0200 | [diff] [blame] | 50 | #endif |
Benjamin Franzke | e5fc4c8 | 2011-05-30 10:50:52 +0200 | [diff] [blame] | 51 | |
Chia-I Wu | 9779f6f | 2011-08-05 14:39:18 +0900 | [diff] [blame] | 52 | #ifdef HAVE_ANDROID_PLATFORM |
| 53 | #define LOG_TAG "EGL-DRI2" |
Chia-I Wu | 75cc24c | 2011-11-25 11:59:02 +0800 | [diff] [blame] | 54 | |
| 55 | #if ANDROID_VERSION >= 0x0400 |
| 56 | # include <system/window.h> |
| 57 | #else |
| 58 | # define android_native_buffer_t ANativeWindowBuffer |
| 59 | # include <ui/egl/android_natives.h> |
| 60 | # include <ui/android_native_buffer.h> |
Chia-I Wu | 9779f6f | 2011-08-05 14:39:18 +0900 | [diff] [blame] | 61 | #endif |
| 62 | |
Chia-I Wu | 75cc24c | 2011-11-25 11:59:02 +0800 | [diff] [blame] | 63 | #include <hardware/gralloc.h> |
| 64 | #include <gralloc_drm_handle.h> |
| 65 | #include <cutils/log.h> |
| 66 | |
| 67 | #endif /* HAVE_ANDROID_PLATFORM */ |
| 68 | |
Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 69 | #include "eglconfig.h" |
| 70 | #include "eglcontext.h" |
| 71 | #include "egldisplay.h" |
| 72 | #include "egldriver.h" |
| 73 | #include "eglcurrent.h" |
| 74 | #include "egllog.h" |
| 75 | #include "eglsurface.h" |
| 76 | #include "eglimage.h" |
Marek Olšák | 9a0bda2 | 2015-04-10 10:56:02 +0200 | [diff] [blame] | 77 | #include "eglsync.h" |
Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 78 | |
| 79 | #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) |
| 80 | |
Chad Versace | eadd5e0 | 2014-01-28 17:03:03 -0800 | [diff] [blame] | 81 | struct wl_buffer; |
| 82 | |
Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 83 | struct dri2_egl_driver |
| 84 | { |
| 85 | _EGLDriver base; |
| 86 | |
| 87 | void *handle; |
| 88 | _EGLProc (*get_proc_address)(const char *procname); |
| 89 | void (*glFlush)(void); |
| 90 | }; |
| 91 | |
Chad Versace | 90502b1 | 2014-01-28 11:41:46 -0800 | [diff] [blame] | 92 | struct dri2_egl_display_vtbl { |
| 93 | int (*authenticate)(_EGLDisplay *disp, uint32_t id); |
Chad Versace | 8b9298a | 2014-01-28 12:34:19 -0800 | [diff] [blame] | 94 | |
Chad Versace | 0a0c881 | 2014-01-28 16:39:09 -0800 | [diff] [blame] | 95 | _EGLSurface* (*create_window_surface)(_EGLDriver *drv, _EGLDisplay *dpy, |
| 96 | _EGLConfig *config, |
Chad Versace | 6d1f83e | 2014-01-07 14:54:51 -0800 | [diff] [blame] | 97 | void *native_window, |
Chad Versace | 0a0c881 | 2014-01-28 16:39:09 -0800 | [diff] [blame] | 98 | const EGLint *attrib_list); |
| 99 | |
Chad Versace | bc8b07a | 2014-01-28 16:45:07 -0800 | [diff] [blame] | 100 | _EGLSurface* (*create_pixmap_surface)(_EGLDriver *drv, _EGLDisplay *dpy, |
| 101 | _EGLConfig *config, |
Chad Versace | 6d1f83e | 2014-01-07 14:54:51 -0800 | [diff] [blame] | 102 | void *native_pixmap, |
Chad Versace | bc8b07a | 2014-01-28 16:45:07 -0800 | [diff] [blame] | 103 | const EGLint *attrib_list); |
| 104 | |
Chad Versace | bf20076 | 2014-01-28 17:03:03 -0800 | [diff] [blame] | 105 | _EGLSurface* (*create_pbuffer_surface)(_EGLDriver *drv, _EGLDisplay *dpy, |
| 106 | _EGLConfig *config, |
| 107 | const EGLint *attrib_list); |
| 108 | |
Chad Versace | 958dd80 | 2014-01-28 17:03:03 -0800 | [diff] [blame] | 109 | EGLBoolean (*destroy_surface)(_EGLDriver *drv, _EGLDisplay *dpy, |
| 110 | _EGLSurface *surface); |
| 111 | |
Chad Versace | 8b9298a | 2014-01-28 12:34:19 -0800 | [diff] [blame] | 112 | EGLBoolean (*swap_interval)(_EGLDriver *drv, _EGLDisplay *dpy, |
| 113 | _EGLSurface *surf, EGLint interval); |
Chad Versace | ad173bc | 2014-01-28 16:21:21 -0800 | [diff] [blame] | 114 | |
Chad Versace | eef68a9 | 2014-01-28 17:03:03 -0800 | [diff] [blame] | 115 | _EGLImage* (*create_image)(_EGLDriver *drv, _EGLDisplay *dpy, |
| 116 | _EGLContext *ctx, EGLenum target, |
| 117 | EGLClientBuffer buffer, |
| 118 | const EGLint *attr_list); |
| 119 | |
Chad Versace | ad173bc | 2014-01-28 16:21:21 -0800 | [diff] [blame] | 120 | EGLBoolean (*swap_buffers)(_EGLDriver *drv, _EGLDisplay *dpy, |
| 121 | _EGLSurface *surf); |
Chad Versace | d03948a | 2014-01-28 16:26:44 -0800 | [diff] [blame] | 122 | |
Boyan Ding | 052b3d4 | 2015-06-13 15:36:27 +0800 | [diff] [blame] | 123 | EGLBoolean (*swap_buffers_with_damage)(_EGLDriver *drv, _EGLDisplay *dpy, |
| 124 | _EGLSurface *surface, |
| 125 | const EGLint *rects, EGLint n_rects); |
Chad Versace | 3fdfbd2 | 2014-01-28 17:03:03 -0800 | [diff] [blame] | 126 | |
Chad Versace | 75d398e | 2014-01-28 17:03:03 -0800 | [diff] [blame] | 127 | EGLBoolean (*swap_buffers_region)(_EGLDriver *drv, _EGLDisplay *dpy, |
| 128 | _EGLSurface *surf, EGLint numRects, |
| 129 | const EGLint *rects); |
| 130 | |
Chad Versace | 688a0e8 | 2014-01-28 17:03:03 -0800 | [diff] [blame] | 131 | EGLBoolean (*post_sub_buffer)(_EGLDriver *drv, _EGLDisplay *dpy, |
| 132 | _EGLSurface *surf, |
| 133 | EGLint x, EGLint y, |
| 134 | EGLint width, EGLint height); |
| 135 | |
Chad Versace | bc2cbc0 | 2014-01-28 17:03:03 -0800 | [diff] [blame] | 136 | EGLBoolean (*copy_buffers)(_EGLDriver *drv, _EGLDisplay *dpy, |
Chad Versace | 6d1f83e | 2014-01-07 14:54:51 -0800 | [diff] [blame] | 137 | _EGLSurface *surf, void *native_pixmap_target); |
Chad Versace | bc2cbc0 | 2014-01-28 17:03:03 -0800 | [diff] [blame] | 138 | |
Chad Versace | 3fdfbd2 | 2014-01-28 17:03:03 -0800 | [diff] [blame] | 139 | EGLint (*query_buffer_age)(_EGLDriver *drv, _EGLDisplay *dpy, |
| 140 | _EGLSurface *surf); |
Chad Versace | eadd5e0 | 2014-01-28 17:03:03 -0800 | [diff] [blame] | 141 | |
| 142 | struct wl_buffer* (*create_wayland_buffer_from_image)( |
| 143 | _EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *img); |
Sarah Sharp | c524f3e | 2014-05-06 12:10:57 -0700 | [diff] [blame] | 144 | |
| 145 | EGLBoolean (*get_sync_values)(_EGLDisplay *display, _EGLSurface *surface, |
| 146 | EGLuint64KHR *ust, EGLuint64KHR *msc, |
| 147 | EGLuint64KHR *sbc); |
Boyan Ding | a25df54 | 2015-07-21 23:43:59 +0800 | [diff] [blame^] | 148 | |
| 149 | __DRIdrawable *(*get_dri_drawable)(_EGLSurface *surf); |
Chad Versace | 90502b1 | 2014-01-28 11:41:46 -0800 | [diff] [blame] | 150 | }; |
| 151 | |
Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 152 | struct dri2_egl_display |
| 153 | { |
Chad Versace | 90502b1 | 2014-01-28 11:41:46 -0800 | [diff] [blame] | 154 | const struct dri2_egl_display_vtbl *vtbl; |
| 155 | |
Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 156 | int dri2_major; |
| 157 | int dri2_minor; |
| 158 | __DRIscreen *dri_screen; |
Benjamin Franzke | 992680c | 2011-06-27 10:23:34 +0200 | [diff] [blame] | 159 | int own_dri_screen; |
Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 160 | const __DRIconfig **driver_configs; |
| 161 | void *driver; |
Emil Velikov | 5f280d0 | 2014-02-12 20:13:15 +0000 | [diff] [blame] | 162 | const __DRIcoreExtension *core; |
| 163 | const __DRIdri2Extension *dri2; |
| 164 | const __DRIswrastExtension *swrast; |
| 165 | const __DRI2flushExtension *flush; |
| 166 | const __DRItexBufferExtension *tex_buffer; |
| 167 | const __DRIimageExtension *image; |
| 168 | const __DRIrobustnessExtension *robustness; |
| 169 | const __DRI2configQueryExtension *config; |
Marek Olšák | 9a0bda2 | 2015-04-10 10:56:02 +0200 | [diff] [blame] | 170 | const __DRI2fenceExtension *fence; |
Marek Olšák | 4f57ccd | 2015-06-10 14:45:58 +0200 | [diff] [blame] | 171 | const __DRI2rendererQueryExtension *rendererQuery; |
Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 172 | int fd; |
| 173 | |
Benjamin Franzke | 2a58453 | 2011-12-13 14:43:48 +0100 | [diff] [blame] | 174 | int own_device; |
Fredrik Höglund | 655f2c1 | 2011-12-20 17:17:02 +0100 | [diff] [blame] | 175 | int swap_available; |
Fredrik Höglund | 352c889 | 2011-12-20 17:38:45 +0100 | [diff] [blame] | 176 | int invalidate_available; |
Eric Anholt | 7e9bd2b | 2012-09-25 14:05:30 -0700 | [diff] [blame] | 177 | int min_swap_interval; |
| 178 | int max_swap_interval; |
| 179 | int default_swap_interval; |
Benjamin Franzke | b2d6375 | 2011-07-02 13:41:35 +0200 | [diff] [blame] | 180 | #ifdef HAVE_DRM_PLATFORM |
Benjamin Franzke | e5fc4c8 | 2011-05-30 10:50:52 +0200 | [diff] [blame] | 181 | struct gbm_dri_device *gbm_dri; |
Benjamin Franzke | b2d6375 | 2011-07-02 13:41:35 +0200 | [diff] [blame] | 182 | #endif |
Benjamin Franzke | e5fc4c8 | 2011-05-30 10:50:52 +0200 | [diff] [blame] | 183 | |
Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 184 | char *device_name; |
| 185 | char *driver_name; |
| 186 | |
Haitao Feng | f55d027 | 2011-02-16 23:05:15 -0500 | [diff] [blame] | 187 | __DRIdri2LoaderExtension dri2_loader_extension; |
| 188 | __DRIswrastLoaderExtension swrast_loader_extension; |
Kristian Høgsberg | 68bb26be | 2013-11-08 22:10:36 -0800 | [diff] [blame] | 189 | const __DRIextension *extensions[5]; |
Eric Anholt | f93533d | 2013-09-27 11:39:25 -0700 | [diff] [blame] | 190 | const __DRIextension **driver_extensions; |
Kristian Høgsberg | 93aea63 | 2011-05-11 13:58:37 -0400 | [diff] [blame] | 191 | |
| 192 | #ifdef HAVE_X11_PLATFORM |
| 193 | xcb_connection_t *conn; |
Marek Olšák | 0b56e23 | 2014-08-20 00:33:34 +0200 | [diff] [blame] | 194 | int screen; |
Kristian Høgsberg | 93aea63 | 2011-05-11 13:58:37 -0400 | [diff] [blame] | 195 | #endif |
| 196 | |
Benjamin Franzke | 93aea84 | 2011-02-04 12:39:40 +0100 | [diff] [blame] | 197 | #ifdef HAVE_WAYLAND_PLATFORM |
Kristian Høgsberg | c0f8c99 | 2011-04-14 10:42:41 -0400 | [diff] [blame] | 198 | struct wl_display *wl_dpy; |
Kristian Høgsberg | 0229e3a | 2012-10-10 22:10:42 -0400 | [diff] [blame] | 199 | struct wl_registry *wl_registry; |
Benjamin Franzke | 6b369c4 | 2011-02-21 16:22:34 +0100 | [diff] [blame] | 200 | struct wl_drm *wl_server_drm; |
Kristian Høgsberg | c0f8c99 | 2011-04-14 10:42:41 -0400 | [diff] [blame] | 201 | struct wl_drm *wl_drm; |
Axel Davy | cdcfe48 | 2015-05-01 11:11:20 +0200 | [diff] [blame] | 202 | struct wl_shm *wl_shm; |
Kristian Høgsberg | 0229e3a | 2012-10-10 22:10:42 -0400 | [diff] [blame] | 203 | struct wl_event_queue *wl_queue; |
Kristian Høgsberg | c0f8c99 | 2011-04-14 10:42:41 -0400 | [diff] [blame] | 204 | int authenticated; |
Kristian Høgsberg | 7b1d94e | 2011-08-31 16:45:04 -0400 | [diff] [blame] | 205 | int formats; |
Kristian Høgsberg | de315f7 | 2013-02-02 12:26:12 -0500 | [diff] [blame] | 206 | uint32_t capabilities; |
Axel Davy | fb0960a | 2015-05-01 01:30:10 +0200 | [diff] [blame] | 207 | int is_render_node; |
Axel Davy | 4cd546d | 2015-05-01 01:16:24 +0200 | [diff] [blame] | 208 | int is_different_gpu; |
Benjamin Franzke | 93aea84 | 2011-02-04 12:39:40 +0100 | [diff] [blame] | 209 | #endif |
Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 210 | }; |
| 211 | |
| 212 | struct dri2_egl_context |
| 213 | { |
| 214 | _EGLContext base; |
| 215 | __DRIcontext *dri_context; |
| 216 | }; |
| 217 | |
Benjamin Franzke | 93aea84 | 2011-02-04 12:39:40 +0100 | [diff] [blame] | 218 | #ifdef HAVE_WAYLAND_PLATFORM |
| 219 | enum wayland_buffer_type { |
| 220 | WL_BUFFER_FRONT, |
| 221 | WL_BUFFER_BACK, |
Benjamin Franzke | 0cb356d | 2011-05-06 19:13:29 +0200 | [diff] [blame] | 222 | WL_BUFFER_THIRD, |
Benjamin Franzke | 93aea84 | 2011-02-04 12:39:40 +0100 | [diff] [blame] | 223 | WL_BUFFER_COUNT |
| 224 | }; |
Benjamin Franzke | 93aea84 | 2011-02-04 12:39:40 +0100 | [diff] [blame] | 225 | #endif |
| 226 | |
Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 227 | struct dri2_egl_surface |
| 228 | { |
| 229 | _EGLSurface base; |
| 230 | __DRIdrawable *dri_drawable; |
Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 231 | __DRIbuffer buffers[5]; |
| 232 | int buffer_count; |
Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 233 | int have_fake_front; |
Haitao Feng | f55d027 | 2011-02-16 23:05:15 -0500 | [diff] [blame] | 234 | |
Kristian Høgsberg | 93aea63 | 2011-05-11 13:58:37 -0400 | [diff] [blame] | 235 | #ifdef HAVE_X11_PLATFORM |
| 236 | xcb_drawable_t drawable; |
| 237 | xcb_xfixes_region_t region; |
Haitao Feng | f55d027 | 2011-02-16 23:05:15 -0500 | [diff] [blame] | 238 | int depth; |
| 239 | int bytes_per_pixel; |
| 240 | xcb_gcontext_t gc; |
| 241 | xcb_gcontext_t swapgc; |
Kristian Høgsberg | 93aea63 | 2011-05-11 13:58:37 -0400 | [diff] [blame] | 242 | #endif |
Haitao Feng | f55d027 | 2011-02-16 23:05:15 -0500 | [diff] [blame] | 243 | |
Benjamin Franzke | 93aea84 | 2011-02-04 12:39:40 +0100 | [diff] [blame] | 244 | #ifdef HAVE_WAYLAND_PLATFORM |
| 245 | struct wl_egl_window *wl_win; |
Benjamin Franzke | 93aea84 | 2011-02-04 12:39:40 +0100 | [diff] [blame] | 246 | int dx; |
| 247 | int dy; |
Neil Roberts | 992a2db | 2013-11-15 13:50:50 +0000 | [diff] [blame] | 248 | struct wl_callback *throttle_callback; |
Kristian Høgsberg | 7b1d94e | 2011-08-31 16:45:04 -0400 | [diff] [blame] | 249 | int format; |
Benjamin Franzke | 93aea84 | 2011-02-04 12:39:40 +0100 | [diff] [blame] | 250 | #endif |
Chia-I Wu | 9779f6f | 2011-08-05 14:39:18 +0900 | [diff] [blame] | 251 | |
Ander Conselvan de Oliveira | 4a976b6 | 2012-01-25 16:24:17 +0200 | [diff] [blame] | 252 | #ifdef HAVE_DRM_PLATFORM |
| 253 | struct gbm_dri_surface *gbm_surf; |
Ander Conselvan de Oliveira | 4a976b6 | 2012-01-25 16:24:17 +0200 | [diff] [blame] | 254 | #endif |
Kristian Høgsberg | 90804e8 | 2012-12-13 23:30:45 -0500 | [diff] [blame] | 255 | |
| 256 | #if defined(HAVE_WAYLAND_PLATFORM) || defined(HAVE_DRM_PLATFORM) |
| 257 | __DRIbuffer *dri_buffers[__DRI_BUFFER_COUNT]; |
| 258 | struct { |
| 259 | #ifdef HAVE_WAYLAND_PLATFORM |
| 260 | struct wl_buffer *wl_buffer; |
Kristian Høgsberg | 664fe6d | 2013-02-02 07:40:51 -0500 | [diff] [blame] | 261 | __DRIimage *dri_image; |
Axel Davy | 4cd546d | 2015-05-01 01:16:24 +0200 | [diff] [blame] | 262 | /* for is_different_gpu case. NULL else */ |
| 263 | __DRIimage *linear_copy; |
Axel Davy | cdcfe48 | 2015-05-01 11:11:20 +0200 | [diff] [blame] | 264 | /* for swrast */ |
| 265 | void *data; |
| 266 | int data_size; |
Kristian Høgsberg | 90804e8 | 2012-12-13 23:30:45 -0500 | [diff] [blame] | 267 | #endif |
| 268 | #ifdef HAVE_DRM_PLATFORM |
| 269 | struct gbm_bo *bo; |
| 270 | #endif |
| 271 | int locked; |
| 272 | int age; |
Neil Roberts | 992a2db | 2013-11-15 13:50:50 +0000 | [diff] [blame] | 273 | } color_buffers[4], *back, *current; |
Ander Conselvan de Oliveira | 4a976b6 | 2012-01-25 16:24:17 +0200 | [diff] [blame] | 274 | #endif |
| 275 | |
Chia-I Wu | 9779f6f | 2011-08-05 14:39:18 +0900 | [diff] [blame] | 276 | #ifdef HAVE_ANDROID_PLATFORM |
Chia-I Wu | 75cc24c | 2011-11-25 11:59:02 +0800 | [diff] [blame] | 277 | struct ANativeWindow *window; |
| 278 | struct ANativeWindowBuffer *buffer; |
Chia-I Wu | 9779f6f | 2011-08-05 14:39:18 +0900 | [diff] [blame] | 279 | |
| 280 | /* EGL-owned buffers */ |
| 281 | __DRIbuffer *local_buffers[__DRI_BUFFER_COUNT]; |
| 282 | #endif |
Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 283 | }; |
| 284 | |
Benjamin Franzke | 93aea84 | 2011-02-04 12:39:40 +0100 | [diff] [blame] | 285 | |
Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 286 | struct dri2_egl_config |
| 287 | { |
| 288 | _EGLConfig base; |
Emil Velikov | 858f2f2 | 2015-09-13 12:25:27 +0100 | [diff] [blame] | 289 | const __DRIconfig *dri_single_config[2]; |
| 290 | const __DRIconfig *dri_double_config[2]; |
Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 291 | }; |
| 292 | |
| 293 | struct dri2_egl_image |
| 294 | { |
| 295 | _EGLImage base; |
| 296 | __DRIimage *dri_image; |
| 297 | }; |
| 298 | |
Marek Olšák | 9a0bda2 | 2015-04-10 10:56:02 +0200 | [diff] [blame] | 299 | struct dri2_egl_sync { |
| 300 | _EGLSync base; |
| 301 | int refcount; |
| 302 | void *fence; |
| 303 | }; |
| 304 | |
Neil Roberts | 992a2db | 2013-11-15 13:50:50 +0000 | [diff] [blame] | 305 | /* From xmlpool/options.h, user exposed so should be stable */ |
| 306 | #define DRI_CONF_VBLANK_NEVER 0 |
| 307 | #define DRI_CONF_VBLANK_DEF_INTERVAL_0 1 |
| 308 | #define DRI_CONF_VBLANK_DEF_INTERVAL_1 2 |
| 309 | #define DRI_CONF_VBLANK_ALWAYS_SYNC 3 |
| 310 | |
Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 311 | /* standard typecasts */ |
| 312 | _EGL_DRIVER_STANDARD_TYPECASTS(dri2_egl) |
| 313 | _EGL_DRIVER_TYPECAST(dri2_egl_image, _EGLImage, obj) |
Marek Olšák | 9a0bda2 | 2015-04-10 10:56:02 +0200 | [diff] [blame] | 314 | _EGL_DRIVER_TYPECAST(dri2_egl_sync, _EGLSync, obj) |
Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 315 | |
| 316 | extern const __DRIimageLookupExtension image_lookup_extension; |
Kristian Høgsberg | 9dc5de5 | 2011-02-02 22:21:13 -0500 | [diff] [blame] | 317 | extern const __DRIuseInvalidateExtension use_invalidate; |
Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 318 | |
| 319 | EGLBoolean |
| 320 | dri2_load_driver(_EGLDisplay *disp); |
| 321 | |
Benjamin Franzke | e5fc4c8 | 2011-05-30 10:50:52 +0200 | [diff] [blame] | 322 | /* Helper for platforms not using dri2_create_screen */ |
| 323 | void |
| 324 | dri2_setup_screen(_EGLDisplay *disp); |
| 325 | |
Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 326 | EGLBoolean |
Chia-I Wu | cf69eea | 2011-06-08 16:33:55 +0800 | [diff] [blame] | 327 | dri2_load_driver_swrast(_EGLDisplay *disp); |
| 328 | |
| 329 | EGLBoolean |
Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 330 | dri2_create_screen(_EGLDisplay *disp); |
| 331 | |
Boyan Ding | a25df54 | 2015-07-21 23:43:59 +0800 | [diff] [blame^] | 332 | __DRIdrawable * |
| 333 | dri2_surface_get_dri_drawable(_EGLSurface *surf); |
| 334 | |
Benjamin Franzke | e5fc4c8 | 2011-05-30 10:50:52 +0200 | [diff] [blame] | 335 | __DRIimage * |
| 336 | dri2_lookup_egl_image(__DRIscreen *screen, void *image, void *data); |
| 337 | |
Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 338 | struct dri2_egl_config * |
| 339 | dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id, |
Kristian Høgsberg | 44e584a | 2013-09-14 23:13:22 -0700 | [diff] [blame] | 340 | EGLint surface_type, const EGLint *attr_list, |
Chia-I Wu | 58911b8 | 2011-08-05 14:36:14 +0900 | [diff] [blame] | 341 | const unsigned int *rgba_masks); |
Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 342 | |
| 343 | _EGLImage * |
| 344 | dri2_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp, |
| 345 | _EGLContext *ctx, EGLenum target, |
| 346 | EGLClientBuffer buffer, const EGLint *attr_list); |
| 347 | |
| 348 | EGLBoolean |
| 349 | dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp); |
| 350 | |
Kristian Høgsberg | 9dc5de5 | 2011-02-02 22:21:13 -0500 | [diff] [blame] | 351 | EGLBoolean |
| 352 | dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp); |
| 353 | |
Benjamin Franzke | 93aea84 | 2011-02-04 12:39:40 +0100 | [diff] [blame] | 354 | EGLBoolean |
| 355 | dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp); |
| 356 | |
Chia-I Wu | 9779f6f | 2011-08-05 14:39:18 +0900 | [diff] [blame] | 357 | EGLBoolean |
| 358 | dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *disp); |
| 359 | |
Haixia Shi | 6b8accb | 2015-06-12 10:10:58 -0700 | [diff] [blame] | 360 | EGLBoolean |
| 361 | dri2_initialize_surfaceless(_EGLDriver *drv, _EGLDisplay *disp); |
| 362 | |
Eric Anholt | 70e8ccc | 2014-12-21 11:51:33 -0800 | [diff] [blame] | 363 | void |
| 364 | dri2_flush_drawable_for_swapbuffers(_EGLDisplay *disp, _EGLSurface *draw); |
| 365 | |
Marek Olšák | c2c2e9a | 2015-06-10 02:49:29 +0200 | [diff] [blame] | 366 | const __DRIconfig * |
| 367 | dri2_get_dri_config(struct dri2_egl_config *conf, EGLint surface_type, |
| 368 | EGLenum colorspace); |
| 369 | |
Kristian Høgsberg | 2889d96 | 2011-02-02 22:10:40 -0500 | [diff] [blame] | 370 | #endif /* EGL_DRI2_INCLUDED */ |