OSDN Git Service

API: add support for raw DRM.
[android-x86/hardware-intel-common-libva.git] / va / va_backend.h
index a588462..b6b651c 100644 (file)
 #define _VA_BACKEND_H_
 
 #include <va/va.h>
-#ifndef ANDROID
-#include <X11/Xlib.h>
-#endif
 #include <linux/videodev2.h>
 
 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,
+    /** \brief VA/DRM API is used, through vaGetDisplayDRM() entry-point. */
+    VA_DISPLAY_DRM      = 0x30,
+};
+
 struct VADriverVTable
 {
        VAStatus (*vaTerminate) ( VADriverContextP ctx );
@@ -181,8 +193,8 @@ struct VADriverVTable
        VAStatus (*vaQuerySurfaceError) (
                VADriverContextP ctx,
                VASurfaceID render_target,
-        VAStatus error_status,
-        void **error_info /*out*/
+                VAStatus error_status,
+                void **error_info /*out*/
        );
 
        VAStatus (*vaPutSurface) (
@@ -347,11 +359,10 @@ struct VADriverVTable
 
         /* used by va trace */        
         VAStatus (*vaBufferInfo) (
-                   VADriverContextP ctx,
-                   VAContextID context, /* in */
-                   VABufferID buf_id, /* in */
-                   VABufferType *type,    /* out */
-                   unsigned int *size,    /* out */
+                   VADriverContextP ctx,      /* in */
+                   VABufferID buf_id,         /* in */
+                   VABufferType *type,        /* out */
+                   unsigned int *size,        /* out */
                    unsigned int *num_elements /* out */
         );
 
@@ -400,7 +411,23 @@ struct VADriverContext
      */
     struct VADriverVTableGLX *vtable_glx;
 
-    void *vtable_tpi; /* the structure is malloc-ed */
+    /**
+     * The VA/EGL implementation hooks.
+     *
+     * This structure is intended for drivers that implement the
+     * VA/EGL API. The driver implementation is responsible for the
+     * allocation and deallocation of this structure.
+     */
+    struct VADriverVTableEGL *vtable_egl;
+
+    /**
+     * The third-party/private implementation hooks.
+     *
+     * This structure is intended for drivers that implement the
+     * private API. The driver implementation is responsible for the
+     * allocation and deallocation of this structure.
+     */
+    void *vtable_tpi;
 
     void *native_dpy;
     int x11_screen;
@@ -415,9 +442,27 @@ struct VADriverContext
     const char *str_vendor;
 
     void *handle;                      /* dlopen handle */
-    
-    void *dri_state;
+
+    /**
+     * \brief DRM state.
+     *
+     * This field holds driver specific data for DRM-based
+     * drivers. This structure is allocated from libva with
+     * calloc(). Do not deallocate from within VA driver
+     * implementations.
+     *
+     * All structures shall be derived from struct drm_state. So, for
+     * instance, this field holds a dri_state structure for VA/X11
+     * drivers that use the DRM protocol.
+     */
+    void *drm_state;
+
     void *glx;                         /* opaque for GLX code */
+
+    /** \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 */