[Libva] [PATCH 3/7] Allow build without VA/X11 API.

Gwenole Beauchesne gb.devel at gmail.com
Tue Jul 3 07:31:26 PDT 2012


From: Dmitry Ermilov <dmitry.ermilov at intel.com>

In this case, VA/GLX API is disabled and another backend shall be
built instead.

Signed-off-by: Dmitry Ermilov <dmitry.ermilov at intel.com>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
---
 configure.ac             |   34 ++++++++++++++++++++++++++++------
 pkgconfig/Makefile.am    |    2 ++
 test/Makefile.am         |    5 ++++-
 test/common/Makefile.am  |    2 ++
 test/common/va_display.c |    2 ++
 test/encode/Makefile.am  |    5 ++++-
 va/Makefile.am           |    4 +++-
 va/drm/va_drm.c          |    7 +++----
 8 files changed, 48 insertions(+), 13 deletions(-)

diff --git a/configure.ac b/configure.ac
index efacc2d..7f7f9af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -121,6 +121,11 @@ AC_ARG_ENABLE(drm,
                     [build with VA/DRM API support @<:@default=yes@:>@])],
     [], [enable_drm="yes"])
 
+AC_ARG_ENABLE(x11,
+    [AC_HELP_STRING([--enable-x11],
+                    [build with VA/X11 API support @<:@default=yes@:>@])],
+    [], [enable_x11="yes"])
+
 AC_ARG_ENABLE(glx,
     [AC_HELP_STRING([--enable-glx],
                     [build with GLX support @<:@default=yes@:>@])],
@@ -155,20 +160,28 @@ AC_PROG_LIBTOOL
 AC_PROG_CC
 AC_PROG_CXX
 AM_PROG_CC_C_O
+PKG_PROG_PKG_CONFIG
 
 AC_HEADER_STDC
 AC_SYS_LARGEFILE
 
-PKG_CHECK_MODULES([X11], [x11])
-PKG_CHECK_MODULES([XEXT],[xext])
-PKG_CHECK_MODULES([XFIXES], [xfixes])
-
 # Check for Doxygen
 if test "$enable_docs" = "yes"; then
     AC_CHECK_TOOL([DOXYGEN], [doxygen], [enable_docs="no"])
 fi
 AM_CONDITIONAL(ENABLE_DOCS, test "$enable_docs" = "yes")
 
+# Check for X11
+USE_X11="no"
+if test "$enable_x11" = "yes"; then
+    PKG_CHECK_MODULES([X11],    [x11])
+    PKG_CHECK_MODULES([XEXT],   [xext])
+    PKG_CHECK_MODULES([XFIXES], [xfixes])
+    USE_X11="yes"
+    AC_DEFINE([HAVE_VA_X11], [1], [Defined to 1 if VA/X11 API is built])
+fi
+AM_CONDITIONAL(USE_X11, test "$USE_X11" = "yes")
+
 # Check for DRM
 LIBDRM_VERSION=libdrm_version
 PKG_CHECK_MODULES([DRM], [libdrm >= $LIBDRM_VERSION])
@@ -193,7 +206,7 @@ AM_CONDITIONAL(USE_DRM, test "$USE_DRM" = "yes")
 USE_GLX="no"
 GL_DEPS_CFLAGS=""
 GL_DEPS_LIBS=""
-if test "$enable_glx" = "yes"; then
+if test "$USE_X11:$enable_glx" = "yes:yes"; then
     saved_CFLAGS="$CFLAGS"
     saved_LIBS="$LIBS"
     PKG_CHECK_MODULES([GL_DEPS], [gl], [], [GL_DEPS_LIBS="-lX11 -lGL"])
@@ -240,7 +253,15 @@ AC_SUBST(LIBVA_LIBS)
 pkgconfigdir=${libdir}/pkgconfig
 AC_SUBST(pkgconfigdir)
 
-LIBVA_DISPLAY=x11
+# Check for builds without backend
+if test "$USE_X11:$USE_DRM" = "no:no"; then
+    AC_MSG_ERROR([Please select at least VA/X11 or VA/DRM backend])
+fi
+
+LIBVA_DISPLAY="drm"
+if test "$USE_X11" = "yes"; then
+    LIBVA_DISPLAY="x11"
+fi
 libvacorelib=libva.la
 libvabackendlib=libva-$LIBVA_DISPLAY.la
 AC_SUBST([libvacorelib])
@@ -277,6 +298,7 @@ AC_OUTPUT([
 
 # Print a small summary
 AS_IF([test x$USE_DRM = xyes], [BACKENDS="drm $BACKENDS"])
+AS_IF([test x$USE_X11 = xyes], [BACKENDS="x11 $BACKENDS"])
 AS_IF([test x$USE_GLX = xyes], [BACKENDS="glx $BACKENDS"])
 AS_IF([test x$USE_EGL = xyes], [BACKENDS="egl $BACKENDS"])
 
diff --git a/pkgconfig/Makefile.am b/pkgconfig/Makefile.am
index 2298c84..df5672c 100644
--- a/pkgconfig/Makefile.am
+++ b/pkgconfig/Makefile.am
@@ -25,7 +25,9 @@ pcfiles		+= libva-tpi.pc
 if USE_DRM
 pcfiles		+= libva-drm.pc
 endif
+if USE_X11
 pcfiles		+= libva-x11.pc
+endif
 if USE_GLX
 pcfiles		+= libva-glx.pc
 endif
diff --git a/test/Makefile.am b/test/Makefile.am
index ae3805f..478cdc0 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -23,6 +23,9 @@
 
 AM_CFLAGS = -I$(top_srcdir)/va -I$(top_srcdir)/test/basic -I$(top_srcdir)/src/x11
 
-SUBDIRS = common basic decode encode putsurface vainfo transcode
+SUBDIRS = common decode encode vainfo
+if USE_X11
+SUBDIRS += basic putsurface transcode
+endif
 
 EXTRA_DIST = loadsurface.h loadsurface_yuv.h
diff --git a/test/common/Makefile.am b/test/common/Makefile.am
index 52aab3a..145384f 100644
--- a/test/common/Makefile.am
+++ b/test/common/Makefile.am
@@ -35,9 +35,11 @@ libva_display_libs = \
 source_c		= va_display.c
 source_h		= va_display.h
 
+if USE_X11
 source_c		+= va_display_x11.c
 libva_display_cflags	+= $(X11_CFLAGS)
 libva_display_libs	+= $(X11_LIBS)
+endif
 
 if USE_DRM
 source_c		+= va_display_drm.c
diff --git a/test/common/va_display.c b/test/common/va_display.c
index f7b0708..3e956ee 100644
--- a/test/common/va_display.c
+++ b/test/common/va_display.c
@@ -36,7 +36,9 @@ static const VADisplayHooks *g_display_hooks_available[] = {
 #ifdef ANDROID
     &va_display_hooks_android,
 #else
+#ifdef HAVE_VA_X11
     &va_display_hooks_x11,
+#endif
 #ifdef HAVE_VA_DRM
     &va_display_hooks_drm,
 #endif
diff --git a/test/encode/Makefile.am b/test/encode/Makefile.am
index b3e4056..942c068 100644
--- a/test/encode/Makefile.am
+++ b/test/encode/Makefile.am
@@ -20,7 +20,10 @@
 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-bin_PROGRAMS = h264encode avcenc
+bin_PROGRAMS = avcenc
+if USE_X11
+bin_PROGRAMS += h264encode
+endif
 
 libva_helpers = \
 	$(top_builddir)/test/common/libva-display.la	\
diff --git a/va/Makefile.am b/va/Makefile.am
index 63f09e9..431e743 100644
--- a/va/Makefile.am
+++ b/va/Makefile.am
@@ -54,7 +54,6 @@ libva_source_h = \
 	va_tpi.h		\
 	va_version.h		\
 	va_vpp.h		\
-	va_x11.h		\
 	$(NULL)
 
 libva_source_h_priv = \
@@ -83,13 +82,16 @@ libva_tpi_la_LDFLAGS		= $(LDADD) -no-undefined
 libva_tpi_la_DEPENDENCIES	= $(libvacorelib) 
 libva_tpi_la_LIBADD		= $(libvacorelib) -ldl
 
+if USE_X11
 SUBDIRS				+= x11
 lib_LTLIBRARIES			+= libva-x11.la
+libva_source_h			+= va_x11.h
 libva_x11_la_SOURCES		= 
 libva_x11_la_LDFLAGS		= $(LDADD)
 libva_x11_la_DEPENDENCIES	= $(libvacorelib) x11/libva_x11.la
 libva_x11_la_LIBADD		= $(libvacorelib) x11/libva_x11.la \
 	$(LIBVA_LIBS) $(X11_LIBS) $(XEXT_LIBS) $(DRM_LIBS) $(XFIXES_LIBS) -ldl
+endif
 
 if USE_DRM
 SUBDIRS				+= drm
diff --git a/va/drm/va_drm.c b/va/drm/va_drm.c
index b927b3c..3b23776 100644
--- a/va/drm/va_drm.c
+++ b/va/drm/va_drm.c
@@ -22,12 +22,11 @@
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include "sysdeps.h"
+#include <xf86drm.h>
 #include "va.h"
 #include "va_backend.h"
-#include <va/va_drmcommon.h>
-#include <stdlib.h>
-#include <string.h>
-#include <xf86drm.h>
+#include "va_drmcommon.h"
 
 static int
 va_DisplayContextIsValid(VADisplayContextP pDisplayContext)
-- 
1.7.9.5



More information about the Libva mailing list