• 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

修订版997d59cf2092a29979c19a62fbe43d7f8d4dfa29 (tree)
时间2009-04-23 01:38:56
作者root <root@loca...>
Commiterroot

Log Message

Merge branch 'DRI2' of ssh://git@moblin-mdi.jf.intel.com/umg-moorestown-libva into DRI2

更改概述

差异

--- a/src/X11/va_x11.c
+++ b/src/X11/va_x11.c
@@ -89,13 +89,51 @@ static void va_DisplayContextDestroy (
8989 free(pDisplayContext);
9090 }
9191
92-static VAStatus va_DisplayContextGetDriverName (
92+
93+static VAStatus va_DRI2GetDriverName (
94+ VADisplayContextP pDisplayContext,
95+ char **driver_name
96+)
97+{
98+ VADriverContextP ctx = pDisplayContext->pDriverContext;
99+ VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
100+ char *driverName, *deviceName;
101+ int driver_major;
102+ int driver_minor;
103+ int driver_patch;
104+ Bool result = True;
105+
106+ if (!VA_DRI2QueryExtension(ctx->x11_dpy, &eventBase, &errorBase)) {
107+ va_infoMessage("DRI2 extension isn't present\n");
108+ return VA_STATUS_ERROR_UNKNOWN;
109+ }
110+
111+ if (!VA_DRI2QueryVersion(ctx->x11_dpy, &driver_major, &driver_minor)) {
112+ va_errorMessage("VA_DRI2QueryVersion failed\n");
113+ return VA_STATUS_ERROR_UNKNOWN;
114+ }
115+
116+ if (!VA_DRI2Connect(ctx->x11_dpy, RootWindow(ctx->x11_dpy, ctx->x11_screen),
117+ &driver_name, &device_name)) {
118+ va_infoMessage("DRI2 isn't enabled, fallback to DRI1\n");
119+ return VA_STATUS_ERROR_UNKNOWN;
120+ }
121+
122+ va_infoMessage("VA_DRI2Connect: %d.%d.%d %s (screen %d)\n",
123+ driver_major, driver_minor, driver_patch, *driver_name, ctx->x11_screen);
124+ ctx->dri2 = 1;
125+
126+ return VA_STATUS_SUCCESS;
127+}
128+
129+static VAStatus va_DRIGetDriverName (
93130 VADisplayContextP pDisplayContext,
94131 char **driver_name
95132 )
96133 {
97134 VADriverContextP ctx = pDisplayContext->pDriverContext;
98135 VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
136+ int eventBase, errorBase;
99137 int direct_capable;
100138 int driver_major;
101139 int driver_minor;
@@ -103,18 +141,11 @@ static VAStatus va_DisplayContextGetDriverName (
103141 Bool result = True;
104142 char *x_driver_name = NULL;
105143
106- if (driver_name)
107- *driver_name = NULL;
108- if (geteuid() == getuid())
109- {
110- /* don't allow setuid apps to use LIBVA_DRIVER_NAME */
111- if (getenv("LIBVA_DRIVER_NAME"))
112- {
113- /* For easier debugging */
114- *driver_name = strdup(getenv("LIBVA_DRIVER_NAME"));
115- return VA_STATUS_SUCCESS;
116- }
144+ if (!VA_DRIQueryExtension(ctx->x11_dpy, &eventBase, &errorBase)) {
145+ va_errorMessage("VA_DRIQueryExtension failed\n");
146+ return VA_STATUS_ERROR_UNKNOWN;
117147 }
148+
118149 if (result)
119150 {
120151 result = VA_DRIQueryDirectRenderingCapable(ctx->x11_dpy, ctx->x11_screen, &direct_capable);
@@ -154,6 +185,45 @@ static VAStatus va_DisplayContextGetDriverName (
154185 return vaStatus;
155186 }
156187
188+static VAStatus va_DisplayContextGetDriverName (
189+ VADisplayContextP pDisplayContext,
190+ char **driver_name
191+)
192+{
193+ VADriverContextP ctx = pDisplayContext->pDriverContext;
194+ VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
195+ int direct_capable;
196+ int driver_major;
197+ int driver_minor;
198+ int driver_patch;
199+ Bool result = True;
200+ char *x_driver_name = NULL;
201+
202+ if (driver_name)
203+ *driver_name = NULL;
204+
205+ vaStatus = va_DRI2GetDriverName(pDisplayContext, driver_name);
206+ if (vaStatus != VA_STATUS_SUCCESS)
207+ vaStatus = va_DRIGetDriverName(pDisplayContext, driver_name);
208+
209+ if ((vaStatus == VA_STATUS_SUCCESS)
210+ && geteuid() == getuid())
211+ {
212+ /* don't allow setuid apps to use LIBVA_DRIVER_NAME */
213+ if (getenv("LIBVA_DRIVER_NAME"))
214+ {
215+ /* For easier debugging */
216+ if (*driver_name)
217+ Xfree(*driver_name);
218+
219+ *driver_name = strdup(getenv("LIBVA_DRIVER_NAME"));
220+ return VA_STATUS_SUCCESS;
221+ }
222+ }
223+
224+ return vaStatus;
225+}
226+
157227 int vaDisplayIsValid(VADisplay dpy)
158228 {
159229 VADisplayContextP tmp=NULL;
--- a/src/va_backend.h
+++ b/src/va_backend.h
@@ -423,7 +423,7 @@ struct VADriverContext
423423
424424 Display *x11_dpy;
425425 int x11_screen;
426-
426+ int dri2;
427427 int version_major;
428428 int version_minor;
429429 int max_profiles;