forked from KolibriOS/kolibrios
libva: basic tests
git-svn-id: svn://kolibrios.org@5366 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -8,11 +8,11 @@
|
||||
* 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.
|
||||
@@ -36,7 +36,7 @@ void pre()
|
||||
void test_unique_surfaces(VASurfaceID *surface_list1, int surface_count1, VASurfaceID *surface_list2, int surface_count2)
|
||||
{
|
||||
int i,j;
|
||||
|
||||
|
||||
for(i = 0; i < surface_count1; i++)
|
||||
{
|
||||
for(j = 0; j < surface_count2; j++)
|
||||
@@ -56,7 +56,7 @@ void test()
|
||||
VASurfaceID surfaces_4[4+1];
|
||||
VASurfaceID surfaces_16[16+1];
|
||||
VASurfaceID 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));
|
||||
@@ -79,17 +79,15 @@ void test()
|
||||
va_status = vaCreateSurfaces(va_dpy, VA_RT_FORMAT_YUV420, 352, 288, surfaces_16, 16, NULL, 0);
|
||||
ASSERT( VA_STATUS_SUCCESS == va_status );
|
||||
ASSERT( DEAD_SURFACE_ID == surfaces_16[16] ); /* 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 = vaDestroySurfaces(va_dpy, surfaces_4, 4);
|
||||
ASSERT( VA_STATUS_SUCCESS == va_status );
|
||||
|
||||
|
||||
status("vaCreateSurfaces 6 surfaces\n");
|
||||
surfaces_6[6] = DEAD_SURFACE_ID;
|
||||
va_status = vaCreateSurfaces(va_dpy, VA_RT_FORMAT_YUV420, 352, 288, surfaces_6, 6, NULL, 0);
|
||||
@@ -98,12 +96,12 @@ void test()
|
||||
|
||||
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);
|
||||
test_unique_surfaces(surfaces_1, 1, surfaces_16, 16);
|
||||
|
||||
status("vaDestroySurface 16 surfaces\n");
|
||||
va_status = vaDestroySurfaces(va_dpy, surfaces_16, 16);
|
||||
ASSERT( VA_STATUS_SUCCESS == va_status );
|
||||
|
||||
|
||||
status("vaDestroySurface 1 surface\n");
|
||||
va_status = vaDestroySurfaces(va_dpy, surfaces_1, 1);
|
||||
ASSERT( VA_STATUS_SUCCESS == va_status );
|
||||
|
@@ -8,11 +8,11 @@
|
||||
* 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.
|
||||
@@ -43,13 +43,13 @@ void pre()
|
||||
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, VA_RT_FORMAT_YUV420, width, height, surfaces, total_surfaces, NULL, 0);
|
||||
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 );
|
||||
@@ -59,7 +59,7 @@ void pre()
|
||||
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++)
|
||||
@@ -84,7 +84,7 @@ VABufferType buffer_types[] =
|
||||
|
||||
unsigned int buffer_sizes[] =
|
||||
{
|
||||
sizeof(VAPictureParameterBufferMPEG4),
|
||||
sizeof(VAPictureParameterBufferMPEG4),
|
||||
sizeof(VAIQMatrixBufferH264),
|
||||
32*1024,
|
||||
48*1024,
|
||||
@@ -113,7 +113,7 @@ void test()
|
||||
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]);
|
||||
@@ -130,10 +130,10 @@ void post()
|
||||
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();
|
||||
|
@@ -8,11 +8,11 @@
|
||||
* 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.
|
||||
@@ -43,13 +43,13 @@ void pre()
|
||||
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, VA_RT_FORMAT_YUV420, width, height, surfaces, total_surfaces, NULL, 0);
|
||||
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 );
|
||||
@@ -59,7 +59,7 @@ void pre()
|
||||
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++)
|
||||
@@ -84,7 +84,7 @@ VABufferType buffer_types[] =
|
||||
|
||||
unsigned int buffer_sizes[] =
|
||||
{
|
||||
sizeof(VAPictureParameterBufferMPEG4),
|
||||
sizeof(VAPictureParameterBufferMPEG4),
|
||||
sizeof(VAIQMatrixBufferH264),
|
||||
32*1024,
|
||||
48*1024,
|
||||
@@ -112,13 +112,13 @@ void test()
|
||||
|
||||
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();
|
||||
input_data[i][j] = 20; //random();
|
||||
}
|
||||
|
||||
|
||||
/* Copy to secondary buffer */
|
||||
data = malloc(buffer_sizes[i]);
|
||||
ASSERT(data);
|
||||
@@ -128,7 +128,7 @@ void test()
|
||||
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]);
|
||||
free(data);
|
||||
@@ -142,10 +142,10 @@ void test()
|
||||
ASSERT( VA_STATUS_SUCCESS == va_status );
|
||||
status("vaMapBuffer mapped buffer %08x\n", buffer_ids[i]);
|
||||
|
||||
/* Compare data */
|
||||
/* 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]);
|
||||
@@ -153,7 +153,7 @@ void test()
|
||||
|
||||
va_status = vaDestroyBuffer(va_dpy, buffer_ids[i]);
|
||||
ASSERT( VA_STATUS_SUCCESS == va_status );
|
||||
|
||||
|
||||
free(input_data[i]);
|
||||
}
|
||||
}
|
||||
@@ -169,10 +169,10 @@ void post()
|
||||
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();
|
||||
|
@@ -8,11 +8,11 @@
|
||||
* 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.
|
||||
@@ -34,7 +34,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#define ASSERT assert
|
||||
|
||||
@@ -45,11 +44,10 @@ void status(const char *msg, ...);
|
||||
#include "test_x11.c"
|
||||
#endif
|
||||
|
||||
Display *dpy;
|
||||
VADisplay va_dpy;
|
||||
VAStatus va_status;
|
||||
int major_version, minor_version;
|
||||
int print_status = 0;
|
||||
int print_status = 1;
|
||||
int num_profiles;
|
||||
VAProfile *profiles = NULL;
|
||||
|
||||
@@ -143,14 +141,14 @@ void test_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++)
|
||||
|
@@ -8,11 +8,11 @@
|
||||
* 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.
|
||||
@@ -22,7 +22,6 @@
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
Display *dpy;
|
||||
VADisplay va_dpy;
|
||||
VAStatus va_status;
|
||||
VAProfile *profiles ;
|
||||
@@ -30,14 +29,10 @@ int major_version, minor_version;
|
||||
|
||||
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_dpy = va_open_display();
|
||||
ASSERT( va_dpy );
|
||||
status("va_open_display: 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);
|
||||
@@ -49,9 +44,6 @@ void test_terminate()
|
||||
ASSERT( VA_STATUS_SUCCESS == va_status );
|
||||
status("vaTerminate\n");
|
||||
|
||||
XCloseDisplay(dpy);
|
||||
status("XCloseDisplay\n");
|
||||
|
||||
if (profiles)
|
||||
{
|
||||
free(profiles);
|
||||
|
Reference in New Issue
Block a user