From 6b369c4c7cd8a52f99bbff2a57fb316b33a87495 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Mon, 21 Feb 2011 16:22:34 +0100 Subject: egl: Add EGL_WL_bind_wayland_display --- src/egl/main/Makefile | 3 +++ src/egl/main/eglapi.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/egl/main/eglapi.h | 11 +++++++++++ src/egl/main/egldisplay.h | 2 ++ src/egl/main/eglmisc.c | 2 ++ 5 files changed, 62 insertions(+) (limited to 'src/egl/main') diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile index a5b92995020..820788d696b 100644 --- a/src/egl/main/Makefile +++ b/src/egl/main/Makefile @@ -58,6 +58,9 @@ LOCAL_LIBS = ifeq ($(filter dri2, $(EGL_DRIVERS_DIRS)),dri2) LOCAL_CFLAGS += -D_EGL_BUILT_IN_DRIVER_DRI2 LOCAL_LIBS += $(TOP)/src/egl/drivers/dri2/libegl_dri2.a +ifneq ($(findstring wayland, $(EGL_PLATFORMS)),) +LOCAL_LIBS += $(TOP)/src/egl/wayland/wayland-drm/libwayland-drm.a +endif EGL_LIB_DEPS += $(XCB_DRI2_LIBS) $(LIBUDEV_LIBS) $(DLOPEN_LIBS) $(LIBDRM_LIB) $(WAYLAND_LIBS) endif ifeq ($(filter glx, $(EGL_DRIVERS_DIRS)),glx) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 4e64ce6f718..19dfd574268 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -913,6 +913,10 @@ eglGetProcAddress(const char *procname) #ifdef EGL_MESA_drm_image { "eglCreateDRMImageMESA", (_EGLProc) eglCreateDRMImageMESA }, { "eglExportDRMImageMESA", (_EGLProc) eglExportDRMImageMESA }, +#endif +#ifdef EGL_WL_bind_display + { "eglBindWaylandDisplayWL", (_EGLProc) eglBindWaylandDisplayWL }, + { "eglUnbindWaylandDisplayWL", (_EGLProc) eglUnbindWaylandDisplayWL }, #endif { NULL, NULL } }; @@ -1491,3 +1495,43 @@ eglExportDRMImageMESA(EGLDisplay dpy, EGLImageKHR image, } #endif + +#ifdef EGL_WL_bind_wayland_display +struct wl_display; + +EGLBoolean EGLAPIENTRY +eglBindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display) +{ + _EGLDisplay *disp = _eglLockDisplay(dpy); + _EGLDriver *drv; + EGLBoolean ret; + + _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); + assert(disp->Extensions.WL_bind_wayland_display); + + if (!display) + RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); + + ret = drv->API.BindWaylandDisplayWL(drv, disp, display); + + RETURN_EGL_EVAL(disp, ret); +} + +EGLBoolean EGLAPIENTRY +eglUnbindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display) +{ + _EGLDisplay *disp = _eglLockDisplay(dpy); + _EGLDriver *drv; + EGLBoolean ret; + + _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); + assert(disp->Extensions.WL_bind_wayland_display); + + if (!display) + RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); + + ret = drv->API.UnbindWaylandDisplayWL(drv, disp, display); + + RETURN_EGL_EVAL(disp, ret); +} +#endif diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h index 01492082f66..c9913f10a10 100644 --- a/src/egl/main/eglapi.h +++ b/src/egl/main/eglapi.h @@ -95,6 +95,12 @@ typedef _EGLImage *(*CreateDRMImageMESA_t)(_EGLDriver *drv, _EGLDisplay *disp, c typedef EGLBoolean (*ExportDRMImageMESA_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *img, EGLint *name, EGLint *handle, EGLint *stride); #endif +#ifdef EGL_WL_bind_wayland_display +struct wl_display; +typedef EGLBoolean (*BindWaylandDisplayWL_t)(_EGLDriver *drv, _EGLDisplay *disp, struct wl_display *display); +typedef EGLBoolean (*UnbindWaylandDisplayWL_t)(_EGLDriver *drv, _EGLDisplay *disp, struct wl_display *display); +#endif + /** * The API dispatcher jumps through these functions */ @@ -169,6 +175,11 @@ struct _egl_api CreateDRMImageMESA_t CreateDRMImageMESA; ExportDRMImageMESA_t ExportDRMImageMESA; #endif + +#ifdef EGL_WL_bind_wayland_display + BindWaylandDisplayWL_t BindWaylandDisplayWL; + UnbindWaylandDisplayWL_t UnbindWaylandDisplayWL; +#endif }; #endif /* EGLAPI_INCLUDED */ diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h index ce035eb2ef1..97ae2b01ba0 100644 --- a/src/egl/main/egldisplay.h +++ b/src/egl/main/egldisplay.h @@ -58,6 +58,8 @@ struct _egl_extensions EGLBoolean MESA_drm_display; EGLBoolean MESA_drm_image; + EGLBoolean WL_bind_wayland_display; + EGLBoolean KHR_image_base; EGLBoolean KHR_image_pixmap; EGLBoolean KHR_vg_parent_image; diff --git a/src/egl/main/eglmisc.c b/src/egl/main/eglmisc.c index f8ba5f33eb9..6bb2498eef4 100644 --- a/src/egl/main/eglmisc.c +++ b/src/egl/main/eglmisc.c @@ -89,6 +89,8 @@ _eglUpdateExtensionsString(_EGLDisplay *dpy) _EGL_CHECK_EXTENSION(MESA_drm_display); _EGL_CHECK_EXTENSION(MESA_drm_image); + _EGL_CHECK_EXTENSION(WL_bind_wayland_display); + _EGL_CHECK_EXTENSION(KHR_image_base); _EGL_CHECK_EXTENSION(KHR_image_pixmap); if (dpy->Extensions.KHR_image_base && dpy->Extensions.KHR_image_pixmap) -- cgit v1.2.3