• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

hardware/intel/libva


Commit MetaInfo

Revision0ea43daae2db5fbfcb4c412853d763f77328414b (tree)
Zeit2010-04-16 06:36:59
AutorAustin Yuan <shengquan.yuan@gmai...>
CommiterAustin Yuan

Log Message

save

Signed-off-by: Austin Yuan <shengquan.yuan@gmail.com>

Ändern Zusammenfassung

Diff

--- a/configure.ac
+++ b/configure.ac
@@ -119,6 +119,7 @@ AC_OUTPUT([
119119 va/Makefile
120120 va/va_version.h
121121 va/x11/Makefile
122+ va/android/Makefile
122123 dummy_drv_video/Makefile
123124 i965_drv_video/Makefile
124125 i965_drv_video/shaders/Makefile
--- a/va/Makefile.am
+++ b/va/Makefile.am
@@ -40,7 +40,7 @@ libva_x11_la_LIBADD = $(libvacorelib) x11/libva_x11.la $(LIBVA_LIBS) $(X11_LIBS
4040 libva_x11_la_LDFLAGS = $(LDADD)
4141 libva_x11_la_DEPENDENCIES = $(libvacorelib) x11/libva_x11.la
4242
43-SUBDIRS = x11
43+SUBDIRS = x11 android
4444
4545 libva_la_SOURCES = va.c va_trace.c
4646
--- a/va/android/va_android.c
+++ b/va/android/va_android.c
@@ -26,6 +26,7 @@
2626 #include "va.h"
2727 #include "va_backend.h"
2828 #include "va_android.h"
29+#include "va_dricommon.h"
2930 #include <stdio.h>
3031 #include <stdlib.h>
3132 #include <stdarg.h>
@@ -36,6 +37,7 @@
3637 #include <fcntl.h>
3738 #include <errno.h>
3839
40+
3941 static VADisplayContextP pDisplayContexts = NULL;
4042
4143 static int va_DisplayContextIsValid (
@@ -70,6 +72,7 @@ static void va_DisplayContextDestroy (
7072 }
7173 ctx = &((*ctx)->pNext);
7274 }
75+ free(pDisplayContext->pDriverContext->dri_state);
7376 free(pDisplayContext->pDriverContext);
7477 free(pDisplayContext);
7578 }
@@ -79,8 +82,11 @@ static VAStatus va_DisplayContextGetDriverName (
7982 VADisplayContextP pDisplayContext,
8083 char **driver_name
8184 )
82-{
85+{
86+ VADriverContextP ctx = pDisplayContext->pDriverContext;
87+ struct dri_state *dri_state = (struct dri_state *)ctx->dri_state;
8388 char *driver_name_env;
89+
8490 struct {
8591 unsigned int verndor_id;
8692 unsigned int device_id;
@@ -89,17 +95,29 @@ static VAStatus va_DisplayContextGetDriverName (
8995 { 0x8086, 0x4100, "pvr" },
9096 };
9197
92- if (driver_name)
93- *driver_name = NULL;
98+ memset(dri_state, 0, sizeof(*dri_state));
99+ dri_state->fd = drm_open_any_master();
100+ if (dri_state->fd < 0)
101+ return VA_STATUS_ERROR_UNKNOWN;
102+
103+ if ((driver_name_env = getenv("LIBVA_DRIVER_NAME")) != NULL
104+ && geteuid() == getuid())
105+ {
106+ /* don't allow setuid apps to use LIBVA_DRIVER_NAME */
107+ *driver_name = strdup(driver_name_env);
108+ return VA_STATUS_SUCCESS;
109+ } else /* TBD: other vendor driver names */
110+ *driver_name = strdup(devices[0].driver_name);
94111
95- *driver_name = strdup(devices[0].driver_name);
112+
113+ dri_state->driConnectedFlag = VA_DRI2;
96114
97115 return VA_STATUS_SUCCESS;
98116 }
99117
100118
101119 VADisplay vaGetDisplay (
102- Display *native_dpy /* implementation specific */
120+ void *native_dpy /* implementation specific */
103121 )
104122 {
105123 VADisplay dpy = NULL;
@@ -123,9 +141,12 @@ VADisplay vaGetDisplay (
123141 {
124142 /* create new entry */
125143 VADriverContextP pDriverContext;
144+ struct dri_state *dri_state;
126145 pDisplayContext = (VADisplayContextP)calloc(1, sizeof(*pDisplayContext));
127146 pDriverContext = (VADriverContextP)calloc(1, sizeof(*pDriverContext));
128- if (pDisplayContext && pDriverContext)
147+ dri_state = calloc(1, sizeof(*dri_state));
148+
149+ if (pDisplayContext && pDriverContext && dri_state)
129150 {
130151 pDisplayContext->vadpy_magic = VA_DISPLAY_MAGIC;
131152
@@ -136,6 +157,7 @@ VADisplay vaGetDisplay (
136157 pDisplayContext->vaDestroy = va_DisplayContextDestroy;
137158 pDisplayContext->vaGetDriverName = va_DisplayContextGetDriverName;
138159 pDisplayContexts = pDisplayContext;
160+ pDriverContext->dri_state = dri_state;
139161 dpy = (VADisplay)pDisplayContext;
140162 }
141163 else
@@ -144,6 +166,8 @@ VADisplay vaGetDisplay (
144166 free(pDisplayContext);
145167 if (pDriverContext)
146168 free(pDriverContext);
169+ if (dri_state)
170+ free(dri_state);
147171 }
148172 }
149173
@@ -160,6 +184,7 @@ static int vaDisplayIsValid(VADisplay dpy)
160184 return pDisplayContext && (pDisplayContext->vadpy_magic == VA_DISPLAY_MAGIC) && pDisplayContext->vaIsValid(pDisplayContext);
161185 }
162186
187+#ifdef ANDROID
163188 VAStatus vaPutSurface (
164189 VADisplay dpy,
165190 VASurfaceID surface,
@@ -214,3 +239,4 @@ VAStatus vaPutSurfaceBuf (
214239 return ctx->vtable.vaPutSurfaceBuf( ctx, surface, draw, data, data_len, srcx, srcy, srcw, srch,
215240 destx, desty, destw, desth, cliprects, number_cliprects, flags );
216241 }
242+#endif
--- a/va/va_android.h
+++ b/va/va_android.h
@@ -2,13 +2,13 @@
22 #define _VA_ANDROID_H_
33
44 #include <va/va.h>
5-#include <ui/Surface.h>
6-class Surface;
5+
76
87 #ifdef __cplusplus
98 extern "C" {
109 #endif
1110
11+
1212 /*
1313 * Returns a suitable VADisplay for VA API
1414 */
@@ -16,6 +16,11 @@ VADisplay vaGetDisplay (
1616 void *dpy
1717 );
1818
19+#ifdef ANDROID
20+
21+#include <ui/Surface.h>
22+class Surface;
23+
1924 /*
2025 * Output rendering
2126 * Following is the rendering interface for X windows,
@@ -42,23 +47,26 @@ VAStatus vaPutSurface (
4247 );
4348
4449 VAStatus vaPutSurfaceBuf (
45- VADriverContextP ctx,
46- VASurfaceID surface,
47- Drawable draw, /* X Drawable */
48- unsigned char* data,
49- int* data_len,
50- short srcx,
51- short srcy,
52- unsigned short srcw,
53- unsigned short srch,
54- short destx,
55- short desty,
56- unsigned short destw,
57- unsigned short desth,
58- VARectangle *cliprects, /* client supplied clip list */
59- unsigned int number_cliprects, /* number of clip rects in the clip list */
60- unsigned int flags /* de-interlacing flags */
61- );
50+ VADriverContextP ctx,
51+ VASurfaceID surface,
52+ Drawable draw, /* X Drawable */
53+ unsigned char* data,
54+ int* data_len,
55+ short srcx,
56+ short srcy,
57+ unsigned short srcw,
58+ unsigned short srch,
59+ short destx,
60+ short desty,
61+ unsigned short destw,
62+ unsigned short desth,
63+ VARectangle *cliprects, /* client supplied clip list */
64+ unsigned int number_cliprects, /* number of clip rects in the clip list */
65+ unsigned int flags /* de-interlacing flags */
66+);
67+
68+#endif
69+
6270 #ifdef __cplusplus
6371 }
6472 #endif