configure: drop check for --enable-vaapi-glx.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Mon, 23 Jul 2012 14:15:38 +0000 (16:15 +0200)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Tue, 24 Jul 2012 13:57:57 +0000 (15:57 +0200)
This flag is obsolete. It was meant to explicitly enable/disable VA/GLX API
support, or fallback to TFP+FBO if this API is not found. Now, we check for
the VA/GLX API by default if --enable-glx is set. If this API is not found,
we now default to use TFP+FBO.

Note: TFP+FBO, i.e. using vaPutSurface() is now also a deprecated usage and
will be removed in the future. If GLX rendering is requested, then the VA/GLX
API shall be used as it covers most usages. e.g. AMD driver can't render to
an X pixmap yet.

configure.ac
gst-libs/gst/vaapi/gstvaapicompat.h
gst/vaapi/Makefile.am
gst/vaapi/gstvaapidecode.c
gst/vaapi/gstvaapidownload.c
gst/vaapi/gstvaapipluginutil.c
gst/vaapi/gstvaapipostproc.c
gst/vaapi/gstvaapiupload.c
tests/test-display.c

index f78919c..7aca8b5 100644 (file)
@@ -107,14 +107,9 @@ AC_ARG_ENABLE(x11,
 
 AC_ARG_ENABLE(glx,
     AS_HELP_STRING([--enable-glx],
-                   [enable OpenGL/X11 @<:@default=yes@:>@]),
+                   [enable OpenGL/X11 output @<:@default=yes@:>@]),
     [], [enable_glx="yes"])
 
-AC_ARG_ENABLE(vaapi-glx,
-    AS_HELP_STRING([--enable-vaapi-glx],
-                   [enable VA/GLX extensions @<:@default=yes@:>@]),
-    [], [enable_vaapi_glx="yes"])
-
 AC_ARG_ENABLE(vaapisink-glx,
     AS_HELP_STRING([--enable-vaapisink-glx],
                    [enable OpenGL/X11 to vaapisink @<:@default=yes@:>@]),
@@ -358,10 +353,13 @@ HAVE_VA_GLX=0
 LIBVA_GLX_PKGNAME="libva-glx"
 if test $USE_GLX -eq 1; then
     PKG_CHECK_MODULES(LIBVA_GLX, [$LIBVA_GLX_PKGNAME >= va_api_glx_version],
-        [HAVE_VA_GLX=1])
-    if test "$enable_vaapi_glx" = "yes" -a $HAVE_VA_GLX -eq 0; then
-        AC_MSG_WARN([VA/GLX not found or disabled. Fallbacking to TFP+FBO])
-        LIBVA_GLX_PKGNAME="$LIBVA_X11_PKGNAME"
+        [HAVE_VA_GLX=1], [LIBVA_GLX_PKGNAME="$LIBVA_X11_PKGNAME"])
+
+    if test $HAVE_VA_GLX -eq 1; then
+        saved_CPPFLAGS="$CPPFLAGS"
+        CPPFLAGS="$LIBVA_GLX_CPPFLAGS"
+        AC_CHECK_HEADERS([va/va_glx.h], [:], [HAVE_VA_GLX=0])
+        CPPFLAGS="$saved_CPPFLAGS"
     fi
 fi
 AC_SUBST(LIBVA_GLX_PKGNAME)
@@ -420,10 +418,6 @@ AC_DEFINE_UNQUOTED(USE_GLX, $USE_GLX,
     [Defined to 1 if GLX is enabled])
 AM_CONDITIONAL(USE_GLX, test $USE_GLX -eq 1)
 
-AC_DEFINE_UNQUOTED([USE_VAAPI_GLX], [$HAVE_VA_GLX],
-    [Defined to 1 if VA/GLX is enabled])
-AM_CONDITIONAL([USE_VAAPI_GLX], [test $HAVE_VA_GLX -eq 1])
-
 AC_DEFINE_UNQUOTED(USE_VAAPISINK_GLX, $USE_VAAPISINK_GLX,
     [Defined to 1 to enable GLX support to vaapisink])
 AM_CONDITIONAL(USE_VAAPISINK_GLX, test $USE_VAAPISINK_GLX -eq 1)
index 766bbe6..47cd7a3 100644 (file)
 
 #include <va/va.h>
 
