Make DRI dependencies and build depend on the target
authorJon TURNEY <jon.turney@dronecode.org.uk>
Mon, 12 May 2014 09:17:06 +0000 (10:17 +0100)
committerJon TURNEY <jon.turney@dronecode.org.uk>
Fri, 23 May 2014 14:24:04 +0000 (15:24 +0100)
- Don't require xcb-dri[23] etc. if we aren't building for a target with DRM, as
we won't be using dri[23]

- Enable a more fine-grained control of what DRI code is built, so that a libGL
using direct swrast can be built on targets which don't have DRM.

The HAVE_DRI automake conditional is retired in favour of a number of other
conditionals:

HAVE_DRI2 enables building of code using the DRI2 interface (and possibly DRI3
with HAVE_DRI3)

HAVE_DRISW enables building of DRI swrast

HAVE_DRICOMMON enables building of target-independent DRI code, and also enables
some makefile cases where a more detailled decision is made at a lower level.

HAVE_APPLEDRI enables building of an Apple-specific direct rendering interface,
still which requires additional fixing up to build properly.

v2:
Place xfont.c and drisw_glx.c into correct categories.
Update 'make check' as well

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
13 files changed:
configure.ac
src/gallium/state_trackers/Makefile.am
src/gallium/state_trackers/dri/Makefile.am
src/gallium/targets/Makefile.am
src/gallium/targets/gbm/Makefile.am
src/gallium/targets/opencl/Makefile.am
src/gallium/targets/xa/Makefile.am
src/gallium/tests/trivial/Makefile.am
src/gallium/winsys/Makefile.am
src/gbm/Makefile.am
src/glx/Makefile.am
src/glx/tests/Makefile.am
src/mesa/Makefile.am

index 675a4a67faa93ddeecb6ab6a6a09843c56cfb188..b91520246bb5d3d5b2a0a445e0fa837c8fef48cd 100644 (file)
@@ -786,8 +786,22 @@ fi
 
 AM_CONDITIONAL(HAVE_DRI_GLX, test "x$enable_glx" = xyes -a \
                                   "x$enable_dri" = xyes)
-AM_CONDITIONAL(HAVE_DRI, test "x$enable_dri" = xyes)
-AM_CONDITIONAL(HAVE_DRI3, test "x$enable_dri3" = xyes)
+
+# Select which platform-dependent DRI code gets built
+case "$host_os" in
+darwin*)
+    dri_platform='apple' ;;
+gnu*|mingw*|cygwin*)
+    dri_platform='none' ;;
+*)
+    dri_platform='drm' ;;
+esac
+
+AM_CONDITIONAL(HAVE_DRICOMMON, test "x$enable_dri" = xyes )
+AM_CONDITIONAL(HAVE_DRISW, test "x$enable_dri" = xyes )
+AM_CONDITIONAL(HAVE_DRI2, test "x$enable_dri" = xyes && test "x$dri_platform" = xdrm )
+AM_CONDITIONAL(HAVE_DRI3, test "x$enable_dri3" = xyes && test "x$dri_platform" = xdrm )
+AM_CONDITIONAL(HAVE_APPLEDRI, test "x$enable_dri" = xyes && test "x$dri_platform" = xapple )
 
 AC_ARG_ENABLE([shared-glapi],
     [AS_HELP_STRING([--enable-shared-glapi],
@@ -912,23 +926,30 @@ xyesyes)
 xyesno)
     # DRI-based GLX
     PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
-    if test x"$driglx_direct" = xyes; then
-        if test "x$have_libdrm" != xyes; then
-            AC_MSG_ERROR([Direct rendering requires libdrm >= $LIBDRM_REQUIRED])
-        fi
-        PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
-        GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV libdrm >= $LIBDRM_REQUIRED"
-        if test x"$enable_dri3" = xyes; then
-            PKG_CHECK_MODULES([DRI3PROTO], [dri3proto >= $DRI3PROTO_REQUIRED])
-            PKG_CHECK_MODULES([PRESENTPROTO], [presentproto >= $PRESENTPROTO_REQUIRED])
-        fi
-    fi
 
     # find the DRI deps for libGL
-    dri_modules="x11 xext xdamage xfixes x11-xcb xcb-glx >= $XCBGLX_REQUIRED xcb-dri2 >= $XCBDRI2_REQUIRED"
+    dri_modules="x11 xext xdamage xfixes x11-xcb xcb-glx >= $XCBGLX_REQUIRED"
 
-    if test x"$enable_dri3" = xyes; then
-        dri_modules="$dri_modules xcb-dri3 xcb-present xcb-sync xshmfence >= $XSHMFENCE_REQUIRED"
+    if test x"$driglx_direct" = xyes; then
+        if test x"$dri_platform" = xdrm ; then
+            if test "x$have_libdrm" != xyes; then
+               AC_MSG_ERROR([Direct rendering requires libdrm >= $LIBDRM_REQUIRED])
+            fi
+
+            PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
+            GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV libdrm >= $LIBDRM_REQUIRED"
+            if test x"$enable_dri3" = xyes; then
+               PKG_CHECK_MODULES([DRI3PROTO], [dri3proto >= $DRI3PROTO_REQUIRED])
+               PKG_CHECK_MODULES([PRESENTPROTO], [presentproto >= $PRESENTPROTO_REQUIRED])
+            fi
+
+            if test x"$enable_dri" = xyes; then
+               dri_modules="$dri_modules xcb-dri2 >= $XCBDRI2_REQUIRED"
+            fi
+
+            if test x"$enable_dri3" = xyes; then
+               dri_modules="$dri_modules xcb-dri3 xcb-present xcb-sync xshmfence >= $XSHMFENCE_REQUIRED"
+            fi
     fi
 
     # add xf86vidmode if available
@@ -2283,7 +2304,9 @@ xnono)
         ;;
 esac
 
