dummy_drv_video_la_LTLIBRARIES = dummy_drv_video.la
dummy_drv_video_ladir = /usr/X11R6/lib/modules/dri
-dummy_drv_video_la_LDFLAGS = -no-undefined -module -Wl,--no-undefined
-dummy_drv_video_la_LIBADD = -lva
+dummy_drv_video_la_LDFLAGS = -module -avoid-version -no-undefined -Wl,--no-undefined
+dummy_drv_video_la_LIBADD = ../src/libva.la
AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/../../include/external/ -I$(top_srcdir)/../../include/kmd
dummy_drv_video_la_SOURCES = dummy_drv_video.c object_heap.c
return vaStatus;
}
+VAStatus dummy_DestroyConfig(
+ VADriverContextP ctx,
+ VAConfigID config_id
+ )
+{
+ INIT_DRIVER_DATA
+ VAStatus vaStatus;
+ object_config_p obj_config;
+
+ obj_config = CONFIG(config_id);
+ if (NULL == obj_config)
+ {
+ vaStatus = VA_STATUS_ERROR_INVALID_CONFIG;
+ return vaStatus;
+ }
+
+ object_heap_free( &driver_data->config_heap, (object_base_p) obj_config);
+ return VA_STATUS_SUCCESS;
+}
+
VAStatus dummy_GetConfigAttributes(
VADriverContextP ctx,
VAConfigID config_id,
unsigned short desth,
VARectangle *cliprects, /* client supplied clip list */
unsigned int number_cliprects, /* number of clip rects in the clip list */
- int flags /* de-interlacing flags */
+ unsigned int flags /* de-interlacing flags */
+ )
+{
+ /* TODO */
+ return VA_STATUS_ERROR_UNKNOWN;
+}
+
+/*
+ * Query display attributes
+ * The caller must provide a "attr_list" array that can hold at
+ * least vaMaxNumDisplayAttributes() entries. The actual number of attributes
+ * returned in "attr_list" is returned in "num_attributes".
+ */
+VAStatus dummy_QueryDisplayAttributes (
+ VADriverContextP ctx,
+ VADisplayAttribute *attr_list, /* out */
+ int *num_attributes /* out */
)
{
/* TODO */
return VA_STATUS_ERROR_UNKNOWN;
}
+/*
+ * Get display attributes
+ * This function returns the current attribute values in "attr_list".
+ * Only attributes returned with VA_DISPLAY_ATTRIB_GETTABLE set in the "flags" field
+ * from vaQueryDisplayAttributes() can have their values retrieved.
+ */
+VAStatus dummy_GetDisplayAttributes (
+ VADriverContextP ctx,
+ VADisplayAttribute *attr_list, /* in/out */
+ int num_attributes
+ )
+{
+ /* TODO */
+ return VA_STATUS_ERROR_UNKNOWN;
+}
-VAStatus dummy_CopySurfaceToGLXPbuffer (
- VADriverContextP ctx,
- VASurface *surface,
- XID pbuffer_id,
- short srcx,
- short srcy,
- unsigned short width,
- unsigned short height,
- short destx,
- short desty,
- unsigned int draw_buffer,
- unsigned int flags /* de-interlacing flags */
-)
+/*
+ * Set display attributes
+ * Only attributes returned with VA_DISPLAY_ATTRIB_SETTABLE set in the "flags" field
+ * from vaQueryDisplayAttributes() can be set. If the attribute is not settable or
+ * the value is out of range, the function returns VA_STATUS_ERROR_ATTR_NOT_SUPPORTED
+ */
+VAStatus dummy_SetDisplayAttributes (
+ VADriverContextP ctx,
+ VADisplayAttribute *attr_list,
+ int num_attributes
+ )
{
/* TODO */
return VA_STATUS_ERROR_UNKNOWN;
}
+
VAStatus dummy_DbgCopySurfaceToBuffer(
VADriverContextP ctx,
VASurface *surface,
return VA_STATUS_SUCCESS;
}
-VAStatus __vaDriverInit_0_23( VADriverContextP ctx )
+VAStatus __vaDriverInit_0_24( VADriverContextP ctx )
{
object_base_p obj;
int result;
int i;
ctx->version_major = 0;
- ctx->version_minor = 22;
+ ctx->version_minor = 24;
ctx->max_profiles = DUMMY_MAX_PROFILES;
ctx->max_entrypoints = DUMMY_MAX_ENTRYPOINTS;
ctx->max_attributes = DUMMY_MAX_CONFIG_ATTRIBUTES;
ctx->max_image_formats = DUMMY_MAX_IMAGE_FORMATS;
ctx->max_subpic_formats = DUMMY_MAX_SUBPIC_FORMATS;
+ ctx->max_display_attributes = DUMMY_MAX_DISPLAY_ATTRIBUTES;
ctx->vtable.vaTerminate = dummy_Terminate;
ctx->vtable.vaQueryConfigEntrypoints = dummy_QueryConfigEntrypoints;
ctx->vtable.vaQueryConfigEntrypoints = dummy_QueryConfigEntrypoints;
ctx->vtable.vaQueryConfigAttributes = dummy_QueryConfigAttributes;
ctx->vtable.vaCreateConfig = dummy_CreateConfig;
+ ctx->vtable.vaDestroyConfig = dummy_DestroyConfig;
ctx->vtable.vaGetConfigAttributes = dummy_GetConfigAttributes;
ctx->vtable.vaCreateSurfaces = dummy_CreateSurfaces;
ctx->vtable.vaDestroySurface = dummy_DestroySurface;
ctx->vtable.vaSyncSurface = dummy_SyncSurface;
ctx->vtable.vaQuerySurfaceStatus = dummy_QuerySurfaceStatus;
ctx->vtable.vaPutSurface = dummy_PutSurface;
- ctx->vtable.vaCopySurfaceToGLXPbuffer = dummy_CopySurfaceToGLXPbuffer;
ctx->vtable.vaQueryImageFormats = dummy_QueryImageFormats;
ctx->vtable.vaCreateImage = dummy_CreateImage;
ctx->vtable.vaDestroyImage = dummy_DestroyImage;
ctx->vtable.vaSetSubpictureChromakey = dummy_SetSubpictureChromakey;
ctx->vtable.vaSetSubpictureGlobalAlpha = dummy_SetSubpictureGlobalAlpha;
ctx->vtable.vaAssociateSubpicture = dummy_AssociateSubpicture;
+ ctx->vtable.vaQueryDisplayAttributes = dummy_QueryDisplayAttributes;
+ ctx->vtable.vaGetDisplayAttributes = dummy_GetDisplayAttributes;
+ ctx->vtable.vaSetDisplayAttributes = dummy_SetDisplayAttributes;
+
ctx->vtable.vaDbgCopySurfaceToBuffer = dummy_DbgCopySurfaceToBuffer;
driver_data = (struct dummy_driver_data *) malloc( sizeof(*driver_data) );
#define DUMMY_MAX_CONFIG_ATTRIBUTES 10
#define DUMMY_MAX_IMAGE_FORMATS 10
#define DUMMY_MAX_SUBPIC_FORMATS 4
+#define DUMMY_MAX_DISPLAY_ATTRIBUTES 4
struct dummy_driver_data {
struct object_heap config_heap;
#define DEFAULT_DRIVER_DIR "/usr/X11R6/lib/modules/dri"
#define DRIVER_EXTENSION "_drv_video.so"
-#define DRIVER_INIT_FUNC "__vaDriverInit_0_23"
+#define DRIVER_INIT_FUNC "__vaDriverInit_0_24"
#define CTX(dpy) ((VADriverContextP) dpy );
#define ASSERT_CONTEXT(dpy) assert( vaDbgContextIsValid(dpy) )
CHECK_MAXIMUM(vaStatus, ctx, attributes);
CHECK_MAXIMUM(vaStatus, ctx, image_formats);
CHECK_MAXIMUM(vaStatus, ctx, subpic_formats);
+ CHECK_MAXIMUM(vaStatus, ctx, display_attributes);
CHECK_VTABLE(vaStatus, ctx, Terminate);
CHECK_VTABLE(vaStatus, ctx, QueryConfigProfiles);
CHECK_VTABLE(vaStatus, ctx, QueryConfigEntrypoints);
CHECK_VTABLE(vaStatus, ctx, QueryConfigAttributes);
CHECK_VTABLE(vaStatus, ctx, CreateConfig);
+ CHECK_VTABLE(vaStatus, ctx, DestroyConfig);
CHECK_VTABLE(vaStatus, ctx, GetConfigAttributes);
CHECK_VTABLE(vaStatus, ctx, CreateSurfaces);
CHECK_VTABLE(vaStatus, ctx, DestroySurface);
CHECK_VTABLE(vaStatus, ctx, SyncSurface);
CHECK_VTABLE(vaStatus, ctx, QuerySurfaceStatus);
CHECK_VTABLE(vaStatus, ctx, PutSurface);
- CHECK_VTABLE(vaStatus, ctx, CopySurfaceToGLXPbuffer);
CHECK_VTABLE(vaStatus, ctx, QueryImageFormats);
CHECK_VTABLE(vaStatus, ctx, CreateImage);
CHECK_VTABLE(vaStatus, ctx, DestroyImage);
CHECK_VTABLE(vaStatus, ctx, SetSubpictureChromakey);
CHECK_VTABLE(vaStatus, ctx, SetSubpictureGlobalAlpha);
CHECK_VTABLE(vaStatus, ctx, AssociateSubpicture);
+ CHECK_VTABLE(vaStatus, ctx, QueryDisplayAttributes);
+ CHECK_VTABLE(vaStatus, ctx, GetDisplayAttributes);
+ CHECK_VTABLE(vaStatus, ctx, SetDisplayAttributes);
CHECK_VTABLE(vaStatus, ctx, DbgCopySurfaceToBuffer);
}
if (VA_STATUS_SUCCESS != vaStatus)
return ctx->vtable.vaCreateConfig ( ctx, profile, entrypoint, attrib_list, num_attribs, config_id );
}
+VAStatus vaDestroyConfig (
+ VADisplay dpy,
+ VAConfigID config_id
+)
+{
+ VADriverContextP ctx = CTX(dpy);
+ ASSERT_CONTEXT(ctx);
+
+ TRACE(vaDestroyConfig);
+ return ctx->vtable.vaDestroyConfig ( ctx, config_id );
+}
+
VAStatus vaGetConfigAttributes (
VADisplay dpy,
VAConfigID config_id,
unsigned short desth,
VARectangle *cliprects, /* client supplied clip list */
unsigned int number_cliprects, /* number of clip rects in the clip list */
- int flags /* de-interlacing flags */
+ unsigned int flags /* de-interlacing flags */
)
{
VADriverContextP ctx = CTX(dpy);
cliprects, number_cliprects, flags );
}
-VAStatus vaCopySurfaceToGLXPbuffer (
- VADisplay dpy,
- VASurface *surface,
- XID pbuffer_id,
- short srcx,
- short srcy,
- unsigned short width,
- unsigned short height,
- short destx,
- short desty,
- unsigned int draw_buffer,
- unsigned int flags /* de-interlacing flags */
-)
-{
- VADriverContextP ctx = CTX(dpy);
- ASSERT_CONTEXT(ctx);
-
- TRACE(vaCopySurfaceToGLXPbuffer);
- return ctx->vtable.vaCopySurfaceToGLXPbuffer( ctx, surface, pbuffer_id,
- srcx,srcy,width, height,destx,desty,
- draw_buffer, flags );
-}
-
/* Get maximum number of image formats supported by the implementation */
int vaMaxNumImageFormats (
VADisplay dpy
return ctx->vtable.vaAssociateSubpicture ( ctx, target_surface, subpicture, src_x, src_y, dest_x, dest_y, width, height, flags );
}
+/* Get maximum number of display attributes supported by the implementation */
+int vaMaxNumDisplayAttributes (
+ VADisplay dpy
+)
+{
+ VADriverContextP ctx = CTX(dpy);
+ ASSERT_CONTEXT(ctx);
+
+ return ctx->max_display_attributes;
+}
+
+/*
+ * Query display attributes
+ * The caller must provide a "attr_list" array that can hold at
+ * least vaMaxNumDisplayAttributes() entries. The actual number of attributes
+ * returned in "attr_list" is returned in "num_attributes".
+ */
+VAStatus vaQueryDisplayAttributes (
+ VADisplay dpy,
+ VADisplayAttribute *attr_list, /* out */
+ int *num_attributes /* out */
+)
+{
+ VADriverContextP ctx = CTX(dpy);
+ ASSERT_CONTEXT(ctx);
+
+ TRACE(vaQueryDisplayAttributes);
+ return ctx->vtable.vaQueryDisplayAttributes ( ctx, attr_list, num_attributes );
+}
+
+/*
+ * Get display attributes
+ * This function returns the current attribute values in "attr_list".
+ * Only attributes returned with VA_DISPLAY_ATTRIB_GETTABLE set in the "flags" field
+ * from vaQueryDisplayAttributes() can have their values retrieved.
+ */
+VAStatus vaGetDisplayAttributes (
+ VADisplay dpy,
+ VADisplayAttribute *attr_list, /* in/out */
+ int num_attributes
+)
+{
+ VADriverContextP ctx = CTX(dpy);
+ ASSERT_CONTEXT(ctx);
+
+ TRACE(vaGetDisplayAttributes);
+ return ctx->vtable.vaGetDisplayAttributes ( ctx, attr_list, num_attributes );
+}
+
+/*
+ * Set display attributes
+ * Only attributes returned with VA_DISPLAY_ATTRIB_SETTABLE set in the "flags" field
+ * from vaQueryDisplayAttributes() can be set. If the attribute is not settable or
+ * the value is out of range, the function returns VA_STATUS_ERROR_ATTR_NOT_SUPPORTED
+ */
+VAStatus vaSetDisplayAttributes (
+ VADisplay dpy,
+ VADisplayAttribute *attr_list,
+ int num_attributes
+)
+{
+ VADriverContextP ctx = CTX(dpy);
+ ASSERT_CONTEXT(ctx);
+
+ TRACE(vaSetDisplayAttributes);
+ return ctx->vtable.vaSetDisplayAttributes ( ctx, attr_list, num_attributes );
+}
+
+
VAStatus vaDbgCopySurfaceToBuffer(VADisplay dpy,
VASurface *surface,
/*
* Video Decode Acceleration API Specification
*
- * Rev. 0.23
+ * Rev. 0.24
* <jonathan.bian@intel.com>
*
* Revision History:
* rev 0.21 (08/20/2007 Jonathan Bian) - Added image and subpicture support.
* rev 0.22 (08/27/2007 Jonathan Bian) - Added support for chroma-keying and global alpha.
* rev 0.23 (09/07/2007 Jonathan Bian) - Fixed some issues with images and subpictures.
+ * rev 0.24 (09/18/2007 Jonathan Bian) - Added display attributes.
*
* Acknowledgements:
* Some concepts borrowed from XvMC and XvImage.
#define VA_STATUS_ERROR_INVALID_CONTEXT 0x00000003
#define VA_STATUS_ERROR_INVALID_SURFACE 0x00000004
#define VA_STATUS_ERROR_INVALID_BUFFER 0x00000005
-#define VA_STATUS_ERROR_ATTR_NOT_SUPPORTED 0x00000006 /* Todo: Remove */
+#define VA_STATUS_ERROR_ATTR_NOT_SUPPORTED 0x00000006
#define VA_STATUS_ERROR_MAX_NUM_EXCEEDED 0x00000007
#define VA_STATUS_ERROR_UNSUPPORTED_PROFILE 0x00000008
#define VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT 0x00000009
int num_attribs
);
-typedef int VAConfigID;
+/* Generic ID type, can be re-typed for specific implementation */
+typedef unsigned int VAGenericID;
+
+typedef VAGenericID VAConfigID;
/*
* Create a configuration for the decode pipeline
);
/*
+ * Free resources associdated with a given config
+ */
+VAStatus vaDestroyConfig (
+ VADisplay dpy,
+ VAConfigID config_id
+);
+
+/*
* Get all attributes for a given configuration
* The profile of the configuration is returned in \93profile\94
* The entrypoint of the configuration is returned in \93entrypoint\94
* Context represents a "virtual" video decode pipeline
*/
-/* generic context ID type, can be re-typed for specific implementation */
-typedef int VAContextID;
+typedef VAGenericID VAContextID;
-/* generic surface ID type, can be re-typed for specific implementation */
-typedef int VASurfaceID;
+typedef VAGenericID VASurfaceID;
#define VA_INVALID_SURFACE -1
*
*/
-typedef int VABufferID;
+typedef VAGenericID VABufferID;
typedef enum
{
unsigned int alpha_mask;
} VAImageFormat;
-typedef int VAImageID;
+typedef VAGenericID VAImageID;
typedef struct _VAImage
{
* DVD sub-titles or closed captioning text etc.
*/
-typedef int VASubpictureID;
+typedef VAGenericID VASubpictureID;
typedef struct _VASubpicture
{
unsigned short height;
} VARectangle;
+/*
+ * Display attributes
+ * Display attributes are used to control things such as contrast, hue, saturation,
+ * brightness etc. in the rendering process. The application can query what
+ * attributes are supported by the driver, and then set the appropriate attributes
+ * before calling vaPutSurface()
+ */
+
+/* Currently defined display attribute types */
+typedef enum
+{
+ VADisplayAttribBrightness = 0,
+ VADisplayAttribContrast = 1,
+ VADisplayAttribHue = 2,
+ VADisplayAttribSaturation = 3,
+} VADisplayAttribType;
+
+/* flags for VADisplayAttribute */
+#define VA_DISPLAY_ATTRIB_NOT_SUPPORTED 0x0000
+#define VA_DISPLAY_ATTRIB_GETTABLE 0x0001
+#define VA_DISPLAY_ATTRIB_SETTABLE 0x0002
+
+typedef struct _VADisplayAttribute
+{
+ VADisplayAttribType type;
+ int min_value;
+ int max_value;
+ int value; /* used by the set/get attribute functions */
+/* flags can be VA_DISPLAY_ATTRIB_GETTABLE or VA_DISPLAY_ATTRIB_SETTABLE or OR'd together */
+ unsigned int flags;
+} VADisplayAttribute;
+
+/* Get maximum number of display attributs supported by the implementation */
+int vaMaxNumDisplayAttributes (
+ VADisplay dpy
+);
+
+/*
+ * Query display attributes
+ * The caller must provide a "attr_list" array that can hold at
+ * least vaMaxNumDisplayAttributes() entries. The actual number of attributes
+ * returned in "attr_list" is returned in "num_attributes".
+ */
+VAStatus vaQueryDisplayAttributes (
+ VADisplay dpy,
+ VADisplayAttribute *attr_list, /* out */
+ int *num_attributes /* out */
+);
+
+/*
+ * Get display attributes
+ * This function returns the current attribute values in "attr_list".
+ * Only attributes returned with VA_DISPLAY_ATTRIB_GETTABLE set in the "flags" field
+ * from vaQueryDisplayAttributes() can have their values retrieved.
+ */
+VAStatus vaGetDisplayAttributes (
+ VADisplay dpy,
+ VADisplayAttribute *attr_list, /* in/out */
+ int num_attributes
+);
+
+/*
+ * Set display attributes
+ * Only attributes returned with VA_DISPLAY_ATTRIB_SETTABLE set in the "flags" field
+ * from vaQueryDisplayAttributes() can be set. If the attribute is not settable or
+ * the value is out of range, the function returns VA_STATUS_ERROR_ATTR_NOT_SUPPORTED
+ */
+VAStatus vaSetDisplayAttributes (
+ VADisplay dpy,
+ VADisplayAttribute *attr_list,
+ int num_attributes
+);
+
#ifdef __cplusplus
}
#endif
VAImage sub_image;
VASubpicture subpicture;
unsigned char sub_data[128][16];
- /* fill sub_data with subtitle in AI44 */
- vaCreateImage(dpy, sub_formats, 128, 16,&sub_image);
+ /* create an image for the subtitle */
+ vaCreateImage(dpy, sub_formats, 128, 16, &sub_image);
+ vaCreateBuffer(dpy, VAImageBufferType, &sub_image->buf);
+ /* fill the image data */
+ vaBufferData(dpy, sub_image->buf, sub_image->data_size, sub_data);
vaCreateSubpicture(dpy, &sub_image, &subpicture);
unsigned char palette[3][16];
/* fill the palette data */
int max_attributes;
int max_image_formats;
int max_subpic_formats;
+ int max_display_attributes;
void *handle; /* dlopen handle */
void *pDriverData;
struct
VAConfigID *config_id /* out */
);
+ VAStatus (*vaDestroyConfig) (
+ VADriverContextP ctx,
+ VAConfigID config_id
+ );
+
VAStatus (*vaGetConfigAttributes) (
VADriverContextP ctx,
VAConfigID config_id,
unsigned short desth,
VARectangle *cliprects, /* client supplied clip list */
unsigned int number_cliprects, /* number of clip rects in the clip list */
- int flags /* de-interlacing flags */
+ unsigned int flags /* de-interlacing flags */
);
- VAStatus (*vaCopySurfaceToGLXPbuffer) (
- VADriverContextP ctx,
- VASurface *surface,
- XID pbuffer_id,
- short srcx,
- short srcy,
- unsigned short width,
- unsigned short height,
- short destx,
- short desty,
- unsigned int draw_buffer,
- unsigned int flags /* de-interlacing flags */
- );
-
VAStatus (*vaQueryImageFormats) (
VADriverContextP ctx,
VAImageFormat *format_list, /* out */
unsigned int flags
);
+ VAStatus (*vaQueryDisplayAttributes) (
+ VADriverContextP ctx,
+ VADisplayAttribute *attr_list, /* out */
+ int *num_attributes /* out */
+ );
+
+ VAStatus (*vaGetDisplayAttributes) (
+ VADriverContextP ctx,
+ VADisplayAttribute *attr_list, /* in/out */
+ int num_attributes
+ );
+
+ VAStatus (*vaSetDisplayAttributes) (
+ VADriverContextP ctx,
+ VADisplayAttribute *attr_list,
+ int num_attributes
+ );
+
+
VAStatus (*vaDbgCopySurfaceToBuffer) (
VADriverContextP ctx,
VASurface *surface,
unsigned short desth,
VARectangle *cliprects, /* client supplied clip list */
unsigned int number_cliprects, /* number of clip rects in the clip list */
- int flags /* de-interlacing flags */
-);
-
-/*
- This function copies a rectangle of dimension "width" by "height"
- from the VASurface indicated by "surface" to the GLXPbuffer
- identified by its XID "pbuffer_id". The locations of source and
- destination rectangles are specified differently for the VASurface
- source and the GLXPbuffer destination as follows. On the VASurface,
- the rectangle location is specified in the usual X-Window fashion
- with srcx and srcy indicating the location of the upper left hand
- corner of the rectangle relative to the VASurface origin (the upper
- left hand corner of the XvMCSurface with positive Y axis going in the
- down direction). On the GLXPbuffer the rectangle location is
- specified in the usual OpenGL fashion with the dstx and dsty
- indicating the location of the lower left hand corner of the
- rectangle relative to the GLXPbuffer origin (the lower left hand
- corner of the GLXPbuffer with the positive Y axis going in the
- up direction).
-
- The "draw_buffer" takes the same OpenGL enums that glDrawBuffer()
- takes (ie. GL_FRONT_LEFT, GL_FRONT_RIGHT, GL_BACK_LEFT, GL_BACK_RIGHT,
- GL_FRONT, GL_BACK, GL_LEFT, GL_RIGHT or GL_FRONT_AND_BACK). This
- indicates which buffer of the GLXPbuffer is to be used for the
- destination of the copy. Buffers specified in the "draw_buffer"
- that do not exist in the GLXPbuffer are ignored.
-
- "flags" may be VA_TOP_FIELD, VA_BOTTOM_FIELD or VA_FRAME_PICTURE.
- If flags is not VA_FRAME_PICTURE, the srcy and height are in field
- coordinates, not frame. That is, the total copyable height is half
- the height of the VASurface.
-*/
-VAStatus vaCopySurfaceToGLXPbuffer (
- VADisplay dpy,
- VASurface *surface,
- XID pbuffer_id,
- short srcx,
- short srcy,
- unsigned short width,
- unsigned short height,
- short destx,
- short desty,
- unsigned int draw_buffer,
unsigned int flags /* de-interlacing flags */
);
-
#ifdef __cplusplus
}
#endif