summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorWaldo Bastian <waldo.bastian@intel.com>2007-09-25 06:43:03 -0700
committerWaldo Bastian <waldo.bastian@intel.com>2007-09-25 06:43:03 -0700
commit53a15fcb53ca5a2aecbd56aaba2d728b456d2b33 (patch)
treefe38406ca5b4effa38cddd4ad260c3413f478a9a /test
parent5c06499420685dbca3e54fab7bf706a79d5d7178 (diff)
downloadlibva-53a15fcb53ca5a2aecbd56aaba2d728b456d2b33.tar.gz
More tests
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am34
-rw-r--r--test/test_05.c2
-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/testplan.txt2
7 files changed, 472 insertions, 9 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 9ec3dea..2e4e580 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -20,26 +20,46 @@
# 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_01 test_02 test_03 test_04 test_05
+check_PROGRAMS = test_01 test_02 test_03 test_04 test_05 test_06 \
+ test_07 test_08 test_09
+
testdir = $(bindir)
AM_CFLAGS = -I$(top_srcdir)/../../include/external/ -I$(top_srcdir)/src
-test_SOURCES = test.c
TESTS = $(check_PROGRAMS)
-test_01_LDADD = ../src/libva.la
+TEST_LIBS = ../src/libva.la ../../psb-video/src/psb_drv_video.la
+
+test_01_LDADD = $(TEST_LIBS)
test_01_SOURCES = test_01.c
-test_02_LDADD = ../src/libva.la
+test_02_LDADD = $(TEST_LIBS)
test_02_SOURCES = test_02.c
-test_03_LDADD = ../src/libva.la
+test_03_LDADD = $(TEST_LIBS)
test_03_SOURCES = test_03.c
-test_04_LDADD = ../src/libva.la
+test_04_LDADD = $(TEST_LIBS)
test_04_SOURCES = test_04.c
-test_05_LDADD = ../src/libva.la
+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
+
+
+valgrind: $(check_PROGRAMS)
+ for a in $(check_PROGRAMS); do \
+ valgrind --leak-check=full --show-reachable=yes .libs/$$a; \
+ done
diff --git a/test/test_05.c b/test/test_05.c
index 1901810..f88dd15 100644
--- a/test/test_05.c
+++ b/test/test_05.c
@@ -22,7 +22,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#define TEST_DESCRIPTION "Create configs for all profiles / entrypoints"
+#define TEST_DESCRIPTION "Create/destroy configs for all profiles / entrypoints"
#include "test_common.c"
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/testplan.txt b/test/testplan.txt
index 4c6ccea..1cc573b 100644
--- a/test/testplan.txt
+++ b/test/testplan.txt
@@ -27,7 +27,7 @@ a given profile / entrypoint
Test 7
- Create and destroy surfaces
-- vaCreateSurfaces, vaDestroySurfaces
+- 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.