forked from KolibriOS/kolibrios
libva: basic tests
git-svn-id: svn://kolibrios.org@5366 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
3b36db1909
commit
5396a8fef8
@ -45,7 +45,7 @@ intel_driver_get_param(struct intel_driver_data *intel, int param, int *value)
|
|||||||
gp.param = param;
|
gp.param = param;
|
||||||
gp.value = value;
|
gp.value = value;
|
||||||
|
|
||||||
return drmIoctl(intel->fd, DRM_I915_GETPARAM, &gp) == 0;
|
return drmIoctl(intel->fd, DRM_IOCTL_I915_GETPARAM, &gp) == 0;
|
||||||
|
|
||||||
// return drmCommandWriteRead(intel->fd, DRM_I915_GETPARAM, &gp, sizeof(gp)) == 0;
|
// return drmCommandWriteRead(intel->fd, DRM_I915_GETPARAM, &gp, sizeof(gp)) == 0;
|
||||||
}
|
}
|
||||||
@ -92,17 +92,10 @@ intel_driver_init(VADriverContextP ctx)
|
|||||||
// fprintf(stderr, "g_intel_debug_option_flags:%x\n", g_intel_debug_option_flags);
|
// fprintf(stderr, "g_intel_debug_option_flags:%x\n", g_intel_debug_option_flags);
|
||||||
|
|
||||||
assert(drm_state);
|
assert(drm_state);
|
||||||
assert(VA_CHECK_DRM_AUTH_TYPE(ctx, VA_DRM_AUTH_DRI1) ||
|
|
||||||
VA_CHECK_DRM_AUTH_TYPE(ctx, VA_DRM_AUTH_DRI2) ||
|
|
||||||
VA_CHECK_DRM_AUTH_TYPE(ctx, VA_DRM_AUTH_CUSTOM));
|
|
||||||
|
|
||||||
intel->fd = drm_state->fd;
|
intel->fd = drm_state->fd;
|
||||||
intel->dri2Enabled = 1;
|
intel->dri2Enabled = 1;
|
||||||
|
|
||||||
if (!intel->dri2Enabled) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
intel->locked = 0;
|
intel->locked = 0;
|
||||||
// pthread_mutex_init(&intel->ctxmutex, NULL);
|
// pthread_mutex_init(&intel->ctxmutex, NULL);
|
||||||
|
|
||||||
|
@ -192,4 +192,9 @@ struct intel_region
|
|||||||
#define IS_CHERRYVIEW(device_info) (device_info->is_cherryview)
|
#define IS_CHERRYVIEW(device_info) (device_info->is_cherryview)
|
||||||
#define IS_GEN8(device_info) (device_info->gen == 8)
|
#define IS_GEN8(device_info) (device_info->gen == 8)
|
||||||
|
|
||||||
|
#define ENTER() printf("enter %s\n",__FUNCTION__)
|
||||||
|
#define LEAVE() printf("leave %s\n",__FUNCTION__)
|
||||||
|
#define FAIL() printf("fail %s\n",__FUNCTION__)
|
||||||
|
|
||||||
|
|
||||||
#endif /* _INTEL_DRIVER_H_ */
|
#endif /* _INTEL_DRIVER_H_ */
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
* distribute, sub license, and/or sell copies of the Software, and to
|
* 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
|
* permit persons to whom the Software is furnished to do so, subject to
|
||||||
* the following conditions:
|
* the following conditions:
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice (including the
|
* The above copyright notice and this permission notice (including the
|
||||||
* next paragraph) shall be included in all copies or substantial portions
|
* next paragraph) shall be included in all copies or substantial portions
|
||||||
* of the Software.
|
* of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
* 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)
|
void test_unique_surfaces(VASurfaceID *surface_list1, int surface_count1, VASurfaceID *surface_list2, int surface_count2)
|
||||||
{
|
{
|
||||||
int i,j;
|
int i,j;
|
||||||
|
|
||||||
for(i = 0; i < surface_count1; i++)
|
for(i = 0; i < surface_count1; i++)
|
||||||
{
|
{
|
||||||
for(j = 0; j < surface_count2; j++)
|
for(j = 0; j < surface_count2; j++)
|
||||||
@ -56,7 +56,7 @@ void test()
|
|||||||
VASurfaceID surfaces_4[4+1];
|
VASurfaceID surfaces_4[4+1];
|
||||||
VASurfaceID surfaces_16[16+1];
|
VASurfaceID surfaces_16[16+1];
|
||||||
VASurfaceID 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));
|
||||||
memset(surfaces_16, 0xff, sizeof(surfaces_16));
|
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);
|
va_status = vaCreateSurfaces(va_dpy, VA_RT_FORMAT_YUV420, 352, 288, surfaces_16, 16, NULL, 0);
|
||||||
ASSERT( VA_STATUS_SUCCESS == va_status );
|
ASSERT( VA_STATUS_SUCCESS == va_status );
|
||||||
ASSERT( DEAD_SURFACE_ID == surfaces_16[16] ); /* 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, 16);
|
test_unique_surfaces(surfaces_4, 4, surfaces_16, 16);
|
||||||
test_unique_surfaces(surfaces_4, 1, 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");
|
status("vaDestroySurface 4 surfaces\n");
|
||||||
va_status = vaDestroySurfaces(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] = DEAD_SURFACE_ID;
|
surfaces_6[6] = DEAD_SURFACE_ID;
|
||||||
va_status = vaCreateSurfaces(va_dpy, VA_RT_FORMAT_YUV420, 352, 288, surfaces_6, 6, NULL, 0);
|
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_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, 1, surfaces_16, 16);
|
||||||
|
|
||||||
status("vaDestroySurface 16 surfaces\n");
|
status("vaDestroySurface 16 surfaces\n");
|
||||||
va_status = vaDestroySurfaces(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 = vaDestroySurfaces(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 );
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
* distribute, sub license, and/or sell copies of the Software, and to
|
* 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
|
* permit persons to whom the Software is furnished to do so, subject to
|
||||||
* the following conditions:
|
* the following conditions:
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice (including the
|
* The above copyright notice and this permission notice (including the
|
||||||
* next paragraph) shall be included in all copies or substantial portions
|
* next paragraph) shall be included in all copies or substantial portions
|
||||||
* of the Software.
|
* of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||||
@ -43,13 +43,13 @@ void pre()
|
|||||||
int height = 288;
|
int height = 288;
|
||||||
int surface_count = 4;
|
int surface_count = 4;
|
||||||
total_surfaces = surface_count;
|
total_surfaces = surface_count;
|
||||||
|
|
||||||
surfaces = malloc(total_surfaces * sizeof(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, VA_RT_FORMAT_YUV420, width, height, surfaces, total_surfaces, NULL, 0);
|
va_status = vaCreateSurfaces(va_dpy, VA_RT_FORMAT_YUV420, width, height, surfaces, total_surfaces, NULL, 0);
|
||||||
ASSERT( VA_STATUS_SUCCESS == va_status );
|
ASSERT( VA_STATUS_SUCCESS == va_status );
|
||||||
|
|
||||||
status("vaCreateContext with config %08x\n", config);
|
status("vaCreateContext with config %08x\n", config);
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
va_status = vaCreateContext( va_dpy, config, width, height, flags, surfaces, surface_count, &context );
|
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)
|
void test_unique_buffers(VABufferID *buffer_list, int buffer_count)
|
||||||
{
|
{
|
||||||
int i,j;
|
int i,j;
|
||||||
|
|
||||||
for(i = 0; i < buffer_count; i++)
|
for(i = 0; i < buffer_count; i++)
|
||||||
{
|
{
|
||||||
for(j = 0; j < i; j++)
|
for(j = 0; j < i; j++)
|
||||||
@ -84,7 +84,7 @@ VABufferType buffer_types[] =
|
|||||||
|
|
||||||
unsigned int buffer_sizes[] =
|
unsigned int buffer_sizes[] =
|
||||||
{
|
{
|
||||||
sizeof(VAPictureParameterBufferMPEG4),
|
sizeof(VAPictureParameterBufferMPEG4),
|
||||||
sizeof(VAIQMatrixBufferH264),
|
sizeof(VAIQMatrixBufferH264),
|
||||||
32*1024,
|
32*1024,
|
||||||
48*1024,
|
48*1024,
|
||||||
@ -113,7 +113,7 @@ void test()
|
|||||||
ASSERT( DEAD_BUFFER_ID == buffer_ids[i+1] ); /* Bounds check */
|
ASSERT( DEAD_BUFFER_ID == buffer_ids[i+1] ); /* Bounds check */
|
||||||
}
|
}
|
||||||
test_unique_buffers(buffer_ids, NUM_BUFFER_TYPES);
|
test_unique_buffers(buffer_ids, NUM_BUFFER_TYPES);
|
||||||
|
|
||||||
for(i=0; i < NUM_BUFFER_TYPES; i++)
|
for(i=0; i < NUM_BUFFER_TYPES; i++)
|
||||||
{
|
{
|
||||||
va_status = vaDestroyBuffer(va_dpy, buffer_ids[i]);
|
va_status = vaDestroyBuffer(va_dpy, buffer_ids[i]);
|
||||||
@ -130,10 +130,10 @@ void post()
|
|||||||
status("vaDestroyConfig for config %08x\n", config);
|
status("vaDestroyConfig for config %08x\n", config);
|
||||||
va_status = vaDestroyConfig( va_dpy, config );
|
va_status = vaDestroyConfig( va_dpy, config );
|
||||||
ASSERT( VA_STATUS_SUCCESS == va_status );
|
ASSERT( VA_STATUS_SUCCESS == va_status );
|
||||||
|
|
||||||
va_status = vaDestroySurfaces(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(surfaces);
|
free(surfaces);
|
||||||
|
|
||||||
test_terminate();
|
test_terminate();
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
* distribute, sub license, and/or sell copies of the Software, and to
|
* 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
|
* permit persons to whom the Software is furnished to do so, subject to
|
||||||
* the following conditions:
|
* the following conditions:
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice (including the
|
* The above copyright notice and this permission notice (including the
|
||||||
* next paragraph) shall be included in all copies or substantial portions
|
* next paragraph) shall be included in all copies or substantial portions
|
||||||
* of the Software.
|
* of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||||
@ -43,13 +43,13 @@ void pre()
|
|||||||
int height = 288;
|
int height = 288;
|
||||||
int surface_count = 4;
|
int surface_count = 4;
|
||||||
total_surfaces = surface_count;
|
total_surfaces = surface_count;
|
||||||
|
|
||||||
surfaces = malloc(total_surfaces * sizeof(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, VA_RT_FORMAT_YUV420, width, height, surfaces, total_surfaces, NULL, 0);
|
va_status = vaCreateSurfaces(va_dpy, VA_RT_FORMAT_YUV420, width, height, surfaces, total_surfaces, NULL, 0);
|
||||||
ASSERT( VA_STATUS_SUCCESS == va_status );
|
ASSERT( VA_STATUS_SUCCESS == va_status );
|
||||||
|
|
||||||
status("vaCreateContext with config %08x\n", config);
|
status("vaCreateContext with config %08x\n", config);
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
va_status = vaCreateContext( va_dpy, config, width, height, flags, surfaces, surface_count, &context );
|
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)
|
void test_unique_buffers(VABufferID *buffer_list, int buffer_count)
|
||||||
{
|
{
|
||||||
int i,j;
|
int i,j;
|
||||||
|
|
||||||
for(i = 0; i < buffer_count; i++)
|
for(i = 0; i < buffer_count; i++)
|
||||||
{
|
{
|
||||||
for(j = 0; j < i; j++)
|
for(j = 0; j < i; j++)
|
||||||
@ -84,7 +84,7 @@ VABufferType buffer_types[] =
|
|||||||
|
|
||||||
unsigned int buffer_sizes[] =
|
unsigned int buffer_sizes[] =
|
||||||
{
|
{
|
||||||
sizeof(VAPictureParameterBufferMPEG4),
|
sizeof(VAPictureParameterBufferMPEG4),
|
||||||
sizeof(VAIQMatrixBufferH264),
|
sizeof(VAIQMatrixBufferH264),
|
||||||
32*1024,
|
32*1024,
|
||||||
48*1024,
|
48*1024,
|
||||||
@ -112,13 +112,13 @@ void test()
|
|||||||
|
|
||||||
input_data[i] = malloc(buffer_sizes[i]+4);
|
input_data[i] = malloc(buffer_sizes[i]+4);
|
||||||
ASSERT(input_data[i]);
|
ASSERT(input_data[i]);
|
||||||
|
|
||||||
/* Generate input data */
|
/* Generate input data */
|
||||||
for(j = buffer_sizes[i] / 4; j--;)
|
for(j = buffer_sizes[i] / 4; j--;)
|
||||||
{
|
{
|
||||||
input_data[i][j] = random();
|
input_data[i][j] = 20; //random();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy to secondary buffer */
|
/* Copy to secondary buffer */
|
||||||
data = malloc(buffer_sizes[i]);
|
data = malloc(buffer_sizes[i]);
|
||||||
ASSERT(data);
|
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]);
|
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]);
|
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]);
|
||||||
free(data);
|
free(data);
|
||||||
@ -142,10 +142,10 @@ void test()
|
|||||||
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]);
|
||||||
|
|
||||||
/* Compare data */
|
/* Compare data */
|
||||||
ASSERT( memcmp(input_data[i], data, buffer_sizes[i]) == 0 );
|
ASSERT( memcmp(input_data[i], data, buffer_sizes[i]) == 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0; i < NUM_BUFFER_TYPES; i++)
|
for(i=0; i < NUM_BUFFER_TYPES; i++)
|
||||||
{
|
{
|
||||||
va_status = vaUnmapBuffer(va_dpy, buffer_ids[i]);
|
va_status = vaUnmapBuffer(va_dpy, buffer_ids[i]);
|
||||||
@ -153,7 +153,7 @@ void test()
|
|||||||
|
|
||||||
va_status = vaDestroyBuffer(va_dpy, buffer_ids[i]);
|
va_status = vaDestroyBuffer(va_dpy, buffer_ids[i]);
|
||||||
ASSERT( VA_STATUS_SUCCESS == va_status );
|
ASSERT( VA_STATUS_SUCCESS == va_status );
|
||||||
|
|
||||||
free(input_data[i]);
|
free(input_data[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -169,10 +169,10 @@ void post()
|
|||||||
status("vaDestroyConfig for config %08x\n", config);
|
status("vaDestroyConfig for config %08x\n", config);
|
||||||
va_status = vaDestroyConfig( va_dpy, config );
|
va_status = vaDestroyConfig( va_dpy, config );
|
||||||
ASSERT( VA_STATUS_SUCCESS == va_status );
|
ASSERT( VA_STATUS_SUCCESS == va_status );
|
||||||
|
|
||||||
va_status = vaDestroySurfaces(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(surfaces);
|
free(surfaces);
|
||||||
|
|
||||||
test_terminate();
|
test_terminate();
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
* distribute, sub license, and/or sell copies of the Software, and to
|
* 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
|
* permit persons to whom the Software is furnished to do so, subject to
|
||||||
* the following conditions:
|
* the following conditions:
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice (including the
|
* The above copyright notice and this permission notice (including the
|
||||||
* next paragraph) shall be included in all copies or substantial portions
|
* next paragraph) shall be included in all copies or substantial portions
|
||||||
* of the Software.
|
* of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||||
@ -34,7 +34,6 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <dlfcn.h>
|
|
||||||
|
|
||||||
#define ASSERT assert
|
#define ASSERT assert
|
||||||
|
|
||||||
@ -45,11 +44,10 @@ void status(const char *msg, ...);
|
|||||||
#include "test_x11.c"
|
#include "test_x11.c"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Display *dpy;
|
|
||||||
VADisplay va_dpy;
|
VADisplay va_dpy;
|
||||||
VAStatus va_status;
|
VAStatus va_status;
|
||||||
int major_version, minor_version;
|
int major_version, minor_version;
|
||||||
int print_status = 0;
|
int print_status = 1;
|
||||||
int num_profiles;
|
int num_profiles;
|
||||||
VAProfile *profiles = NULL;
|
VAProfile *profiles = NULL;
|
||||||
|
|
||||||
@ -143,14 +141,14 @@ void test_profiles()
|
|||||||
ASSERT(max_profiles > 0);
|
ASSERT(max_profiles > 0);
|
||||||
profiles = malloc(max_profiles * sizeof(VAProfile));
|
profiles = malloc(max_profiles * sizeof(VAProfile));
|
||||||
ASSERT(profiles);
|
ASSERT(profiles);
|
||||||
|
|
||||||
va_status = vaQueryConfigProfiles(va_dpy, profiles, &num_profiles);
|
va_status = vaQueryConfigProfiles(va_dpy, profiles, &num_profiles);
|
||||||
ASSERT( VA_STATUS_SUCCESS == va_status );
|
ASSERT( VA_STATUS_SUCCESS == va_status );
|
||||||
|
|
||||||
status("vaQueryConfigProfiles reports %d profiles\n", num_profiles);
|
status("vaQueryConfigProfiles reports %d profiles\n", num_profiles);
|
||||||
ASSERT(num_profiles <= max_profiles);
|
ASSERT(num_profiles <= max_profiles);
|
||||||
ASSERT(num_profiles > 0);
|
ASSERT(num_profiles > 0);
|
||||||
|
|
||||||
if (print_status)
|
if (print_status)
|
||||||
{
|
{
|
||||||
for(i = 0; i < num_profiles; i++)
|
for(i = 0; i < num_profiles; i++)
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
* distribute, sub license, and/or sell copies of the Software, and to
|
* 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
|
* permit persons to whom the Software is furnished to do so, subject to
|
||||||
* the following conditions:
|
* the following conditions:
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice (including the
|
* The above copyright notice and this permission notice (including the
|
||||||
* next paragraph) shall be included in all copies or substantial portions
|
* next paragraph) shall be included in all copies or substantial portions
|
||||||
* of the Software.
|
* of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||||
@ -22,7 +22,6 @@
|
|||||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Display *dpy;
|
|
||||||
VADisplay va_dpy;
|
VADisplay va_dpy;
|
||||||
VAStatus va_status;
|
VAStatus va_status;
|
||||||
VAProfile *profiles ;
|
VAProfile *profiles ;
|
||||||
@ -30,14 +29,10 @@ int major_version, minor_version;
|
|||||||
|
|
||||||
void test_init()
|
void test_init()
|
||||||
{
|
{
|
||||||
dpy = XOpenDisplay(NULL);
|
va_dpy = va_open_display();
|
||||||
ASSERT( dpy );
|
ASSERT( va_dpy );
|
||||||
status("XOpenDisplay: dpy = %08x\n", dpy);
|
status("va_open_display: va_dpy = %08x\n", va_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);
|
va_status = vaInitialize(va_dpy, &major_version, &minor_version);
|
||||||
ASSERT( VA_STATUS_SUCCESS == va_status );
|
ASSERT( VA_STATUS_SUCCESS == va_status );
|
||||||
status("vaInitialize: major = %d minor = %d\n", major_version, minor_version);
|
status("vaInitialize: major = %d minor = %d\n", major_version, minor_version);
|
||||||
@ -49,9 +44,6 @@ void test_terminate()
|
|||||||
ASSERT( VA_STATUS_SUCCESS == va_status );
|
ASSERT( VA_STATUS_SUCCESS == va_status );
|
||||||
status("vaTerminate\n");
|
status("vaTerminate\n");
|
||||||
|
|
||||||
XCloseDisplay(dpy);
|
|
||||||
status("XCloseDisplay\n");
|
|
||||||
|
|
||||||
if (profiles)
|
if (profiles)
|
||||||
{
|
{
|
||||||
free(profiles);
|
free(profiles);
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
* distribute, sub license, and/or sell copies of the Software, and to
|
* 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
|
* permit persons to whom the Software is furnished to do so, subject to
|
||||||
* the following conditions:
|
* the following conditions:
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice (including the
|
* The above copyright notice and this permission notice (including the
|
||||||
* next paragraph) shall be included in all copies or substantial portions
|
* next paragraph) shall be included in all copies or substantial portions
|
||||||
* of the Software.
|
* of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||||
@ -30,26 +30,11 @@
|
|||||||
#include <va/va.h>
|
#include <va/va.h>
|
||||||
#include "va_display.h"
|
#include "va_display.h"
|
||||||
|
|
||||||
extern const VADisplayHooks va_display_hooks_android;
|
|
||||||
extern const VADisplayHooks va_display_hooks_wayland;
|
|
||||||
extern const VADisplayHooks va_display_hooks_x11;
|
|
||||||
extern const VADisplayHooks va_display_hooks_drm;
|
extern const VADisplayHooks va_display_hooks_drm;
|
||||||
|
|
||||||
static const VADisplayHooks *g_display_hooks;
|
static const VADisplayHooks *g_display_hooks;
|
||||||
static const VADisplayHooks *g_display_hooks_available[] = {
|
static const VADisplayHooks *g_display_hooks_available[] = {
|
||||||
#ifdef ANDROID
|
|
||||||
&va_display_hooks_android,
|
|
||||||
#else
|
|
||||||
#ifdef HAVE_VA_WAYLAND
|
|
||||||
&va_display_hooks_wayland,
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_VA_X11
|
|
||||||
&va_display_hooks_x11,
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_VA_DRM
|
|
||||||
&va_display_hooks_drm,
|
&va_display_hooks_drm,
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -32,43 +32,29 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "va_display.h"
|
#include "va_display.h"
|
||||||
|
|
||||||
static int drm_fd = -1;
|
static int drm_fd = 0;
|
||||||
|
|
||||||
static VADisplay
|
static VADisplay
|
||||||
va_open_display_drm(void)
|
va_open_display_drm(void)
|
||||||
{
|
{
|
||||||
VADisplay va_dpy;
|
VADisplay va_dpy;
|
||||||
int i;
|
|
||||||
|
|
||||||
static const char *drm_device_paths[] = {
|
drm_fd = get_service("DISPLAY");
|
||||||
"/dev/dri/renderD128",
|
if (drm_fd == 0)
|
||||||
"/dev/dri/card0",
|
return NULL;
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
for (i = 0; drm_device_paths[i]; i++) {
|
va_dpy = vaGetDisplayDRM(drm_fd);
|
||||||
drm_fd = open(drm_device_paths[i], O_RDWR);
|
if (va_dpy)
|
||||||
if (drm_fd < 0)
|
return va_dpy;
|
||||||
continue;
|
|
||||||
|
|
||||||
va_dpy = vaGetDisplayDRM(drm_fd);
|
drm_fd = 0;
|
||||||
if (va_dpy)
|
|
||||||
return va_dpy;
|
|
||||||
|
|
||||||
close(drm_fd);
|
|
||||||
drm_fd = -1;
|
|
||||||
}
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
va_close_display_drm(VADisplay va_dpy)
|
va_close_display_drm(VADisplay va_dpy)
|
||||||
{
|
{
|
||||||
if (drm_fd < 0)
|
drm_fd = 0;
|
||||||
return;
|
|
||||||
|
|
||||||
close(drm_fd);
|
|
||||||
drm_fd = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#define _VA_X11_H_
|
#define _VA_X11_H_
|
||||||
|
|
||||||
#include <va/va.h>
|
#include <va/va.h>
|
||||||
#include <X11/Xlib.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -34,22 +33,19 @@ extern "C" {
|
|||||||
/*
|
/*
|
||||||
* Returns a suitable VADisplay for VA API
|
* Returns a suitable VADisplay for VA API
|
||||||
*/
|
*/
|
||||||
VADisplay vaGetDisplay (
|
VADisplay va_open_display(void);
|
||||||
Display *dpy
|
|
||||||
);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Output rendering
|
* Output rendering
|
||||||
* Following is the rendering interface for X windows,
|
* Following is the rendering interface for X windows,
|
||||||
* to get the decode output surface to a X drawable
|
* to get the decode output surface to a X drawable
|
||||||
* It basically performs a de-interlacing (if needed),
|
* It basically performs a de-interlacing (if needed),
|
||||||
* color space conversion and scaling to the destination
|
* color space conversion and scaling to the destination
|
||||||
* rectangle
|
* rectangle
|
||||||
*/
|
*/
|
||||||
VAStatus vaPutSurface (
|
VAStatus vaPutSurface (
|
||||||
VADisplay dpy,
|
VADisplay dpy,
|
||||||
VASurfaceID surface,
|
VASurfaceID surface,
|
||||||
Drawable draw, /* X Drawable */
|
|
||||||
short srcx,
|
short srcx,
|
||||||
short srcy,
|
short srcy,
|
||||||
unsigned short srcw,
|
unsigned short srcw,
|
||||||
|
Loading…
Reference in New Issue
Block a user