+#ifdef HAVE_VA_VA_GLX_H
+# define USE_VAAPI_GLX 1
+#else
+# define USE_VAAPI_GLX 0
+#endif
+
 #if USE_VAAPI_GLX
 # include <va/va_glx.h>
 #else
index 3879fb6..6a4175a 100644 (file)
@@ -7,14 +7,18 @@ libgstvaapi_CFLAGS = \
        -I$(top_builddir)/gst-libs      \
        $(NULL)
 
-if USE_VAAPI_GLX
-libgstvaapi_LIBS = \
-       $(top_builddir)/gst-libs/gst/vaapi/libgstvaapi-glx-$(GST_MAJORMINOR).la
-else
-libgstvaapi_LIBS = \
+libgstvaapi_LIBS =
+
+if USE_X11
+libgstvaapi_LIBS += \
        $(top_builddir)/gst-libs/gst/vaapi/libgstvaapi-x11-$(GST_MAJORMINOR).la
 endif
 
+if USE_GLX
+libgstvaapi_LIBS += \
+       $(top_builddir)/gst-libs/gst/vaapi/libgstvaapi-glx-$(GST_MAJORMINOR).la
+endif
+
 libgstvaapi_la_SOURCES =       \
        gstvaapi.c              \
        gstvaapidecode.c        \
index adafed1..1680b00 100644 (file)
@@ -35,7 +35,7 @@
 #include <gst/vaapi/gstvaapivideobuffer.h>
 #include <gst/video/videocontext.h>
 
-#if USE_VAAPI_GLX
+#if USE_GLX
 #include <gst/vaapi/gstvaapivideobuffer_glx.h>
 #define gst_vaapi_video_buffer_new(display) \
     gst_vaapi_video_buffer_glx_new(GST_VAAPI_DISPLAY_GLX(display))
@@ -169,7 +169,7 @@ gst_vaapidecode_update_src_caps(GstVaapiDecode *decode, GstCaps *caps)
         gst_structure_set_value(structure, "interlaced", v_interlaced);
 
     gst_structure_set(structure, "type", G_TYPE_STRING, "vaapi", NULL);
-    gst_structure_set(structure, "opengl", G_TYPE_BOOLEAN, USE_VAAPI_GLX, NULL);
+    gst_structure_set(structure, "opengl", G_TYPE_BOOLEAN, USE_GLX, NULL);
 
     other_caps = gst_caps_copy(decode->srcpad_caps);
     success = gst_pad_set_caps(decode->srcpad, other_caps);
index 2358b41..7fdcbe6 100644 (file)
@@ -35,7 +35,7 @@
 #include <gst/vaapi/gstvaapivideosink.h>
 #include <gst/vaapi/gstvaapivideobuffer.h>
 
-#if USE_VAAPI_GLX
+#if USE_GLX
 #include <gst/vaapi/gstvaapivideobuffer_glx.h>
 #define gst_vaapi_video_buffer_new_from_pool(pool) \
     gst_vaapi_video_buffer_glx_new_from_pool(pool)
@@ -493,7 +493,7 @@ gst_vaapidownload_transform_caps(
         gst_structure_set(
             structure,
             "type", G_TYPE_STRING, "vaapi",
-            "opengl", G_TYPE_BOOLEAN, USE_VAAPI_GLX,
+            "opengl", G_TYPE_BOOLEAN, USE_GLX,
             NULL
         );
     }
index 168ae1f..e026fa0 100644 (file)
  */
 
 #ifdef HAVE_CONFIG_H
-#include <config.h>
+# include "config.h"
+#endif
+#include <string.h>
+#if USE_X11
+# include <gst/vaapi/gstvaapidisplay_x11.h>
+#endif
+#if USE_GLX
+# include <gst/vaapi/gstvaapidisplay_glx.h>
 #endif
 
 #include "gstvaapipluginutil.h"
 
 #include <string.h>
 
