Add OpenGL extensions (v3) and generic implementation with TFP and FBO.
authorGwenole Beauchesne <gbeauchesne@splitted-desktop.com>
Mon, 8 Mar 2010 08:44:25 +0000 (09:44 +0100)
committerAustin Yuan <shengquan.yuan@gmail.com>
Wed, 12 May 2010 18:29:32 +0000 (02:29 +0800)
Makefile.am
configure.ac
libva-glx.pc.in [new file with mode: 0644]
va/va_backend.h
va/x11/va_x11.c

index 459660b..e75a2db 100644 (file)
@@ -32,10 +32,13 @@ endif
 
 pcfiles = libva.pc
 pcfiles += libva-x11.pc
+if USE_GLX
+pcfiles += libva-glx.pc
+endif
 
 pkgconfigdir = @pkgconfigdir@
 pkgconfig_DATA = $(pcfiles)
 
-EXTRA_DIST = libva.pc.in libva-x11.pc.in
+EXTRA_DIST = libva.pc.in libva-x11.pc.in libva-glx.pc.in
 
 CLEANFILES = $(pcfiles)
index a6d01ee..ebb06cf 100644 (file)
@@ -60,6 +60,11 @@ LIBVA_LT_LDFLAGS="-version-info $LIBVA_LT_VERSION"
 AC_SUBST(LIBVA_LT_VERSION)
 AC_SUBST(LIBVA_LT_LDFLAGS)
 
+AC_ARG_ENABLE(glx,
+              [AC_HELP_STRING([--enable-glx],
+                              [build with OpenGL for X11 support])],
+              [], [enable_glx=yes])
+
 AC_ARG_ENABLE(dummy-driver,
               [AC_HELP_STRING([--enable-dummy-driver],
                               [build dummy video driver])],
@@ -113,6 +118,22 @@ if test x$libudev = xno; then
 fi
 AM_CONDITIONAL(BUILD_DUMMY_BACKEND, test x$enable_dummy_backend = xyes)
 
+# Check for OpenGL (X11)
+USE_GLX="no"
+GL_DEPS_CFLAGS=""
+GL_DEPS_LIBS=""
+if test x$enable_glx = xyes; then
+    AC_CHECK_HEADERS([GL/gl.h])
+    AC_CHECK_HEADERS([GL/glx.h])
+    AC_CHECK_LIB(GL, glXCreateContext, [
+        USE_GLX="yes"
+        GL_DEPS_LIBS="-lX11 -lGL"
+    ])
+fi
+AC_SUBST(GL_DEPS_CFLAGS)
+AC_SUBST(GL_DEPS_LIBS)
+AM_CONDITIONAL(USE_GLX, test "$USE_GLX" = "yes")
+
 # We only need the headers, we don't link against the DRM libraries
 LIBVA_CFLAGS="$DRM_CFLAGS"
 AC_SUBST(LIBVA_CFLAGS)
@@ -146,5 +167,6 @@ AC_OUTPUT([
        test/encode/Makefile
        libva.pc
        libva-x11.pc
+       libva-glx.pc
 ])
 
diff --git a/libva-glx.pc.in b/libva-glx.pc.in
new file mode 100644 (file)
index 0000000..2019915
--- /dev/null
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+display=glx
+
+Name: libva-${display}
+Description: Userspace Video Acceleration (VA) ${display} interface
+Requires: libva
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lva-${display}
+Cflags: -I${includedir}
index 9ba9000..842fce6 100644 (file)
@@ -371,6 +371,9 @@ struct VADriverVTable
                VADriverContextP ctx,
                 VASurfaceID surface
         );
+
+        /* Optional: GLX support hooks */
+        struct VADriverVTableGLX *glx;
 };
 
 struct VADriverContext
@@ -394,6 +397,7 @@ struct VADriverContext
     void *handle;                      /* dlopen handle */
     
     void *dri_state;
+    void *glx;                          /* opaque for GLX code */
 };
 
 #define VA_DISPLAY_MAGIC 0x56414430 /* VAD0 */
@@ -416,6 +420,8 @@ struct VADisplayContext
        VADisplayContextP ctx,
        char **driver_name
     );
+
+    void *opaque;                       /* opaque for display extensions (e.g. GLX) */
 };
 
 typedef VAStatus (*VADriverInit) (
index 9a7135c..9f233da 100644 (file)
@@ -198,6 +198,7 @@ VADisplay vaGetDisplay (
          pDisplayContext->vaIsValid       = va_DisplayContextIsValid;
          pDisplayContext->vaDestroy       = va_DisplayContextDestroy;
          pDisplayContext->vaGetDriverName = va_DisplayContextGetDriverName;
+          pDisplayContext->opaque          = NULL;
          pDisplayContexts                 = pDisplayContext;
          pDriverContext->dri_state        = dri_state;
          dpy                              = (VADisplay)pDisplayContext;