Mesa (master): egl_dri2: Make it possible to not compile in the X11 platform
Kristian Høgsberg
krh at kemper.freedesktop.org
Fri May 13 13:34:26 UTC 2011
Module: Mesa
Branch: master
Commit: 93aea63a33c575bbce80acad391e810acc2f3e94
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=93aea63a33c575bbce80acad391e810acc2f3e94
Author: Kristian Høgsberg <krh at bitplanet.net>
Date: Wed May 11 13:58:37 2011 -0400
egl_dri2: Make it possible to not compile in the X11 platform
---
src/egl/drivers/dri2/Makefile | 11 ++++++++---
src/egl/drivers/dri2/egl_dri2.c | 4 ++++
src/egl/drivers/dri2/egl_dri2.h | 14 +++++++++++---
src/egl/main/Makefile | 6 +++++-
4 files changed, 28 insertions(+), 7 deletions(-)
diff --git a/src/egl/drivers/dri2/Makefile b/src/egl/drivers/dri2/Makefile
index 4783975..447babd 100644
--- a/src/egl/drivers/dri2/Makefile
+++ b/src/egl/drivers/dri2/Makefile
@@ -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) \
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index d77f0ed..10309e6 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -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;
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 99f990a..efcb366 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -28,10 +28,12 @@
#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
diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile
index 820788d..cb8f055 100644
--- a/src/egl/main/Makefile
+++ b/src/egl/main/Makefile
@@ -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
More information about the mesa-commit
mailing list