+echo ""
 if test "x$enable_dri" != xno; then
+        echo "        DRI platform:    $dri_platform"
         if test -z "$DRI_DIRS"; then
             echo "        DRI drivers:     no"
         else
index 209856041eee5e792146224a5baed1eba650ce0b..3ced6adb482610f453753114e4529af6233aa0bb 100644 (file)
@@ -29,7 +29,7 @@ if HAVE_GALLIUM_OSMESA
 SUBDIRS += osmesa
 endif
 
-if HAVE_DRI
+if HAVE_DRICOMMON
 SUBDIRS += dri
 endif
 
index 9428b555512210faf20937d9de9fbc8c68029241..b89d02f2a2b3c2ea9d26b2187e8ed3cfeb768a05 100644 (file)
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 # DEALINGS IN THE SOFTWARE.
 
-SUBDIRS = sw
+SUBDIRS =
+
+if HAVE_DRISW
+SUBDIRS += sw
+endif
 
 if HAVE_LIBDRM
 SUBDIRS += drm
index 5023dbc3bff32a706c4bf269189c339d92f78e10..36d359ce77291340153adeedb5fe9b73eb1d1ad6 100644 (file)
@@ -43,37 +43,37 @@ SUBDIRS += opencl
 endif
 
 if HAVE_GALLIUM_SVGA
-if HAVE_DRI
+if HAVE_DRI2
 SUBDIRS += dri-vmwgfx
 endif
 endif
 
 if HAVE_GALLIUM_FREEDRENO
-if HAVE_DRI
+if HAVE_DRI2
 SUBDIRS += dri-freedreno
 endif
 endif
 
 if HAVE_GALLIUM_I915
-if HAVE_DRI
+if HAVE_DRI2
 SUBDIRS += dri-i915
 endif
 endif
 
 if HAVE_GALLIUM_ILO
-if HAVE_DRI
+if HAVE_DRI2
 SUBDIRS += dri-ilo
 endif
 endif
 
 if HAVE_GALLIUM_R300
-if HAVE_DRI
+if HAVE_DRI2
 SUBDIRS += r300/dri
 endif
 endif
 
 if HAVE_GALLIUM_R600
-if HAVE_DRI
+if HAVE_DRI2
 SUBDIRS += r600/dri
 endif
 
@@ -91,7 +91,7 @@ endif
 endif
 
 if HAVE_GALLIUM_RADEONSI
-if HAVE_DRI
+if HAVE_DRI2
 SUBDIRS += radeonsi/dri
 endif
 
@@ -105,7 +105,7 @@ endif
 endif
 
 if HAVE_GALLIUM_NOUVEAU
-if HAVE_DRI
+if HAVE_DRI2
 SUBDIRS += dri-nouveau
 endif
 
@@ -123,7 +123,7 @@ endif
 endif
 
 if HAVE_GALLIUM_SOFTPIPE
-if HAVE_DRI
+if HAVE_DRISW
 SUBDIRS += dri-swrast
 endif
 endif
index bfc03073b3c6fa51af492fe9a9d7be2e7c57cef9..ccfddacd86591aedb7eb5ad286e03d944a8b00a9 100644 (file)
@@ -51,7 +51,7 @@ gbm_gallium_drm_la_LIBADD = \
        $(LIBDRM_LIBS) \
        $(GALLIUM_COMMON_LIB_DEPS)
 
-if HAVE_DRI
+if HAVE_DRISW
 gbm_gallium_drm_la_LIBADD += \
        $(top_builddir)/src/gallium/winsys/sw/dri/libswdri.la
 endif
index f8c591d62817b1fba242e8ddb71b1cabefb77cc1..55a73b49ecd9d3bbff582c87ae8f73e0161ec54e 100644 (file)
@@ -35,7 +35,7 @@ lib@OPENCL_LIBNAME@_la_LIBADD = \
        -lclangBasic \
        $(LLVM_LIBS)
 
