diff options
author | Waldo Bastian <waldo.bastian@intel.com> | 2007-11-07 10:47:56 -0800 |
---|---|---|
committer | Waldo Bastian <waldo.bastian@intel.com> | 2007-11-07 10:47:56 -0800 |
commit | d2e4f9b2a5e144081223c905304a1b97fa51eb91 (patch) | |
tree | 39de228842af1f5c483986712afd595527ae9ead /test | |
parent | a0e81bbb0b3a4756b8ef3fe50733786ded414922 (diff) | |
download | libva-d2e4f9b2a5e144081223c905304a1b97fa51eb91.tar.gz |
Update to VA API 0.26
- Combine vaCreateBuffer and vaBufferData
Diffstat (limited to 'test')
-rw-r--r-- | test/test_10.c | 55 | ||||
-rw-r--r-- | test/test_11.c | 67 |
2 files changed, 113 insertions, 9 deletions
diff --git a/test/test_10.c b/test/test_10.c index 3158184..c84211c 100644 --- a/test/test_10.c +++ b/test/test_10.c @@ -26,9 +26,34 @@ #include "test_common.c" +VAConfigID config; +VAContextID context; +VASurfaceID *surfaces; +int total_surfaces; + void pre() { 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) @@ -58,6 +83,21 @@ VABufferType buffer_types[] = 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)) #define DEAD_BUFFER_ID ((VABufferID) 0x1234ffff) @@ -70,7 +110,7 @@ void test() 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]); + va_status = vaCreateBuffer(va_dpy, context, buffer_types[i], buffer_sizes[i], 1, NULL, &buffer_ids[i]); ASSERT( VA_STATUS_SUCCESS == va_status ); ASSERT( DEAD_BUFFER_ID == buffer_ids[i+1] ); /* Bounds check */ } @@ -85,5 +125,18 @@ void test() 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(); } diff --git a/test/test_11.c b/test/test_11.c index 53a1bd5..7535613 100644 --- a/test/test_11.c +++ b/test/test_11.c @@ -26,9 +26,47 @@ #include "test_common.c" +VAConfigID config; +VAContextID context; +VASurfaceID *surfaces; +int total_surfaces; + void pre() { 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[] = @@ -59,8 +97,11 @@ unsigned int buffer_sizes[] = 32*1024, }; + #define NUM_BUFFER_TYPES (sizeof(buffer_types) / sizeof(VABufferType)) +#define DEAD_BUFFER_ID ((VABufferID) 0x1234ffff) + void test() { VABufferID buffer_ids[NUM_BUFFER_TYPES+1]; @@ -70,9 +111,6 @@ void test() 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]); @@ -88,9 +126,10 @@ void test() 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); + /* Create buffer and fill with data */ + va_status = vaCreateBuffer(va_dpy, context, buffer_types[i], buffer_sizes[i], 1, data, &buffer_ids[i]); ASSERT( VA_STATUS_SUCCESS == va_status ); + status("vaCreateBuffer created buffer %08x of type %d\n", buffer_ids[i], buffer_types[i]); /* Wipe secondary buffer */ memset(data, 0, buffer_sizes[i]); @@ -101,9 +140,6 @@ void test() { 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]); @@ -124,7 +160,22 @@ void test() } } + + 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(); } |