summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRen Zhaohan <zhaohan.ren@intel.com>2010-05-05 16:19:39 +0800
committerRen Zhaohan <zhaohan.ren@intel.com>2010-05-05 16:19:39 +0800
commit5bc5efa30ce3a53b69c2560ab50e1a3d9367fdac (patch)
treed1a373c00448a4b601f17c3afbb70bd0285f3d89
parent01d2fa69930aae3a1b63acf4657843395cf1c095 (diff)
add new va_DisplayContextGetDriverName, remove 'x11/XX' include folder namePO-ww19.3-new
-rw-r--r--va/Android.mk1
-rw-r--r--va/android/va_android.c53
-rw-r--r--va/va_android.h3
-rw-r--r--va/va_backend.h25
4 files changed, 57 insertions, 25 deletions
diff --git a/va/Android.mk b/va/Android.mk
index eb9967d..5eb8e6d 100644
--- a/va/Android.mk
+++ b/va/Android.mk
@@ -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
diff --git a/va/android/va_android.c b/va/android/va_android.c
index 5ccf998..39b1876 100644
--- a/va/android/va_android.c
+++ b/va/android/va_android.c
@@ -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 );
diff --git a/va/va_android.h b/va/va_android.h
index 3e050b8..43b2730 100644
--- a/va/va_android.h
+++ b/va/va_android.h
@@ -5,7 +5,6 @@
#ifdef __cplusplus
extern "C" {
#endif
-
/*
* Returns a suitable VADisplay for VA API
*/
@@ -16,7 +15,7 @@ VADisplay vaGetDisplay (
#if ANDROID
//#include <ui/Surface.h>
//class Surface;
-
+
/*
* Output rendering
* Following is the rendering interface for X windows,
diff --git a/va/va_backend.h b/va/va_backend.h
index 54db430..f457cc4 100644
--- a/va/va_backend.h
+++ b/va/va_backend.h
@@ -185,7 +185,11 @@ struct VADriverVTable
VAStatus (*vaPutSurface) (
VADriverContextP ctx,
VASurfaceID surface,
- void * draw, /* Drawable of window system */
+#ifdef ANDROID
+ Surface* draw, /* Drawable of window system */
+#else
+ Drawable draw,
+#endif
short srcx,
short srcy,
unsigned short srcw,
@@ -199,25 +203,6 @@ struct VADriverVTable
unsigned int flags /* de-interlacing flags */
);
- VAStatus (*vaPutSurfaceBuf) (
- VADriverContextP ctx,
- VASurfaceID surface,
- Drawable draw, /* X Drawable */
- unsigned char* data,
- int* data_len,
- 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 (*vaQueryImageFormats) (
VADriverContextP ctx,
VAImageFormat *format_list, /* out */