Commit 5bc5efa3 authored by Ren Zhaohan's avatar Ren Zhaohan

add new va_DisplayContextGetDriverName, remove 'x11/XX' include folder name

parent 01d2fa69
......@@ -17,6 +17,7 @@ LOCAL_CFLAGS += -DHAVE_CONFIG_H \
LOCAL_C_INCLUDES += \
$(TOPDIR)kernel/include \
$(TARGET_OUT_HEADERS)/libva \
$(LOCAL_PATH)/x11 \
$(TOPDIR)kernel/include/drm
LOCAL_COPY_HEADERS_TO := libva/va
......
......@@ -26,7 +26,7 @@
#include "va.h"
#include "va_backend.h"
#include "va_android.h"
#include "x11/va_dricommon.h" /* needs some helper functions from this file */
#include "va_dricommon.h" /* needs some helper functions from this file */
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
......@@ -37,6 +37,10 @@
#include <fcntl.h>
#include <dlfcn.h>
#include <errno.h>
#ifndef ANDROID
#include <libudev.h>
#include "drm_test.h"
#endif
#define CHECK_SYMBOL(func) { if (!func) printf("func %s not found\n", #func); return VA_STATUS_ERROR_UNKNOWN; }
#define DEVICE_NAME "/dev/dri/card0"
......@@ -110,7 +114,7 @@ static void va_DisplayContextDestroy (
free(pDisplayContext);
}
#ifdef ANDROID
static VAStatus va_DisplayContextGetDriverName (
VADisplayContextP pDisplayContext,
char **driver_name
......@@ -154,7 +158,51 @@ static VAStatus va_DisplayContextGetDriverName (
return VA_STATUS_SUCCESS;
}
#else
static VAStatus va_DisplayContextGetDriverName (
VADisplayContextP pDisplayContext,
char **driver_name
)
{
VADriverContextP ctx = pDisplayContext->pDriverContext;
struct dri_state *dri_state = (struct dri_state *)ctx->dri_state;
char *driver_name_env;
struct {
unsigned int vendor_id;
unsigned int device_id;
char driver_name[64];
} devices[] = {
{ 0x8086, 0x4100, "pvr" },
};
memset(dri_state, 0, sizeof(*dri_state));
dri_state->fd = drm_open_any_master();
if (dri_state->fd < 0) {
fprintf(stderr, "open DRM device by udev failed, try /dev/dri/card0\n");
dri_state->fd = open("/dev/dri/card0", O_RDWR);
}
if (dri_state->fd < 0) {
fprintf(stderr,"can't open DRM devices\n");
return VA_STATUS_ERROR_UNKNOWN;
}
if ((driver_name_env = getenv("LIBVA_DRIVER_NAME")) != NULL
&& geteuid() == getuid())
{
/* don't allow setuid apps to use LIBVA_DRIVER_NAME */
*driver_name = strdup(driver_name_env);
return VA_STATUS_SUCCESS;
} else /* TBD: other vendor driver names */
*driver_name = strdup(devices[0].driver_name);
dri_state->driConnectedFlag = VA_DUMMY;
return VA_STATUS_SUCCESS;
}
#endif
VADisplay vaGetDisplay (
void *native_dpy /* implementation specific */
......@@ -245,7 +293,6 @@ VAStatus vaPutSurface (
CHECK_DISPLAY(dpy);
ctx = CTX(dpy);
return ctx->vtable.vaPutSurface( ctx, surface, (void *)draw, srcx, srcy, srcw, srch,
destx, desty, destw, desth,
cliprects, number_cliprects, flags );
......
......@@ -5,7 +5,6 @@
#ifdef __cplusplus
extern "C" {
#endif
/*
* Returns a suitable VADisplay for VA API
*/
......
......@@ -185,26 +185,11 @@ struct VADriverVTable
VAStatus (*vaPutSurface) (
VADriverContextP ctx,
VASurfaceID surface,
void * draw, /* Drawable of window system */
short srcx,
short srcy,
unsigned short srcw,
unsigned short srch,
short destx,
short desty,
unsigned short destw,
unsigned short desth,
VARectangle *cliprects, /* client supplied clip list */
unsigned int number_cliprects, /* number of clip rects in the clip list */
unsigned int flags /* de-interlacing flags */
);
VAStatus (*vaPutSurfaceBuf) (
VADriverContextP ctx,
VASurfaceID surface,
Drawable draw, /* X Drawable */
unsigned char* data,
int* data_len,
#ifdef ANDROID
Surface* draw, /* Drawable of window system */
#else
Drawable draw,
#endif
short srcx,
short srcy,
unsigned short srcw,
......
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