diff options
author | Nitin A Kamble <nitin.a.kamble@intel.com> | 2012-09-18 12:16:07 -0700 |
---|---|---|
committer | Tom Zanussi <tom.zanussi@intel.com> | 2012-12-03 14:20:44 -0600 |
commit | 6eed0090597bfe82603be5ffa9c9f1fd141306f0 (patch) | |
tree | e4e16247f8ae3b3ad3a1426f59af2dcf5668e533 /meta-emenlow/recipes-graphics/libva/libva-0.31.0/203_fix_fglrx_detection.patch | |
parent | b4141a6404fa7d3445d660860b6bf68acec9f114 (diff) | |
download | meta-intel-6eed0090597bfe82603be5ffa9c9f1fd141306f0.tar.gz |
emenlow: use emgd instead of psb for graphics driver
Remove all the Poulsbo graphics driver specific meta data files.
And configure the BSP to use EMGD instead of psb for graphics stack.
Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
Diffstat (limited to 'meta-emenlow/recipes-graphics/libva/libva-0.31.0/203_fix_fglrx_detection.patch')
-rw-r--r-- | meta-emenlow/recipes-graphics/libva/libva-0.31.0/203_fix_fglrx_detection.patch | 542 |
1 files changed, 0 insertions, 542 deletions
diff --git a/meta-emenlow/recipes-graphics/libva/libva-0.31.0/203_fix_fglrx_detection.patch b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/203_fix_fglrx_detection.patch deleted file mode 100644 index ce7f1065..00000000 --- a/meta-emenlow/recipes-graphics/libva/libva-0.31.0/203_fix_fglrx_detection.patch +++ /dev/null | |||
@@ -1,542 +0,0 @@ | |||
1 | commit fb6ccda5984eda96bcb394b23255143dcbc21f18 | ||
2 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
3 | Date: Thu Sep 10 12:22:17 2009 +0000 | ||
4 | |||
5 | Don't link against libdrm to workaround XvBA / fglrx >= 8.66-RC1 bugs. | ||
6 | |||
7 | commit ab3c0f65182462b54729d2d82d4d645c8be5b2d1 | ||
8 | Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | ||
9 | Date: Wed Sep 9 13:24:46 2009 +0000 | ||
10 | |||
11 | Fix DRM device opening with fglrx >= 8.66-RC1. | ||
12 | |||
13 | diff --git a/src/x11/Makefile.am b/src/x11/Makefile.am | ||
14 | index c70380d..b6916f2 100644 | ||
15 | --- a/src/x11/Makefile.am | ||
16 | +++ b/src/x11/Makefile.am | ||
17 | @@ -25,6 +25,6 @@ noinst_LTLIBRARIES = libva_x11.la | ||
18 | libva_x11includedir = ${includedir}/va | ||
19 | libva_x11include_HEADERS = va_x11.h va_dri.h va_dri2.h va_dricommon.h | ||
20 | |||
21 | -libva_x11_la_SOURCES = va_x11.c va_dri.c va_dri2.c va_dricommon.c dri2_util.c dri1_util.c va_nvctrl.c | ||
22 | +libva_x11_la_SOURCES = va_x11.c va_dri.c va_dri2.c va_dricommon.c dri2_util.c dri1_util.c va_nvctrl.c libdrm_glue.c | ||
23 | |||
24 | -EXTRA_DIST = va_dristr.h va_dri2str.h va_dri2tokens.h va_nvctrl.h | ||
25 | +EXTRA_DIST = va_dristr.h va_dri2str.h va_dri2tokens.h va_nvctrl.h libdrm_glue.h | ||
26 | diff --git a/src/x11/dri1_util.c b/src/x11/dri1_util.c | ||
27 | index b3db5b4..3bd490f 100644 | ||
28 | --- a/src/x11/dri1_util.c | ||
29 | +++ b/src/x11/dri1_util.c | ||
30 | @@ -1,10 +1,12 @@ | ||
31 | +#include "config.h" | ||
32 | +#include <stdio.h> | ||
33 | #include <stdlib.h> | ||
34 | #include <fcntl.h> | ||
35 | #include <unistd.h> | ||
36 | #include <sys/mman.h> | ||
37 | #include <assert.h> | ||
38 | |||
39 | -#include <xf86drm.h> | ||
40 | +#include "libdrm_glue.h" | ||
41 | |||
42 | #include "X11/Xlib.h" | ||
43 | #include "va.h" | ||
44 | @@ -21,6 +23,75 @@ struct dri1_drawable | ||
45 | int height; | ||
46 | }; | ||
47 | |||
48 | +static int | ||
49 | +firegl_drmOpenMinor(int minor) | ||
50 | +{ | ||
51 | + char buf[64]; | ||
52 | + int fd; | ||
53 | + | ||
54 | + sprintf(buf, "/dev/ati/card%d", minor); | ||
55 | + if ((fd = open(buf, O_RDWR, 0)) >= 0) | ||
56 | + return fd; | ||
57 | + return -1; | ||
58 | +} | ||
59 | + | ||
60 | +static int | ||
61 | +firegl_drmOpenByBusID(const char *busid) | ||
62 | +{ | ||
63 | + int i, fd; | ||
64 | + drmSetVersion sv; | ||
65 | + const char *buf; | ||
66 | + | ||
67 | + for (i = 0; i < DRM_MAX_MINOR; i++) { | ||
68 | + if ((fd = firegl_drmOpenMinor(i)) < 0) | ||
69 | + continue; | ||
70 | + sv.drm_di_major = 1; | ||
71 | + sv.drm_di_minor = 1; | ||
72 | + sv.drm_dd_major = -1; | ||
73 | + sv.drm_dd_minor = -1; | ||
74 | + libdrm_drmSetInterfaceVersion(fd, &sv); | ||
75 | + buf = libdrm_drmGetBusid(fd); | ||
76 | + if (buf && strcasecmp(buf, busid) == 0) { /* XXX: drmMatchBusID() */ | ||
77 | + libdrm_drmFreeBusid(buf); | ||
78 | + return fd; | ||
79 | + } | ||
80 | + if (buf) | ||
81 | + libdrm_drmFreeBusid(buf); | ||
82 | + close(fd); | ||
83 | + } | ||
84 | + return -1; | ||
85 | +} | ||
86 | + | ||
87 | +static int | ||
88 | +drm_open_once(struct dri_state *dri_state, const char *BusID, int *newlyopened) | ||
89 | +{ | ||
90 | + dri_state->driConnectedFlag = VA_NONE; | ||
91 | + dri_state->fd = libdrm_drmOpenOnce(NULL, BusID, newlyopened); | ||
92 | + if (dri_state->fd < 0) { | ||
93 | + dri_state->fd = firegl_drmOpenByBusID(BusID); | ||
94 | + if (dri_state->fd >= 0) { | ||
95 | + *newlyopened = 1; | ||
96 | + dri_state->driConnectedFlag |= VA_DRI_AMD; | ||
97 | + } | ||
98 | + } | ||
99 | + return dri_state->fd; | ||
100 | +} | ||
101 | + | ||
102 | +static void | ||
103 | +drm_close_once(struct dri_state *dri_state) | ||
104 | +{ | ||
105 | + /* XXX: dri_state->close() doesn't seem to be called, thus this | ||
106 | + function is never called either */ | ||
107 | + if (dri_state->fd < 0) | ||
108 | + return; | ||
109 | + if (dri_state->driConnectedFlag & VA_DRI_AMD) | ||
110 | + close(dri_state->fd); | ||
111 | + else | ||
112 | + libdrm_drmCloseOnce(dri_state->fd); | ||
113 | + dri_state->fd = -1; | ||
114 | + dri_state->driConnectedFlag = VA_NONE; | ||
115 | +} | ||
116 | + | ||
117 | static struct dri_drawable * | ||
118 | dri1CreateDrawable(VADriverContextP ctx, XID x_drawable) | ||
119 | { | ||
120 | @@ -64,9 +135,9 @@ dri1Close(VADriverContextP ctx) | ||
121 | free_drawable_hashtable(ctx); | ||
122 | VA_DRIDestroyContext(ctx->x11_dpy, ctx->x11_screen, dri_state->hwContextID); | ||
123 | assert(dri_state->pSAREA != MAP_FAILED); | ||
124 | - drmUnmap(dri_state->pSAREA, SAREA_MAX); | ||
125 | + libdrm_drmUnmap(dri_state->pSAREA, SAREA_MAX); | ||
126 | assert(dri_state->fd >= 0); | ||
127 | - drmCloseOnce(dri_state->fd); | ||
128 | + drm_close_once(dri_state); | ||
129 | VA_DRICloseConnection(ctx->x11_dpy, ctx->x11_screen); | ||
130 | } | ||
131 | |||
132 | @@ -104,21 +175,20 @@ isDRI1Connected(VADriverContextP ctx, char **driver_name) | ||
133 | &dri_state->hSAREA, &BusID)) | ||
134 | goto err_out0; | ||
135 | |||
136 | - | ||
137 | - dri_state->fd = drmOpenOnce(NULL, BusID, &newlyopened); | ||
138 | + drm_open_once(dri_state, BusID, &newlyopened); | ||
139 | XFree(BusID); | ||
140 | |||
141 | if (dri_state->fd < 0) | ||
142 | goto err_out1; | ||
143 | |||
144 | |||
145 | - if (drmGetMagic(dri_state->fd, &magic)) | ||
146 | + if (libdrm_drmGetMagic(dri_state->fd, &magic)) | ||
147 | goto err_out1; | ||
148 | |||
149 | if (newlyopened && !VA_DRIAuthConnection(ctx->x11_dpy, ctx->x11_screen, magic)) | ||
150 | goto err_out1; | ||
151 | |||
152 | - if (drmMap(dri_state->fd, dri_state->hSAREA, SAREA_MAX, &dri_state->pSAREA)) | ||
153 | + if (libdrm_drmMap(dri_state->fd, dri_state->hSAREA, SAREA_MAX, &dri_state->pSAREA)) | ||
154 | goto err_out1; | ||
155 | |||
156 | if (!VA_DRICreateContext(ctx->x11_dpy, ctx->x11_screen, | ||
157 | @@ -127,7 +196,8 @@ isDRI1Connected(VADriverContextP ctx, char **driver_name) | ||
158 | &dri_state->hwContextID, &dri_state->hwContext)) | ||
159 | goto err_out1; | ||
160 | |||
161 | - dri_state->driConnectedFlag = VA_DRI1; | ||
162 | + dri_state->driConnectedFlag &= VA_DRI_AMD; /* clear flags but AMD bit */ | ||
163 | + dri_state->driConnectedFlag |= VA_DRI1; | ||
164 | dri_state->createDrawable = dri1CreateDrawable; | ||
165 | dri_state->destroyDrawable = dri1DestroyDrawable; | ||
166 | dri_state->swapBuffer = dri1SwapBuffer; | ||
167 | @@ -138,10 +208,10 @@ isDRI1Connected(VADriverContextP ctx, char **driver_name) | ||
168 | |||
169 | err_out1: | ||
170 | if (dri_state->pSAREA != MAP_FAILED) | ||
171 | - drmUnmap(dri_state->pSAREA, SAREA_MAX); | ||
172 | + libdrm_drmUnmap(dri_state->pSAREA, SAREA_MAX); | ||
173 | |||
174 | if (dri_state->fd >= 0) | ||
175 | - drmCloseOnce(dri_state->fd); | ||
176 | + drm_close_once(dri_state); | ||
177 | |||
178 | VA_DRICloseConnection(ctx->x11_dpy, ctx->x11_screen); | ||
179 | |||
180 | diff --git a/src/x11/dri2_util.c b/src/x11/dri2_util.c | ||
181 | index ebe7a2c..b727e97 100644 | ||
182 | --- a/src/x11/dri2_util.c | ||
183 | +++ b/src/x11/dri2_util.c | ||
184 | @@ -3,7 +3,7 @@ | ||
185 | #include <unistd.h> | ||
186 | #include <assert.h> | ||
187 | |||
188 | -#include <xf86drm.h> | ||
189 | +#include "libdrm_glue.h" | ||
190 | |||
191 | #include <X11/Xlibint.h> | ||
192 | #include <X11/Xlib.h> | ||
193 | @@ -166,7 +166,7 @@ isDRI2Connected(VADriverContextP ctx, char **driver_name) | ||
194 | if (dri_state->fd < 0) | ||
195 | goto err_out; | ||
196 | |||
197 | - if (drmGetMagic(dri_state->fd, &magic)) | ||
198 | + if (libdrm_drmGetMagic(dri_state->fd, &magic)) | ||
199 | goto err_out; | ||
200 | |||
201 | if (!VA_DRI2Authenticate(ctx->x11_dpy, RootWindow(ctx->x11_dpy, ctx->x11_screen), | ||
202 | diff --git a/src/x11/libdrm_glue.c b/src/x11/libdrm_glue.c | ||
203 | new file mode 100644 | ||
204 | index 0000000..b72a2d1 | ||
205 | --- /dev/null | ||
206 | +++ b/src/x11/libdrm_glue.c | ||
207 | @@ -0,0 +1,208 @@ | ||
208 | +/* | ||
209 | + * Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved. | ||
210 | + * | ||
211 | + * Permission is hereby granted, free of charge, to any person obtaining a | ||
212 | + * copy of this software and associated documentation files (the | ||
213 | + * "Software"), to deal in the Software without restriction, including | ||
214 | + * without limitation the rights to use, copy, modify, merge, publish, | ||
215 | + * distribute, sub license, and/or sell copies of the Software, and to | ||
216 | + * permit persons to whom the Software is furnished to do so, subject to | ||
217 | + * the following conditions: | ||
218 | + * | ||
219 | + * The above copyright notice and this permission notice (including the | ||
220 | + * next paragraph) shall be included in all copies or substantial portions | ||
221 | + * of the Software. | ||
222 | + * | ||
223 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
224 | + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
225 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | ||
226 | + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR | ||
227 | + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
228 | + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
229 | + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
230 | + */ | ||
231 | + | ||
232 | +#define _GNU_SOURCE 1 | ||
233 | +#include "libdrm_glue.h" | ||
234 | +#include <stdio.h> | ||
235 | +#include <string.h> | ||
236 | +#include <dlfcn.h> | ||
237 | +#include <assert.h> | ||
238 | + | ||
239 | +#define LOAD_FUNC_(NAME, RET, ARGS, FALLBACK) \ | ||
240 | + static RET (*lib_##NAME) ARGS; \ | ||
241 | + if (lib_##NAME == NULL) { \ | ||
242 | + lib_##NAME = libdrm_symbol(#NAME); \ | ||
243 | + if (!lib_##NAME) \ | ||
244 | + lib_##NAME = FALLBACK; \ | ||
245 | + } \ | ||
246 | + assert(lib_##NAME != NULL) | ||
247 | + | ||
248 | +#define LOAD_FUNC(NAME, RET, ARGS) \ | ||
249 | + LOAD_FUNC_(NAME, RET, ARGS, NULL) | ||
250 | + | ||
251 | +static void *libdrm_handle; | ||
252 | +static int libdrm_handle_ok = -1; | ||
253 | + | ||
254 | +static inline void *libdrm_symbol(const char *name) | ||
255 | +{ | ||
256 | + if (!libdrm_open()) | ||
257 | + return NULL; | ||
258 | + return dlsym(libdrm_handle, name); | ||
259 | +} | ||
260 | + | ||
261 | +int libdrm_open(void) | ||
262 | +{ | ||
263 | + if (libdrm_handle_ok < 0) { | ||
264 | + libdrm_handle = dlopen("libdrm.so.2", RTLD_LOCAL|RTLD_LAZY); | ||
265 | + libdrm_handle_ok = libdrm_handle != NULL; | ||
266 | + } | ||
267 | + assert(libdrm_handle); | ||
268 | + return libdrm_handle_ok; | ||
269 | +} | ||
270 | + | ||
271 | +void libdrm_close(void) | ||
272 | +{ | ||
273 | + if (libdrm_handle) | ||
274 | + dlclose(libdrm_handle); | ||
275 | +} | ||
276 | + | ||
277 | +// Default drmOpenOnce() and drmCloseOnce() implementations based on current GIT | ||
278 | +#define DRM_MAX_FDS 16 | ||
279 | +static struct { | ||
280 | + char *BusID; | ||
281 | + int fd; | ||
282 | + int refcount; | ||
283 | +} connection[DRM_MAX_FDS]; | ||
284 | + | ||
285 | +static int nr_fds = 0; | ||
286 | + | ||
287 | +// Default implementation for drmOpenOnce() if none exists in the library | ||
288 | +static int | ||
289 | +libdrm_default_drmOpenOnce(void *unused, const char *BusID, int *newlyopened) | ||
290 | +{ | ||
291 | + int i; | ||
292 | + int fd; | ||
293 | + | ||
294 | + for (i = 0; i < nr_fds; i++) | ||
295 | + if (strcmp(BusID, connection[i].BusID) == 0) { | ||
296 | + connection[i].refcount++; | ||
297 | + *newlyopened = 0; | ||
298 | + return connection[i].fd; | ||
299 | + } | ||
300 | + | ||
301 | + fd = libdrm_drmOpen(unused, BusID); | ||
302 | + if (fd <= 0 || nr_fds == DRM_MAX_FDS) | ||
303 | + return fd; | ||
304 | + | ||
305 | + connection[nr_fds].BusID = strdup(BusID); | ||
306 | + connection[nr_fds].fd = fd; | ||
307 | + connection[nr_fds].refcount = 1; | ||
308 | + *newlyopened = 1; | ||
309 | + | ||
310 | + if (0) | ||
311 | + fprintf(stderr, "saved connection %d for %s %d\n", | ||
312 | + nr_fds, connection[nr_fds].BusID, | ||
313 | + strcmp(BusID, connection[nr_fds].BusID)); | ||
314 | + nr_fds++; | ||
315 | + return fd; | ||
316 | +} | ||
317 | + | ||
318 | +// Default implementation for drmCloseOnce() if none exists in the library | ||
319 | +static void libdrm_default_drmCloseOnce(int fd) | ||
320 | +{ | ||
321 | + int i; | ||
322 | + | ||
323 | + for (i = 0; i < nr_fds; i++) { | ||
324 | + if (fd == connection[i].fd) { | ||
325 | + if (--connection[i].refcount == 0) { | ||
326 | + libdrm_drmClose(connection[i].fd); | ||
327 | + free(connection[i].BusID); | ||
328 | + if (i < --nr_fds) | ||
329 | + connection[i] = connection[nr_fds]; | ||
330 | + return; | ||
331 | + } | ||
332 | + } | ||
333 | + } | ||
334 | +} | ||
335 | + | ||
336 | +// Determine whether the DRM kernel driver has been loaded | ||
337 | +int libdrm_drmAvailable(void) | ||
338 | +{ | ||
339 | + LOAD_FUNC(drmAvailable, int, (void)); | ||
340 | + return lib_drmAvailable(); | ||
341 | +} | ||
342 | + | ||
343 | +// Open the DRM device | ||
344 | +int libdrm_drmOpen(const char *name, const char *busid) | ||
345 | +{ | ||
346 | + LOAD_FUNC(drmOpen, int, (const char *, const char *)); | ||
347 | + return lib_drmOpen(name, busid); | ||
348 | +} | ||
349 | + | ||
350 | +// Close the device | ||
351 | +int libdrm_drmClose(int fd) | ||
352 | +{ | ||
353 | + LOAD_FUNC(drmClose, int, (int)); | ||
354 | + return lib_drmClose(fd); | ||
355 | +} | ||
356 | + | ||
357 | +// Open the DRM device (re-use an existing connection) | ||
358 | +int libdrm_drmOpenOnce(void *unused, const char *BusID, int *newlyopened) | ||
359 | +{ | ||
360 | + LOAD_FUNC_(drmOpenOnce, int, (void *, const char *, int *), | ||
361 | + libdrm_default_drmOpenOnce); | ||
362 | + return lib_drmOpenOnce(unused, BusID, newlyopened); | ||
363 | +} | ||
364 | + | ||
365 | +// Close the device (unref an existing connection prior to actually closing it) | ||
366 | +void libdrm_drmCloseOnce(int fd) | ||
367 | +{ | ||
368 | + LOAD_FUNC_(drmCloseOnce, void, (int), libdrm_default_drmCloseOnce); | ||
369 | + lib_drmCloseOnce(fd); | ||
370 | +} | ||
371 | + | ||
372 | +// DRM connection cookie | ||
373 | +int libdrm_drmGetMagic(int fd, drm_magic_t * magic) | ||
374 | +{ | ||
375 | + LOAD_FUNC(drmGetMagic, int, (int, drm_magic_t *)); | ||
376 | + return lib_drmGetMagic(fd, magic); | ||
377 | +} | ||
378 | + | ||
379 | +// Issue a set-version ioctl | ||
380 | +int libdrm_drmSetInterfaceVersion(int fd, drmSetVersion *version) | ||
381 | +{ | ||
382 | + LOAD_FUNC(drmSetInterfaceVersion, int, (int, drmSetVersion *)); | ||
383 | + return lib_drmSetInterfaceVersion(fd, version); | ||
384 | +} | ||
385 | + | ||
386 | +// Get the bus ID of the device | ||
387 | +char *libdrm_drmGetBusid(int fd) | ||
388 | +{ | ||
389 | + LOAD_FUNC(drmGetBusid, char *, (int)); | ||
390 | + return lib_drmGetBusid(fd); | ||
391 | +} | ||
392 | + | ||
393 | +// Free the bus ID information | ||
394 | +void libdrm_drmFreeBusid(const char *busid) | ||
395 | +{ | ||
396 | + LOAD_FUNC(drmFreeBusid, void, (const char *)); | ||
397 | + lib_drmFreeBusid(busid); | ||
398 | +} | ||
399 | + | ||
400 | +// Map a region of memory | ||
401 | +int libdrm_drmMap(int fd, | ||
402 | + drm_handle_t handle, | ||
403 | + drmSize size, | ||
404 | + drmAddressPtr address) | ||
405 | +{ | ||
406 | + LOAD_FUNC(drmMap, int, (int, drm_handle_t, drmSize, drmAddressPtr)); | ||
407 | + return lib_drmMap(fd, handle, size, address); | ||
408 | +} | ||
409 | + | ||
410 | +// Unmap mappings obtained with drmMap() | ||
411 | +int libdrm_drmUnmap(drmAddress address, drmSize size) | ||
412 | +{ | ||
413 | + LOAD_FUNC(drmUnmap, int, (drmAddress, drmSize)); | ||
414 | + return lib_drmUnmap(address, size); | ||
415 | +} | ||
416 | diff --git a/src/x11/libdrm_glue.h b/src/x11/libdrm_glue.h | ||
417 | new file mode 100644 | ||
418 | index 0000000..878470b | ||
419 | --- /dev/null | ||
420 | +++ b/src/x11/libdrm_glue.h | ||
421 | @@ -0,0 +1,73 @@ | ||
422 | +/* | ||
423 | + * Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved. | ||
424 | + * | ||
425 | + * Permission is hereby granted, free of charge, to any person obtaining a | ||
426 | + * copy of this software and associated documentation files (the | ||
427 | + * "Software"), to deal in the Software without restriction, including | ||
428 | + * without limitation the rights to use, copy, modify, merge, publish, | ||
429 | + * distribute, sub license, and/or sell copies of the Software, and to | ||
430 | + * permit persons to whom the Software is furnished to do so, subject to | ||
431 | + * the following conditions: | ||
432 | + * | ||
433 | + * The above copyright notice and this permission notice (including the | ||
434 | + * next paragraph) shall be included in all copies or substantial portions | ||
435 | + * of the Software. | ||
436 | + * | ||
437 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
438 | + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
439 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. | ||
440 | + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR | ||
441 | + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
442 | + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
443 | + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
444 | + */ | ||
445 | + | ||
446 | +#ifndef LIBDRM_GLUE_H | ||
447 | +#define LIBDRM_GLUE_H | ||
448 | + | ||
449 | +#include "config.h" | ||
450 | +#include <xf86drm.h> | ||
451 | + | ||
452 | +int libdrm_open(void) | ||
453 | + ATTRIBUTE_HIDDEN; | ||
454 | + | ||
455 | +void libdrm_close(void) | ||
456 | + ATTRIBUTE_HIDDEN; | ||
457 | + | ||
458 | +int libdrm_drmAvailable(void) | ||
459 | + ATTRIBUTE_HIDDEN; | ||
460 | + | ||
461 | +int libdrm_drmOpen(const char *name, const char *busid) | ||
462 | + ATTRIBUTE_HIDDEN; | ||
463 | + | ||
464 | +int libdrm_drmClose(int fd) | ||
465 | + ATTRIBUTE_HIDDEN; | ||
466 | + | ||
467 | +int libdrm_drmOpenOnce(void *unused, const char *BusID, int *newlyopened) | ||
468 | + ATTRIBUTE_HIDDEN; | ||
469 | + | ||
470 | +void libdrm_drmCloseOnce(int fd) | ||
471 | + ATTRIBUTE_HIDDEN; | ||
472 | + | ||
473 | +int libdrm_drmGetMagic(int fd, drm_magic_t * magic) | ||
474 | + ATTRIBUTE_HIDDEN; | ||
475 | + | ||
476 | +int libdrm_drmSetInterfaceVersion(int fd, drmSetVersion *version) | ||
477 | + ATTRIBUTE_HIDDEN; | ||
478 | + | ||
479 | +char *libdrm_drmGetBusid(int fd) | ||
480 | + ATTRIBUTE_HIDDEN; | ||
481 | + | ||
482 | +void libdrm_drmFreeBusid(const char *busid) | ||
483 | + ATTRIBUTE_HIDDEN; | ||
484 | + | ||
485 | +int libdrm_drmMap(int fd, | ||
486 | + drm_handle_t handle, | ||
487 | + drmSize size, | ||
488 | + drmAddressPtr address) | ||
489 | + ATTRIBUTE_HIDDEN; | ||
490 | + | ||
491 | +int libdrm_drmUnmap(drmAddress address, drmSize size) | ||
492 | + ATTRIBUTE_HIDDEN; | ||
493 | + | ||
494 | +#endif /* LIBDRM_GLUE_H */ | ||
495 | diff --git a/src/x11/va_dricommon.h b/src/x11/va_dricommon.h | ||
496 | index a2a51a6..0da35fe 100644 | ||
497 | --- a/src/x11/va_dricommon.h | ||
498 | +++ b/src/x11/va_dricommon.h | ||
499 | @@ -13,7 +13,8 @@ enum | ||
500 | { | ||
501 | VA_NONE = 0, | ||
502 | VA_DRI1 = 1, | ||
503 | - VA_DRI2 = 2 | ||
504 | + VA_DRI2 = 2, | ||
505 | + VA_DRI_AMD = 4 /* AMD DRI implementation */ | ||
506 | }; | ||
507 | |||
508 | union dri_buffer | ||
509 | diff --git a/src/x11/va_x11.c b/src/x11/va_x11.c | ||
510 | index b8c60fa..414c261 100644 | ||
511 | --- a/src/x11/va_x11.c | ||
512 | +++ b/src/x11/va_x11.c | ||
513 | @@ -31,6 +31,7 @@ | ||
514 | #include "va_dri2.h" | ||
515 | #include "va_dricommon.h" | ||
516 | #include "va_nvctrl.h" | ||
517 | +#include "libdrm_glue.h" | ||
518 | #include <stdio.h> | ||
519 | #include <stdarg.h> | ||
520 | #include <string.h> | ||
521 | @@ -94,6 +75,8 @@ static void va_DisplayContextDestroy ( | ||
522 | } | ||
523 | ctx = &((*ctx)->pNext); | ||
524 | } | ||
525 | + | ||
526 | + libdrm_close(); | ||
527 | free(pDisplayContext->pDriverContext->dri_state); | ||
528 | free(pDisplayContext->pDriverContext); | ||
529 | free(pDisplayContext); | ||
530 | diff --git a/src/Makefile.am b/src/Makefile.am | ||
531 | index e50a15f..d1f8f70 100644 | ||
532 | --- a/src/Makefile.am | ||
533 | +++ b/src/Makefile.am | ||
534 | @@ -45,7 +45,7 @@ libva_la_LDFLAGS = $(LDADD) -no-undefined | ||
535 | libva_la_LIBADD = $(LIBVA_LIBS) -ldl | ||
536 | |||
537 | libva_x11_la_SOURCES = | ||
538 | -libva_x11_la_LIBADD = $(libvacorelib) x11/libva_x11.la $(LIBVA_LIBS) $(X11_LIBS) $(XEXT_LIBS) $(DRM_LIBS) $(XFIXES_LIBS) | ||
539 | +libva_x11_la_LIBADD = $(libvacorelib) x11/libva_x11.la $(LIBVA_LIBS) $(X11_LIBS) $(XEXT_LIBS) $(XFIXES_LIBS) -ldl | ||
540 | libva_x11_la_LDFLAGS = $(LDADD) | ||
541 | libva_x11_la_DEPENDENCIES = $(libvacorelib) x11/libva_x11.la | ||
542 | |||