Commit 563092b8 authored by Waldo Bastian's avatar Waldo Bastian

Update to libva v0.26

parent 8de3509f
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
AC_PREREQ(2.57) AC_PREREQ(2.57)
AC_INIT([libva], 0.22, [waldo.bastian@intel.com], libva) AC_INIT([libva], 0.26, [waldo.bastian@intel.com], libva)
AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([dist-bzip2]) AM_INIT_AUTOMAKE([dist-bzip2])
......
This diff is collapsed.
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#define DUMMY_MAX_IMAGE_FORMATS 10 #define DUMMY_MAX_IMAGE_FORMATS 10
#define DUMMY_MAX_SUBPIC_FORMATS 4 #define DUMMY_MAX_SUBPIC_FORMATS 4
#define DUMMY_MAX_DISPLAY_ATTRIBUTES 4 #define DUMMY_MAX_DISPLAY_ATTRIBUTES 4
#define DUMMY_STR_VENDOR "Dummy-dummy-1.0-dummy"
struct dummy_driver_data { struct dummy_driver_data {
struct object_heap config_heap; struct object_heap config_heap;
...@@ -52,14 +53,19 @@ struct object_config { ...@@ -52,14 +53,19 @@ struct object_config {
struct object_context { struct object_context {
struct object_base base; struct object_base base;
VAContext *context; VAContextID context_id;
VAConfigID config; VAConfigID config_id;
VASurfaceID current_render_target; VASurfaceID current_render_target;
int picture_width;
int picture_height;
int num_render_targets;
int flags;
VASurfaceID *render_targets;
}; };
struct object_surface { struct object_surface {
struct object_base base; struct object_base base;
VASurface *surface; VASurfaceID surface_id;
}; };
struct object_buffer { struct object_buffer {
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
libva_la_LTLIBRARIES = libva.la libva_la_LTLIBRARIES = libva.la
libva_ladir = $(libdir) libva_ladir = $(libdir)
libva_la_LDFLAGS = -version-number 0:24:0 -no-undefined libva_la_LDFLAGS = -version-number 0:26:0 -no-undefined
libva_la_LIBADD = -ldl -lX11 -lXext libva_la_LIBADD = -ldl -lX11 -lXext
libva_la_SOURCES = va_dri.c va.c va_dristr.h libva_la_SOURCES = va_dri.c va.c va_dristr.h
......
This diff is collapsed.
This diff is collapsed.
...@@ -34,25 +34,11 @@ ...@@ -34,25 +34,11 @@
#include <stdlib.h> #include <stdlib.h>
typedef struct VADriverContext *VADriverContextP; typedef struct VADriverContext *VADriverContextP;
struct VADriverContext struct VADriverVTable
{ {
VADriverContextP pNext;
Display *x11_dpy;
int x11_screen;
int version_major;
int version_minor;
int max_profiles;
int max_entrypoints;
int max_attributes;
int max_image_formats;
int max_subpic_formats;
int max_display_attributes;
void *handle; /* dlopen handle */
void *pDriverData;
struct
{
VAStatus (*vaTerminate) ( VADriverContextP ctx ); VAStatus (*vaTerminate) ( VADriverContextP ctx );
VAStatus (*vaQueryConfigProfiles) ( VAStatus (*vaQueryConfigProfiles) (
...@@ -105,12 +91,12 @@ struct VADriverContext ...@@ -105,12 +91,12 @@ struct VADriverContext
int height, int height,
int format, int format,
int num_surfaces, int num_surfaces,
VASurface *surfaces /* out */ VASurfaceID *surfaces /* out */
); );
VAStatus (*vaDestroySurface) ( VAStatus (*vaDestroySurfaces) (
VADriverContextP ctx, VADriverContextP ctx,
VASurface *surface_list, VASurfaceID *surface_list,
int num_surfaces int num_surfaces
); );
...@@ -120,28 +106,24 @@ struct VADriverContext ...@@ -120,28 +106,24 @@ struct VADriverContext
int picture_width, int picture_width,
int picture_height, int picture_height,
int flag, int flag,
VASurface *render_targets, VASurfaceID *render_targets,
int num_render_targets, int num_render_targets,
VAContext *context /* out */ VAContextID *context /* out */
); );
VAStatus (*vaDestroyContext) ( VAStatus (*vaDestroyContext) (
VADriverContextP ctx, VADriverContextP ctx,
VAContext *context VAContextID context
); );
VAStatus (*vaCreateBuffer) ( VAStatus (*vaCreateBuffer) (
VADriverContextP ctx, VADriverContextP ctx,
VAContextID context, /* in */
VABufferType type, /* in */ VABufferType type, /* in */
VABufferID *buf_desc /* out */
);
VAStatus (*vaBufferData) (
VADriverContextP ctx,
VABufferID buf_id, /* in */
unsigned int size, /* in */ unsigned int size, /* in */
unsigned int num_elements, /* in */ unsigned int num_elements, /* in */
void *data /* in */ void *data, /* in */
VABufferID *buf_id /* out */
); );
VAStatus (*vaBufferSetNumElements) ( VAStatus (*vaBufferSetNumElements) (
...@@ -168,38 +150,37 @@ struct VADriverContext ...@@ -168,38 +150,37 @@ struct VADriverContext
VAStatus (*vaBeginPicture) ( VAStatus (*vaBeginPicture) (
VADriverContextP ctx, VADriverContextP ctx,
VAContext *context, VAContextID context,
VASurface *render_target VASurfaceID render_target
); );
VAStatus (*vaRenderPicture) ( VAStatus (*vaRenderPicture) (
VADriverContextP ctx, VADriverContextP ctx,
VAContext *context, VAContextID context,
VABufferID *buffers, VABufferID *buffers,
int num_buffers int num_buffers
); );
VAStatus (*vaEndPicture) ( VAStatus (*vaEndPicture) (
VADriverContextP ctx, VADriverContextP ctx,
VAContext *context VAContextID context
); );
VAStatus (*vaSyncSurface) ( VAStatus (*vaSyncSurface) (
VADriverContextP ctx, VADriverContextP ctx,
VAContext *context, VAContextID context,
VASurface *render_target VASurfaceID render_target
); );
VAStatus (*vaQuerySurfaceStatus) ( VAStatus (*vaQuerySurfaceStatus) (
VADriverContextP ctx, VADriverContextP ctx,
VAContext *context, VASurfaceID render_target,
VASurface *render_target,
VASurfaceStatus *status /* out */ VASurfaceStatus *status /* out */
); );
VAStatus (*vaPutSurface) ( VAStatus (*vaPutSurface) (
VADriverContextP ctx, VADriverContextP ctx,
VASurface *surface, VASurfaceID surface,
Drawable draw, /* X Drawable */ Drawable draw, /* X Drawable */
short srcx, short srcx,
short srcy, short srcy,
...@@ -230,23 +211,34 @@ struct VADriverContext ...@@ -230,23 +211,34 @@ struct VADriverContext
VAStatus (*vaDestroyImage) ( VAStatus (*vaDestroyImage) (
VADriverContextP ctx, VADriverContextP ctx,
VAImage *image VAImageID image
);
VAStatus (*vaSetImagePalette) (
VADriverContextP ctx,
VAImageID image,
/*
* pointer to an array holding the palette data. The size of the array is
* num_palette_entries * entry_bytes in size. The order of the components
* in the palette is described by the component_order in VAImage struct
*/
unsigned char *palette
); );
VAStatus (*vaGetImage) ( VAStatus (*vaGetImage) (
VADriverContextP ctx, VADriverContextP ctx,
VASurface *surface, VASurfaceID surface,
int x, /* coordinates of the upper left source pixel */ int x, /* coordinates of the upper left source pixel */
int y, int y,
unsigned int width, /* width and height of the region */ unsigned int width, /* width and height of the region */
unsigned int height, unsigned int height,
VAImage *image VAImageID image
); );
VAStatus (*vaPutImage) ( VAStatus (*vaPutImage) (
VADriverContextP ctx, VADriverContextP ctx,
VASurface *surface, VASurfaceID surface,
VAImage *image, VAImageID image,
int src_x, int src_x,
int src_y, int src_y,
unsigned int width, unsigned int width,
...@@ -264,24 +256,24 @@ struct VADriverContext ...@@ -264,24 +256,24 @@ struct VADriverContext
VAStatus (*vaCreateSubpicture) ( VAStatus (*vaCreateSubpicture) (
VADriverContextP ctx, VADriverContextP ctx,
VAImage *image, VAImageID image,
VASubpicture *subpicture /* out */ VASubpictureID *subpicture /* out */
); );
VAStatus (*vaDestroySubpicture) ( VAStatus (*vaDestroySubpicture) (
VADriverContextP ctx, VADriverContextP ctx,
VASubpicture *subpicture VASubpictureID subpicture
); );
VAStatus (*vaSetSubpictureImage) ( VAStatus (*vaSetSubpictureImage) (
VADriverContextP ctx, VADriverContextP ctx,
VASubpicture *subpicture, VASubpictureID subpicture,
VAImage *image VAImageID image
); );
VAStatus (*vaSetSubpicturePalette) ( VAStatus (*vaSetSubpicturePalette) (
VADriverContextP ctx, VADriverContextP ctx,
VASubpicture *subpicture, VASubpictureID subpicture,
/* /*
* pointer to an array holding the palette data. The size of the array is * pointer to an array holding the palette data. The size of the array is
* num_palette_entries * entry_bytes in size. The order of the components * num_palette_entries * entry_bytes in size. The order of the components
...@@ -292,21 +284,23 @@ struct VADriverContext ...@@ -292,21 +284,23 @@ struct VADriverContext
VAStatus (*vaSetSubpictureChromakey) ( VAStatus (*vaSetSubpictureChromakey) (
VADriverContextP ctx, VADriverContextP ctx,
VASubpicture *subpicture, VASubpictureID subpicture,
unsigned int chromakey_min, unsigned int chromakey_min,
unsigned int chromakey_max unsigned int chromakey_max,
unsigned int chromakey_mask
); );
VAStatus (*vaSetSubpictureGlobalAlpha) ( VAStatus (*vaSetSubpictureGlobalAlpha) (
VADriverContextP ctx, VADriverContextP ctx,
VASubpicture *subpicture, VASubpictureID subpicture,
float global_alpha float global_alpha
); );
VAStatus (*vaAssociateSubpicture) ( VAStatus (*vaAssociateSubpicture) (
VADriverContextP ctx, VADriverContextP ctx,
VASurface *target_surface, VASubpictureID subpicture,
VASubpicture *subpicture, VASurfaceID *target_surfaces,
int num_surfaces,
short src_x, /* upper left offset in subpicture */ short src_x, /* upper left offset in subpicture */
short src_y, short src_y,
short dest_x, /* upper left offset in surface */ short dest_x, /* upper left offset in surface */
...@@ -320,6 +314,13 @@ struct VADriverContext ...@@ -320,6 +314,13 @@ struct VADriverContext
unsigned int flags unsigned int flags
); );
VAStatus (*vaDeassociateSubpicture) (
VADriverContextP ctx,
VASubpictureID subpicture,
VASurfaceID *target_surfaces,
int num_surfaces
);
VAStatus (*vaQueryDisplayAttributes) ( VAStatus (*vaQueryDisplayAttributes) (
VADriverContextP ctx, VADriverContextP ctx,
VADisplayAttribute *attr_list, /* out */ VADisplayAttribute *attr_list, /* out */
...@@ -341,12 +342,33 @@ struct VADriverContext ...@@ -341,12 +342,33 @@ struct VADriverContext
VAStatus (*vaDbgCopySurfaceToBuffer) ( VAStatus (*vaDbgCopySurfaceToBuffer) (
VADriverContextP ctx, VADriverContextP ctx,
VASurface *surface, VASurfaceID surface,
void **buffer, /* out */ void **buffer, /* out */
unsigned int *stride /* out */ unsigned int *stride /* out */
); );
};
struct VADriverContext
{
VADriverContextP pNext;
void *pDriverData;
struct VADriverVTable vtable;
} vtable; Display *x11_dpy;
int x11_screen;
int version_major;
int version_minor;
int max_profiles;
int max_entrypoints;
int max_attributes;
int max_image_formats;
int max_subpic_formats;
int max_display_attributes;
const char *str_vendor;
void *handle; /* dlopen handle */
}; };
typedef VAStatus (*VADriverInit) ( typedef VAStatus (*VADriverInit) (
......
...@@ -36,9 +36,16 @@ extern "C" { ...@@ -36,9 +36,16 @@ extern "C" {
#define VA_TOP_FIELD 0x00000001 #define VA_TOP_FIELD 0x00000001
#define VA_BOTTOM_FIELD 0x00000002 #define VA_BOTTOM_FIELD 0x00000002
#define VA_FRAME_PICTURE 0x00000004 /* weave */ #define VA_FRAME_PICTURE 0x00000004 /* weave */
/*
* clears the drawable with background color.
* for hardware overlay based implementation this flag
* can be used to turn off the overlay
*/
#define VA_CLEAR_DRAWABLE 0x00000008
VAStatus vaPutSurface ( VAStatus vaPutSurface (
VADisplay dpy, VADisplay dpy,
VASurface *surface, VASurfaceID surface,
Drawable draw, /* X Drawable */ Drawable draw, /* X Drawable */
short srcx, short srcx,
short srcy, short srcy,
......
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
check_PROGRAMS = test_01 test_02 test_03 test_04 test_05 test_06 \ check_PROGRAMS = test_01 test_02 test_03 test_04 test_05 test_06 \
test_07 test_08 test_09 test_10 test_11 test_07 test_08 test_09 test_10 test_11
bin_PROGRAMS = vainfo
testdir = $(bindir) testdir = $(bindir)
AM_CFLAGS = -I$(top_srcdir)/../../include/external/ -I$(top_srcdir)/src AM_CFLAGS = -I$(top_srcdir)/../../include/external/ -I$(top_srcdir)/src
...@@ -31,6 +33,9 @@ TESTS = $(check_PROGRAMS) ...@@ -31,6 +33,9 @@ TESTS = $(check_PROGRAMS)
TEST_LIBS = ../src/libva.la TEST_LIBS = ../src/libva.la
vainfo_LDADD = ../src/libva.la
vainfo_SOURCES = vainfo.c
test_01_LDADD = $(TEST_LIBS) test_01_LDADD = $(TEST_LIBS)
test_01_SOURCES = test_01.c test_01_SOURCES = test_01.c
......
...@@ -53,23 +53,23 @@ int main(int argc, const char* argv[]) ...@@ -53,23 +53,23 @@ int main(int argc, const char* argv[])
printf("vaInitialize: major = %d minor = %d\n", major_version, minor_version); printf("vaInitialize: major = %d minor = %d\n", major_version, minor_version);
{ {
VASurface surfaces[21]; VASurfaceID surfaces[21];
int i; int i;
surfaces[20].surface_id = -1; surfaces[20] = -1;
va_status = vaCreateSurfaces(va_dpy, 720, 480, VA_RT_FORMAT_YUV420, 20, surfaces); va_status = vaCreateSurfaces(va_dpy, 720, 480, VA_RT_FORMAT_YUV420, 20, surfaces);
ASSERT( VA_STATUS_SUCCESS == va_status ); ASSERT( VA_STATUS_SUCCESS == va_status );
ASSERT( -1 == surfaces[20].surface_id ); /* bounds check */ ASSERT( -1 == surfaces[20] ); /* bounds check */
for(i = 0; i < 20; i++) for(i = 0; i < 20; i++)
{ {
printf("Surface %d surface_id = %08x\n", i, surfaces[i].surface_id); printf("Surface %d surface_id = %08x\n", i, surfaces[i]);
} }
Window win = XCreateSimpleWindow(dpy, RootWindow(dpy, 0), 0, 0, 720, 480, 0, 0, WhitePixel(dpy, 0)); Window win = XCreateSimpleWindow(dpy, RootWindow(dpy, 0), 0, 0, 720, 480, 0, 0, WhitePixel(dpy, 0));
printf("Window = %08x\n", win); printf("Window = %08x\n", win);
XMapWindow(dpy, win); XMapWindow(dpy, win);
XSync(dpy, False); XSync(dpy, False);
vaPutSurface(va_dpy, &(surfaces[0]), win, 0, 0, 720, 480, 0, 0, 720, 480, 0); vaPutSurface(va_dpy, surfaces[0], win, 0, 0, 720, 480, 0, 0, 720, 480, 0);
sleep(10); sleep(10);
va_status = vaDestroySurface(va_dpy, surfaces, 20); va_status = vaDestroySurface(va_dpy, surfaces, 20);
...@@ -94,14 +94,14 @@ int main(int argc, const char* argv[]) ...@@ -94,14 +94,14 @@ int main(int argc, const char* argv[])
} }
{ {
VASurface surfaces[20]; VASurfaceID surfaces[20];
VAContext context; VAContextID context;
VAConfigAttrib attrib; VAConfigAttrib attrib;
VAConfigID config_id; VAConfigID config_id;
int i; int i;
attrib.type = VAConfigAttribRTFormat; attrib.type = VAConfigAttribRTFormat;
va_status = vaQueryConfigAttributes(va_dpy, VAProfileMPEG2Main, VAEntrypointVLD, va_status = vaGetConfigAttributes(va_dpy, VAProfileMPEG2Main, VAEntrypointVLD,
&attrib, 1); &attrib, 1);
ASSERT( VA_STATUS_SUCCESS == va_status ); ASSERT( VA_STATUS_SUCCESS == va_status );
...@@ -118,7 +118,7 @@ int main(int argc, const char* argv[]) ...@@ -118,7 +118,7 @@ int main(int argc, const char* argv[])
va_status = vaCreateContext(va_dpy, config_id, 720, 480, 0 /* flag */, surfaces, 20, &context); va_status = vaCreateContext(va_dpy, config_id, 720, 480, 0 /* flag */, surfaces, 20, &context);
ASSERT( VA_STATUS_SUCCESS == va_status ); ASSERT( VA_STATUS_SUCCESS == va_status );
va_status = vaDestroyContext(va_dpy, &context); va_status = vaDestroyContext(va_dpy, context);
ASSERT( VA_STATUS_SUCCESS == va_status ); ASSERT( VA_STATUS_SUCCESS == va_status );
va_status = vaDestroySurface(va_dpy, surfaces, 20); va_status = vaDestroySurface(va_dpy, surfaces, 20);
......
...@@ -33,7 +33,7 @@ void pre() ...@@ -33,7 +33,7 @@ void pre()
#define DEAD_SURFACE_ID (VASurfaceID) 0xbeefdead #define DEAD_SURFACE_ID (VASurfaceID) 0xbeefdead
void test_unique_surfaces(VASurface *surface_list1, int surface_count1, VASurface *surface_list2, int surface_count2) void test_unique_surfaces(VASurfaceID *surface_list1, int surface_count1, VASurfaceID *surface_list2, int surface_count2)
{ {
int i,j; int i,j;
...@@ -42,9 +42,9 @@ void test_unique_surfaces(VASurface *surface_list1, int surface_count1, VASurfac ...@@ -42,9 +42,9 @@ void test_unique_surfaces(VASurface *surface_list1, int surface_count1, VASurfac
for(j = 0; j < surface_count2; j++) for(j = 0; j < surface_count2; j++)
{ {
if ((surface_list1 == surface_list2) && (i == j)) continue; if ((surface_list1 == surface_list2) && (i == j)) continue;
ASSERT(surface_list1[i].surface_id != VA_INVALID_SURFACE); ASSERT(surface_list1[i] != VA_INVALID_SURFACE);
ASSERT(surface_list2[j].surface_id != VA_INVALID_SURFACE); ASSERT(surface_list2[j] != VA_INVALID_SURFACE);
ASSERT(surface_list1[i].surface_id != surface_list2[j].surface_id); ASSERT(surface_list1[i] != surface_list2[j]);
} }
} }
} }
...@@ -52,10 +52,10 @@ void test_unique_surfaces(VASurface *surface_list1, int surface_count1, VASurfac ...@@ -52,10 +52,10 @@ void test_unique_surfaces(VASurface *surface_list1, int surface_count1, VASurfac
void test() void test()
{ {
VASurface surfaces_1[1+1]; VASurfaceID surfaces_1[1+1];
VASurface surfaces_4[4+1]; VASurfaceID surfaces_4[4+1];
VASurface surfaces_16[16+1]; VASurfaceID surfaces_16[16+1];
VASurface surfaces_6[6+1]; VASurfaceID surfaces_6[6+1];
memset(surfaces_1, 0xff, sizeof(surfaces_1)); memset(surfaces_1, 0xff, sizeof(surfaces_1));
memset(surfaces_4, 0xff, sizeof(surfaces_4)); memset(surfaces_4, 0xff, sizeof(surfaces_4));
...@@ -63,22 +63,22 @@ void test() ...@@ -63,22 +63,22 @@ void test()
memset(surfaces_6, 0xff, sizeof(surfaces_6)); memset(surfaces_6, 0xff, sizeof(surfaces_6));
status("vaCreateSurfaces 1 surface\n"); status("vaCreateSurfaces 1 surface\n");
surfaces_1[1].surface_id = DEAD_SURFACE_ID; surfaces_1[1] = DEAD_SURFACE_ID;
va_status = vaCreateSurfaces(va_dpy, 352, 288, VA_RT_FORMAT_YUV420, 1, surfaces_1); va_status = vaCreateSurfaces(va_dpy, 352, 288, VA_RT_FORMAT_YUV420, 1, surfaces_1);
ASSERT( VA_STATUS_SUCCESS == va_status ); ASSERT( VA_STATUS_SUCCESS == va_status );
ASSERT( DEAD_SURFACE_ID == surfaces_1[1].surface_id ); /* bounds check */ ASSERT( DEAD_SURFACE_ID == surfaces_1[1] ); /* bounds check */
status("vaCreateSurfaces 4 surfaces\n"); status("vaCreateSurfaces 4 surfaces\n");
surfaces_4[4].surface_id = DEAD_SURFACE_ID; surfaces_4[4] = DEAD_SURFACE_ID;
va_status = vaCreateSurfaces(va_dpy, 352, 288, VA_RT_FORMAT_YUV420, 4, surfaces_4); va_status = vaCreateSurfaces(va_dpy, 352, 288, VA_RT_FORMAT_YUV420, 4, surfaces_4);
ASSERT( VA_STATUS_SUCCESS == va_status ); ASSERT( VA_STATUS_SUCCESS == va_status );
ASSERT( DEAD_SURFACE_ID == surfaces_4[4].surface_id ); /* bounds check */ ASSERT( DEAD_SURFACE_ID == surfaces_4[4] ); /* bounds check */
status("vaCreateSurfaces 16 surfaces\n"); status("vaCreateSurfaces 16 surfaces\n");
surfaces_16[16].surface_id = DEAD_SURFACE_ID; surfaces_16[16] = DEAD_SURFACE_ID;
va_status = vaCreateSurfaces(va_dpy, 352, 288, VA_RT_FORMAT_YUV420, 16, surfaces_16); va_status = vaCreateSurfaces(va_dpy, 352, 288, VA_RT_FORMAT_YUV420, 16, surfaces_16);
ASSERT( VA_STATUS_SUCCESS == va_status ); ASSERT( VA_STATUS_SUCCESS == va_status );
ASSERT( DEAD_SURFACE_ID == surfaces_16[16].surface_id ); /* bounds check */ ASSERT( DEAD_SURFACE_ID == surfaces_16[16] ); /* bounds check */
test_unique_surfaces(surfaces_1, 1, surfaces_4, 4); 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, 4);
...@@ -87,29 +87,29 @@ void test() ...@@ -87,29 +87,29 @@ void test()
test_unique_surfaces(surfaces_1, 16, surfaces_16, 16); test_unique_surfaces(surfaces_1, 16, surfaces_16, 16);
status("vaDestroySurface 4 surfaces\n"); status("vaDestroySurface 4 surfaces\n");
va_status = vaDestroySurface(va_dpy, surfaces_4, 4); va_status = vaDestroySurfaces(va_dpy, surfaces_4, 4);
ASSERT( VA_STATUS_SUCCESS == va_status ); ASSERT( VA_STATUS_SUCCESS == va_status );
status("vaCreateSurfaces 6 surfaces\n"); status("vaCreateSurfaces 6 surfaces\n");
surfaces_6[6].surface_id = DEAD_SURFACE_ID; surfaces_6[6] = DEAD_SURFACE_ID;
va_status = vaCreateSurfaces(va_dpy, 352, 288, VA_RT_FORMAT_YUV420, 6, surfaces_6); va_status = vaCreateSurfaces(va_dpy, 352, 288, VA_RT_FORMAT_YUV420, 6, surfaces_6);
ASSERT( VA_STATUS_SUCCESS == va_status ); ASSERT( VA_STATUS_SUCCESS == va_status );
ASSERT( DEAD_SURFACE_ID == surfaces_6[6].surface_id ); /* bounds check */ ASSERT( DEAD_SURFACE_ID == surfaces_6[6] ); /* bounds check */
test_unique_surfaces(surfaces_1, 1, surfaces_6, 6); test_unique_surfaces(surfaces_1, 1, surfaces_6, 6);
test_unique_surfaces(surfaces_6, 6, surfaces_16, 16); test_unique_surfaces(surfaces_6, 6, surfaces_16, 16);
test_unique_surfaces(surfaces_1, 6, surfaces_16, 6); test_unique_surfaces(surfaces_1, 6, surfaces_16, 6);
status("vaDestroySurface 16 surfaces\n"); status("vaDestroySurface 16 surfaces\n");
va_status = vaDestroySurface(va_dpy, surfaces_16, 16); va_status = vaDestroySurfaces(va_dpy, surfaces_16, 16);
ASSERT( VA_STATUS_SUCCESS == va_status ); ASSERT( VA_STATUS_SUCCESS == va_status );
status("vaDestroySurface 1 surface\n"); status("vaDestroySurface 1 surface\n");
va_status = vaDestroySurface(va_dpy, surfaces_1, 1); va_status = vaDestroySurfaces(va_dpy, surfaces_1, 1);
ASSERT( VA_STATUS_SUCCESS == va_status ); ASSERT( VA_STATUS_SUCCESS == va_status );
status("vaDestroySurface 6 surfaces\n"); status("vaDestroySurface 6 surfaces\n");
va_status = vaDestroySurface(va_dpy, surfaces_6, 6); va_status = vaDestroySurfaces(va_dpy, surfaces_6, 6);
ASSERT( VA_STATUS_SUCCESS == va_status ); ASSERT( VA_STATUS_SUCCESS == va_status );
} }
......
...@@ -33,17 +33,17 @@ void pre() ...@@ -33,17 +33,17 @@ void pre()
#define DEAD_SURFACE_ID (VASurfaceID) 0xbeefdead #define DEAD_SURFACE_ID (VASurfaceID) 0xbeefdead
void test_unique_surfaces(VASurface *surface_list, int surface_count) void test_unique_surfaces(VASurfaceID *surface_list, int surface_count)
{ {
int i,j; int i,j;
for(i = 0; i < surface_count; i++) for(i = 0; i < surface_count; i++)
{ {
ASSERT(surface_list[i].surface_id != VA_INVALID_SURFACE); ASSERT(surface_list[i] != VA_INVALID_SURFACE);
for(j = 0; j < i; j++) for(j = 0; j < i; j++)
{ {
if (i == j) continue; if (i == j) continue;
ASSERT(surface_list[i].surface_id != surface_list[j].surface_id); ASSERT(surface_list[i] != surface_list[j]);
} }
} }
} }
...@@ -65,7 +65,7 @@ test_size_t test_sizes[] = { ...@@ -65,7 +65,7 @@ test_size_t test_sizes[] = {
void test() void test()
{ {
VASurface surfaces[NUM_SIZES+1]; VASurfaceID surfaces[NUM_SIZES+1];
int i; int i;
memset(surfaces, 0xff, sizeof(surfaces)); memset(surfaces, 0xff, sizeof(surfaces));
...@@ -73,16 +73,16 @@ void test() ...@@ -73,16 +73,16 @@ void test()
for(i = 0; i < NUM_SIZES; i++) for(i = 0; i < NUM_SIZES; i++)
{ {
status("vaCreateSurfaces create %dx%d surface\n", test_sizes[i].w, test_sizes[i].h); status("vaCreateSurfaces create %dx%d surface\n", test_sizes[i].w, test_sizes[i].h);
surfaces[i+1].surface_id = DEAD_SURFACE_ID; surfaces[i+1] = DEAD_SURFACE_ID;
va_status = vaCreateSurfaces(va_dpy, test_sizes[i].w, test_sizes[i].h, VA_RT_FORMAT_YUV420, 1, &surfaces[i]); 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( VA_STATUS_SUCCESS == va_status );
ASSERT( DEAD_SURFACE_ID == surfaces[i+1].surface_id ); ASSERT( DEAD_SURFACE_ID == surfaces[i+1] );
} }
test_unique_surfaces(surfaces, NUM_SIZES); test_unique_surfaces(surfaces, NUM_SIZES);
status("vaDestroySurface all surfaces\n"); status("vaDestroySurface all surfaces\n");
va_status = vaDestroySurface(va_dpy, surfaces, NUM_SIZES); va_status = vaDestroySurfaces(va_dpy, surfaces, NUM_SIZES);
ASSERT( VA_STATUS_SUCCESS == va_status ); ASSERT( VA_STATUS_SUCCESS == va_status );
} }
......
...@@ -44,7 +44,7 @@ void test() ...@@ -44,7 +44,7 @@ void test()
ASSERT(entrypoints); ASSERT(entrypoints);
VAConfigID *configs = malloc(max_entrypoints * num_profiles * sizeof(VAConfigID)); VAConfigID *configs = malloc(max_entrypoints * num_profiles * sizeof(VAConfigID));
VAContext *contexts = malloc(max_entrypoints * num_profiles * sizeof(VAContext)); VAContextID *contexts = malloc(max_entrypoints * num_profiles * sizeof(VAContextID));
for(i = 0; i < num_profiles; i++) for(i = 0; i < num_profiles; i++)
{ {
...@@ -66,7 +66,7 @@ void test() ...@@ -66,7 +66,7 @@ void test()
int surface_count = 4; int surface_count = 4;
int total_surfaces = config_count * surface_count; int total_surfaces = config_count * surface_count;
VASurface *surfaces = malloc(total_surfaces * sizeof(VASurface)); VASurfaceID *surfaces = malloc(total_surfaces * sizeof(VASurfaceID));
// TODO: Don't assume VA_RT_FORMAT_YUV420 is supported / needed for each config // 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); va_status = vaCreateSurfaces(va_dpy, width, height, VA_RT_FORMAT_YUV420, total_surfaces, surfaces);
...@@ -82,8 +82,8 @@ void test() ...@@ -82,8 +82,8 @@ void test()
for(i = 0; i < config_count; i++) for(i = 0; i < config_count; i++)
{ {
status("vaDestroyContext for context %08x\n", contexts[i].context_id); status("vaDestroyContext for context %08x\n", contexts[i]);
va_status = vaDestroyContext( va_dpy, &contexts[i] ); va_status = vaDestroyContext( va_dpy, contexts[i] );
ASSERT( VA_STATUS_SUCCESS == va_status ); ASSERT( VA_STATUS_SUCCESS == va_status );
} }
...@@ -94,7 +94,7 @@ void test() ...@@ -94,7 +94,7 @@ void test()
ASSERT( VA_STATUS_SUCCESS == va_status ); ASSERT( VA_STATUS_SUCCESS == va_status );
} }
va_status = vaDestroySurface(va_dpy, surfaces, total_surfaces); va_status = vaDestroySurfaces(va_dpy, surfaces, total_surfaces);
ASSERT( VA_STATUS_SUCCESS == va_status ); ASSERT( VA_STATUS_SUCCESS == va_status );
free(contexts); free(contexts);
......
...@@ -26,9 +26,34 @@ ...@@ -26,9 +26,34 @@
#include "test_common.c" #include "test_common.c"
VAConfigID config;
VAContextID context;
VASurfaceID *surfaces;
int total_surfaces;
void pre() void pre()
{ {
test_init(); test_init();
va_status = vaCreateConfig(va_dpy, VAProfileMPEG2Main, VAEntrypointVLD, NULL, 0, &config);
ASSERT( VA_STATUS_SUCCESS == va_status );
status("vaCreateConfig returns %08x\n", config);
int width = 352;
int height = 288;
int surface_count = 4;
total_surfaces = surface_count;
surfaces = malloc(total_surfaces * sizeof(VASurfaceID));
// 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 );
status("vaCreateContext with config %08x\n", config);
int flags = 0;
va_status = vaCreateContext( va_dpy, config, width, height, flags, surfaces, surface_count, &context );
ASSERT( VA_STATUS_SUCCESS == va_status );
} }
void test_unique_buffers(VABufferID *buffer_list, int buffer_count) void test_unique_buffers(VABufferID *buffer_list, int buffer_count)
...@@ -55,9 +80,22 @@ VABufferType buffer_types[] = ...@@ -55,9 +80,22 @@ VABufferType buffer_types[] =
VAMacroblockParameterBufferType, VAMacroblockParameterBufferType,
VAResidualDataBufferType, VAResidualDataBufferType,
VADeblockingParameterBufferType, VADeblockingParameterBufferType,
VAImageBufferType
}; };
unsigned int buffer_sizes[] =
{
sizeof(VAPictureParameterBufferMPEG4),
sizeof(VAIQMatrixBufferH264),
32*1024,
48*1024,
sizeof(VASliceParameterBufferMPEG2),
128*1024,
sizeof(VAMacroblockParameterBufferMPEG2),
32*1024,
15*1024,
};
#define NUM_BUFFER_TYPES (sizeof(buffer_types) / sizeof(VABufferType)) #define NUM_BUFFER_TYPES (sizeof(buffer_types) / sizeof(VABufferType))
#define DEAD_BUFFER_ID ((VABufferID) 0x1234ffff) #define DEAD_BUFFER_ID ((VABufferID) 0x1234ffff)
...@@ -70,7 +108,7 @@ void test() ...@@ -70,7 +108,7 @@ void test()
for(i=0; i < NUM_BUFFER_TYPES; i++) for(i=0; i < NUM_BUFFER_TYPES; i++)
{ {
buffer_ids[i+1] = DEAD_BUFFER_ID; buffer_ids[i+1] = DEAD_BUFFER_ID;
va_status = vaCreateBuffer(va_dpy, buffer_types[i], &buffer_ids[i]); va_status = vaCreateBuffer(va_dpy, context, buffer_types[i], buffer_sizes[i], 1, NULL, &buffer_ids[i]);
ASSERT( VA_STATUS_SUCCESS == va_status ); ASSERT( VA_STATUS_SUCCESS == va_status );
ASSERT( DEAD_BUFFER_ID == buffer_ids[i+1] ); /* Bounds check */ ASSERT( DEAD_BUFFER_ID == buffer_ids[i+1] ); /* Bounds check */
} }
...@@ -85,5 +123,18 @@ void test() ...@@ -85,5 +123,18 @@ void test()
void post() void post()
{ {
status("vaDestroyContext for context %08x\n", context);
va_status = vaDestroyContext( va_dpy, context );
ASSERT( VA_STATUS_SUCCESS == va_status );
status("vaDestroyConfig for config %08x\n", config);
va_status = vaDestroyConfig( va_dpy, config );
ASSERT( VA_STATUS_SUCCESS == va_status );
va_status = vaDestroySurfaces(va_dpy, surfaces, total_surfaces);
ASSERT( VA_STATUS_SUCCESS == va_status );
free(surfaces);
test_terminate(); test_terminate();
} }
...@@ -26,9 +26,47 @@ ...@@ -26,9 +26,47 @@
#include "test_common.c" #include "test_common.c"
VAConfigID config;
VAContextID context;
VASurfaceID *surfaces;
int total_surfaces;
void pre() void pre()
{ {
test_init(); test_init();
va_status = vaCreateConfig(va_dpy, VAProfileMPEG2Main, VAEntrypointVLD, NULL, 0, &config);
ASSERT( VA_STATUS_SUCCESS == va_status );
status("vaCreateConfig returns %08x\n", config);
int width = 352;
int height = 288;
int surface_count = 4;
total_surfaces = surface_count;
surfaces = malloc(total_surfaces * sizeof(VASurfaceID));
// 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 );
status("vaCreateContext with config %08x\n", config);
int flags = 0;
va_status = vaCreateContext( va_dpy, config, width, height, flags, surfaces, surface_count, &context );
ASSERT( VA_STATUS_SUCCESS == va_status );
}
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[] = VABufferType buffer_types[] =
...@@ -42,7 +80,6 @@ VABufferType buffer_types[] = ...@@ -42,7 +80,6 @@ VABufferType buffer_types[] =
VAMacroblockParameterBufferType, VAMacroblockParameterBufferType,
VAResidualDataBufferType, VAResidualDataBufferType,
VADeblockingParameterBufferType, VADeblockingParameterBufferType,
VAImageBufferType
}; };
unsigned int buffer_sizes[] = unsigned int buffer_sizes[] =
...@@ -56,11 +93,13 @@ unsigned int buffer_sizes[] = ...@@ -56,11 +93,13 @@ unsigned int buffer_sizes[] =
sizeof(VAMacroblockParameterBufferMPEG2), sizeof(VAMacroblockParameterBufferMPEG2),
32*1024, 32*1024,
15*1024, 15*1024,
32*1024,
}; };
#define NUM_BUFFER_TYPES (sizeof(buffer_types) / sizeof(VABufferType)) #define NUM_BUFFER_TYPES (sizeof(buffer_types) / sizeof(VABufferType))
#define DEAD_BUFFER_ID ((VABufferID) 0x1234ffff)
void test() void test()
{ {
VABufferID buffer_ids[NUM_BUFFER_TYPES+1]; VABufferID buffer_ids[NUM_BUFFER_TYPES+1];
...@@ -70,9 +109,6 @@ void test() ...@@ -70,9 +109,6 @@ void test()
for(i=0; i < NUM_BUFFER_TYPES; i++) for(i=0; i < NUM_BUFFER_TYPES; i++)
{ {
uint32_t *data; 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); input_data[i] = malloc(buffer_sizes[i]+4);
ASSERT(input_data[i]); ASSERT(input_data[i]);
...@@ -88,9 +124,10 @@ void test() ...@@ -88,9 +124,10 @@ void test()
ASSERT(data); ASSERT(data);
memcpy(data, input_data[i], buffer_sizes[i]); memcpy(data, input_data[i], buffer_sizes[i]);
/* Send to VA Buffer */ /* Create buffer and fill with data */
va_status = vaBufferData(va_dpy, buffer_ids[i], buffer_sizes[i], 1, data); va_status = vaCreateBuffer(va_dpy, context, buffer_types[i], buffer_sizes[i], 1, data, &buffer_ids[i]);
ASSERT( VA_STATUS_SUCCESS == va_status ); ASSERT( VA_STATUS_SUCCESS == va_status );
status("vaCreateBuffer created buffer %08x of type %d\n", buffer_ids[i], buffer_types[i]);
/* Wipe secondary buffer */ /* Wipe secondary buffer */
memset(data, 0, buffer_sizes[i]); memset(data, 0, buffer_sizes[i]);
...@@ -101,9 +138,6 @@ void test() ...@@ -101,9 +138,6 @@ void test()
{ {
void *data = NULL; void *data = NULL;
/* Fetch VA Buffer */ /* 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); va_status = vaMapBuffer(va_dpy, buffer_ids[i], &data);
ASSERT( VA_STATUS_SUCCESS == va_status ); ASSERT( VA_STATUS_SUCCESS == va_status );
status("vaMapBuffer mapped buffer %08x\n", buffer_ids[i]); status("vaMapBuffer mapped buffer %08x\n", buffer_ids[i]);
...@@ -124,7 +158,22 @@ void test() ...@@ -124,7 +158,22 @@ void test()
} }
} }
void post() void post()
{ {
status("vaDestroyContext for context %08x\n", context);
va_status = vaDestroyContext( va_dpy, context );
ASSERT( VA_STATUS_SUCCESS == va_status );
status("vaDestroyConfig for config %08x\n", config);
va_status = vaDestroyConfig( va_dpy, config );
ASSERT( VA_STATUS_SUCCESS == va_status );
va_status = vaDestroySurfaces(va_dpy, surfaces, total_surfaces);
ASSERT( VA_STATUS_SUCCESS == va_status );
free(surfaces);
test_terminate(); test_terminate();
} }
/*
* 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 <stdarg.h>
#include <stdio.h>
#include <string.h>
int main(int argc, const char* argv[])
{
Display *dpy;
VADisplay va_dpy;
VAStatus va_status;
int major_version, minor_version;
const char *driver;
const char *display = getenv("DISPLAY");
const char *name = rindex(argv[0], '/');
if (name)
name++;
else
name = argv[0];
dpy = XOpenDisplay(NULL);
if (NULL == dpy)
{
fprintf(stderr, "%s: Error, can't open display: '%s'\n", name, display ? display : "");
return 1;
}
va_dpy = vaGetDisplay(dpy);
if (NULL == va_dpy)
{
fprintf(stderr, "%s: vaGetDisplay() failed\n", name);
return 2;
}
va_status = vaInitialize(va_dpy, &major_version, &minor_version);
if (VA_STATUS_SUCCESS != va_status )
{
fprintf(stderr, "%s: vaInitialize failed with error code %d (%s)\n",
name, va_status, vaErrorStr(va_status));
}
printf("%s: VA API version: %d.%d\n", name, major_version, minor_version);
driver = vaQueryVendorString(va_dpy);
printf("%s: Driver version: %s\n", name, driver ? driver : "<unknown>");
vaTerminate(va_dpy);
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment