egl: Implement __DRI_BACKGROUND_CALLABLE
[mesa.git] / src / egl / drivers / dri2 / egl_dri2.h
index 85d4b85eae27331d75a9265bad393632fa46ec28..230c0663d3c06f79b7e512084b49d7d16286c26d 100644 (file)
@@ -80,8 +80,6 @@
 #include "eglimage.h"
 #include "eglsync.h"
 
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
-
 struct wl_buffer;
 
 struct dri2_egl_driver
@@ -201,7 +199,7 @@ struct dri2_egl_display
 
 #ifdef HAVE_X11_PLATFORM
    xcb_connection_t         *conn;
-   int                      screen;
+   xcb_screen_t             *screen;
    int                      swap_available;
 #ifdef HAVE_DRI3
    struct loader_dri3_extensions loader_dri3_ext;
@@ -210,6 +208,7 @@ struct dri2_egl_display
 
 #ifdef HAVE_WAYLAND_PLATFORM
    struct wl_display        *wl_dpy;
+   struct wl_display        *wl_dpy_wrapper;
    struct wl_registry       *wl_registry;
    struct wl_drm            *wl_server_drm;
    struct wl_drm            *wl_drm;
@@ -221,6 +220,10 @@ struct dri2_egl_display
    char                     *device_name;
 #endif
 
+#ifdef HAVE_ANDROID_PLATFORM
+   const gralloc_module_t *gralloc;
+#endif
+
    int                       is_render_node;
    int                       is_different_gpu;
 };
@@ -292,10 +295,20 @@ struct dri2_egl_surface
 #ifdef HAVE_ANDROID_PLATFORM
    struct ANativeWindow *window;
    struct ANativeWindowBuffer *buffer;
-   __DRIimage *dri_image;
+   __DRIimage *dri_image_back;
+   __DRIimage *dri_image_front;
 
    /* EGL-owned buffers */
    __DRIbuffer           *local_buffers[__DRI_BUFFER_COUNT];
+
+   /* Used to record all the buffers created by ANativeWindow and their ages.
+    * Usually Android uses at most triple buffers in ANativeWindow
+    * so hardcode the number of color_buffers to 3.
+    */
+   struct {
+      struct ANativeWindowBuffer *buffer;
+      int age;
+   } color_buffers[3], *back;
 #endif
 
 #if defined(HAVE_SURFACELESS_PLATFORM)
@@ -338,6 +351,7 @@ _EGL_DRIVER_TYPECAST(dri2_egl_sync, _EGLSync, obj)
 
 extern const __DRIimageLookupExtension image_lookup_extension;
 extern const __DRIuseInvalidateExtension use_invalidate;
+extern const __DRIbackgroundCallableExtension background_callable_extension;
 
 EGLBoolean
 dri2_load_driver(_EGLDisplay *disp);