From 50c8ae8a5379a3aa6312edae6bb083936eaa43a6 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> Date: Mon, 8 Mar 2010 09:44:25 +0100 Subject: [PATCH] Add OpenGL extensions (v3) and generic implementation with TFP and FBO. --- Makefile.am | 5 ++++- configure.ac | 22 ++++++++++++++++++++++ libva-glx.pc.in | 12 ++++++++++++ va/va_backend.h | 6 ++++++ va/x11/va_x11.c | 1 + 5 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 libva-glx.pc.in diff --git a/Makefile.am b/Makefile.am index 459660b..e75a2db 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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) diff --git a/configure.ac b/configure.ac index a6d01ee..ebb06cf 100644 --- a/configure.ac +++ b/configure.ac @@ -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 index 0000000..2019915 --- /dev/null +++ b/libva-glx.pc.in @@ -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} diff --git a/va/va_backend.h b/va/va_backend.h index 9ba9000..842fce6 100644 --- a/va/va_backend.h +++ b/va/va_backend.h @@ -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) ( diff --git a/va/x11/va_x11.c b/va/x11/va_x11.c index 9a7135c..9f233da 100644 --- a/va/x11/va_x11.c +++ b/va/x11/va_x11.c @@ -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; -- 2.25.4