-if HAVE_DRI
+if HAVE_DRISW
 lib@OPENCL_LIBNAME@_la_LIBADD += \
        $(top_builddir)/src/gallium/winsys/sw/dri/libswdri.la
 endif
index 2619e57e142316e70d8267877213b3f490ed9fc2..0d3945430a10b2e288fdefc3a03580ef9ddf03de 100644 (file)
@@ -48,7 +48,7 @@ libxatracker_la_LIBADD = \
        $(LIBDRM_LIBS) \
        $(GALLIUM_COMMON_LIB_DEPS)
 
-if HAVE_DRI
+if HAVE_DRISW
 libxatracker_la_LIBADD += \
        $(top_builddir)/src/gallium/winsys/sw/dri/libswdri.la
 endif
index d795ab164d7aca550e3a1886c8508a5292a96611..8a8fad138e323cc9061fc246c99ad0e2e13a9fc3 100644 (file)
@@ -17,7 +17,7 @@ LDADD = $(GALLIUM_PIPE_LOADER_CLIENT_LIBS) \
        $(top_builddir)/src/gallium/auxiliary/libgallium.la \
        $(GALLIUM_COMMON_LIB_DEPS)
 
-if HAVE_DRI
+if HAVE_DRISW
 LDADD += \
        $(top_builddir)/src/gallium/winsys/sw/dri/libswdri.la
 endif
index ab1acc37b4a6026690fd083c92fd8705963d1a3e..7d7a0b11f7a413c6fd79b5504c380138c9636474 100644 (file)
@@ -26,7 +26,7 @@ if NEED_WINSYS_XLIB
 SUBDIRS += sw/xlib
 endif
 
-if HAVE_DRI
+if HAVE_DRISW
 SUBDIRS += sw/dri
 endif
 
index f6545ee5b7dad577da659cfd50a5857dbed68098..08369f234cf714247e674f8b8a6c64afdbb8ad67 100644 (file)
@@ -40,7 +40,7 @@ AM_CFLAGS += $(WAYLAND_CFLAGS)
 libgbm_la_LIBADD += $(top_builddir)/src/egl/wayland/wayland-drm/libwayland-drm.la $(WAYLAND_LIBS)
 endif
 
-if HAVE_DRI
+if HAVE_DRI2
 noinst_LTLIBRARIES = libgbm_dri.la
 libgbm_dri_la_SOURCES = \
        backends/dri/gbm_dri.c \
index 0cf65e50732cf01369bf32ee4b569d2d93db4b8e..4553de01a1737e99232e1e39efbe4b7de7576f05 100644 (file)
@@ -82,24 +82,40 @@ libglx_la_SOURCES = \
          single2.c \
          singlepix.c \
          vertarr.c \
-         xfont.c \
          glx_pbuffer.c \
          glx_query.c \
-         drisw_glx.c \
-         dri_common.c \
+         glxhash.c
+
+if HAVE_DRISW
+libglx_la_SOURCES += \
+         drisw_glx.c
+endif
+
+if HAVE_DRICOMMON
+libglx_la_SOURCES += \
+         xfont.c \
+         dri_common.c
+endif
+
+if HAVE_DRI2
+libglx_la_SOURCES += \
          dri_glx.c \
          XF86dri.c \
-         glxhash.c \
          dri2_glx.c \
          dri2.c \
-         dri2_query_renderer.c \
-         applegl_glx.c
+         dri2_query_renderer.c
+endif
 
 if HAVE_DRI3
 libglx_la_SOURCES += \
           dri3_glx.c
 endif
 
+if HAVE_APPLEDRI
+libglx_la_SOURCES += \
+         applegl_glx.c
+endif
+
 libglx_la_LIBADD = $(top_builddir)/src/loader/libloader.la
 
 GL_LIBS = \
index 4dc358c3261ba1e924249f15e2abef5d366b21bd..3599b3d55e81450cc021fef0f075e834ab697f17 100644 (file)
@@ -20,9 +20,13 @@ glx_test_SOURCES =                   \
        enum_sizes.cpp                  \
        fake_glx_screen.cpp             \
        indirect_api.cpp                \
-       query_renderer_implementation_unittest.cpp      \
        query_renderer_unittest.cpp
 
+if HAVE_DRI2
+glx_test_SOURCES += \
+       query_renderer_implementation_unittest.cpp
+endif
+
 glx_test_LDADD = \
        $(top_builddir)/src/glx/libglx.la \
        $(top_builddir)/src/gtest/libgtest.la \
index 0fdc8f3150c8c7823b396ed85264535136f990fb..88eeff9ee508e1ed025b9424d15e535224bfebe6 100644 (file)
@@ -25,7 +25,7 @@ if HAVE_X11_DRIVER
 SUBDIRS += drivers/x11
 endif
 
-if HAVE_DRI
+if HAVE_DRICOMMON
 SUBDIRS += drivers/dri
 endif