egl_dri2: Make it possible to not compile in the X11 platform
authorKristian Høgsberg <krh@bitplanet.net>
Wed, 11 May 2011 17:58:37 +0000 (13:58 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Fri, 13 May 2011 13:31:09 +0000 (09:31 -0400)
src/egl/drivers/dri2/Makefile
src/egl/drivers/dri2/egl_dri2.c
src/egl/drivers/dri2/egl_dri2.h
src/egl/main/Makefile

index 4783975852a28e0914139a3f9615b9be30932c5a..447babd6747ba2efb8565a314f50e6d41975cb67 100644 (file)
@@ -4,18 +4,17 @@ TOP = ../../../..
 include $(TOP)/configs/current
 
 EGL_DRIVER = egl_dri2
-EGL_SOURCES = egl_dri2.c platform_x11.c platform_drm.c
+EGL_SOURCES = egl_dri2.c platform_drm.c
 
 EGL_INCLUDES = \
        -I$(TOP)/include \
        -I$(TOP)/src/egl/main \
        -I$(TOP)/src/mapi \
        -DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\" \
-       $(XCB_DRI2_CFLAGS) \
        $(LIBUDEV_CFLAGS) \
        $(LIBDRM_CFLAGS)
 
-EGL_LIBS = $(XCB_DRI2_LIBS) $(LIBUDEV_LIBS) $(DLOPEN_LIBS) $(LIBDRM_LIB)
+EGL_LIBS = $(LIBUDEV_LIBS) $(DLOPEN_LIBS) $(LIBDRM_LIB)
 
 EGL_CFLAGS = -D_EGL_MAIN=_eglBuiltInDriverDRI2
 EGL_BUILTIN = true
@@ -24,6 +23,12 @@ ifeq ($(SHARED_GLAPI),1)
 EGL_CFLAGS += -DHAVE_SHARED_GLAPI
 endif
 
+ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
+EGL_SOURCES += platform_x11.c
+EGL_INCLUDES += -DHAVE_X11_PLATFORM $(XCB_DRI2_CFLAGS)
+EGL_LIBS +=  $(XCB_DRI2_LIBS)
+endif
+
 ifneq ($(findstring wayland, $(EGL_PLATFORMS)),)
 EGL_SOURCES += platform_wayland.c
 EGL_INCLUDES += -DHAVE_WAYLAND_PLATFORM $(WAYLAND_CFLAGS) \
index d77f0ed67d14bdc7fb083eb1e40a062878204966..10309e6eeaf06e32c13555b7aa7aab1071da2588 100644 (file)
@@ -490,10 +490,12 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp)
       return EGL_FALSE;
 
    switch (disp->Platform) {
+#ifdef HAVE_X11_PLATFORM
    case _EGL_PLATFORM_X11:
       if (disp->Options.TestOnly)
          return EGL_TRUE;
       return dri2_initialize_x11(drv, disp);
+#endif
 
 #ifdef HAVE_LIBUDEV
    case _EGL_PLATFORM_DRM:
@@ -528,8 +530,10 @@ dri2_terminate(_EGLDriver *drv, _EGLDisplay *disp)
    if (dri2_dpy->fd)
       close(dri2_dpy->fd);
    dlclose(dri2_dpy->driver);
+#ifdef HAVE_X11_PLATFORM
    if (disp->PlatformDisplay == NULL)
       xcb_disconnect(dri2_dpy->conn);
+#endif
    free(dri2_dpy);
    disp->DriverData = NULL;
 
index 99f990ac688c7228437e3de6f4bf34f0eba48ff3..efcb366568e4e5fba08ee33934c1a2ce472ee32a 100644 (file)
 #ifndef EGL_DRI2_INCLUDED
 #define EGL_DRI2_INCLUDED
 
+#ifdef HAVE_X11_PLATFORM
 #include <xcb/xcb.h>
 #include <xcb/dri2.h>
 #include <xcb/xfixes.h>
 #include <X11/Xlib-xcb.h>
+#endif
 
 #ifdef HAVE_WAYLAND_PLATFORM
 #include <wayland-client.h>
@@ -64,7 +66,6 @@ struct dri2_egl_driver
 
 struct dri2_egl_display
 {
-   xcb_connection_t         *conn;
    int                       dri2_major;
    int                       dri2_minor;
    __DRIscreen              *dri_screen;
@@ -84,6 +85,11 @@ struct dri2_egl_display
    __DRIdri2LoaderExtension    dri2_loader_extension;
    __DRIswrastLoaderExtension  swrast_loader_extension;
    const __DRIextension     *extensions[3];
+
+#ifdef HAVE_X11_PLATFORM
+   xcb_connection_t         *conn;
+#endif
+
 #ifdef HAVE_WAYLAND_PLATFORM
    struct wl_display        *wl_dpy;
    struct wl_drm            *wl_server_drm;
@@ -120,17 +126,19 @@ struct dri2_egl_surface
 {
    _EGLSurface          base;
    __DRIdrawable       *dri_drawable;
-   xcb_drawable_t       drawable;
    __DRIbuffer          buffers[5];
    int                  buffer_count;
-   xcb_xfixes_region_t  region;
    int                  have_fake_front;
    int                  swap_interval;
 
+#ifdef HAVE_X11_PLATFORM
+   xcb_drawable_t       drawable;
+   xcb_xfixes_region_t  region;
    int                  depth;
    int                  bytes_per_pixel;
    xcb_gcontext_t       gc;
    xcb_gcontext_t       swapgc;
+#endif
 
    enum dri2_surface_type type;
 #ifdef HAVE_WAYLAND_PLATFORM
index 820788d696b42081e6612437c356d0e229b73072..cb8f05512937e3affcd0e80f4a7ee3c7da2a3e47 100644 (file)
@@ -58,11 +58,15 @@ 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 x11, $(EGL_PLATFORMS)),)
+EGL_LIB_DEPS += $(XCB_DRI2_LIBS)
+endif
 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)
+EGL_LIB_DEPS += $(LIBUDEV_LIBS) $(DLOPEN_LIBS) $(LIBDRM_LIB) $(WAYLAND_LIBS)
 endif
+
 ifeq ($(filter glx, $(EGL_DRIVERS_DIRS)),glx)
 LOCAL_CFLAGS += -D_EGL_BUILT_IN_DRIVER_GLX
 LOCAL_LIBS += $(TOP)/src/egl/drivers/glx/libegl_glx.a