summaryrefslogtreecommitdiffstats
path: root/meta-emenlow/recipes-graphics/libva/libva-0.31.0/204_check_ATIFGLEXTENSION.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-emenlow/recipes-graphics/libva/libva-0.31.0/204_check_ATIFGLEXTENSION.patch')
-rw-r--r--meta-emenlow/recipes-graphics/libva/libva-0.31.0/204_check_ATIFGLEXTENSION.patch312
1 files changed, 0 insertions, 312 deletions
diff --git a/meta-emenlow/recipes-graphics/libva/libva-0.31.0/204_check_ATIFGLEXTENSION.patch b/meta-emenlow/recipes-graphics/libva/libva-0.31.0/204_check_ATIFGLEXTENSION.patch
deleted file mode 100644
index 02920a89..00000000
--- a/meta-emenlow/recipes-graphics/libva/libva-0.31.0/204_check_ATIFGLEXTENSION.patch
+++ /dev/null
@@ -1,312 +0,0 @@
1commit d91645f8b37aa43bafa76da3146dcdc9c17963ff
2Author: Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>
3Date: Fri Nov 20 15:51:22 2009 +0000
4
5 Fix detection of fglrx.
6
7diff --git a/src/x11/Makefile.am b/src/x11/Makefile.am
8index b6916f2..0b61c33 100644
9--- a/src/x11/Makefile.am
10+++ b/src/x11/Makefile.am
11@@ -25,6 +25,23 @@ noinst_LTLIBRARIES = libva_x11.la
12 libva_x11includedir = ${includedir}/va
13 libva_x11include_HEADERS = va_x11.h va_dri.h va_dri2.h va_dricommon.h
14
15-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
16+libva_x11_la_SOURCES = \
17+ dri1_util.c \
18+ dri2_util.c \
19+ libdrm_glue.c \
20+ va_dri.c \
21+ va_dri2.c \
22+ va_dricommon.c \
23+ va_fglext.c \
24+ va_nvctrl.c \
25+ va_x11.c \
26+ $(NULL)
27
28-EXTRA_DIST = va_dristr.h va_dri2str.h va_dri2tokens.h va_nvctrl.h libdrm_glue.h
29+EXTRA_DIST = \
30+ libdrm_glue.h \
31+ va_dri2str.h \
32+ va_dri2tokens.h \
33+ va_dristr.h \
34+ va_fglext.h \
35+ va_nvctrl.h \
36+ $(NULL)
37diff --git a/src/x11/va_fglext.c b/src/x11/va_fglext.c
38new file mode 100644
39index 0000000..bc58e8b
40--- /dev/null
41+++ b/src/x11/va_fglext.c
42@@ -0,0 +1,175 @@
43+/*
44+ * Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
45+ *
46+ * Permission is hereby granted, free of charge, to any person obtaining a
47+ * copy of this software and associated documentation files (the
48+ * "Software"), to deal in the Software without restriction, including
49+ * without limitation the rights to use, copy, modify, merge, publish,
50+ * distribute, sub license, and/or sell copies of the Software, and to
51+ * permit persons to whom the Software is furnished to do so, subject to
52+ * the following conditions:
53+ *
54+ * The above copyright notice and this permission notice (including the
55+ * next paragraph) shall be included in all copies or substantial portions
56+ * of the Software.
57+ *
58+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
59+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
60+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
61+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
62+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
63+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
64+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
65+ */
66+
67+#define _GNU_SOURCE 1
68+#include <string.h>
69+
70+#define NEED_REPLIES
71+#include <stdlib.h>
72+#include <X11/Xlibint.h>
73+#include <X11/Xutil.h>
74+#include <X11/extensions/Xext.h>
75+#include <X11/extensions/extutil.h>
76+#include "va_fglext.h"
77+
78+#define ATIFGL_EXTENSION_NAME "ATIFGLEXTENSION"
79+#define ATIFGL_EXTENSION_EVENTS 0
80+
81+typedef struct _FGLGetDriverData {
82+ CARD8 reqType;
83+ CARD8 fireglReqType;
84+ CARD16 length B16;
85+ CARD32 screen B32;
86+ CARD16 size B16;
87+ CARD16 pad1;
88+} xFGLGetDriverDataReq;
89+#define sz_xFGLGetDriverDataReq sizeof(xFGLGetDriverDataReq)
90+
91+typedef struct {
92+ BYTE type;
93+ BYTE pad1;
94+ CARD16 sequenceNumber B16;
95+ CARD32 length B32;
96+ CARD8 majorVersion;
97+ CARD8 minorVersion;
98+ CARD8 patchlevel B16;
99+ CARD8 BIOSVersionMajor;
100+ CARD8 BIOSVersionMinor;
101+ CARD8 HasSecondary;
102+ CARD16 pad3 B16;
103+ CARD32 pad4 B32;
104+ CARD32 pad5 B32;
105+ CARD32 pad6 B32;
106+ CARD32 pad7 B32;
107+ // ... there are more fields
108+} xFGLGetDriverDataReply;
109+#define sz_xFGLGetDriverDataReply sizeof(xFGLGetDriverDataReply)
110+
111+#define X_FGLGetDriverData 0
112+
113+static XExtensionInfo _fglext_ext_info_data;
114+static XExtensionInfo *fglext_ext_info = &_fglext_ext_info_data;
115+static /* const */ char *fglext_extension_name = ATIFGL_EXTENSION_NAME;
116+
117+#define xFGLCheckExtension(dpy,i,val) \
118+ XextCheckExtension (dpy, i, fglext_extension_name, val)
119+
120+static int close_display();
121+static /* const */ XExtensionHooks fglext_extension_hooks = {
122+ NULL, /* create_gc */
123+ NULL, /* copy_gc */
124+ NULL, /* flush_gc */
125+ NULL, /* free_gc */
126+ NULL, /* create_font */
127+ NULL, /* free_font */
128+ close_display, /* close_display */
129+ NULL, /* wire_to_event */
130+ NULL, /* event_to_wire */
131+ NULL, /* error */
132+ NULL, /* error_string */
133+};
134+
135+static XEXT_GENERATE_FIND_DISPLAY (find_display, fglext_ext_info,
136+ fglext_extension_name,
137+ &fglext_extension_hooks,
138+ ATIFGL_EXTENSION_EVENTS, NULL)
139+
140+static XEXT_GENERATE_CLOSE_DISPLAY (close_display, fglext_ext_info)
141+
142+Bool VA_FGLEXTQueryDirectRenderingCapable( Display *dpy, int screen,
143+ Bool *isCapable )
144+{
145+ char **extensions;
146+ int i, n_extensions, has_fglext = 0, has_fglrxdri = 0;
147+
148+ if (isCapable)
149+ *isCapable = False;
150+
151+ extensions = XListExtensions(dpy, &n_extensions);
152+ if (!extensions)
153+ return False;
154+
155+ for (i = 0; i < n_extensions; i++) {
156+ if (strcmp(extensions[i], ATIFGL_EXTENSION_NAME) == 0)
157+ has_fglext = 1;
158+ if (strcmp(extensions[i], "ATIFGLRXDRI") == 0)
159+ has_fglrxdri = 1;
160+ }
161+ XFreeExtensionList(extensions);
162+
163+ if (!has_fglext)
164+ return False;
165+
166+ if (isCapable)
167+ *isCapable = has_fglrxdri;
168+
169+ return True;
170+}
171+
172+Bool VA_FGLEXTGetClientDriverName( Display *dpy, int screen,
173+ int *ddxDriverMajorVersion, int *ddxDriverMinorVersion,
174+ int *ddxDriverPatchVersion, char **clientDriverName )
175+{
176+ XExtDisplayInfo *info = find_display (dpy);
177+ xFGLGetDriverDataReply rep;
178+ xFGLGetDriverDataReq *req;
179+
180+ if (ddxDriverMajorVersion)
181+ *ddxDriverMajorVersion = 0;
182+ if (ddxDriverMinorVersion)
183+ *ddxDriverMinorVersion = 0;
184+ if (ddxDriverPatchVersion)
185+ *ddxDriverPatchVersion = 0;
186+ if (clientDriverName)
187+ *clientDriverName = NULL;
188+
189+ if(!XextHasExtension(info))
190+ return False;
191+
192+ xFGLCheckExtension (dpy, info, False);
193+
194+ LockDisplay (dpy);
195+ GetReq (FGLGetDriverData, req);
196+ req->reqType = info->codes->major_opcode;
197+ req->fireglReqType = X_FGLGetDriverData;
198+ req->screen = screen;
199+ if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
200+ UnlockDisplay (dpy);
201+ SyncHandle ();
202+ return False;
203+ }
204+ UnlockDisplay (dpy);
205+ SyncHandle ();
206+
207+ if (ddxDriverMajorVersion)
208+ *ddxDriverMajorVersion = rep.majorVersion;
209+ if (ddxDriverMinorVersion)
210+ *ddxDriverMinorVersion = rep.minorVersion;
211+ if (ddxDriverPatchVersion)
212+ *ddxDriverPatchVersion = rep.patchlevel;
213+ if (clientDriverName)
214+ *clientDriverName = strdup("fglrx");
215+
216+ return True;
217+}
218diff --git a/src/x11/va_fglext.h b/src/x11/va_fglext.h
219new file mode 100644
220index 0000000..f2d87c3
221--- /dev/null
222+++ b/src/x11/va_fglext.h
223@@ -0,0 +1,37 @@
224+/*
225+ * Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
226+ *
227+ * Permission is hereby granted, free of charge, to any person obtaining a
228+ * copy of this software and associated documentation files (the
229+ * "Software"), to deal in the Software without restriction, including
230+ * without limitation the rights to use, copy, modify, merge, publish,
231+ * distribute, sub license, and/or sell copies of the Software, and to
232+ * permit persons to whom the Software is furnished to do so, subject to
233+ * the following conditions:
234+ *
235+ * The above copyright notice and this permission notice (including the
236+ * next paragraph) shall be included in all copies or substantial portions
237+ * of the Software.
238+ *
239+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
240+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
241+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
242+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
243+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
244+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
245+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
246+ */
247+
248+#ifndef VA_FGLEXTLIB_H
249+#define VA_FGLEXTLIB_H
250+
251+#include <X11/Xlib.h>
252+
253+Bool VA_FGLEXTQueryDirectRenderingCapable( Display *dpy, int screen,
254+ Bool *isCapable );
255+
256+Bool VA_FGLEXTGetClientDriverName( Display *dpy, int screen,
257+ int *ddxDriverMajorVersion, int *ddxDriverMinorVersion,
258+ int *ddxDriverPatchVersion, char **clientDriverName );
259+
260+#endif /* VA_FGLEXTLIB_H */
261diff --git a/src/x11/va_x11.c b/src/x11/va_x11.c
262index 414c261..0510e00 100644
263--- a/src/x11/va_x11.c
264+++ b/src/x11/va_x11.c
265@@ -31,6 +31,7 @@
266 #include "va_dri2.h"
267 #include "va_dricommon.h"
268 #include "va_nvctrl.h"
269+#include "va_fglext.h"
270 #include "libdrm_glue.h"
271 #include <stdio.h>
272 #include <stdarg.h>
273@@ -132,6 +133,29 @@ static VAStatus va_NVCTRL_GetDriverName (
274 return VA_STATUS_SUCCESS;
275 }
276
277+static VAStatus va_FGLEXT_GetDriverName(
278+ VADisplayContextP pDisplayContext,
279+ char **driver_name
280+)
281+{
282+ VADriverContextP ctx = pDisplayContext->pDriverContext;
283+ int direct_capable, driver_major, driver_minor, driver_patch;
284+ Bool result;
285+
286+ result = VA_FGLEXTQueryDirectRenderingCapable(ctx->x11_dpy, ctx->x11_screen,
287+ &direct_capable);
288+ if (!result || !direct_capable)
289+ return VA_STATUS_ERROR_UNKNOWN;
290+
291+ result = VA_FGLEXTGetClientDriverName(ctx->x11_dpy, ctx->x11_screen,
292+ &driver_major, &driver_minor,
293+ &driver_patch, driver_name);
294+ if (!result)
295+ return VA_STATUS_ERROR_UNKNOWN;
296+
297+ return VA_STATUS_SUCCESS;
298+}
299+
300 static VAStatus va_DisplayContextGetDriverName (
301 VADisplayContextP pDisplayContext,
302 char **driver_name
303@@ -156,7 +180,8 @@ static VAStatus va_DisplayContextGetDriverName (
304 vaStatus = va_DRIGetDriverName(pDisplayContext, driver_name);
305 if (vaStatus != VA_STATUS_SUCCESS)
306 vaStatus = va_NVCTRL_GetDriverName(pDisplayContext, driver_name);
307-
308+ if (vaStatus != VA_STATUS_SUCCESS)
309+ vaStatus = va_FGLEXT_GetDriverName(pDisplayContext, driver_name);
310 return vaStatus;
311 }
312