• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

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

hardware/intel/libva


コミットメタ情報

リビジョン943686a94957337b6a6fadcc316d6dee0e0f56d4 (tree)
日時2010-06-04 15:29:01
作者Austin Yuan <shengquan.yuan@gmai...>
コミッターAustin Yuan

ログメッセージ

Follow up the change of "LIBVA_DRIVER_NAME", remove it from va_android.cpp

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

変更サマリ

差分

--- a/va/android/va_android.cpp
+++ b/va/android/va_android.cpp
@@ -47,45 +47,39 @@
4747
4848 static VADisplayContextP pDisplayContexts = NULL;
4949
50-static int vaDisplayIsValid (VADisplay dpy)
51-{
52- VADisplayContextP pDisplayContext = (VADisplayContextP)dpy;
53- return pDisplayContext && (pDisplayContext->vadpy_magic == VA_DISPLAY_MAGIC) && pDisplayContext->vaIsValid(pDisplayContext);
54-}
55-
5650 static int open_device (char *dev_name)
5751 {
58- struct stat st;
59- int fd;
52+ struct stat st;
53+ int fd;
6054
61- if (-1 == stat (dev_name, &st))
55+ if (-1 == stat (dev_name, &st))
6256 {
63- printf ("Cannot identify '%s': %d, %s\n",
64- dev_name, errno, strerror (errno));
65- return -1;
57+ printf ("Cannot identify '%s': %d, %s\n",
58+ dev_name, errno, strerror (errno));
59+ return -1;
6660 }
6761
68- if (!S_ISCHR (st.st_mode))
62+ if (!S_ISCHR (st.st_mode))
6963 {
70- printf ("%s is no device\n", dev_name);
71- return -1;
64+ printf ("%s is no device\n", dev_name);
65+ return -1;
7266 }
7367
74- fd = open (dev_name, O_RDWR);
68+ fd = open (dev_name, O_RDWR);
7569
76- if (-1 == fd)
70+ if (-1 == fd)
7771 {
78- fprintf (stderr, "Cannot open '%s': %d, %s\n",
79- dev_name, errno, strerror (errno));
80- return -1;
72+ fprintf (stderr, "Cannot open '%s': %d, %s\n",
73+ dev_name, errno, strerror (errno));
74+ return -1;
8175 }
8276
83- return fd;
77+ return fd;
8478 }
8579
8680 static int va_DisplayContextIsValid (
8781 VADisplayContextP pDisplayContext
88-)
82+ )
8983 {
9084 VADisplayContextP ctx = pDisplayContexts;
9185
@@ -149,17 +143,11 @@ static VAStatus va_DisplayContextGetDriverName (
149143 return VA_STATUS_ERROR_UNKNOWN;
150144 }
151145
152- if ((driver_name_env = getenv("LIBVA_DRIVER_NAME")) != NULL
153- && geteuid() == getuid()) {
154- /* don't allow setuid apps to use LIBVA_DRIVER_NAME */
155- *driver_name = strdup(driver_name_env);
156- return VA_STATUS_SUCCESS;
157- } else { /* TBD: other vendor driver names */
158- vendor_id = devices[0].vendor_id;
159- device_id = devices[0].device_id;
160- *driver_name = strdup(devices[0].driver_name);
161- }
162-
146+ /* TBD: other vendor driver names */
147+ vendor_id = devices[0].vendor_id;
148+ device_id = devices[0].device_id;
149+ *driver_name = strdup(devices[0].driver_name);
150+
163151 dri_state->driConnectedFlag = VA_DUMMY;
164152
165153 return VA_STATUS_SUCCESS;
@@ -174,6 +162,7 @@ static VAStatus va_DisplayContextGetDriverName (
174162 struct dri_state *dri_state = (struct dri_state *)ctx->dri_state;
175163 char *driver_name_env;
176164 int vendor_id, device_id;
165+ int i = 0;
177166
178167 struct {
179168 int vendor_id;
@@ -193,31 +182,24 @@ static VAStatus va_DisplayContextGetDriverName (
193182 return VA_STATUS_ERROR_UNKNOWN;
194183 }
195184
196- if ((driver_name_env = getenv("LIBVA_DRIVER_NAME")) != NULL
197- && geteuid() == getuid()) {
198- /* don't allow setuid apps to use LIBVA_DRIVER_NAME */
199- *driver_name = strdup(driver_name_env);
200- return VA_STATUS_SUCCESS;
201- } else { /* TBD: other vendor driver names */
202- int i = 0;
203-
204- while (devices[i].device_id != 0) {
205- if ((devices[i].vendor_id == vendor_id) &&
206- (devices[i].device_id == device_id))
207- break;
208- i++;
209- }
185+ /* TBD: other vendor driver names */
210186
211- if (devices[i].device_id != 0)
212- *driver_name = strdup(devices[i].driver_name);
213- else {
214- fprintf(stderr,"device (0x%04x:0x%04x) is not supported\n",
215- vendor_id, device_id);
216-
217- return VA_STATUS_ERROR_UNKNOWN;
218- }
187+ while (devices[i].device_id != 0) {
188+ if ((devices[i].vendor_id == vendor_id) &&
189+ (devices[i].device_id == device_id))
190+ break;
191+ i++;
219192 }
220193
194+ if (devices[i].device_id != 0)
195+ *driver_name = strdup(devices[i].driver_name);
196+ else {
197+ fprintf(stderr,"device (0x%04x:0x%04x) is not supported\n",
198+ vendor_id, device_id);
199+
200+ return VA_STATUS_ERROR_UNKNOWN;
201+ }
202+
221203 printf("DRM device is opened, loading driver %s for device 0x%04x:0x%04x\n",
222204 driver_name, vendor_id, device_id);
223205
@@ -231,58 +213,58 @@ VADisplay vaGetDisplay (
231213 void *native_dpy /* implementation specific */
232214 )
233215 {
234- VADisplay dpy = NULL;
235- VADisplayContextP pDisplayContext = pDisplayContexts;
236-
237- if (!native_dpy)
238- return NULL;
216+ VADisplay dpy = NULL;
217+ VADisplayContextP pDisplayContext = pDisplayContexts;
239218
240- while (pDisplayContext)
241- {
242- if (pDisplayContext->pDriverContext &&
243- pDisplayContext->pDriverContext->native_dpy == (void *)native_dpy)
244- {
245- dpy = (VADisplay)pDisplayContext;
246- break;
247- }
248- pDisplayContext = pDisplayContext->pNext;
249- }
219+ if (!native_dpy)
220+ return NULL;
250221
222+ while (pDisplayContext)
223+ {
224+ if (pDisplayContext->pDriverContext &&
225+ pDisplayContext->pDriverContext->native_dpy == (void *)native_dpy)
226+ {
227+ dpy = (VADisplay)pDisplayContext;
228+ break;
229+ }
230+ pDisplayContext = pDisplayContext->pNext;
231+ }
251232
252- if (!dpy)
253- {
254- /* create new entry */
255- VADriverContextP pDriverContext;
256- struct dri_state *dri_state;
257- pDisplayContext = (VADisplayContextP)calloc(1, sizeof(*pDisplayContext));
258- pDriverContext = (VADriverContextP)calloc(1, sizeof(*pDriverContext));
259- dri_state = (struct dri_state*)calloc(1, sizeof(*dri_state));
260- if (pDisplayContext && pDriverContext && dri_state)
261- {
262- pDisplayContext->vadpy_magic = VA_DISPLAY_MAGIC;
263233
264- pDriverContext->native_dpy = (void *)native_dpy;
265- pDisplayContext->pNext = pDisplayContexts;
266- pDisplayContext->pDriverContext = pDriverContext;
267- pDisplayContext->vaIsValid = va_DisplayContextIsValid;
268- pDisplayContext->vaDestroy = va_DisplayContextDestroy;
269- pDisplayContext->vaGetDriverName = va_DisplayContextGetDriverName;
270- pDisplayContexts = pDisplayContext;
271- pDriverContext->dri_state = dri_state;
272- dpy = (VADisplay)pDisplayContext;
273- }
274- else
275- {
276- if (pDisplayContext)
277- free(pDisplayContext);
278- if (pDriverContext)
279- free(pDriverContext);
280- if (dri_state)
281- free(dri_state);
282- }
283- }
234+ if (!dpy)
235+ {
236+ /* create new entry */
237+ VADriverContextP pDriverContext;
238+ struct dri_state *dri_state;
239+ pDisplayContext = (VADisplayContextP)calloc(1, sizeof(*pDisplayContext));
240+ pDriverContext = (VADriverContextP)calloc(1, sizeof(*pDriverContext));
241+ dri_state = (struct dri_state*)calloc(1, sizeof(*dri_state));
242+ if (pDisplayContext && pDriverContext && dri_state)
243+ {
244+ pDisplayContext->vadpy_magic = VA_DISPLAY_MAGIC;
245+
246+ pDriverContext->native_dpy = (void *)native_dpy;
247+ pDisplayContext->pNext = pDisplayContexts;
248+ pDisplayContext->pDriverContext = pDriverContext;
249+ pDisplayContext->vaIsValid = va_DisplayContextIsValid;
250+ pDisplayContext->vaDestroy = va_DisplayContextDestroy;
251+ pDisplayContext->vaGetDriverName = va_DisplayContextGetDriverName;
252+ pDisplayContexts = pDisplayContext;
253+ pDriverContext->dri_state = dri_state;
254+ dpy = (VADisplay)pDisplayContext;
255+ }
256+ else
257+ {
258+ if (pDisplayContext)
259+ free(pDisplayContext);
260+ if (pDriverContext)
261+ free(pDriverContext);
262+ if (dri_state)
263+ free(dri_state);
264+ }
265+ }
284266
285- return dpy;
267+ return dpy;
286268 }
287269
288270 #define CTX(dpy) (((VADisplayContextP)dpy)->pDriverContext)
@@ -307,12 +289,12 @@ VAStatus vaPutSurface (
307289 unsigned int flags /* de-interlacing flags */
308290 )
309291 {
310- VADriverContextP ctx;
292+ VADriverContextP ctx;
311293
312- CHECK_DISPLAY(dpy);
313- ctx = CTX(dpy);
314- return ctx->vtable.vaPutSurface( ctx, surface, static_cast<void*>(&draw), srcx, srcy, srcw, srch,
315- destx, desty, destw, desth,
316- cliprects, number_cliprects, flags );
294+ CHECK_DISPLAY(dpy);
295+ ctx = CTX(dpy);
296+ return ctx->vtable.vaPutSurface( ctx, surface, static_cast<void*>(&draw), srcx, srcy, srcw, srch,
297+ destx, desty, destw, desth,
298+ cliprects, number_cliprects, flags );
317299 }
318300 #endif
--- a/va/glx/va_glx.c
+++ b/va/glx/va_glx.c
@@ -47,8 +47,6 @@
4747 status = vtable->va##func##GLX args; \
4848 } while (0)
4949
50-// Check VADisplay is valid (from libva.so.*)
51-int vaDisplayIsValid(VADisplay dpy);
5250
5351 // Destroy VA/GLX display context
5452 static void va_DisplayContextDestroy(VADisplayContextP pDisplayContext)
--- a/va/va.h
+++ b/va/va.h
@@ -159,6 +159,8 @@ const char *vaErrorStr(VAStatus error_status);
159159 */
160160 typedef void* NativeDisplay; /* window system dependent */
161161
162+int vaDisplayIsValid(VADisplay dpy);
163+
162164 /*
163165 * Initialize the library
164166 */