-#if USE_VAAPI_GLX
-#include <gst/vaapi/gstvaapidisplay_glx.h>
-#else
-#include <gst/vaapi/gstvaapidisplay_x11.h>
-#endif
-
 /* Preferred first */
 static const char *display_types[] = {
   "gst-vaapi-display",
@@ -60,12 +61,12 @@ gst_vaapi_ensure_display (gpointer element, GstVaapiDisplay **display)
   gst_video_context_prepare (context, display_types);
 
   /* If no neighboor, or application not interested, use system default */
+#if USE_GLX
   if (!*display)
-#if USE_VAAPI_GLX
     *display = gst_vaapi_display_glx_new (NULL);
-#else
-    *display = gst_vaapi_display_x11_new (NULL);
 #endif
+  if (!*display)
+    *display = gst_vaapi_display_x11_new (NULL);
 
   /* FIXME allocator should return NULL in case of failure */
   if (*display && !gst_vaapi_display_get_display(*display)) {
@@ -85,18 +86,18 @@ gst_vaapi_set_display (const gchar *type,
 
   if (!strcmp (type, "x11-display-name")) {
     g_return_if_fail (G_VALUE_HOLDS_STRING (value));
-#if USE_VAAPI_GLX
+#if USE_GLX
     dpy = gst_vaapi_display_glx_new (g_value_get_string (value));
-#else
-    dpy = gst_vaapi_display_x11_new (g_value_get_string (value));
 #endif
+    if (!dpy)
+      dpy = gst_vaapi_display_x11_new (g_value_get_string (value));
   } else if (!strcmp (type, "x11-display")) {
     g_return_if_fail (G_VALUE_HOLDS_POINTER (value));
-#if USE_VAAPI_GLX
+#if USE_GLX
     dpy = gst_vaapi_display_glx_new_with_display (g_value_get_pointer (value));
-#else
-    dpy = gst_vaapi_display_x11_new_with_display (g_value_get_pointer (value));
 #endif
+    if (!dpy)
+      dpy = gst_vaapi_display_x11_new_with_display (g_value_get_pointer (value));
   } else if (!strcmp (type, "vaapi-display")) {
     g_return_if_fail (G_VALUE_HOLDS_POINTER (value));
     dpy = gst_vaapi_display_new_with_display (g_value_get_pointer (value));
index 0f8ebf5..3b81830 100644 (file)
@@ -401,7 +401,7 @@ gst_vaapipostproc_update_src_caps(GstVaapiPostproc *postproc, GstCaps *caps)
         gst_structure_set_value(structure, "pixel-aspect-ratio", v_par);
 
     gst_structure_set(structure, "type", G_TYPE_STRING, "vaapi", NULL);
-    gst_structure_set(structure, "opengl", G_TYPE_BOOLEAN, USE_VAAPI_GLX, NULL);
+    gst_structure_set(structure, "opengl", G_TYPE_BOOLEAN, USE_GLX, NULL);
 
     if (!postproc->deinterlace)
         gst_structure_remove_field(structure, "interlaced");
index 6457562..9e5d513 100644 (file)
@@ -36,7 +36,7 @@
 #include <gst/vaapi/gstvaapivideosink.h>
 #include <gst/vaapi/gstvaapivideobuffer.h>
 
-#if USE_VAAPI_GLX
+#if USE_GLX
 #include <gst/vaapi/gstvaapivideobuffer_glx.h>
 #define gst_vaapi_video_buffer_new_from_pool(pool) \
     gst_vaapi_video_buffer_glx_new_from_pool(pool)
@@ -471,7 +471,7 @@ gst_vaapiupload_transform_caps(
         gst_structure_set(
             structure,
             "type", G_TYPE_STRING, "vaapi",
-            "opengl", G_TYPE_BOOLEAN, USE_VAAPI_GLX,
+            "opengl", G_TYPE_BOOLEAN, USE_GLX,
             NULL
         );
     }
index 12f7520..47caa3d 100644 (file)
 #include <gst/vaapi/gstvaapidisplay_glx.h>
 #endif
 
-#if USE_VAAPI_GLX
+#ifdef HAVE_VA_VA_GLX_H
 # include <va/va_glx.h>
-#else
-# define vaGetDisplayGLX(dpy) vaGetDisplay(dpy)
 #endif
 
 static void
@@ -255,6 +253,7 @@ main(int argc, char *argv[])
     }
     g_print("\n");
 
+#ifdef HAVE_VA_VA_GLX_H
     g_print("#\n");
     g_print("# Create display with gst_vaapi_display_new_with_display() [vaGetDisplayGLX()]\n");
     g_print("#\n");
@@ -277,6 +276,7 @@ main(int argc, char *argv[])
     }
     g_print("\n");
 #endif
+#endif
 
     gst_deinit();
     return 0;