summaryrefslogtreecommitdiff
path: root/va
diff options
context:
space:
mode:
authorRen Zhaohan <zhaohan.ren@intel.com>2010-05-06 14:39:16 +0800
committerRen Zhaohan <zhaohan.ren@intel.com>2010-05-06 14:39:16 +0800
commite498c6a1ab475acde9a4343bc403109ae73f652d (patch)
tree39ffeb4246986660ef2b5f768d9fd60600b6d8ba /va
parenta9ea9bcf481f4f3b33253484493658b8bee02adf (diff)
downloadlibva-e498c6a1ab475acde9a4343bc403109ae73f652d.tar.gz
restore old va_DisplayContextGetDriverName
Diffstat (limited to 'va')
-rw-r--r--va/android/va_android.c53
-rw-r--r--va/va_android.h4
-rw-r--r--va/va_backend.h4
3 files changed, 36 insertions, 25 deletions
diff --git a/va/android/va_android.c b/va/android/va_android.c
index 39b1876..31f8581 100644
--- a/va/android/va_android.c
+++ b/va/android/va_android.c
@@ -43,7 +43,7 @@
#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"
+#define DEVICE_NAME "/dev/card0"
static VADisplayContextP pDisplayContexts = NULL;
@@ -65,7 +65,7 @@ static int open_device (char *dev_name)
return -1;
}
- fd = open (dev_name, O_RDWR /* required */ | O_NONBLOCK, 0);
+ fd = open (dev_name, O_RDWR);
if (-1 == fd)
{
@@ -167,39 +167,56 @@ static VAStatus va_DisplayContextGetDriverName (
VADriverContextP ctx = pDisplayContext->pDriverContext;
struct dri_state *dri_state = (struct dri_state *)ctx->dri_state;
char *driver_name_env;
-
+ int vendor_id, device_id;
+
struct {
- unsigned int vendor_id;
- unsigned int device_id;
+ int vendor_id;
+ int device_id;
char driver_name[64];
} devices[] = {
{ 0x8086, 0x4100, "pvr" },
+ { 0x8086, 0x0130, "pvr" },
+ { 0x0, 0x0, "\0" },
};
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);
- }
-
+ dri_state->fd = drm_open_any(&vendor_id, &device_id);
+
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())
- {
+ && 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);
-
+ } else { /* TBD: other vendor driver names */
+ int i = 0;
+
+ while (devices[i].device_id != 0) {
+ if ((devices[i].vendor_id == vendor_id) &&
+ (devices[i].device_id == device_id))
+ break;
+ i++;
+ }
+
+ if (devices[i].device_id != 0)
+ *driver_name = strdup(devices[i].driver_name);
+ else {
+ fprintf(stderr,"device (0x%04x:0x%04x) is not supported\n",
+ vendor_id, device_id);
+
+ return VA_STATUS_ERROR_UNKNOWN;
+ }
+ }
+ printf("DRM device is opened, loading driver %s for device 0x%04x:0x%04x\n",
+ driver_name, vendor_id, device_id);
+
dri_state->driConnectedFlag = VA_DUMMY;
-
+
return VA_STATUS_SUCCESS;
}
#endif
diff --git a/va/va_android.h b/va/va_android.h
index 5ba1156..fa46ae0 100644
--- a/va/va_android.h
+++ b/va/va_android.h
@@ -3,8 +3,6 @@
#include <va/va.h>
-#define Surface void
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -30,7 +28,7 @@ VADisplay vaGetDisplay (
VAStatus vaPutSurface (
VADisplay dpy,
VASurfaceID surface,
- Surface *draw, /* Android Window/Surface */
+ void *draw, /* Android Window/Surface */
short srcx,
short srcy,
unsigned short srcw,
diff --git a/va/va_backend.h b/va/va_backend.h
index f457cc4..00684da 100644
--- a/va/va_backend.h
+++ b/va/va_backend.h
@@ -185,11 +185,7 @@ struct VADriverVTable
VAStatus (*vaPutSurface) (
VADriverContextP ctx,
VASurfaceID surface,
-#ifdef ANDROID
Surface* draw, /* Drawable of window system */
-#else
- Drawable draw,
-#endif
short srcx,
short srcy,
unsigned short srcw,