libva: basic tests

git-svn-id: svn://kolibrios.org@5366 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2015-01-09 17:05:23 +00:00
parent 3b36db1909
commit 5396a8fef8
10 changed files with 65 additions and 112 deletions

View File

@ -45,7 +45,7 @@ intel_driver_get_param(struct intel_driver_data *intel, int param, int *value)
gp.param = param;
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;
}
@ -92,17 +92,10 @@ intel_driver_init(VADriverContextP ctx)
// fprintf(stderr, "g_intel_debug_option_flags:%x\n", g_intel_debug_option_flags);
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->dri2Enabled = 1;
if (!intel->dri2Enabled) {
return false;
}
intel->locked = 0;
// pthread_mutex_init(&intel->ctxmutex, NULL);

View File

@ -192,4 +192,9 @@ struct intel_region
#define IS_CHERRYVIEW(device_info) (device_info->is_cherryview)
#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_ */

View File

@ -81,10 +81,8 @@ void test()
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);
@ -98,7 +96,7 @@ 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);

View File

@ -116,7 +116,7 @@ void test()
/* 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 */

View File

@ -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;

View File

@ -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,13 +29,9 @@ int major_version, minor_version;
void test_init()
{
dpy = XOpenDisplay(NULL);
ASSERT( dpy );
status("XOpenDisplay: dpy = %08x\n", dpy);
va_dpy = vaGetDisplay(dpy);
va_dpy = va_open_display();
ASSERT( va_dpy );
status("vaGetDisplay: va_dpy = %08x\n", 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 );
@ -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);

View File

@ -30,26 +30,11 @@
#include <va/va.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;
static const VADisplayHooks *g_display_hooks;
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,
#endif
#endif
NULL
};

View File

@ -32,43 +32,29 @@
#endif
#include "va_display.h"
static int drm_fd = -1;
static int drm_fd = 0;
static VADisplay
va_open_display_drm(void)
{
VADisplay va_dpy;
int i;
static const char *drm_device_paths[] = {
"/dev/dri/renderD128",
"/dev/dri/card0",
NULL
};
for (i = 0; drm_device_paths[i]; i++) {
drm_fd = open(drm_device_paths[i], O_RDWR);
if (drm_fd < 0)
continue;
drm_fd = get_service("DISPLAY");
if (drm_fd == 0)
return NULL;
va_dpy = vaGetDisplayDRM(drm_fd);
if (va_dpy)
return va_dpy;
close(drm_fd);
drm_fd = -1;
}
drm_fd = 0;
return NULL;
}
static void
va_close_display_drm(VADisplay va_dpy)
{
if (drm_fd < 0)
return;
close(drm_fd);
drm_fd = -1;
drm_fd = 0;
}

View File

@ -25,7 +25,6 @@
#define _VA_X11_H_
#include <va/va.h>
#include <X11/Xlib.h>
#ifdef __cplusplus
extern "C" {
@ -34,9 +33,7 @@ extern "C" {
/*
* Returns a suitable VADisplay for VA API
*/
VADisplay vaGetDisplay (
Display *dpy
);
VADisplay va_open_display(void);
/*
* Output rendering
@ -49,7 +46,6 @@ VADisplay vaGetDisplay (
VAStatus vaPutSurface (
VADisplay dpy,
VASurfaceID surface,
Drawable draw, /* X Drawable */
short srcx,
short srcy,
unsigned short srcw,