OSDN Git Service

API: backend: add VA display types.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Fri, 6 Apr 2012 12:31:42 +0000 (14:31 +0200)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Wed, 26 Sep 2012 09:46:59 +0000 (11:46 +0200)
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 <gwenole.beauchesne@intel.com>
va/android/va_android.cpp
va/glx/va_glx.c
va/va_backend.h
va/x11/va_x11.c

index 20aaadd..b731275 100644 (file)
@@ -221,6 +221,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;
index 1812ef5..e03847e 100644 (file)
@@ -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;
index 98fcd3c..a6f4047 100644 (file)
 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 );
@@ -444,7 +457,10 @@ struct VADriverContext
 
     void *glx;                         /* opaque for GLX code */
 
-    unsigned long reserved[45];         /* reserve for future add-ins, decrease the subscript accordingly */
+    /** \brief VA display type. */
+    unsigned long display_type;
+
+    unsigned long reserved[44];         /* reserve for future add-ins, decrease the subscript accordingly */
 };
 
 #define VA_DISPLAY_MAGIC 0x56414430 /* VAD0 */
index 05aa697..625ab7e 100644 (file)
@@ -169,6 +169,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;