• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No 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

修订版5bc5efa30ce3a53b69c2560ab50e1a3d9367fdac (tree)
时间2010-05-05 17:19:39
作者Ren Zhaohan <zhaohan.ren@inte...>
CommiterRen Zhaohan

Log Message

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

更改概述

差异

--- a/va/Android.mk
+++ b/va/Android.mk
@@ -17,6 +17,7 @@ LOCAL_CFLAGS += -DHAVE_CONFIG_H \
1717 LOCAL_C_INCLUDES += \
1818 $(TOPDIR)kernel/include \
1919 $(TARGET_OUT_HEADERS)/libva \
20+ $(LOCAL_PATH)/x11 \
2021 $(TOPDIR)kernel/include/drm
2122
2223 LOCAL_COPY_HEADERS_TO := libva/va
--- a/va/android/va_android.c
+++ b/va/android/va_android.c
@@ -26,7 +26,7 @@
2626 #include "va.h"
2727 #include "va_backend.h"
2828 #include "va_android.h"
29-#include "x11/va_dricommon.h" /* needs some helper functions from this file */
29+#include "va_dricommon.h" /* needs some helper functions from this file */
3030 #include <stdio.h>
3131 #include <stdlib.h>
3232 #include <stdarg.h>
@@ -37,6 +37,10 @@
3737 #include <fcntl.h>
3838 #include <dlfcn.h>
3939 #include <errno.h>
40+#ifndef ANDROID
41+#include <libudev.h>
42+#include "drm_test.h"
43+#endif
4044
4145 #define CHECK_SYMBOL(func) { if (!func) printf("func %s not found\n", #func); return VA_STATUS_ERROR_UNKNOWN; }
4246 #define DEVICE_NAME "/dev/dri/card0"
@@ -110,7 +114,7 @@ static void va_DisplayContextDestroy (
110114 free(pDisplayContext);
111115 }
112116
113-
117+#ifdef ANDROID
114118 static VAStatus va_DisplayContextGetDriverName (
115119 VADisplayContextP pDisplayContext,
116120 char **driver_name
@@ -154,7 +158,51 @@ static VAStatus va_DisplayContextGetDriverName (
154158
155159 return VA_STATUS_SUCCESS;
156160 }
161+#else
162+static VAStatus va_DisplayContextGetDriverName (
163+ VADisplayContextP pDisplayContext,
164+ char **driver_name
165+)
166+{
167+ VADriverContextP ctx = pDisplayContext->pDriverContext;
168+ struct dri_state *dri_state = (struct dri_state *)ctx->dri_state;
169+ char *driver_name_env;
170+
171+ struct {
172+ unsigned int vendor_id;
173+ unsigned int device_id;
174+ char driver_name[64];
175+ } devices[] = {
176+ { 0x8086, 0x4100, "pvr" },
177+ };
157178
179+ memset(dri_state, 0, sizeof(*dri_state));
180+ dri_state->fd = drm_open_any_master();
181+ if (dri_state->fd < 0) {
182+ fprintf(stderr, "open DRM device by udev failed, try /dev/dri/card0\n");
183+ dri_state->fd = open("/dev/dri/card0", O_RDWR);
184+ }
185+
186+ if (dri_state->fd < 0) {
187+ fprintf(stderr,"can't open DRM devices\n");
188+ return VA_STATUS_ERROR_UNKNOWN;
189+ }
190+
191+ if ((driver_name_env = getenv("LIBVA_DRIVER_NAME")) != NULL
192+ && geteuid() == getuid())
193+ {
194+ /* don't allow setuid apps to use LIBVA_DRIVER_NAME */
195+ *driver_name = strdup(driver_name_env);
196+ return VA_STATUS_SUCCESS;
197+ } else /* TBD: other vendor driver names */
198+ *driver_name = strdup(devices[0].driver_name);
199+
200+
201+ dri_state->driConnectedFlag = VA_DUMMY;
202+
203+ return VA_STATUS_SUCCESS;
204+}
205+#endif
158206
159207 VADisplay vaGetDisplay (
160208 void *native_dpy /* implementation specific */
@@ -245,7 +293,6 @@ VAStatus vaPutSurface (
245293
246294 CHECK_DISPLAY(dpy);
247295 ctx = CTX(dpy);
248-
249296 return ctx->vtable.vaPutSurface( ctx, surface, (void *)draw, srcx, srcy, srcw, srch,
250297 destx, desty, destw, desth,
251298 cliprects, number_cliprects, flags );
--- a/va/va_android.h
+++ b/va/va_android.h
@@ -5,7 +5,6 @@
55 #ifdef __cplusplus
66 extern "C" {
77 #endif
8-
98 /*
109 * Returns a suitable VADisplay for VA API
1110 */
@@ -16,7 +15,7 @@ VADisplay vaGetDisplay (
1615 #if ANDROID
1716 //#include <ui/Surface.h>
1817 //class Surface;
19-
18+
2019 /*
2120 * Output rendering
2221 * Following is the rendering interface for X windows,
--- a/va/va_backend.h
+++ b/va/va_backend.h
@@ -185,7 +185,11 @@ struct VADriverVTable
185185 VAStatus (*vaPutSurface) (
186186 VADriverContextP ctx,
187187 VASurfaceID surface,
188- void * draw, /* Drawable of window system */
188+#ifdef ANDROID
189+ Surface* draw, /* Drawable of window system */
190+#else
191+ Drawable draw,
192+#endif
189193 short srcx,
190194 short srcy,
191195 unsigned short srcw,
@@ -199,25 +203,6 @@ struct VADriverVTable
199203 unsigned int flags /* de-interlacing flags */
200204 );
201205
202- VAStatus (*vaPutSurfaceBuf) (
203- VADriverContextP ctx,
204- VASurfaceID surface,
205- Drawable draw, /* X Drawable */
206- unsigned char* data,
207- int* data_len,
208- short srcx,
209- short srcy,
210- unsigned short srcw,
211- unsigned short srch,
212- short destx,
213- short desty,
214- unsigned short destw,
215- unsigned short desth,
216- VARectangle *cliprects, /* client supplied clip list */
217- unsigned int number_cliprects, /* number of clip rects in the clip list */
218- unsigned int flags /* de-interlacing flags */
219- );
220-
221206 VAStatus (*vaQueryImageFormats) (
222207 VADriverContextP ctx,
223208 VAImageFormat *format_list, /* out */