hardware/intel/libva
修訂 | b88e0895f0c4657e2e24fcfd4aa0078c2cb222a4 (tree) |
---|---|
時間 | 2009-07-08 18:42:05 |
作者 | Gwenole Beauchesne <gbeauchesne@spli...> |
Commiter | Austin Yuan |
Fix driver name retrieval for dri1 and dri2.
Signed-off-by: Austin Yuan <shengquan.yuan@intel.com>
@@ -116,21 +116,8 @@ static Bool va_checkString(const char* value, char *variable) | ||
116 | 116 | static VAStatus va_getDriverName(VADisplay dpy, char **driver_name) |
117 | 117 | { |
118 | 118 | VADisplayContextP pDisplayContext = (VADisplayContextP)dpy; |
119 | - VADriverContextP ctx = CTX(dpy); | |
120 | 119 | |
121 | - VAStatus ret; | |
122 | - ret = pDisplayContext->vaGetDriverName(pDisplayContext, driver_name); | |
123 | - if (ret == VA_STATUS_SUCCESS) | |
124 | - { | |
125 | - if (isDRI2Connected(ctx, driver_name)) | |
126 | - { | |
127 | - ret = VA_STATUS_SUCCESS; | |
128 | - } else if (isDRI1Connected(ctx, driver_name)) | |
129 | - { | |
130 | - ret = VA_STATUS_SUCCESS; | |
131 | - } | |
132 | - } | |
133 | - return ret; | |
120 | + return pDisplayContext->vaGetDriverName(pDisplayContext, driver_name); | |
134 | 121 | } |
135 | 122 | |
136 | 123 | static VAStatus va_openDriver(VADisplay dpy, char *driver_name) |
@@ -414,7 +414,7 @@ struct VADriverContext | ||
414 | 414 | |
415 | 415 | Display *x11_dpy; |
416 | 416 | int x11_screen; |
417 | - int dri2; | |
417 | + int old_dri2; /* obsolete */ | |
418 | 418 | int version_major; |
419 | 419 | int version_minor; |
420 | 420 | int max_profiles; |
@@ -104,34 +104,10 @@ static VAStatus va_DRI2GetDriverName ( | ||
104 | 104 | ) |
105 | 105 | { |
106 | 106 | VADriverContextP ctx = pDisplayContext->pDriverContext; |
107 | - VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN; | |
108 | - int eventBase, errorBase; | |
109 | - char *device_name; | |
110 | - int driver_major; | |
111 | - int driver_minor; | |
112 | - int driver_patch; | |
113 | - Bool result = True; | |
114 | 107 | |
115 | - if (!VA_DRI2QueryExtension(ctx->x11_dpy, &eventBase, &errorBase)) { | |
116 | - va_infoMessage("DRI2 extension isn't present\n"); | |
108 | + if (!isDRI2Connected(ctx, driver_name)) | |
117 | 109 | return VA_STATUS_ERROR_UNKNOWN; |
118 | - } | |
119 | 110 | |
120 | - if (!VA_DRI2QueryVersion(ctx->x11_dpy, &driver_major, &driver_minor)) { | |
121 | - va_errorMessage("VA_DRI2QueryVersion failed\n"); | |
122 | - return VA_STATUS_ERROR_UNKNOWN; | |
123 | - } | |
124 | - | |
125 | - if (!VA_DRI2Connect(ctx->x11_dpy, RootWindow(ctx->x11_dpy, ctx->x11_screen), | |
126 | - driver_name, &device_name)) { | |
127 | - va_infoMessage("DRI2 isn't enabled, fallback to DRI1\n"); | |
128 | - return VA_STATUS_ERROR_UNKNOWN; | |
129 | - } | |
130 | - | |
131 | - va_infoMessage("VA_DRI2Connect: %d.%d.%d %s (screen %d)\n", | |
132 | - driver_major, driver_minor, driver_patch, *driver_name, ctx->x11_screen); | |
133 | - ctx->dri2 = 1; | |
134 | - | |
135 | 111 | return VA_STATUS_SUCCESS; |
136 | 112 | } |
137 | 113 |
@@ -141,57 +117,11 @@ static VAStatus va_DRIGetDriverName ( | ||
141 | 117 | ) |
142 | 118 | { |
143 | 119 | VADriverContextP ctx = pDisplayContext->pDriverContext; |
144 | - VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN; | |
145 | - int eventBase, errorBase; | |
146 | - int direct_capable; | |
147 | - int driver_major; | |
148 | - int driver_minor; | |
149 | - int driver_patch; | |
150 | - Bool result = True; | |
151 | - char *x_driver_name = NULL; | |
152 | 120 | |
153 | - if (!VA_DRIQueryExtension(ctx->x11_dpy, &eventBase, &errorBase)) { | |
154 | - va_errorMessage("VA_DRIQueryExtension failed\n"); | |
121 | + if (!isDRI1Connected(ctx, driver_name)) | |
155 | 122 | return VA_STATUS_ERROR_UNKNOWN; |
156 | - } | |
157 | - | |
158 | - if (result) | |
159 | - { | |
160 | - result = VA_DRIQueryDirectRenderingCapable(ctx->x11_dpy, ctx->x11_screen, &direct_capable); | |
161 | - if (!result) | |
162 | - { | |
163 | - va_errorMessage("VA_DRIQueryDirectRenderingCapable failed\n"); | |
164 | - } | |
165 | - } | |
166 | - if (result) | |
167 | - { | |
168 | - result = direct_capable; | |
169 | - if (!result) | |
170 | - { | |
171 | - va_errorMessage("VA_DRIQueryDirectRenderingCapable returned false\n"); | |
172 | - } | |
173 | - } | |
174 | - if (result) | |
175 | - { | |
176 | - result = VA_DRIGetClientDriverName(ctx->x11_dpy, ctx->x11_screen, &driver_major, &driver_minor, | |
177 | - &driver_patch, &x_driver_name); | |
178 | - if (!result) | |
179 | - { | |
180 | - va_errorMessage("VA_DRIGetClientDriverName returned false\n"); | |
181 | - } | |
182 | - } | |
183 | - if (result) | |
184 | - { | |
185 | - vaStatus = VA_STATUS_SUCCESS; | |
186 | - va_infoMessage("VA_DRIGetClientDriverName: %d.%d.%d %s (screen %d)\n", | |
187 | - driver_major, driver_minor, driver_patch, x_driver_name, ctx->x11_screen); | |
188 | - if (driver_name) | |
189 | - *driver_name = strdup(x_driver_name); | |
190 | - } | |
191 | - if (x_driver_name) | |
192 | - XFree(x_driver_name); | |
193 | 123 | |
194 | - return vaStatus; | |
124 | + return VA_STATUS_SUCCESS; | |
195 | 125 | } |
196 | 126 | |
197 | 127 | static VAStatus va_DisplayContextGetDriverName ( |
@@ -199,13 +129,7 @@ static VAStatus va_DisplayContextGetDriverName ( | ||
199 | 129 | char **driver_name |
200 | 130 | ) |
201 | 131 | { |
202 | - VADriverContextP ctx = pDisplayContext->pDriverContext; | |
203 | - VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN; | |
204 | - int direct_capable; | |
205 | - int driver_major; | |
206 | - int driver_minor; | |
207 | - int driver_patch; | |
208 | - Bool result = True; | |
132 | + VAStatus vaStatus; | |
209 | 133 | char *driver_name_env; |
210 | 134 | |
211 | 135 | if (driver_name) |