[Mesa-dev] [PATCH 18/21] i915: Conditionally build an i915g driver instead of two i915 drivers.

Johannes Obermayr johannesobermayr at gmx.de
Wed Sep 11 15:32:56 PDT 2013


---
 configure.ac                                 |  5 +++++
 src/gallium/targets/dri-i915/Makefile.am     | 15 +++++++--------
 src/gallium/targets/dri-i915/target.c        |  2 +-
 src/gallium/targets/egl-static/Makefile.am   |  4 +++-
 src/gallium/targets/egl-static/egl.c         |  2 +-
 src/gallium/targets/egl-static/egl_pipe.c    |  2 +-
 src/gallium/targets/pipe-loader/Makefile.am  | 11 ++++++-----
 src/gallium/targets/pipe-loader/pipe_i915.c  |  2 +-
 src/gallium/targets/xorg-i915/Makefile.am    | 16 +++++++++-------
 src/gallium/targets/xorg-i915/intel_target.c |  2 +-
 src/gallium/targets/xorg-i915/intel_xorg.c   |  4 ++--
 11 files changed, 37 insertions(+), 28 deletions(-)

diff --git a/configure.ac b/configure.ac
index 383150a..c600051 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1702,6 +1702,7 @@ fi
 AM_CONDITIONAL(NEED_NONNULL_WINSYS, test "x$NEED_NONNULL_WINSYS" = xyes)
 
 dnl Duplicates in GALLIUM_DRIVERS_DIRS are removed by sorting it after this block
+GALLIUM_I915_NAME=i915
 if test "x$with_gallium_drivers" != x; then
     gallium_drivers=`IFS=', '; echo $with_gallium_drivers`
     for driver in $gallium_drivers; do
@@ -1712,6 +1713,9 @@ if test "x$with_gallium_drivers" != x; then
             gallium_check_st "svga/drm" "dri-vmwgfx" "" "xa-vmwgfx"
             ;;
         xi915)
+            if test "x$HAVE_I915_DRI" = xyes; then
+                GALLIUM_I915_NAME=i915g
+            fi
             HAVE_GALLIUM_I915=yes
             PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
             GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 softpipe"
@@ -1804,6 +1808,7 @@ if test "x$with_gallium_drivers" != x; then
         esac
     done
 fi
