diff options
author | Waldo Bastian <waldo.bastian@intel.com> | 2007-09-25 16:21:28 -0700 |
---|---|---|
committer | Waldo Bastian <waldo.bastian@intel.com> | 2007-09-25 16:21:28 -0700 |
commit | 8de3509ff26510ef02a00fdda78c3431b4329253 (patch) | |
tree | 78fc798c16afee72672cf607aca36613903f6c1d /src | |
parent | 4d74a235f18cf13166adefc3bbb02638bc36424a (diff) |
Update VA API to v0.24
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/va.c | 126 | ||||
-rwxr-xr-x | src/va.h | 134 | ||||
-rwxr-xr-x | src/va_backend.h | 45 | ||||
-rwxr-xr-x | src/va_x11.h | 44 |
5 files changed, 233 insertions, 118 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 74a6711..e0ea3c1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -22,7 +22,7 @@ libva_la_LTLIBRARIES = libva.la libva_ladir = $(libdir) -libva_la_LDFLAGS = -version-number 0:22:0 -no-undefined +libva_la_LDFLAGS = -version-number 0:24:0 -no-undefined libva_la_LIBADD = -ldl -lX11 -lXext libva_la_SOURCES = va_dri.c va.c va_dristr.h @@ -36,7 +36,7 @@ #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) ) @@ -254,11 +254,13 @@ static VAStatus va_openDriver(VADriverContextP ctx, char *driver_name) 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); @@ -276,7 +278,6 @@ static VAStatus va_openDriver(VADriverContextP ctx, char *driver_name) 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); @@ -290,6 +291,9 @@ static VAStatus va_openDriver(VADriverContextP ctx, char *driver_name) 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) @@ -473,7 +477,7 @@ VAStatus vaQueryConfigEntrypoints ( return ctx->vtable.vaQueryConfigEntrypoints ( ctx, profile, entrypoints, num_entrypoints); } -VAStatus vaQueryConfigAttributes ( +VAStatus vaGetConfigAttributes ( VADisplay dpy, VAProfile profile, VAEntrypoint entrypoint, @@ -484,8 +488,8 @@ VAStatus vaQueryConfigAttributes ( VADriverContextP ctx = CTX(dpy); ASSERT_CONTEXT(ctx); - TRACE(vaQueryConfigAttributes); - return ctx->vtable.vaQueryConfigAttributes ( ctx, profile, entrypoint, attrib_list, num_attribs ); + TRACE(vaGetConfigAttributes); + return ctx->vtable.vaGetConfigAttributes ( ctx, profile, entrypoint, attrib_list, num_attribs ); } VAStatus vaQueryConfigProfiles ( @@ -517,7 +521,19 @@ VAStatus vaCreateConfig ( return ctx->vtable.vaCreateConfig ( ctx, profile, entrypoint, attrib_list, num_attribs, config_id ); } -VAStatus vaGetConfigAttributes ( +VAStatus vaDestroyConfig ( + VADisplay dpy, + VAConfigID config_id +) +{ + VADriverContextP ctx = CTX(dpy); + ASSERT_CONTEXT(ctx); + + TRACE(vaDestroyConfig); + return ctx->vtable.vaDestroyConfig ( ctx, config_id ); +} + +VAStatus vaQueryConfigAttributes ( VADisplay dpy, VAConfigID config_id, VAProfile *profile, /* out */ @@ -529,8 +545,8 @@ VAStatus vaGetConfigAttributes ( VADriverContextP ctx = CTX(dpy); ASSERT_CONTEXT(ctx); - TRACE(vaGetConfigAttributes); - return ctx->vtable.vaGetConfigAttributes( ctx, config_id, profile, entrypoint, attrib_list, num_attribs); + TRACE(vaQueryConfigAttributes); + return ctx->vtable.vaQueryConfigAttributes( ctx, config_id, profile, entrypoint, attrib_list, num_attribs); } VAStatus vaCreateSurfaces ( @@ -752,7 +768,7 @@ VAStatus vaPutSurface ( 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); @@ -764,29 +780,6 @@ VAStatus vaPutSurface ( 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 @@ -1056,6 +1049,75 @@ VAStatus vaAssociateSubpicture ( 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, @@ -24,7 +24,7 @@ /* * Video Decode Acceleration API Specification * - * Rev. 0.23 + * Rev. 0.24 * <jonathan.bian@intel.com> * * Revision History: @@ -43,6 +43,7 @@ * 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. @@ -90,7 +91,7 @@ typedef int VAStatus; /* Return status type from functions */ #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 @@ -230,14 +231,14 @@ VAStatus vaQueryConfigEntrypoints ( ); /* - * Query attributes for a given profile/entrypoint pair + * Get attributes for a given profile/entrypoint pair * The caller must provide an “attrib_list” with all attributes to be * queried. Upon return, the attributes in “attrib_list” have been * updated with their value. Unknown attributes or attributes that are * not supported for the given profile/entrypoint pair will have their * value set to VA_ATTRIB_NOT_SUPPORTED */ -VAStatus vaQueryConfigAttributes ( +VAStatus vaGetConfigAttributes ( VADisplay dpy, VAProfile profile, VAEntrypoint entrypoint, @@ -245,7 +246,10 @@ VAStatus vaQueryConfigAttributes ( 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 @@ -262,14 +266,22 @@ VAStatus vaCreateConfig ( ); /* - * Get all attributes for a given configuration + * Free resources associdated with a given config + */ +VAStatus vaDestroyConfig ( + VADisplay dpy, + VAConfigID config_id +); + +/* + * Query all attributes for a given configuration * The profile of the configuration is returned in “profile” * The entrypoint of the configuration is returned in “entrypoint” * The caller must provide an “attrib_list” array that can hold at least * vaMaxNumConfigAttributes() entries. The actual number of attributes * returned in “attrib_list” is returned in “num_attribs” */ -VAStatus vaGetConfigAttributes ( +VAStatus vaQueryConfigAttributes ( VADisplay dpy, VAConfigID config_id, VAProfile *profile, /* out */ @@ -285,11 +297,9 @@ VAStatus vaGetConfigAttributes ( * 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 @@ -386,7 +396,7 @@ VAStatus vaDestroyContext ( * */ -typedef int VABufferID; +typedef VAGenericID VABufferID; typedef enum { @@ -820,15 +830,15 @@ typedef struct _VAPictureParameterBufferH264 }; unsigned char num_slice_groups_minus1; unsigned char slice_group_map_type; - unsigned char pic_init_qp_minus26; - unsigned char chroma_qp_index_offset; - unsigned char second_chroma_qp_index_offset; + signed char pic_init_qp_minus26; + signed char chroma_qp_index_offset; + signed char second_chroma_qp_index_offset; union { struct { - unsigned char entropy_coding_mode_flag : 1; - unsigned char weighted_pred_flag : 1; - unsigned char weighted_bipred_idc : 1; - unsigned char transform_8x8_mode_flag : 1; + unsigned char entropy_coding_mode_flag : 1; + unsigned char weighted_pred_flag : 1; + unsigned char weighted_bipred_idc : 2; + unsigned char transform_8x8_mode_flag : 1; unsigned char field_pic_flag : 1; unsigned char constrained_intra_pred_flag : 1; }; @@ -1075,7 +1085,7 @@ typedef struct _VAImageFormat unsigned int alpha_mask; } VAImageFormat; -typedef int VAImageID; +typedef VAGenericID VAImageID; typedef struct _VAImage { @@ -1187,7 +1197,7 @@ VAStatus vaPutImage ( * DVD sub-titles or closed captioning text etc. */ -typedef int VASubpictureID; +typedef VAGenericID VASubpictureID; typedef struct _VASubpicture { @@ -1333,6 +1343,79 @@ typedef struct _VARectangle 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 @@ -1376,7 +1459,7 @@ Mostly to demonstrate program flow with no error handling ... /* Assuming finding VLD, find out the format for the render target */ VAConfigAttrib attrib; attrib.type = VAConfigAttribRTFormat; - vaQueryConfigAttributes(dpy, VAProfileMPEG2Main, VAEntrypointVLD, + vaGetConfigAttributes(dpy, VAProfileMPEG2Main, VAEntrypointVLD, &attrib, 1); if (attrib.value & VA_RT_FORMAT_YUV420) @@ -1476,8 +1559,11 @@ Mostly to demonstrate program flow with no error handling ... 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 */ diff --git a/src/va_backend.h b/src/va_backend.h index c474925..3ffb113 100755 --- a/src/va_backend.h +++ b/src/va_backend.h @@ -48,6 +48,7 @@ struct VADriverContext int max_attributes; int max_image_formats; int max_subpic_formats; + int max_display_attributes; void *handle; /* dlopen handle */ void *pDriverData; struct @@ -67,7 +68,7 @@ struct VADriverContext int *num_entrypoints /* out */ ); - VAStatus (*vaQueryConfigAttributes) ( + VAStatus (*vaGetConfigAttributes) ( VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoint, @@ -84,7 +85,12 @@ struct VADriverContext VAConfigID *config_id /* out */ ); - VAStatus (*vaGetConfigAttributes) ( + VAStatus (*vaDestroyConfig) ( + VADriverContextP ctx, + VAConfigID config_id + ); + + VAStatus (*vaQueryConfigAttributes) ( VADriverContextP ctx, VAConfigID config_id, VAProfile *profile, /* out */ @@ -205,23 +211,9 @@ struct VADriverContext 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 */ @@ -328,6 +320,25 @@ struct VADriverContext 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, diff --git a/src/va_x11.h b/src/va_x11.h index e49c6c5..58b312f 100755 --- a/src/va_x11.h +++ b/src/va_x11.h @@ -50,53 +50,9 @@ VAStatus vaPutSurface ( 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 |