[cairo] [PATCH 26/71] drm: made various drm-backends optional (buildtime)

Enrico Weigelt, metux IT consult enrico.weigelt at gr13.net
Mon Apr 17 16:57:05 UTC 2017


Signed-off-by: Enrico Weigelt, metux IT consult <enrico.weigelt at gr13.net>
---
 configure.ac         | 26 +++++++++++++++++++++++++
 src/Makefile.sources | 54 ++++++++++++++++++++++++++++++++++------------------
 src/drm/cairo-drm.c  |  9 +++++++++
 3 files changed, 71 insertions(+), 18 deletions(-)

diff --git a/configure.ac b/configure.ac
index 93953a7f2..5472efdcd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -299,6 +299,32 @@ CAIRO_ENABLE_SURFACE_BACKEND(drm, DRM, no, [
   drm_REQUIRES="libudev >= 136, libdrm >= 2.4"
   PKG_CHECK_MODULES(drm, $drm_REQUIRES, ,
    [use_drm="no (requires $drm_REQUIRES, udev is available from git://git.kernel.org/pub/scm/linux/hotplug/udev.git)"])
+  enable_cairo_surface_drm=1
+])
+
+CAIRO_ENABLE_SURFACE_BACKEND(drm_intel, DRM_INTEL, no, [
+  if test "$enable_cairo_surface_drm" != "1"; then
+    AC_MSG_ERROR([drm-intel backend needs drm backend])
+  fi
+  enable_cairo_surface_drm_intel=1
+])
+
+CAIRO_ENABLE_SURFACE_BACKEND(drm_i915, DRM_I915, no, [
+  if test "$enable_cairo_surface_drm_intel" != "1"; then
+    AC_MSG_ERROR([drm-i915 backend needs drm backend])
+  fi
+])
+
+CAIRO_ENABLE_SURFACE_BACKEND(drm_i965, DRM_I965, no, [
+  if test "$enable_cairo_surface_drm_intel" != "1"; then
+    AC_MSG_ERROR([drm-i965 backend needs drm backend])
+  fi
+])
+
+CAIRO_ENABLE_SURFACE_BACKEND(drm_radeon, DRM_RADEON, no, [
+  if test "$enable_cairo_surface_drm" != "1"; then
+    AC_MSG_ERROR([drm-radeon backend needs drm backend])
+  fi
 ])
 
 CAIRO_ENABLE_SURFACE_BACKEND(gallium, Gallium3D, no, [
diff --git a/src/Makefile.sources b/src/Makefile.sources
index b1e3eb13e..693124314 100644
--- a/src/Makefile.sources
+++ b/src/Makefile.sources
@@ -414,36 +414,54 @@ cairo_wgl_sources += cairo-wgl-context.c
 cairo_directfb_headers = cairo-directfb.h
 cairo_directfb_sources = cairo-directfb-surface.c
 
-cairo_drm_headers = cairo-drm.h
-cairo_drm_private = drm/cairo-drm-private.h \
+cairo_drm_i915_private = \
+		    drm/cairo-drm-i915-private.h
+
+cairo_drm_i915_sources = \
+		    drm/cairo-drm-i915-surface.c \
+		    drm/cairo-drm-i915-glyphs.c \
+		    drm/cairo-drm-i915-shader.c \
+		    drm/cairo-drm-i915-spans.c
+
+cairo_drm_i965_private = \
+		    drm/cairo-drm-i965-private.h
+
+cairo_drm_i965_sources = \
+		    drm/cairo-drm-i965-surface.c \
+		    drm/cairo-drm-i965-glyphs.c \
+		    drm/cairo-drm-i965-shader.c \
+		    drm/cairo-drm-i965-spans.c
+
+cairo_drm_intel_private = \
 		    drm/cairo-drm-intel-private.h \
 		    drm/cairo-drm-intel-brw-defines.h \
 		    drm/cairo-drm-intel-brw-structs.h \
 		    drm/cairo-drm-intel-brw-eu.h \
 		    drm/cairo-drm-intel-command-private.h \
-		    drm/cairo-drm-intel-ioctl-private.h \
-		    drm/cairo-drm-i915-private.h \
-		    drm/cairo-drm-i965-private.h \
-		    drm/cairo-drm-radeon-private.h
-cairo_drm_sources = drm/cairo-drm.c \
-		    drm/cairo-drm-bo.c \
-		    drm/cairo-drm-surface.c \
+		    drm/cairo-drm-intel-ioctl-private.h
+
+cairo_drm_intel_sources = \
 		    drm/cairo-drm-intel.c \
 		    drm/cairo-drm-intel-debug.c \
 		    drm/cairo-drm-intel-surface.c \
-		    drm/cairo-drm-i915-surface.c \
-		    drm/cairo-drm-i915-glyphs.c \
-		    drm/cairo-drm-i915-shader.c \
-		    drm/cairo-drm-i915-spans.c \
-		    drm/cairo-drm-i965-surface.c \
-		    drm/cairo-drm-i965-glyphs.c \
-		    drm/cairo-drm-i965-shader.c \
-		    drm/cairo-drm-i965-spans.c \
 		    drm/cairo-drm-intel-brw-eu.c \
 		    drm/cairo-drm-intel-brw-eu-emit.c \
-		    drm/cairo-drm-intel-brw-eu-util.c \
+		    drm/cairo-drm-intel-brw-eu-util.c
+
+cairo_drm_radeon_private = \
+		    drm/cairo-drm-radeon-private.h
+
+cairo_drm_radeon_sources = \
 		    drm/cairo-drm-radeon.c \
 		    drm/cairo-drm-radeon-surface.c
+
+cairo_drm_headers = cairo-drm.h
+cairo_drm_private = drm/cairo-drm-private.h
+
+cairo_drm_sources = drm/cairo-drm.c \
+		    drm/cairo-drm-bo.c \
+		    drm/cairo-drm-surface.c
+
 cairo_gallium_sources = drm/cairo-drm-gallium-surface.c
 
 cairo_script_headers = cairo-script.h
diff --git a/src/drm/cairo-drm.c b/src/drm/cairo-drm.c
index 161874c7f..418c3c6d5 100644
--- a/src/drm/cairo-drm.c
+++ b/src/drm/cairo-drm.c
@@ -147,6 +147,7 @@ cairo_drm_device_get (struct udev_device *device)
 	uint32_t chip_id;
 	cairo_drm_device_create_func_t create_func;
     } driver_map[] = {
+#if CAIRO_HAS_DRM_I965_SURFACE
 	{ 0x8086, 0x29a2, _cairo_drm_i965_device_create }, /* I965_G */
 	{ 0x8086, 0x2982, _cairo_drm_i965_device_create }, /* G35_G */
 	{ 0x8086, 0x2992, _cairo_drm_i965_device_create }, /* I965_Q */
@@ -158,7 +159,9 @@ cairo_drm_device_get (struct udev_device *device)
 	{ 0x8086, 0x2e12, _cairo_drm_i965_device_create }, /* Q45_G */
 	{ 0x8086, 0x2e32, _cairo_drm_i965_device_create }, /* G41_G */
 	{ 0x8086, 0x2a42, _cairo_drm_i965_device_create }, /* GM45_GM */
+#endif
 
+#if CAIRO_HAS_DRM_I915_SURFACE
 	{ 0x8086, 0x2582, _cairo_drm_i915_device_create }, /* I915_G */
 	{ 0x8086, 0x2592, _cairo_drm_i915_device_create }, /* I915_GM */
 	{ 0x8086, 0x258a, _cairo_drm_i915_device_create }, /* E7221_G */
@@ -170,12 +173,18 @@ cairo_drm_device_get (struct udev_device *device)
 	{ 0x8086, 0x29d2, _cairo_drm_i915_device_create }, /* Q33_G */
 	{ 0x8086, 0xa011, _cairo_drm_i915_device_create }, /* IGD_GM */
 	{ 0x8086, 0xa001, _cairo_drm_i915_device_create }, /* IGD_G */
+#endif
 
 	/* XXX i830 */
 
+#if CAIRO_HAS_DRM_INTEL_SURFACE
 	{ 0x8086, ~0, _cairo_drm_intel_device_create },
+#endif
 
+#if CAIRO_HAS_DRM_RADEON_SURFACE
 	{ 0x1002, ~0, _cairo_drm_radeon_device_create },
+#endif
+
 #if CAIRO_HAS_GALLIUM_SURFACE
 	{ ~0, ~0, _cairo_drm_gallium_device_create },
 #endif
-- 
2.11.0.rc0.7.gbe5a750



More information about the cairo mailing list