diff options
author | Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | 2011-01-27 13:03:29 +0000 |
---|---|---|
committer | Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | 2011-01-27 13:03:29 +0000 |
commit | 68615ee83ed31647908481a214c8d9fb4ebf5754 (patch) | |
tree | b515f3ebce0969a7d7bbb3704ccb2f4f2de6ff41 | |
parent | af3de44c07e6e68fdcabaf5cdb7d047a35c7ecb1 (diff) |
Fix VA/GLX support with VA-API >= 0.32.0.
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | src/vdpau_driver.c | 14 | ||||
-rw-r--r-- | src/vdpau_driver_template.h | 29 |
3 files changed, 38 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac index a075865..fcc5faa 100644 --- a/configure.ac +++ b/configure.ac @@ -213,6 +213,7 @@ AC_CACHE_CHECK([for VA-API (GLX extensions)], # error "VA-API version >= 0.31.0-sds$LIBVA_GLX_SDS_VERSION_0_31 is required" # endif # endif + #elif VA_MAJOR_VERSION ==0 && VA_MINOR_VERSION >= 32 #else # error "This version of VA-API is not supported for OpenGL rendering" #endif diff --git a/src/vdpau_driver.c b/src/vdpau_driver.c index f4bc4d6..ade708f 100644 --- a/src/vdpau_driver.c +++ b/src/vdpau_driver.c @@ -258,6 +258,20 @@ vdpau_common_Initialize(vdpau_driver_data_t *driver_data) return VA_STATUS_SUCCESS; } +#if VA_MAJOR_VERSION == 0 && VA_MINOR_VERSION >= 32 +#define VA_INIT_VERSION_MAJOR 0 +#define VA_INIT_VERSION_MINOR 32 +#define VA_INIT_VERSION_MICRO 0 +#define VA_INIT_SUFFIX 0_32_0 +#define VA_INIT_GLX USE_GLX +#include "vdpau_driver_template.h" + +VAStatus __vaDriverInit_0_32(void *ctx) +{ + return vdpau_Initialize_0_32_0(ctx); +} +#endif + #if VA_MAJOR_VERSION == 0 && VA_MINOR_VERSION == 31 #define VA_INIT_VERSION_MAJOR 0 #define VA_INIT_VERSION_MINOR 31 diff --git a/src/vdpau_driver_template.h b/src/vdpau_driver_template.h index fa9916e..fa9ef3c 100644 --- a/src/vdpau_driver_template.h +++ b/src/vdpau_driver_template.h @@ -37,7 +37,8 @@ #undef VA_INIT_CHECK_VERSION_SDS #define VA_INIT_CHECK_VERSION_SDS(major, minor, micro, sds) \ (VA_INIT_CHECK_VERSION(major, minor, (micro)+1) || \ - (VA_CHECK_VERSION(major, minor, micro) && VA_SDS_VERSION >= (sds))) + (VA_INIT_CHECK_VERSION(major, minor, micro) && \ + VA_INIT_VERSION_SDS >= (sds))) #ifndef VA_INIT_SUFFIX #define VA_INIT_SUFFIX Current @@ -410,8 +411,10 @@ struct VA_DRIVER_VTABLE { VASurfaceID surface ); +#if !VA_INIT_CHECK_VERSION_SDS(0,32,0,1) /* Optional: GLX support hooks */ - void *glx; + struct VADriverVTableGLX *glx; +#endif #else /* device specific */ VAStatus (*vaCreateSurfaceFromCIFrame) ( @@ -447,7 +450,12 @@ struct VA_DRIVER_VTABLE { /* Driver context */ struct VA_DRIVER_CONTEXT { void *pDriverData; +#if VA_INIT_CHECK_VERSION_SDS(0,32,0,1) + struct VA_DRIVER_VTABLE *vtable; + struct VADriverVTableGLX *vtable_glx; +#else struct VA_DRIVER_VTABLE vtable; +#endif #if VA_INIT_CHECK_VERSION(0,31,1) void *vtable_tpi; /* the structure is malloc-ed */ #endif @@ -484,14 +492,20 @@ typedef struct VA_DRIVER_VTABLE *VA_DRIVER_VTABLE_GLX_P; static inline VA_DRIVER_VTABLE_GLX_P FUNC(GetVTableGLX)(VA_DRIVER_CONTEXT_P ctx) { #if VA_INIT_CHECK_VERSION_SDS(0,31,0,6) +#if VA_INIT_CHECK_VERSION_SDS(0,32,0,1) + /* SDS >= 0.32.0-sds1 */ + VA_DRIVER_VTABLE_GLX_P *p_vtable_glx = &ctx->vtable_glx; +#else /* Upstream VA-API 0.31.1 or SDS >= 0.31.0-sds6 */ - VA_DRIVER_VTABLE_GLX_P vtable_glx = ctx->vtable.glx; + VA_DRIVER_VTABLE_GLX_P *p_vtable_glx = &ctx->vtable.glx; +#endif + VA_DRIVER_VTABLE_GLX_P vtable_glx = *p_vtable_glx; if (!vtable_glx) { vtable_glx = calloc(1, sizeof(*vtable_glx)); if (!vtable_glx) return NULL; - ctx->vtable.glx = vtable_glx; + *p_vtable_glx = vtable_glx; } return vtable_glx; #elif VA_INIT_CHECK_VERSION_SDS(0,31,0,2) @@ -505,7 +519,10 @@ static inline VA_DRIVER_VTABLE_GLX_P FUNC(GetVTableGLX)(VA_DRIVER_CONTEXT_P ctx) static inline void FUNC(ReleaseVTableGLX)(VA_DRIVER_CONTEXT_P ctx) { -#if VA_INIT_CHECK_VERSION_SDS(0,31,0,6) +#if VA_INIT_CHECK_VERSION_SDS(0,32,0,1) + free(ctx->vtable_glx); + ctx->vtable_glx = NULL; +#elif VA_INIT_CHECK_VERSION_SDS(0,31,0,6) free(ctx->vtable.glx); ctx->vtable.glx = NULL; #endif @@ -556,7 +573,7 @@ static VAStatus FUNC(Initialize)(VA_DRIVER_CONTEXT_P ctx) ctx->max_display_attributes = VDPAU_MAX_DISPLAY_ATTRIBUTES; ctx->str_vendor = driver_data->va_vendor; - struct VADriverVTable *vtable; + struct VA_DRIVER_VTABLE *vtable; #if VA_INIT_CHECK_VERSION_SDS(0,32,0,1) vtable = ctx->vtable; #else |