#ifdef HAVE_WAYLAND_PLATFORM
#include <wayland-client.h>
-#include "wayland-egl-priv.h"
+#include "wayland-egl-backend.h"
+/* forward declarations of protocol elements */
+struct zwp_linux_dmabuf_v1;
#endif
#include <GL/gl.h>
#include "eglimage.h"
#include "eglsync.h"
-struct wl_buffer;
-
-struct dri2_egl_driver
-{
- _EGLDriver base;
+#include "util/u_vector.h"
- void *handle;
- _EGLProc (*get_proc_address)(const char *procname);
- void (*glFlush)(void);
-};
+struct wl_buffer;
struct dri2_egl_display_vtbl {
int (*authenticate)(_EGLDisplay *disp, uint32_t id);
EGLuint64KHR *sbc);
__DRIdrawable *(*get_dri_drawable)(_EGLSurface *surf);
+
+ void (*close_screen_notify)(_EGLDisplay *dpy);
};
struct dri2_egl_display
const __DRIdri2Extension *dri2;
const __DRIswrastExtension *swrast;
const __DRI2flushExtension *flush;
+ const __DRI2flushControlExtension *flush_control;
const __DRItexBufferExtension *tex_buffer;
const __DRIimageExtension *image;
const __DRIrobustnessExtension *robustness;
+ const __DRInoErrorExtension *no_error;
const __DRI2configQueryExtension *config;
const __DRI2fenceExtension *fence;
const __DRI2rendererQueryExtension *rendererQuery;
struct wl_drm *wl_drm;
struct wl_shm *wl_shm;
struct wl_event_queue *wl_queue;
+ struct zwp_linux_dmabuf_v1 *wl_dmabuf;
+ struct {
+ struct u_vector xrgb2101010;
+ struct u_vector argb2101010;
+ struct u_vector xrgb8888;
+ struct u_vector argb8888;
+ struct u_vector rgb565;
+ } wl_modifiers;
bool authenticated;
int formats;
uint32_t capabilities;
_EGLSurface base;
__DRIdrawable *dri_drawable;
__DRIbuffer buffers[5];
- int buffer_count;
bool have_fake_front;
#ifdef HAVE_X11_PLATFORM
struct gbm_dri_surface *gbm_surf;
#endif
+ /* EGL-owned buffers */
+ __DRIbuffer *local_buffers[__DRI_BUFFER_COUNT];
+
#if defined(HAVE_WAYLAND_PLATFORM) || defined(HAVE_DRM_PLATFORM)
- __DRIbuffer *dri_buffers[__DRI_BUFFER_COUNT];
struct {
#ifdef HAVE_WAYLAND_PLATFORM
struct wl_buffer *wl_buffer;
__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.
__DRIimage *front;
unsigned int visual;
#endif
+ int out_fence_fd;
+ EGLBoolean enable_out_fence;
};
struct dri2_egl_config
void
dri2_setup_screen(_EGLDisplay *disp);
+void
+dri2_setup_swap_interval(_EGLDisplay *disp, int max_swap_interval);
+
EGLBoolean
dri2_load_driver_swrast(_EGLDisplay *disp);
dri2_create_image_dma_buf(_EGLDisplay *disp, _EGLContext *ctx,
EGLClientBuffer buffer, const EGLint *attr_list);
+#ifdef HAVE_X11_PLATFORM
EGLBoolean
dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp);
+void
+dri2_teardown_x11(struct dri2_egl_display *dri2_dpy);
+#else
+static inline EGLBoolean
+dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp)
+{
+ return _eglError(EGL_NOT_INITIALIZED, "X11 platform not built");
+}
+static inline void
+dri2_teardown_x11(struct dri2_egl_display *dri2_dpy) {}
+#endif
+#ifdef HAVE_DRM_PLATFORM
EGLBoolean
dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp);
+void
+dri2_teardown_drm(struct dri2_egl_display *dri2_dpy);
+#else
+static inline EGLBoolean
+dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
+{
+ return _eglError(EGL_NOT_INITIALIZED, "GBM/DRM platform not built");
+}
+static inline void
+dri2_teardown_drm(struct dri2_egl_display *dri2_dpy) {}
+#endif
+#ifdef HAVE_WAYLAND_PLATFORM
EGLBoolean
dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp);
+void
+dri2_teardown_wayland(struct dri2_egl_display *dri2_dpy);
+#else
+static inline EGLBoolean
+dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
+{
+ return _eglError(EGL_NOT_INITIALIZED, "Wayland platform not built");
+}
+static inline void
+dri2_teardown_wayland(struct dri2_egl_display *dri2_dpy) {}
+#endif
+#ifdef HAVE_ANDROID_PLATFORM
EGLBoolean
dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *disp);
+#else
+static inline EGLBoolean
+dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *disp)
+{
+ return _eglError(EGL_NOT_INITIALIZED, "Android platform not built");
+}
+#endif
+#ifdef HAVE_SURFACELESS_PLATFORM
EGLBoolean
dri2_initialize_surfaceless(_EGLDriver *drv, _EGLDisplay *disp);
+#else
+static inline EGLBoolean
+dri2_initialize_surfaceless(_EGLDriver *drv, _EGLDisplay *disp)
+{
+ return _eglError(EGL_NOT_INITIALIZED, "Surfaceless platform not built");
+}
+#endif
void
dri2_flush_drawable_for_swapbuffers(_EGLDisplay *disp, _EGLSurface *draw);
void
dri2_display_destroy(_EGLDisplay *disp);
+__DRIbuffer *
+dri2_egl_surface_alloc_local_buffer(struct dri2_egl_surface *dri2_surf,
+ unsigned int att, unsigned int format);
+
+void
+dri2_egl_surface_free_local_buffers(struct dri2_egl_surface *dri2_surf);
+
+EGLBoolean
+dri2_init_surface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type,
+ _EGLConfig *conf, const EGLint *attrib_list, EGLBoolean enable_out_fence);
+
+void
+dri2_fini_surface(_EGLSurface *surf);
+
#endif /* EGL_DRI2_INCLUDED */