summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--va/Android.mk32
-rw-r--r--va/android/va_android.c43
-rw-r--r--va/va.h2
-rw-r--r--va/va_backend.h4
4 files changed, 47 insertions, 34 deletions
diff --git a/va/Android.mk b/va/Android.mk
new file mode 100644
index 0000000..da0d705
--- /dev/null
+++ b/va/Android.mk
@@ -0,0 +1,32 @@
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+ android/va_android.c
+
+LOCAL_CFLAGS += -DHAVE_CONFIG_H \
+ -DIN_LIBVA \
+
+LOCAL_C_INCLUDES += \
+ $(TOPDIR)kernel/include \
+ $(TARGET_OUT_HEADERS)/libva \
+ $(TOPDIR)kernel/include/drm
+
+LOCAL_CC := g++
+
+LOCAL_COPY_HEADERS_TO := libva/va
+
+LOCAL_COPY_HEADERS := \
+ va.h \
+ va_backend.h \
+ va_version.h.in \
+ va_android.h
+
+LOCAL_MODULE := libva_android
+
+LOCAL_SHARED_LIBRARIES := libdl libdrm libcutils
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/va/android/va_android.c b/va/android/va_android.c
index 9b1fe0d..ec15d6a 100644
--- a/va/android/va_android.c
+++ b/va/android/va_android.c
@@ -23,10 +23,9 @@
*/
#define _GNU_SOURCE 1
-#include "config.h"
-#include "va.h"
-#include "va_backend.h"
-#include "va_android.h"
+#include "../va.h"
+#include "../va_backend.h"
+#include "../va_android.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
@@ -43,15 +42,7 @@ static int va_DisplayContextIsValid (
VADisplayContextP pDisplayContext
)
{
- VADisplayContextP ctx = pDisplayContexts;
-
- while (ctx)
- {
- if (ctx == pDisplayContext && pDisplayContext->pDriverContext)
- return 1;
- ctx = ctx->pNext;
- }
- return 0;
+ return 1;
}
static void va_DisplayContextDestroy (
@@ -71,7 +62,6 @@ static void va_DisplayContextDestroy (
}
ctx = &((*ctx)->pNext);
}
- free(pDisplayContext->pDriverContext->dri_state);
free(pDisplayContext->pDriverContext);
free(pDisplayContext);
}
@@ -81,31 +71,22 @@ static VAStatus va_DisplayContextGetDriverName (
VADisplayContextP pDisplayContext,
char **driver_name
)
-{
- VAStatus vaStatus VA_STATUS_SUCCESS;
+{
char *driver_name_env;
struct {
unsigned int verndor_id;
unsigned int device_id;
char driver_name[64];
} devices[] = {
- { 0x8086, 0x4100, "pvr" },
+ { 0x8086, 0x4100, "android" },
};
if (driver_name)
*driver_name = NULL;
- 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;
- }
-
*driver_name = strdup(devices[0].driver_name);
- return vaStatus;
+ return VA_STATUS_SUCCESS;
}
@@ -134,10 +115,9 @@ VADisplay vaGetDisplay (
{
/* create new entry */
VADriverContextP pDriverContext;
- struct dri_state *dri_state;
- pDisplayContext = calloc(1, sizeof(*pDisplayContext));
- pDriverContext = calloc(1, sizeof(*pDriverContext));
- if (pDisplayContext && pDriverContext && dri_state)
+ pDisplayContext = (VADisplayContextP)calloc(1, sizeof(*pDisplayContext));
+ pDriverContext = (VADriverContextP)calloc(1, sizeof(*pDriverContext));
+ if (pDisplayContext && pDriverContext)
{
pDisplayContext->vadpy_magic = VA_DISPLAY_MAGIC;
@@ -148,7 +128,6 @@ VADisplay vaGetDisplay (
pDisplayContext->vaDestroy = va_DisplayContextDestroy;
pDisplayContext->vaGetDriverName = va_DisplayContextGetDriverName;
pDisplayContexts = pDisplayContext;
- pDriverContext->dri_state = dri_state;
dpy = (VADisplay)pDisplayContext;
}
else
@@ -195,7 +174,7 @@ VAStatus vaPutSurface (
CHECK_DISPLAY(dpy);
ctx = CTX(dpy);
- return ctx->vtable.vaPutSurface( ctx, surface, draw, srcx, srcy, srcw, srch,
+ return ctx->vtable.vaPutSurface( ctx, surface, draw, srcx, srcy, srcw, srch,
destx, desty, destw, desth,
cliprects, number_cliprects, flags );
}
diff --git a/va/va.h b/va/va.h
index 76de2c7..394b810 100644
--- a/va/va.h
+++ b/va/va.h
@@ -67,7 +67,7 @@
#ifndef _VA_H_
#define _VA_H_
-#include <va/va_version.h>
+#include <va/va_version.h.in>
#ifdef __cplusplus
extern "C" {
diff --git a/va/va_backend.h b/va/va_backend.h
index 370c78d..cd6201e 100644
--- a/va/va_backend.h
+++ b/va/va_backend.h
@@ -32,7 +32,9 @@
#include <va/va.h>
#include <X11/Xlib.h>
#include <linux/videodev2.h>
+#include <ui/Surface.h>
+class Surface;
typedef struct VADriverContext *VADriverContextP;
typedef struct VADisplayContext *VADisplayContextP;
@@ -180,7 +182,7 @@ struct VADriverVTable
VAStatus (*vaPutSurface) (
VADriverContextP ctx,
VASurfaceID surface,
- Drawable draw, /* X Drawable */
+ Surface* draw, /* X Drawable */
short srcx,
short srcy,
unsigned short srcw,