summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWaldo Bastian <waldo.bastian@intel.com>2007-09-25 16:21:28 -0700
committerWaldo Bastian <waldo.bastian@intel.com>2007-09-25 16:21:28 -0700
commit8de3509ff26510ef02a00fdda78c3431b4329253 (patch)
tree78fc798c16afee72672cf607aca36613903f6c1d
parent4d74a235f18cf13166adefc3bbb02638bc36424a (diff)
downloadlibva-8de3509ff26510ef02a00fdda78c3431b4329253.tar.gz
Update VA API to v0.24
-rw-r--r--dummy_drv_video/Makefile.am4
-rw-r--r--dummy_drv_video/dummy_drv_video.c96
-rw-r--r--dummy_drv_video/dummy_drv_video.h1
-rw-r--r--src/Makefile.am2
-rw-r--r--src/va.c126
-rwxr-xr-xsrc/va.h134
-rwxr-xr-xsrc/va_backend.h45
-rwxr-xr-xsrc/va_x11.h44
-rw-r--r--test/Makefile.am50
-rw-r--r--test/test_01.c42
-rw-r--r--test/test_02.c42
-rw-r--r--test/test_03.c67
-rw-r--r--test/test_04.c84
-rw-r--r--test/test_05.c77
-rw-r--r--test/test_06.c123
-rw-r--r--test/test_07.c119
-rw-r--r--test/test_08.c92
-rw-r--r--test/test_09.c109
-rw-r--r--test/test_10.c89
-rw-r--r--test/test_11.c130
-rw-r--r--test/test_common.c171
-rw-r--r--test/testplan.txt106
22 files changed, 1608 insertions, 145 deletions
diff --git a/dummy_drv_video/Makefile.am b/dummy_drv_video/Makefile.am
index feb2f8b..643f53c 100644
--- a/dummy_drv_video/Makefile.am
+++ b/dummy_drv_video/Makefile.am
@@ -22,8 +22,8 @@
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
diff --git a/dummy_drv_video/dummy_drv_video.c b/dummy_drv_video/dummy_drv_video.c
index ce600aa..4ec2a55 100644
--- a/dummy_drv_video/dummy_drv_video.c
+++ b/dummy_drv_video/dummy_drv_video.c
@@ -141,7 +141,7 @@ VAStatus dummy_QueryConfigEntrypoints(
return VA_STATUS_SUCCESS;
}
-VAStatus dummy_QueryConfigAttributes(
+VAStatus dummy_GetConfigAttributes(
VADriverContextP ctx,
VAProfile profile,
VAEntrypoint entrypoint,
@@ -312,7 +312,27 @@ VAStatus dummy_CreateConfig(
return vaStatus;
}
-VAStatus dummy_GetConfigAttributes(
+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_QueryConfigAttributes(
VADriverContextP ctx,
VAConfigID config_id,
VAProfile *profile, /* out */
@@ -717,11 +737,14 @@ VAStatus dummy_CreateBuffer(
{
case VAPictureParameterBufferType:
case VAIQMatrixBufferType:
+ case VABitPlaneBufferType:
+ case VASliceGroupMapBufferType:
case VASliceParameterBufferType:
case VASliceDataBufferType:
case VAMacroblockParameterBufferType:
case VAResidualDataBufferType:
case VADeblockingParameterBufferType:
+ case VAImageBufferType:
/* Ok */
break;
default:
@@ -1010,32 +1033,62 @@ VAStatus dummy_PutSurface(
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;
+}
-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 */
-)
+/*
+ * 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;
}
+/*
+ * 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,
@@ -1087,7 +1140,7 @@ VAStatus dummy_Terminate( VADriverContextP ctx )
return VA_STATUS_SUCCESS;
}
-VAStatus __vaDriverInit_0_23( VADriverContextP ctx )
+VAStatus __vaDriverInit_0_24( VADriverContextP ctx )
{
object_base_p obj;
int result;
@@ -1095,12 +1148,13 @@ VAStatus __vaDriverInit_0_23( VADriverContextP ctx )
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;
@@ -1108,6 +1162,7 @@ VAStatus __vaDriverInit_0_23( VADriverContextP ctx )
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;
@@ -1125,7 +1180,6 @@ VAStatus __vaDriverInit_0_23( VADriverContextP ctx )
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;
@@ -1139,6 +1193,10 @@ VAStatus __vaDriverInit_0_23( VADriverContextP ctx )
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) );
diff --git a/dummy_drv_video/dummy_drv_video.h b/dummy_drv_video/dummy_drv_video.h
index 05f3c9d..81a9a44 100644
--- a/dummy_drv_video/dummy_drv_video.h
+++ b/dummy_drv_video/dummy_drv_video.h
@@ -33,6 +33,7 @@
#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;
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
diff --git a/src/va.c b/src/va.c
index 9a3aca5..bb02f38 100644
--- a/src/va.c
+++ b/src/va.c
@@ -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,
diff --git a/src/va.h b/src/va.h
index 2343412..66cc7a0 100755
--- a/src/va.h
+++ b/src/va.h
@@ -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
diff --git a/test/Makefile.am b/test/Makefile.am
index a42608d..13bff08 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -20,14 +20,52 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-check_PROGRAMS = test
-testdir = $(bindir)
+check_PROGRAMS = test_01 test_02 test_03 test_04 test_05 test_06 \
+ test_07 test_08 test_09 test_10 test_11
-# This gives better backtraces when running valgrind:
-# test_LDADD = ../src/libva.la ../../psb-video/src/psb_drv_video.la
-test_LDADD = ../src/libva.la
+testdir = $(bindir)
AM_CFLAGS = -I$(top_srcdir)/../../include/external/ -I$(top_srcdir)/src
-test_SOURCES = test.c
TESTS = $(check_PROGRAMS)
+
+TEST_LIBS = ../src/libva.la
+
+test_01_LDADD = $(TEST_LIBS)
+test_01_SOURCES = test_01.c
+
+test_02_LDADD = $(TEST_LIBS)
+test_02_SOURCES = test_02.c
+
+test_03_LDADD = $(TEST_LIBS)
+test_03_SOURCES = test_03.c
+
+test_04_LDADD = $(TEST_LIBS)
+test_04_SOURCES = test_04.c
+
+test_05_LDADD = $(TEST_LIBS)
+test_05_SOURCES = test_05.c
+
+test_06_LDADD = $(TEST_LIBS)
+test_06_SOURCES = test_06.c
+
+test_07_LDADD = $(TEST_LIBS)
+test_07_SOURCES = test_07.c
+
+test_08_LDADD = $(TEST_LIBS)
+test_08_SOURCES = test_08.c
+
+test_09_LDADD = $(TEST_LIBS)
+test_09_SOURCES = test_09.c
+
+test_10_LDADD = $(TEST_LIBS)
+test_10_SOURCES = test_10.c
+
+test_11_LDADD = $(TEST_LIBS)
+test_11_SOURCES = test_11.c
+
+
+valgrind: $(check_PROGRAMS)
+ for a in $(check_PROGRAMS); do \
+ valgrind --leak-check=full --show-reachable=yes .libs/$$a; \
+ done
diff --git a/test/test_01.c b/test/test_01.c
new file mode 100644
index 0000000..4075655
--- /dev/null
+++ b/test/test_01.c
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2007 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#define TEST_DESCRIPTION "Initialize & Terminate"
+
+#include "test_common.c"
+
+void pre()
+{
+}
+
+void post()
+{
+}
+
+void test()
+{
+ test_init();
+
+ test_terminate();
+}
diff --git a/test/test_02.c b/test/test_02.c
new file mode 100644
index 0000000..5622a18
--- /dev/null
+++ b/test/test_02.c
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2007 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#define TEST_DESCRIPTION "Query profiles"
+
+#include "test_common.c"
+
+void pre()
+{
+ test_init();
+}
+
+void test()
+{
+ test_profiles();
+}
+
+void post()
+{
+ test_terminate();
+}
diff --git a/test/test_03.c b/test/test_03.c
new file mode 100644
index 0000000..d2af494
--- /dev/null
+++ b/test/test_03.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2007 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#define TEST_DESCRIPTION "Query entrypoints for all profiles"
+
+#include "test_common.c"
+
+void pre()
+{
+ test_init();
+ test_profiles();
+}
+
+void test()
+{
+ int max_entrypoints;
+ int num_entrypoints;
+ int i, j;
+ max_entrypoints = vaMaxNumEntrypoints(va_dpy);
+ status("vaMaxEntryPoints = %d\n", max_entrypoints);
+ ASSERT(max_entrypoints > 0);
+
+ VAEntrypoint *entrypoints = malloc(max_entrypoints * sizeof(VAEntrypoint));
+ ASSERT(entrypoints);
+
+ for(i = 0; i < num_profiles; i++)
+ {
+ memset(entrypoints, 0xff, max_entrypoints * sizeof(VAEntrypoint));
+ va_status = vaQueryConfigEntrypoints(va_dpy, profiles[i], entrypoints, &num_entrypoints);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+ status("vaQueryConfigEntryPoints(%s) reports %d entrypoints\n", profile2string(profiles[i]), num_entrypoints);
+ ASSERT(num_entrypoints <= max_entrypoints);
+ ASSERT(num_entrypoints > 0);
+ for(j = 0; j < num_entrypoints; j++)
+ {
+ status(" entrypoint %d [%s]\n", entrypoints[j], entrypoint2string(entrypoints[j]));
+ }
+ }
+
+ free(entrypoints);
+}
+
+void post()
+{
+ test_terminate();
+}
diff --git a/test/test_04.c b/test/test_04.c
new file mode 100644
index 0000000..2e3329c
--- /dev/null
+++ b/test/test_04.c
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2007 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#define TEST_DESCRIPTION "Get config attributes for all profiles / entrypoints"
+
+#include "test_common.c"
+
+void pre()
+{
+ test_init();
+ test_profiles();
+}
+
+#define DEADVALUE 0xdeaddead
+
+void test()
+{
+ VAConfigAttrib attributes[] = {
+ { type: VAConfigAttribRTFormat, value: DEADVALUE },
+ { type: VAConfigAttribSpatialResidual, value: DEADVALUE },
+ { type: VAConfigAttribSpatialClipping, value: DEADVALUE },
+ { type: VAConfigAttribIntraResidual, value: DEADVALUE },
+ { type: VAConfigAttribEncryption, value: DEADVALUE }
+ };
+ int max_entrypoints;
+ int num_entrypoints;
+ int num_attribs = sizeof(attributes) / sizeof(VAConfigAttrib);
+ int i, j, k;
+ max_entrypoints = vaMaxNumEntrypoints(va_dpy);
+ ASSERT(max_entrypoints > 0);
+ VAEntrypoint *entrypoints = malloc(max_entrypoints * sizeof(VAEntrypoint));
+ ASSERT(entrypoints);
+
+ VAConfigAttrib *attrib_list = (VAConfigAttrib *) malloc(sizeof(attributes));
+ ASSERT(attrib_list);
+
+ for(i = 0; i < num_profiles; i++)
+ {
+ va_status = vaQueryConfigEntrypoints(va_dpy, profiles[i], entrypoints, &num_entrypoints);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+
+ for(j = 0; j < num_entrypoints; j++)
+ {
+ memcpy(attrib_list, attributes, sizeof(attributes));
+ status("vaGetConfigAttributes for %s, %s\n", profile2string(profiles[i]), entrypoint2string(entrypoints[j]));
+ va_status = vaGetConfigAttributes(va_dpy, profiles[i], entrypoints[j], attrib_list, num_attribs);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+ for(k = 0; k < num_attribs; k++)
+ {
+ status(" %d -> %08x\n", attrib_list[k].type, attrib_list[k].value);
+ ASSERT(attrib_list[k].value != DEADVALUE);
+ }
+ }
+ }
+
+ free(attrib_list);
+ free(entrypoints);
+}
+
+void post()
+{
+ test_terminate();
+}
diff --git a/test/test_05.c b/test/test_05.c
new file mode 100644
index 0000000..f88dd15
--- /dev/null
+++ b/test/test_05.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2007 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#define TEST_DESCRIPTION "Create/destroy configs for all profiles / entrypoints"
+
+#include "test_common.c"
+
+void pre()
+{
+ test_init();
+ test_profiles();
+}
+
+void test()
+{
+ int max_entrypoints;
+ int num_entrypoints;
+ int i, j, k;
+ int config_count = 0;
+ max_entrypoints = vaMaxNumEntrypoints(va_dpy);
+ ASSERT(max_entrypoints > 0);
+ VAEntrypoint *entrypoints = malloc(max_entrypoints * sizeof(VAEntrypoint));
+ ASSERT(entrypoints);
+
+ VAConfigID *configs = malloc(max_entrypoints * num_profiles * sizeof(VAConfigID));
+
+ for(i = 0; i < num_profiles; i++)
+ {
+ va_status = vaQueryConfigEntrypoints(va_dpy, profiles[i], entrypoints, &num_entrypoints);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+
+ for(j = 0; j < num_entrypoints; j++)
+ {
+ status("vaCreateConfig for %s, %s\n", profile2string(profiles[i]), entrypoint2string(entrypoints[j]));
+ va_status = vaCreateConfig(va_dpy, profiles[i], entrypoints[j], NULL, 0, &(configs[config_count]));
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+ status("vaCreateConfig returns %08x\n", configs[config_count]);
+ config_count++;
+ }
+ }
+
+ for(i = 0; i < config_count; i++)
+ {
+ status("vaDestroyConfig for config %08x\n", configs[i]);
+ va_status = vaDestroyConfig( va_dpy, configs[i] );
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+ }
+
+ free(configs);
+ free(entrypoints);
+}
+
+void post()
+{
+ test_terminate();
+}
diff --git a/test/test_06.c b/test/test_06.c
new file mode 100644
index 0000000..ca47e50
--- /dev/null
+++ b/test/test_06.c
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2007 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#define TEST_DESCRIPTION "Get config attributes from configs"
+
+#include "test_common.c"
+
+int max_entrypoints;
+VAEntrypoint *entrypoints;
+
+VAConfigID *configs;
+int config_count = 0;
+
+
+
+void pre()
+{
+ int i, j, k;
+
+ test_init();
+ test_profiles();
+
+ max_entrypoints = vaMaxNumEntrypoints(va_dpy);
+ ASSERT(max_entrypoints > 0);
+ entrypoints = malloc(max_entrypoints * sizeof(VAEntrypoint));
+ ASSERT(entrypoints);
+
+ configs = malloc(max_entrypoints * num_profiles * sizeof(VAConfigID));
+ ASSERT(configs);
+
+ // Create configs
+ for(i = 0; i < num_profiles; i++)
+ {
+ int num_entrypoints;
+ va_status = vaQueryConfigEntrypoints(va_dpy, profiles[i], entrypoints, &num_entrypoints);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+
+ for(j = 0; j < num_entrypoints; j++)
+ {
+ va_status = vaCreateConfig(va_dpy, profiles[i], entrypoints[j], NULL, 0, &(configs[config_count]));
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+ config_count++;
+ }
+ }
+}
+
+void test()
+{
+ int i, j, k;
+ int max_attribs;
+
+ max_attribs = vaMaxNumConfigAttributes(va_dpy);
+ ASSERT(max_attribs > 0);
+
+ VAConfigAttrib *attrib_list = malloc(max_attribs * sizeof(VAConfigAttrib));
+
+ config_count = 0;
+ for(i = 0; i < num_profiles; i++)
+ {
+ int num_entrypoints;
+
+ va_status = vaQueryConfigEntrypoints(va_dpy, profiles[i], entrypoints, &num_entrypoints);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+ for(j = 0; j < num_entrypoints; j++)
+ {
+ VAProfile profile= -1;
+ VAEntrypoint entrypoint = -1;
+ int num_attribs = -1;
+
+ status("Checking vaQueryConfigAttributes for %s, %s\n", profile2string(profiles[i]), entrypoint2string(entrypoints[j]));
+ memset(attrib_list, 0xff, max_attribs * sizeof(VAConfigAttrib));
+
+ va_status = vaQueryConfigAttributes(va_dpy, configs[config_count], &profile, &entrypoint, attrib_list, &num_attribs);
+ config_count++;
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+ ASSERT( profile == profiles[i] );
+ ASSERT( entrypoint == entrypoints[j] );
+ ASSERT( num_attribs >= 0 );
+ for(k = 0; k < num_attribs; k++)
+ {
+ status(" %d -> %08x\n", attrib_list[k].type, attrib_list[k].value);
+ ASSERT(attrib_list[k].value != VA_ATTRIB_NOT_SUPPORTED);
+ }
+ }
+ }
+
+ free(attrib_list);
+}
+
+void post()
+{
+ int i;
+ for(i = 0; i < config_count; i++)
+ {
+ va_status = vaDestroyConfig( va_dpy, configs[i] );
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+ }
+
+ free(configs);
+ free(entrypoints);
+ test_terminate();
+}
diff --git a/test/test_07.c b/test/test_07.c
new file mode 100644
index 0000000..3ae8f01
--- /dev/null
+++ b/test/test_07.c
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2007 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#define TEST_DESCRIPTION "Create and destory surfaces"
+
+#include "test_common.c"
+
+void pre()
+{
+ test_init();
+}
+
+#define DEAD_SURFACE_ID (VASurfaceID) 0xbeefdead
+
+void test_unique_surfaces(VASurface *surface_list1, int surface_count1, VASurface *surface_list2, int surface_count2)
+{
+ int i,j;
+
+ for(i = 0; i < surface_count1; i++)
+ {
+ for(j = 0; j < surface_count2; j++)
+ {
+ if ((surface_list1 == surface_list2) && (i == j)) continue;
+ ASSERT(surface_list1[i].surface_id != VA_INVALID_SURFACE);
+ ASSERT(surface_list2[j].surface_id != VA_INVALID_SURFACE);
+ ASSERT(surface_list1[i].surface_id != surface_list2[j].surface_id);
+ }
+ }
+}
+
+
+void test()
+{
+ VASurface surfaces_1[1+1];
+ VASurface surfaces_4[4+1];
+ VASurface surfaces_16[16+1];
+ VASurface surfaces_6[6+1];
+
+ memset(surfaces_1, 0xff, sizeof(surfaces_1));
+ memset(surfaces_4, 0xff, sizeof(surfaces_4));
+ memset(surfaces_16, 0xff, sizeof(surfaces_16));
+ memset(surfaces_6, 0xff, sizeof(surfaces_6));
+
+ status("vaCreateSurfaces 1 surface\n");
+ surfaces_1[1].surface_id = DEAD_SURFACE_ID;
+ va_status = vaCreateSurfaces(va_dpy, 352, 288, VA_RT_FORMAT_YUV420, 1, surfaces_1);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+ ASSERT( DEAD_SURFACE_ID == surfaces_1[1].surface_id ); /* bounds check */
+
+ status("vaCreateSurfaces 4 surfaces\n");
+ surfaces_4[4].surface_id = DEAD_SURFACE_ID;
+ va_status = vaCreateSurfaces(va_dpy, 352, 288, VA_RT_FORMAT_YUV420, 4, surfaces_4);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+ ASSERT( DEAD_SURFACE_ID == surfaces_4[4].surface_id ); /* bounds check */
+
+ status("vaCreateSurfaces 16 surfaces\n");
+ surfaces_16[16].surface_id = DEAD_SURFACE_ID;
+ va_status = vaCreateSurfaces(va_dpy, 352, 288, VA_RT_FORMAT_YUV420, 16, surfaces_16);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+ ASSERT( DEAD_SURFACE_ID == surfaces_16[16].surface_id ); /* bounds check */
+
+ test_unique_surfaces(surfaces_1, 1, surfaces_4, 4);
+ test_unique_surfaces(surfaces_4, 4, surfaces_16, 4);
+ test_unique_surfaces(surfaces_4, 4, surfaces_16, 16);
+ test_unique_surfaces(surfaces_4, 1, surfaces_16, 16);
+ test_unique_surfaces(surfaces_1, 16, surfaces_16, 16);
+
+ status("vaDestroySurface 4 surfaces\n");
+ va_status = vaDestroySurface(va_dpy, surfaces_4, 4);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+
+ status("vaCreateSurfaces 6 surfaces\n");
+ surfaces_6[6].surface_id = DEAD_SURFACE_ID;
+ va_status = vaCreateSurfaces(va_dpy, 352, 288, VA_RT_FORMAT_YUV420, 6, surfaces_6);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+ ASSERT( DEAD_SURFACE_ID == surfaces_6[6].surface_id ); /* bounds check */
+
+ test_unique_surfaces(surfaces_1, 1, surfaces_6, 6);
+ test_unique_surfaces(surfaces_6, 6, surfaces_16, 16);
+ test_unique_surfaces(surfaces_1, 6, surfaces_16, 6);
+
+ status("vaDestroySurface 16 surfaces\n");
+ va_status = vaDestroySurface(va_dpy, surfaces_16, 16);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+
+ status("vaDestroySurface 1 surface\n");
+ va_status = vaDestroySurface(va_dpy, surfaces_1, 1);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+
+ status("vaDestroySurface 6 surfaces\n");
+ va_status = vaDestroySurface(va_dpy, surfaces_6, 6);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+}
+
+void post()
+{
+ test_terminate();
+}
diff --git a/test/test_08.c b/test/test_08.c
new file mode 100644
index 0000000..ce4932d
--- /dev/null
+++ b/test/test_08.c
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2007 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#define TEST_DESCRIPTION "Create and destory surfaces of different sizes"
+
+#include "test_common.c"
+
+void pre()
+{
+ test_init();
+}
+
+#define DEAD_SURFACE_ID (VASurfaceID) 0xbeefdead
+
+void test_unique_surfaces(VASurface *surface_list, int surface_count)
+{
+ int i,j;
+
+ for(i = 0; i < surface_count; i++)
+ {
+ ASSERT(surface_list[i].surface_id != VA_INVALID_SURFACE);
+ for(j = 0; j < i; j++)
+ {
+ if (i == j) continue;
+ ASSERT(surface_list[i].surface_id != surface_list[j].surface_id);
+ }
+ }
+}
+
+typedef struct test_size { int w; int h; } test_size_t;
+
+test_size_t test_sizes[] = {
+ { 10, 10 },
+ { 128, 128 },
+ { 176, 144 },
+ { 144, 176 },
+ { 352, 288 },
+ { 399, 299 },
+ { 640, 480 },
+ { 1280, 720 }
+};
+
+#define NUM_SIZES (sizeof(test_sizes) / sizeof(test_size_t))
+
+void test()
+{
+ VASurface surfaces[NUM_SIZES+1];
+ int i;
+
+ memset(surfaces, 0xff, sizeof(surfaces));
+
+ for(i = 0; i < NUM_SIZES; i++)
+ {
+ status("vaCreateSurfaces create %dx%d surface\n", test_sizes[i].w, test_sizes[i].h);
+ surfaces[i+1].surface_id = DEAD_SURFACE_ID;
+ va_status = vaCreateSurfaces(va_dpy, test_sizes[i].w, test_sizes[i].h, VA_RT_FORMAT_YUV420, 1, &surfaces[i]);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+ ASSERT( DEAD_SURFACE_ID == surfaces[i+1].surface_id );
+ }
+
+ test_unique_surfaces(surfaces, NUM_SIZES);
+
+ status("vaDestroySurface all surfaces\n");
+ va_status = vaDestroySurface(va_dpy, surfaces, NUM_SIZES);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+}
+
+void post()
+{
+ test_terminate();
+}
diff --git a/test/test_09.c b/test/test_09.c
new file mode 100644
index 0000000..c3d5b18
--- /dev/null
+++ b/test/test_09.c
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2007 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#define TEST_DESCRIPTION "Create/destroy contexts for all profiles / entrypoints"
+
+#include "test_common.c"
+
+void pre()
+{
+ test_init();
+ test_profiles();
+}
+
+void test()
+{
+ int max_entrypoints;
+ int num_entrypoints;
+ int i, j, k;
+ int config_count = 0;
+ max_entrypoints = vaMaxNumEntrypoints(va_dpy);
+ ASSERT(max_entrypoints > 0);
+ VAEntrypoint *entrypoints = malloc(max_entrypoints * sizeof(VAEntrypoint));
+ ASSERT(entrypoints);
+
+ VAConfigID *configs = malloc(max_entrypoints * num_profiles * sizeof(VAConfigID));
+ VAContext *contexts = malloc(max_entrypoints * num_profiles * sizeof(VAContext));
+
+ for(i = 0; i < num_profiles; i++)
+ {
+ va_status = vaQueryConfigEntrypoints(va_dpy, profiles[i], entrypoints, &num_entrypoints);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+
+ for(j = 0; j < num_entrypoints; j++)
+ {
+ status("vaCreateConfig for %s, %s\n", profile2string(profiles[i]), entrypoint2string(entrypoints[j]));
+ va_status = vaCreateConfig(va_dpy, profiles[i], entrypoints[j], NULL, 0, &(configs[config_count]));
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+ status("vaCreateConfig returns %08x\n", configs[config_count]);
+ config_count++;
+ }
+ }
+
+ int width = 352;
+ int height = 288;
+ int surface_count = 4;
+ int total_surfaces = config_count * surface_count;
+
+ VASurface *surfaces = malloc(total_surfaces * sizeof(VASurface));
+
+ // TODO: Don't assume VA_RT_FORMAT_YUV420 is supported / needed for each config
+ va_status = vaCreateSurfaces(va_dpy, width, height, VA_RT_FORMAT_YUV420, total_surfaces, surfaces);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+
+ for(i = 0; i < config_count; i++)
+ {
+ status("vaCreateContext with config %08x\n", configs[i]);
+ int flags = 0;
+ va_status = vaCreateContext( va_dpy, configs[i], width, height, flags, surfaces + i*surface_count, surface_count, &contexts[i] );
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+ }
+
+ for(i = 0; i < config_count; i++)
+ {
+ status("vaDestroyContext for context %08x\n", contexts[i].context_id);
+ va_status = vaDestroyContext( va_dpy, &contexts[i] );
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+ }
+
+ for(i = 0; i < config_count; i++)
+ {
+ status("vaDestroyConfig for config %08x\n", configs[i]);
+ va_status = vaDestroyConfig( va_dpy, configs[i] );
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+ }
+
+ va_status = vaDestroySurface(va_dpy, surfaces, total_surfaces);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+
+ free(contexts);
+ free(configs);
+ free(surfaces);
+ free(entrypoints);
+}
+
+void post()
+{
+ test_terminate();
+}
diff --git a/test/test_10.c b/test/test_10.c
new file mode 100644
index 0000000..3158184
--- /dev/null
+++ b/test/test_10.c
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2007 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#define TEST_DESCRIPTION "Create and destroy buffers"
+
+#include "test_common.c"
+
+void pre()
+{
+ test_init();
+}
+
+void test_unique_buffers(VABufferID *buffer_list, int buffer_count)
+{
+ int i,j;
+
+ for(i = 0; i < buffer_count; i++)
+ {
+ for(j = 0; j < i; j++)
+ {
+ ASSERT(buffer_list[i] != buffer_list[j]);
+ }
+ }
+}
+
+VABufferType buffer_types[] =
+{
+ VAPictureParameterBufferType,
+ VAIQMatrixBufferType,
+ VABitPlaneBufferType,
+ VASliceGroupMapBufferType,
+ VASliceParameterBufferType,
+ VASliceDataBufferType,
+ VAMacroblockParameterBufferType,
+ VAResidualDataBufferType,
+ VADeblockingParameterBufferType,
+ VAImageBufferType
+};
+
+#define NUM_BUFFER_TYPES (sizeof(buffer_types) / sizeof(VABufferType))
+
+#define DEAD_BUFFER_ID ((VABufferID) 0x1234ffff)
+
+void test()
+{
+ VABufferID buffer_ids[NUM_BUFFER_TYPES+1];
+ int i;
+ memset(buffer_ids, 0xff, sizeof(buffer_ids));
+ for(i=0; i < NUM_BUFFER_TYPES; i++)
+ {
+ buffer_ids[i+1] = DEAD_BUFFER_ID;
+ va_status = vaCreateBuffer(va_dpy, buffer_types[i], &buffer_ids[i]);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+ ASSERT( DEAD_BUFFER_ID == buffer_ids[i+1] ); /* Bounds check */
+ }
+ test_unique_buffers(buffer_ids, NUM_BUFFER_TYPES);
+
+ for(i=0; i < NUM_BUFFER_TYPES; i++)
+ {
+ va_status = vaDestroyBuffer(va_dpy, buffer_ids[i]);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+ }
+}
+
+void post()
+{
+ test_terminate();
+}
diff --git a/test/test_11.c b/test/test_11.c
new file mode 100644
index 0000000..53a1bd5
--- /dev/null
+++ b/test/test_11.c
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2007 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#define TEST_DESCRIPTION "Map and unmap buffers"
+
+#include "test_common.c"
+
+void pre()
+{
+ test_init();
+}
+
+VABufferType buffer_types[] =
+{
+ VAPictureParameterBufferType,
+ VAIQMatrixBufferType,
+ VABitPlaneBufferType,
+ VASliceGroupMapBufferType,
+ VASliceParameterBufferType,
+ VASliceDataBufferType,
+ VAMacroblockParameterBufferType,
+ VAResidualDataBufferType,
+ VADeblockingParameterBufferType,
+ VAImageBufferType
+};
+
+unsigned int buffer_sizes[] =
+{
+ sizeof(VAPictureParameterBufferMPEG4),
+ sizeof(VAIQMatrixBufferH264),
+ 32*1024,
+ 48*1024,
+ sizeof(VASliceParameterBufferMPEG2),
+ 128*1024,
+ sizeof(VAMacroblockParameterBufferMPEG2),
+ 32*1024,
+ 15*1024,
+ 32*1024,
+};
+
+#define NUM_BUFFER_TYPES (sizeof(buffer_types) / sizeof(VABufferType))
+
+void test()
+{
+ VABufferID buffer_ids[NUM_BUFFER_TYPES+1];
+ uint32_t *input_data[NUM_BUFFER_TYPES];
+ int i, j;
+ memset(buffer_ids, 0xff, sizeof(buffer_ids));
+ for(i=0; i < NUM_BUFFER_TYPES; i++)
+ {
+ uint32_t *data;
+ va_status = vaCreateBuffer(va_dpy, buffer_types[i], &buffer_ids[i]);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+ status("vaCreateBuffer created buffer %08x of type %d\n", buffer_ids[i], buffer_types[i]);
+
+ input_data[i] = malloc(buffer_sizes[i]+4);
+ ASSERT(input_data[i]);
+
+ /* Generate input data */
+ for(j = buffer_sizes[i] / 4; j--;)
+ {
+ input_data[i][j] = random();
+ }
+
+ /* Copy to secondary buffer */
+ data = malloc(buffer_sizes[i]);
+ ASSERT(data);
+ memcpy(data, input_data[i], buffer_sizes[i]);
+
+ /* Send to VA Buffer */
+ va_status = vaBufferData(va_dpy, buffer_ids[i], buffer_sizes[i], 1, data);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+
+ /* Wipe secondary buffer */
+ memset(data, 0, buffer_sizes[i]);
+ free(data);
+ }
+
+ for(i=0; i < NUM_BUFFER_TYPES; i++)
+ {
+ void *data = NULL;
+ /* Fetch VA Buffer */
+ va_status = vaBufferData(va_dpy, buffer_ids[i], buffer_sizes[i], 1, NULL);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+
+ va_status = vaMapBuffer(va_dpy, buffer_ids[i], &data);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+ status("vaMapBuffer mapped buffer %08x\n", buffer_ids[i]);
+
+ /* Compare data */
+ ASSERT( memcmp(input_data[i], data, buffer_sizes[i]) == 0 );
+ }
+
+ for(i=0; i < NUM_BUFFER_TYPES; i++)
+ {
+ va_status = vaUnmapBuffer(va_dpy, buffer_ids[i]);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+
+ va_status = vaDestroyBuffer(va_dpy, buffer_ids[i]);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+
+ free(input_data[i]);
+ }
+}
+
+void post()
+{
+ test_terminate();
+}
diff --git a/test/test_common.c b/test/test_common.c
new file mode 100644
index 0000000..9069668
--- /dev/null
+++ b/test/test_common.c
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2007 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "va.h"
+#include "X11/Xlib.h"
+
+#include "assert.h"
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdint.h>
+#include <dlfcn.h>
+
+#define ASSERT assert
+
+Display *dpy;
+VADisplay va_dpy;
+VAStatus va_status;
+int major_version, minor_version;
+int print_status = 0;
+int num_profiles;
+VAProfile *profiles = NULL;
+
+void pre();
+void test();
+void post();
+
+void status(const char *msg, ...)
+{
+ if (!print_status) return;
+ va_list args;
+ printf("--- ");
+ va_start(args, msg);
+ vfprintf(stdout, msg, args);
+ va_end(args);
+}
+
+
+int main(int argc, const char* argv[])
+{
+ const char *name = rindex(argv[0], '/');
+ if (name)
+ name++;
+ else
+ name = argv[0];
+ printf("*** %s: %s\n", name, TEST_DESCRIPTION);
+ pre();
+ print_status = 1;
+ test();
+ print_status = 0;
+ post();
+ printf("*** %s: Finished\n", name);
+ return 0;
+}
+
+void test_init()
+{
+ dpy = XOpenDisplay(NULL);
+ ASSERT( dpy );
+ status("XOpenDisplay: dpy = %08x\n", dpy);
+
+ va_dpy = vaGetDisplay(dpy);
+ ASSERT( va_dpy );
+ status("vaGetDisplay: va_dpy = %08x\n", va_dpy);
+
+ va_status = vaInitialize(va_dpy, &major_version, &minor_version);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+ status("vaInitialize: major = %d minor = %d\n", major_version, minor_version);
+}
+
+void test_terminate()
+{
+ va_status = vaTerminate(va_dpy);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+ status("vaTerminate\n");
+
+ XCloseDisplay(dpy);
+ status("XCloseDisplay\n");
+
+ if (profiles)
+ {
+ free(profiles);
+ profiles = NULL;
+ }
+}
+
+#define PROFILE(profile) case VAProfile##profile: return("VAProfile" #profile);
+
+const char *profile2string(VAProfile profile)
+{
+ switch(profile)
+ {
+ PROFILE(MPEG2Simple)
+ PROFILE(MPEG2Main)
+ PROFILE(MPEG4Simple)
+ PROFILE(MPEG4AdvancedSimple)
+ PROFILE(MPEG4Main)
+ PROFILE(H264Baseline)
+ PROFILE(H264Main)
+ PROFILE(H264High)
+ PROFILE(VC1Simple)
+ PROFILE(VC1Main)
+ PROFILE(VC1Advanced)
+ }
+ ASSERT(0);
+ return "Unknown";
+}
+
+#define ENTRYPOINT(profile) case VAEntrypoint##profile: return("VAEntrypoint" #profile);
+
+const char *entrypoint2string(VAEntrypoint entrypoint)
+{
+ switch(entrypoint)
+ {
+ ENTRYPOINT(VLD)
+ ENTRYPOINT(IZZ)
+ ENTRYPOINT(IDCT)
+ ENTRYPOINT(MoComp)
+ ENTRYPOINT(Deblocking)
+ }
+ ASSERT(0);
+ return "Unknown";
+}
+
+
+void test_profiles()
+{
+ int max_profiles;
+ int i;
+ max_profiles = vaMaxNumProfiles(va_dpy);
+ status("vaMaxNumProfiles = %d\n", max_profiles);
+ ASSERT(max_profiles > 0);
+ profiles = malloc(max_profiles * sizeof(VAProfile));
+ ASSERT(profiles);
+
+ va_status = vaQueryConfigProfiles(va_dpy, profiles, &num_profiles);
+ ASSERT( VA_STATUS_SUCCESS == va_status );
+
+ status("vaQueryConfigProfiles reports %d profiles\n", num_profiles);
+ ASSERT(num_profiles <= max_profiles);
+ ASSERT(num_profiles > 0);
+
+ if (print_status)
+ {
+ for(i = 0; i < num_profiles; i++)
+ {
+ status(" profile %d [%s]\n", profiles[i], profile2string(profiles[i]));
+ }
+ }
+}
diff --git a/test/testplan.txt b/test/testplan.txt
new file mode 100644
index 0000000..1cc573b
--- /dev/null
+++ b/test/testplan.txt
@@ -0,0 +1,106 @@
+
+Test 1
+- Initialize & Terminate
+- vaGetDisplay, vaInitialize, vaTerminate
+
+Test 2
+- Query profiles
+- vaQueryConfigProfiles, vaMaxNumProfiles
+
+Test 3
+- Query Entrypoints for all profiles
+- vaQueryConfigEntryPoints, vaMaxNumEntryPoints
+
+Test 4
+- Get Config attributes for all profiles / entrypoints
+- vaGetConfigAttributes
+
+Test 5
+- Create & destroy config for each profile / entrypoint
+- vaCreateConfig, vaDestroyConfig
+
+Test 6
+- Get config attributes of various possible configs
+- vaQueryConfigAttributes, vaMaxNumConfigAttributes
+- Check if results for vaGetConfigAttributes match with vaQueryConfigAttributes for
+a given profile / entrypoint
+
+Test 7
+- Create and destroy surfaces
+- vaCreateSurfaces, vaDestroySurface
+- Create surfaces of 352 x 288 pixels
+- Create 1, 4 and 16 surfaces, destroy 4, create 6 surfaces, destroy 16, 1
+and 6 surfaces.
+
+Test 8
+- Create and destroy surfaces of different sizes
+- Create surfaces of 10 x 10 pixels, 128 x 128 pixels, 176 x 144 pixels, 144 x 176
+pixels, 352 x 288 pixels, 399 x 299 pixels, 640 x 480 pixels, 1280 x 720
+pixels
+
+Test 9
+- Create and destroy a context for each profile / entrypoint
+- Pass 4 surfaces of 352 x 288 pixels
+- vaCreateContext, vaDestroyContext
+- See also Test 5
+
+Test 10
+- Create and destroy buffers
+- vaCreateBuffer, vaDestroyBuffer
+- For each different buffertype, create a buffer, then destroy them one by
+one.
+
+Test 11
+- Map & unmap buffers
+- vaBufferData, vaMapBuffer, vaUnmapBuffer
+- For each different buffertype, copy data to the buffer with vaBufferData.
+Then map the buffer and verify the contents of the buffer.
+
+Test 12
+- Render single MPEG2 I-frame
+- vaBeginPicture, vaRenderPicture (num_buffers == 1), vaEndPicture
+
+Test 13
+- Render single MPEG2 I-frame, multiple buffer submission
+- vaRenderPicture (num_buffers > 1)
+
+Test 14
+- Render single MPEG2 I-frame, split buffers
+- Slice split over 2 buffers
+
+Test 15
+- Render single MPEG2 I-frame, split buffers
+- Slice split over 3 buffers
+
+Test 16
+- Sync Surface
+- Render single MPEG2 I-frame, then check vaQuerySurfaceStatus, vaSyncSurface and vaQuerySurfaceStatus
+
+Test 17
+- Query image formats
+- vaMaxNumImageFormats, vaQueryImageFormats
+
+Test 18
+- Create and destroy vaImage
+- vaCreateImage, vaDestroyImage
+
+Test 19
+- Get image data
+- Render single MPEG2 I-frame, copy surface data to image, check resulting
+image
+- vaGetImage
+
+Test 20
+- Put image data
+- Render single MPEG2 I-frame, copy half of a VAImage to surface, copy
+surface back to VAImage, check resulting image
+- vaPutImage
+
+Test 21
+- Query subpicture formats
+- vaMaxNumSubpictureFormats, vaQuerySubpictureFromats
+
+Test 22
+- Create and destory subpictures
+- vaCreateSubpicture, vaDestroySubpicture
+