From e5a1d3e59fb9a00e22d7a4a26704a9ae0b34ab87 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Fri, 6 Apr 2012 14:31:42 +0200 Subject: [PATCH] API: backend: add VA display types. Make it possible to easily find how the VA display was created. This helps implement multiple backends in VA drivers. e.g. X11, Wayland while keeping a single generated binary. Signed-off-by: Gwenole Beauchesne --- va/android/va_android.cpp | 1 + va/glx/va_glx.c | 1 + va/va_backend.h | 18 +++++++++++++++++- va/x11/va_x11.c | 1 + 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/va/android/va_android.cpp b/va/android/va_android.cpp index b811afc..5612c3c 100644 --- a/va/android/va_android.cpp +++ b/va/android/va_android.cpp @@ -223,6 +223,7 @@ VADisplay vaGetDisplay ( pDisplayContext->vadpy_magic = VA_DISPLAY_MAGIC; pDriverContext->native_dpy = (void *)native_dpy; + pDriverContext->display_type = VA_DISPLAY_ANDROID; pDisplayContext->pDriverContext = pDriverContext; pDisplayContext->vaIsValid = va_DisplayContextIsValid; pDisplayContext->vaDestroy = va_DisplayContextDestroy; diff --git a/va/glx/va_glx.c b/va/glx/va_glx.c index 1812ef5..e03847e 100644 --- a/va/glx/va_glx.c +++ b/va/glx/va_glx.c @@ -98,6 +98,7 @@ VADisplay vaGetDisplayGLX(Display *native_dpy) if (!pDriverContextGLX) goto error; + pDriverContext->display_type = VA_DISPLAY_GLX; pDisplayContextGLX->vaDestroy = pDisplayContext->vaDestroy; pDisplayContext->vaDestroy = va_DisplayContextDestroy; pDisplayContext->opaque = pDisplayContextGLX; diff --git a/va/va_backend.h b/va/va_backend.h index 1e04a9c..72e8d7d 100644 --- a/va/va_backend.h +++ b/va/va_backend.h @@ -38,6 +38,19 @@ typedef struct VADriverContext *VADriverContextP; typedef struct VADisplayContext *VADisplayContextP; +/** \brief VA display types. */ +enum { + /** \brief Mask to major identifier for VA display type. */ + VA_DISPLAY_MAJOR_MASK = 0xf0, + + /** \brief VA/X11 API is used, through vaGetDisplay() entry-point. */ + VA_DISPLAY_X11 = 0x10, + /** \brief VA/GLX API is used, through vaGetDisplayGLX() entry-point. */ + VA_DISPLAY_GLX = (VA_DISPLAY_X11 | (1 << 0)), + /** \brief VA/Android API is used, through vaGetDisplay() entry-point. */ + VA_DISPLAY_ANDROID = 0x20, +}; + struct VADriverVTable { VAStatus (*vaTerminate) ( VADriverContextP ctx ); @@ -474,7 +487,10 @@ struct VADriverContext */ struct VADriverVTableVPP *vtable_vpp; - unsigned long reserved[44]; /* reserve for future add-ins, decrease the subscript accordingly */ + /** \brief VA display type. */ + unsigned long display_type; + + unsigned long reserved[43]; /* reserve for future add-ins, decrease the subscript accordingly */ }; #define VA_DISPLAY_MAGIC 0x56414430 /* VAD0 */ diff --git a/va/x11/va_x11.c b/va/x11/va_x11.c index f81e30a..2aa579b 100644 --- a/va/x11/va_x11.c +++ b/va/x11/va_x11.c @@ -185,6 +185,7 @@ VADisplay vaGetDisplay ( pDisplayContext->vadpy_magic = VA_DISPLAY_MAGIC; pDriverContext->native_dpy = (void *)native_dpy; + pDriverContext->display_type = VA_DISPLAY_X11; pDisplayContext->pDriverContext = pDriverContext; pDisplayContext->vaIsValid = va_DisplayContextIsValid; pDisplayContext->vaDestroy = va_DisplayContextDestroy; -- 2.7.4