Commit 5c064994 authored by Waldo Bastian's avatar Waldo Bastian

First test cases

parent 4b49afc6
...@@ -20,14 +20,26 @@ ...@@ -20,14 +20,26 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
check_PROGRAMS = test check_PROGRAMS = test_01 test_02 test_03 test_04 test_05
testdir = $(bindir) testdir = $(bindir)
# This gives better backtraces when running valgrind:
# test_LDADD = ../src/libva.la ../../psb-video/src/psb_drv_video.la
test_LDADD = ../src/libva.la
AM_CFLAGS = -I$(top_srcdir)/../../include/external/ -I$(top_srcdir)/src AM_CFLAGS = -I$(top_srcdir)/../../include/external/ -I$(top_srcdir)/src
test_SOURCES = test.c test_SOURCES = test.c
TESTS = $(check_PROGRAMS) TESTS = $(check_PROGRAMS)
test_01_LDADD = ../src/libva.la
test_01_SOURCES = test_01.c
test_02_LDADD = ../src/libva.la
test_02_SOURCES = test_02.c
test_03_LDADD = ../src/libva.la
test_03_SOURCES = test_03.c
test_04_LDADD = ../src/libva.la
test_04_SOURCES = test_04.c
test_05_LDADD = ../src/libva.la
test_05_SOURCES = test_05.c
/*
* 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();
}
/*
* 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();
}
/*
* 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();
}
/*
* 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();
}
/*
* 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 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();
}
/*
* 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 <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]));
}
}
}
...@@ -12,17 +12,16 @@ Test 3 ...@@ -12,17 +12,16 @@ Test 3
- vaQueryConfigEntryPoints, vaMaxNumEntryPoints - vaQueryConfigEntryPoints, vaMaxNumEntryPoints
Test 4 Test 4
- Query Config attributes for all profiles / entrypoints - Get Config attributes for all profiles / entrypoints
- vaQueryConfigAttributes, vaMaxNumConfigAttributes - vaGetConfigAttributes
Test 5 Test 5
- Create & destroy config for each profile / entrypoint - Create & destroy config for each profile / entrypoint
- vaCreateConfig - vaCreateConfig, vaDestroyConfig
- NOTE: vaDestroyConfig does not exist
Test 6 Test 6
- Get config attributes of various possible configs - Get config attributes of various possible configs
- vaGetConfigAttributes - vaQueryConfigAttributes, vaMaxNumConfigAttributes
- Check if results for vaGetConfigAttributes match with vaQueryConfigAttributes for - Check if results for vaGetConfigAttributes match with vaQueryConfigAttributes for
a given profile / entrypoint a given profile / entrypoint
...@@ -57,5 +56,51 @@ Test 11 ...@@ -57,5 +56,51 @@ Test 11
- For each different buffertype, copy data to the buffer with vaBufferData. - For each different buffertype, copy data to the buffer with vaBufferData.
Then map the buffer and verify the contents of the buffer. 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
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