+AC_SUBST([GALLIUM_I915_NAME])
 
 function strip_llvm_libs() {
     _libs=`$2`
diff --git a/src/gallium/targets/dri-i915/Makefile.am b/src/gallium/targets/dri-i915/Makefile.am
index 7ad3ff5..5f54bf3 100644
--- a/src/gallium/targets/dri-i915/Makefile.am
+++ b/src/gallium/targets/dri-i915/Makefile.am
@@ -25,7 +25,8 @@ include $(top_srcdir)/src/gallium/Automake.inc
 AM_CFLAGS = \
 	$(GALLIUM_CFLAGS) \
 	$(PTHREAD_CFLAGS) \
-	$(LIBDRM_CFLAGS)
+	$(LIBDRM_CFLAGS) \
+	-DI915_NAME=\"@GALLIUM_I915_NAME@\"
 
 AM_CPPFLAGS = \
 	-I$(top_srcdir)/src/gallium/drivers \
@@ -40,13 +41,13 @@ AM_CPPFLAGS = \
 
 dridir = $(DRI_DRIVER_INSTALL_DIR)
 
-dri_LTLIBRARIES = i915_dri.la
+dri_LTLIBRARIES = @GALLIUM_I915_NAME at _dri.la
 
-i915_dri_la_SOURCES = target.c
+ at GALLIUM_I915_NAME@_dri_la_SOURCES = target.c
 
-i915_dri_la_LDFLAGS = -Wl,--no-undefined -module -avoid-version -shared
+ at GALLIUM_I915_NAME@_dri_la_LDFLAGS = -Wl,--no-undefined -module -avoid-version -shared
 
-i915_dri_la_LIBADD = \
+ at GALLIUM_I915_NAME@_dri_la_LIBADD = \
 	$(top_builddir)/src/gallium/state_trackers/dri/drm/libdridrm.la \
 	$(top_builddir)/src/gallium/winsys/i915/drm/libi915drm.la \
 	$(top_builddir)/src/gallium/winsys/sw/wrapper/libwsw.la \
@@ -60,9 +61,7 @@ i915_dri_la_LIBADD = \
 	$(GALLIUM_DRI_LIB_DEPS) \
 	$(INTEL_LIBS)
 
-nodist_EXTRA_i915_dri_la_SOURCES = dummy.cpp
-
 if HAVE_MESA_LLVM
 AM_CPPFLAGS += -DGALLIUM_LLVMPIPE
-i915_dri_la_LIBADD += $(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la
+ at GALLIUM_I915_NAME@_dri_la_LIBADD += $(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la
 endif
diff --git a/src/gallium/targets/dri-i915/target.c b/src/gallium/targets/dri-i915/target.c
index 935eb0e..05dc254 100644
--- a/src/gallium/targets/dri-i915/target.c
+++ b/src/gallium/targets/dri-i915/target.c
@@ -26,4 +26,4 @@ create_screen(int fd)
    return screen;
 }
 
-DRM_DRIVER_DESCRIPTOR("i915", "i915", create_screen, NULL)
+DRM_DRIVER_DESCRIPTOR(I915_NAME, "i915", create_screen, NULL)
diff --git a/src/gallium/targets/egl-static/Makefile.am b/src/gallium/targets/egl-static/Makefile.am
index 015133c..daec14c 100644
--- a/src/gallium/targets/egl-static/Makefile.am
+++ b/src/gallium/targets/egl-static/Makefile.am
@@ -30,7 +30,9 @@
 #
 include $(top_srcdir)/src/gallium/Automake.inc
 
-AM_CFLAGS = $(PTHREAD_CFLAGS)
+AM_CFLAGS = $(PTHREAD_CFLAGS) \
+	-DI915_NAME=\"@GALLIUM_I915_NAME@\"
+
 AM_CPPFLAGS = \
 	$(GALLIUM_CFLAGS) \
 	-I$(top_srcdir)/include \
diff --git a/src/gallium/targets/egl-static/egl.c b/src/gallium/targets/egl-static/egl.c
index 0b59bdb..1af7c43 100644
--- a/src/gallium/targets/egl-static/egl.c
+++ b/src/gallium/targets/egl-static/egl.c
@@ -136,7 +136,7 @@ drm_fd_get_pci_id(int fd, int *vendor_id, int *chip_id)
       return FALSE;
    }
 
-   if (util_strcmp(version->name, "i915") == 0) {
+   if (util_strcmp(version->name, I915_NAME) == 0) {
       struct drm_i915_getparam gp;
       int ret;
 
diff --git a/src/gallium/targets/egl-static/egl_pipe.c b/src/gallium/targets/egl-static/egl_pipe.c
index e5100c1..f6bc188 100644
--- a/src/gallium/targets/egl-static/egl_pipe.c
+++ b/src/gallium/targets/egl-static/egl_pipe.c
@@ -227,7 +227,7 @@ pipe_freedreno_create_screen(int fd)
 struct pipe_screen *
 egl_pipe_create_drm_screen(const char *name, int fd)
 {
-   if (strcmp(name, "i915") == 0)
+   if (strcmp(name, I915_NAME) == 0)
       return pipe_i915_create_screen(fd);
    else if (strcmp(name, "i965") == 0)
       return pipe_ilo_create_screen(fd);
diff --git a/src/gallium/targets/pipe-loader/Makefile.am b/src/gallium/targets/pipe-loader/Makefile.am
index a21330f..189e026 100644
--- a/src/gallium/targets/pipe-loader/Makefile.am
+++ b/src/gallium/targets/pipe-loader/Makefile.am
@@ -30,7 +30,8 @@ AM_CPPFLAGS = \
 	 $(LIBDRM_CFLAGS) \
 	-DGALLIUM_RBUG \
 	-DGALLIUM_TRACE \
-	-DGALLIUM_GALAHAD
+	-DGALLIUM_GALAHAD \
+	-DI915_NAME=\"@GALLIUM_I915_NAME@\"
 
 mesalib_LTLIBRARIES =
 
@@ -45,15 +46,15 @@ PIPE_LIBS = \
 	-lm
 
 if HAVE_GALLIUM_I915
-mesalib_LTLIBRARIES += pipe_i915.la
-pipe_i915_la_SOURCES = pipe_i915.c
-pipe_i915_la_LIBADD = \
+mesalib_LTLIBRARIES += pipe_ at GALLIUM_I915_NAME@.la
+pipe_ at GALLIUM_I915_NAME@_la_SOURCES = pipe_i915.c
+pipe_ at GALLIUM_I915_NAME@_la_LIBADD = \
 	$(PIPE_LIBS) \
 	$(top_builddir)/src/gallium/winsys/i915/drm/libi915drm.la \
 	$(top_builddir)/src/gallium/drivers/i915/libi915.la \
 	$(LIBDRM_LIBS) \
 	$(INTEL_LIBS)
-pipe_i915_la_LDFLAGS = -Wl,--no-undefined -shared -module -avoid-version
+pipe_ at GALLIUM_I915_NAME@_la_LDFLAGS = -Wl,--no-undefined -shared -module -avoid-version
 endif
 
 if HAVE_GALLIUM_NOUVEAU
diff --git a/src/gallium/targets/pipe-loader/pipe_i915.c b/src/gallium/targets/pipe-loader/pipe_i915.c
index 85662cb..1754f9f 100644
--- a/src/gallium/targets/pipe-loader/pipe_i915.c
+++ b/src/gallium/targets/pipe-loader/pipe_i915.c
@@ -24,4 +24,4 @@ create_screen(int fd)
 }
 
 PUBLIC
-DRM_DRIVER_DESCRIPTOR("i915", "i915", create_screen, NULL)
+DRM_DRIVER_DESCRIPTOR(I915_NAME, "i915", create_screen, NULL)
diff --git a/src/gallium/targets/xorg-i915/Makefile.am b/src/gallium/targets/xorg-i915/Makefile.am
index f0f132d..36edac5 100644
--- a/src/gallium/targets/xorg-i915/Makefile.am
+++ b/src/gallium/targets/xorg-i915/Makefile.am
@@ -25,7 +25,9 @@ include $(top_srcdir)/src/gallium/Automake.inc
 AM_CFLAGS = \
 	$(GALLIUM_CFLAGS) \
 	$(PTHREAD_CFLAGS) \
-	$(XORG_CFLAGS)
+	$(XORG_CFLAGS) \
+	-DI915_NAME=\"@GALLIUM_I915_NAME@\"
+
 AM_CPPFLAGS = \
 	-I$(top_srcdir)/src/gallium/drivers \
 	-I$(top_srcdir)/src/gallium/winsys \
@@ -35,15 +37,15 @@ AM_CPPFLAGS = \
 	-DGALLIUM_GALAHAD
 
 xorgdir = $(XORG_DRIVER_INSTALL_DIR)
-xorg_LTLIBRARIES = i915_drv.la
+xorg_LTLIBRARIES = @GALLIUM_I915_NAME at _drv.la
 
-i915_drv_la_SOURCES = \
+ at GALLIUM_I915_NAME@_drv_la_SOURCES = \
 	intel_target.c \
 	intel_xorg.c
 
-i915_drv_la_LDFLAGS = -Wl,--no-undefined -module -avoid-version -shared
+ at GALLIUM_I915_NAME@_drv_la_LDFLAGS = -Wl,--no-undefined -module -avoid-version -shared
 
-i915_drv_la_LIBADD = \
+ at GALLIUM_I915_NAME@_drv_la_LIBADD = \
 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
 	$(top_builddir)/src/gallium/state_trackers/xorg/libxorgtracker.la \
 	$(top_builddir)/src/gallium/winsys/i915/drm/libi915drm.la \
@@ -56,9 +58,9 @@ i915_drv_la_LIBADD = \
 	$(LIBKMS_XORG_LIBS) \
 	$(INTEL_LIBS)
 
-nodist_EXTRA_i915_drv_la_SOURCES = dummy.cpp
+nodist_EXTRA_ at GALLIUM_I915_NAME@_drv_la_SOURCES = dummy.cpp
 
 if HAVE_MESA_LLVM
 AM_CPPFLAGS += -DGALLIUM_LLVMPIPE
-i915_drv_la_LIBADD += $(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la
+ at GALLIUM_I915_NAME@_drv_la_LIBADD += $(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la
 endif
diff --git a/src/gallium/targets/xorg-i915/intel_target.c b/src/gallium/targets/xorg-i915/intel_target.c
index 50efa21..5531cf9 100644
--- a/src/gallium/targets/xorg-i915/intel_target.c
+++ b/src/gallium/targets/xorg-i915/intel_target.c
@@ -23,4 +23,4 @@ create_screen(int fd)
    return screen;
 }
 
-DRM_DRIVER_DESCRIPTOR("i915", "i915", create_screen, NULL)
+DRM_DRIVER_DESCRIPTOR(I915_NAME, "i915", create_screen, NULL)
diff --git a/src/gallium/targets/xorg-i915/intel_xorg.c b/src/gallium/targets/xorg-i915/intel_xorg.c
index 32d4a54..3ddad97 100644
--- a/src/gallium/targets/xorg-i915/intel_xorg.c
+++ b/src/gallium/targets/xorg-i915/intel_xorg.c
@@ -52,7 +52,7 @@ static PciChipsets intel_xorg_pci_devices[] = {
 };
 
 static XF86ModuleVersionInfo intel_xorg_version = {
-    "i915",
+    I915_NAME,
     MODULEVENDORSTRING,
     MODINFOSTRING1,
     MODINFOSTRING2,
@@ -134,7 +134,7 @@ intel_xorg_pci_probe(DriverPtr driver,
 			       NULL, NULL, NULL, NULL, NULL);
     if (scrn != NULL) {
 	scrn->driverVersion = 1;
-	scrn->driverName = "i915";
+	scrn->driverName = I915_NAME;
 	scrn->name = "modesetting";
 	scrn->Probe = NULL;
 
-- 
1.8.1.4



More information about the mesa-dev mailing list