Gentoo Archives: gentoo-commits

From: Emil Karlson <jekarlson@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/x11:master commit in: x11-drivers/ati-drivers/, x11-drivers/ati-drivers/files/, profiles/
Date: Fri, 02 Aug 2013 11:41:48
Message-Id: 1375443668.430b6ed334a3310d8b7b2bb3859dc98312ee487c.emil_karlson@gentoo
1 commit: 430b6ed334a3310d8b7b2bb3859dc98312ee487c
2 Author: Emil Karlson <jekarlson <AT> gmail <DOT> com>
3 AuthorDate: Fri Aug 2 11:41:08 2013 +0000
4 Commit: Emil Karlson <jekarlson <AT> gmail <DOT> com>
5 CommitDate: Fri Aug 2 11:41:08 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/x11.git;a=commit;h=430b6ed3
7
8 x11-drivers/ati-drivers version bump
9
10 Masked, doesn't work for me.
11
12 ---
13 profiles/package.mask | 3 +
14 .../ati-drivers/ati-drivers-13.8_beta.ebuild | 620 +++++++++++++++++++++
15 .../ati-drivers-13.8-beta-include-seq_file.patch | 13 +
16 ...heck-for-iommu-only-if-iommu-is-supported.patch | 31 ++
17 4 files changed, 667 insertions(+)
18
19 diff --git a/profiles/package.mask b/profiles/package.mask
20 index 973f0da..f74262c 100644
21 --- a/profiles/package.mask
22 +++ b/profiles/package.mask
23 @@ -121,3 +121,6 @@
24 =x11-proto/xf86vidmodeproto-9999
25 =x11-proto/xineramaproto-9999
26 =x11-proto/xproto-9999
27 +
28 +# Known to broken/untested
29 +=x11-drivers/ati-drivers-13.8_beta
30
31 diff --git a/x11-drivers/ati-drivers/ati-drivers-13.8_beta.ebuild b/x11-drivers/ati-drivers/ati-drivers-13.8_beta.ebuild
32 new file mode 100644
33 index 0000000..0e621d7
34 --- /dev/null
35 +++ b/x11-drivers/ati-drivers/ati-drivers-13.8_beta.ebuild
36 @@ -0,0 +1,620 @@
37 +# Copyright 1999-2013 Gentoo Foundation
38 +# Distributed under the terms of the GNU General Public License v2
39 +# $Header: $
40 +
41 +EAPI=5
42 +
43 +inherit eutils multilib linux-info linux-mod toolchain-funcs versionator pax-utils
44 +
45 +DESCRIPTION="Ati precompiled drivers for Radeon Evergreen (HD5000 Series) and newer chipsets"
46 +HOMEPAGE="http://www.amd.com"
47 +#RUN="${WORKDIR}/amd-driver-installer-9.00-x86.x86_64.run"
48 +SLOT="1"
49 +DRIVERS_URI="http://www2.ati.com/drivers/beta/amd-catalyst-13.8-beta1-linux-x86.x86_64.zip"
50 +XVBA_SDK_URI="http://developer.amd.com/wordpress/media/2012/10/xvba-sdk-0.74-404001.tar.gz"
51 +SRC_URI="${DRIVERS_URI} ${XVBA_SDK_URI}"
52 +FOLDER_PREFIX="common/"
53 +IUSE="debug +modules multilib qt4 static-libs disable-watermark pax_kernel"
54 +
55 +LICENSE="AMD GPL-2 QPL-1.0"
56 +KEYWORDS="-* ~amd64 ~x86"
57 +
58 +RESTRICT="bindist test"
59 +
60 +RDEPEND="
61 + <=x11-base/xorg-server-1.14.49[-minimal]
62 + >=app-admin/eselect-opengl-1.0.7
63 + app-admin/eselect-opencl
64 + sys-power/acpid
65 + x11-apps/xauth
66 + x11-libs/libX11
67 + x11-libs/libXext
68 + x11-libs/libXinerama
69 + x11-libs/libXrandr
70 + x11-libs/libXrender
71 + virtual/glu
72 + multilib? (
73 + app-emulation/emul-linux-x86-opengl
74 + || (
75 + (
76 + x11-libs/libX11[abi_x86_32]
77 + x11-libs/libXext[abi_x86_32]
78 + x11-libs/libXinerama[abi_x86_32]
79 + x11-libs/libXrandr[abi_x86_32]
80 + x11-libs/libXrender[abi_x86_32]
81 + )
82 + app-emulation/emul-linux-x86-xlibs
83 + )
84 + )
85 + qt4? (
86 + x11-libs/libICE
87 + x11-libs/libSM
88 + x11-libs/libXcursor
89 + x11-libs/libXfixes
90 + x11-libs/libXxf86vm
91 + dev-qt/qtcore:4
92 + dev-qt/qtgui:4[accessibility]
93 + )
94 +"
95 +if [[ legacy != ${SLOT} ]]; then
96 + RDEPEND="${RDEPEND}
97 + !x11-drivers/ati-drivers:legacy"
98 +else
99 + RDEPEND="${RDEPEND}
100 + !x11-drivers/ati-drivers:1"
101 +fi
102 +
103 +DEPEND="${RDEPEND}
104 + x11-proto/inputproto
105 + x11-proto/xf86miscproto
106 + x11-proto/xf86vidmodeproto
107 + x11-proto/xineramaproto
108 + x11-libs/libXtst
109 + sys-apps/findutils
110 + app-misc/pax-utils
111 + app-arch/unzip
112 +"
113 +
114 +EMULTILIB_PKG="true"
115 +
116 +S="${WORKDIR}"
117 +
118 +# QA Silencing
119 +QA_TEXTRELS="
120 + usr/lib*/opengl/ati/lib/libGL.so.1.2
121 + usr/lib*/libatiadlxx.so
122 + usr/lib*/xorg/modules/glesx.so
123 + usr/lib*/libaticaldd.so
124 + usr/lib*/dri/fglrx_dri.so
125 +"
126 +
127 +QA_EXECSTACK="
128 + opt/bin/atiode
129 + opt/bin/amdcccle
130 + usr/lib*/opengl/ati/lib/libGL.so.1.2
131 + usr/lib*/dri/fglrx_dri.so
132 +"
133 +
134 +QA_WX_LOAD="
135 + usr/lib*/opengl/ati/lib/libGL.so.1.2
136 + usr/lib*/dri/fglrx_dri.so
137 +"
138 +
139 +QA_PRESTRIPPED="
140 + usr/lib\(32\|64\)\?/libXvBAW.so.1.0
141 + usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
142 + usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
143 + usr/lib\(32\|64\)\?/xorg/modules/glesx.so
144 + usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
145 + usr/lib\(32\|64\)\?/libaticaldd.so
146 + usr/lib\(32\|64\)\?/dri/fglrx_dri.so
147 +"
148 +
149 +QA_SONAME="
150 + usr/lib\(32\|64\)\?/libatiadlxx.so
151 + usr/lib\(32\|64\)\?/libaticalcl.so
152 + usr/lib\(32\|64\)\?/libaticaldd.so
153 + usr/lib\(32\|64\)\?/libaticalrt.so
154 + usr/lib\(32\|64\)\?/libamdocl\(32\|64\)\?.so
155 +"
156 +
157 +QA_DT_HASH="
158 + opt/bin/amdcccle
159 + opt/bin/aticonfig
160 + opt/bin/atiodcli
161 + opt/bin/atiode
162 + opt/bin/clinfo
163 + opt/bin/fglrxinfo
164 + opt/sbin/atieventsd
165 + opt/sbin/amdnotifyui
166 + usr/lib\(32\|64\)\?/libaticalcl.so
167 + usr/lib\(32\|64\)\?/libaticalrt.so
168 + usr/lib\(32\|64\)\?/libatiuki.so.1.0
169 + usr/lib\(32\|64\)\?/libatiadlxx.so
170 + usr/lib\(32\|64\)\?/libfglrx_dm.so.1.0
171 + usr/lib\(32\|64\)\?/libXvBAW.so.1.0
172 + usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
173 + usr/lib\(32\|64\)\?/xorg/modules/amdxmm.so
174 + usr/lib\(32\|64\)\?/xorg/modules/glesx.so
175 + usr/lib\(32\|64\)\?/xorg/modules/linux/libfglrxdrm.so
176 + usr/lib\(32\|64\)\?/xorg/modules/drivers/fglrx_drv.so
177 + usr/lib\(32\|64\)\?/libaticaldd.so
178 + usr/lib\(32\|64\)\?/dri/fglrx_dri.so
179 + usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
180 + usr/lib\(32\|64\)\?/opengl/ati/extensions/fglrx-libglx.so
181 + usr/lib\(32\|64\)\?/opengl/ati/lib/fglrx-libGL.so.1.2
182 + usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
183 + usr/lib\(32\|64\)\?/OpenCL/vendors/amd/libamdocl\(32\|64\)\?.so
184 + usr/lib\(32\|64\)\?/OpenCL/vendors/amd/libOpenCL.so.1
185 +"
186 +
187 +CONFIG_CHECK="~MTRR ~!DRM ACPI PCI_MSI !LOCKDEP !PAX_KERNEXEC_PLUGIN_METHOD_OR"
188 +ERROR_MTRR="CONFIG_MTRR required for direct rendering."
189 +ERROR_DRM="CONFIG_DRM must be disabled or compiled as a module and not loaded for direct
190 + rendering to work."
191 +ERROR_LOCKDEP="CONFIG_LOCKDEP (lock tracking) exports the symbol lock_acquire
192 + as GPL-only. This prevents ${P} from compiling with an error like this:
193 + FATAL: modpost: GPL-incompatible module fglrx.ko uses GPL-only symbol 'lock_acquire'"
194 +ERROR_PAX_KERNEXEC_PLUGIN_METHOD_OR="This config option will cause
195 + kernel to reject loading the fglrx module with
196 + \"ERROR: could not insert 'fglrx': Exec format error.\"
197 + You may want to try CONFIG_PAX_KERNEXEC_PLUGIN_METHOD_BTS instead."
198 +
199 +_check_kernel_config() {
200 + if ! linux_chkconfig_present AGP && \
201 + ! linux_chkconfig_present PCIEPORTBUS; then
202 + ewarn "You don't have AGP and/or PCIe support enabled in the kernel"
203 + ewarn "Direct rendering will not work."
204 + fi
205 +
206 + kernel_is ge 2 6 37 && kernel_is le 2 6 38 && if ! linux_chkconfig_present BKL ; then
207 + die "CONFIG_BKL must be enabled for kernels 2.6.37-2.6.38."
208 + fi
209 +
210 + if use amd64 && ! linux_chkconfig_present COMPAT; then
211 + die "CONFIG_COMPAT must be enabled for amd64 kernels."
212 + fi
213 +}
214 +
215 +pkg_pretend() {
216 + # workaround until bug 365543 is solved
217 + if use modules; then
218 + linux-info_pkg_setup
219 + require_configured_kernel
220 + _check_kernel_config
221 + fi
222 +
223 + if ! has XT ${PAX_MARKINGS} && use pax_kernel; then
224 + ewarn "You have disabled xattr pax markings for portage."
225 + ewarn "This will likely cause programs using ati-drivers provided"
226 + ewarn "libraries to be killed kernel."
227 + fi
228 +}
229 +
230 +pkg_setup() {
231 + if use modules; then
232 + MODULE_NAMES="fglrx(video:${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod/2.6.x)"
233 + BUILD_TARGETS="kmod_build"
234 + linux-mod_pkg_setup
235 + BUILD_PARAMS="GCC_VER_MAJ=$(gcc-major-version) KVER=${KV_FULL} KDIR=${KV_DIR}"
236 + BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=\"-DMODULE -DATI -DFGL\""
237 + if grep -q arch_compat_alloc_user_space ${KV_DIR}/arch/x86/include/asm/compat.h ; then
238 + BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space"
239 + else
240 + BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=compat_alloc_user_space"
241 + fi
242 + fi
243 + # Define module dir.
244 + MODULE_DIR="${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod"
245 + # get the xorg-server version and set BASE_DIR for that
246 + BASE_DIR="${S}/xpic"
247 +
248 + # amd64/x86
249 + if use amd64 ; then
250 + MY_BASE_DIR="${BASE_DIR}_64a"
251 + PKG_LIBDIR=lib64
252 + ARCH_DIR="${S}/arch/x86_64"
253 + else
254 + MY_BASE_DIR="${BASE_DIR}"
255 + PKG_LIBDIR=lib
256 + ARCH_DIR="${S}/arch/x86"
257 + fi
258 +
259 + elog
260 + elog "Please note that this driver only supports graphic cards based on"
261 + elog "Evergreen chipset and newer."
262 + elog "This includes the AMD Radeon HD 5400+ series at this moment."
263 + elog
264 + elog "If your card is older then use ${CATEGORY}/xf86-video-ati"
265 + elog "For migration informations please refer to:"
266 + elog "http://www.gentoo.org/proj/en/desktop/x/x11/ati-migration-guide.xml"
267 + einfo
268 +}
269 +
270 +src_unpack() {
271 + local DRIVERS_DISTFILE XVBA_SDK_DISTFILE
272 + DRIVERS_DISTFILE=${DRIVERS_URI##*/}
273 + XVBA_SDK_DISTFILE=${XVBA_SDK_URI##*/}
274 +
275 + if [[ ${DRIVERS_DISTFILE} =~ .*\.tar\.gz ]]; then
276 + unpack ${DRIVERS_DISTFILE}
277 + else
278 + #please note, RUN may be insanely assigned at top near SRC_URI
279 + if [[ ${DRIVERS_DISTFILE} =~ .*\.zip ]]; then
280 + unpack ${DRIVERS_DISTFILE}
281 + [[ -z "$RUN" ]] && RUN="${S}/${DRIVERS_DISTFILE/%.zip/.run}"
282 + else
283 + RUN="${DISTDIR}/${DRIVERS_DISTFILE}"
284 + fi
285 + sh ${RUN} --extract "${S}" 2>&1 > /dev/null || die
286 + fi
287 +
288 + mkdir xvba_sdk
289 + cd xvba_sdk
290 + unpack ${XVBA_SDK_DISTFILE}
291 +}
292 +
293 +src_prepare() {
294 + if use modules; then
295 + if use debug; then
296 + sed -i '/^#define DRM_DEBUG_CODE/s/0/1/' \
297 + "${MODULE_DIR}/firegl_public.c" \
298 + || die "Failed to enable debug output."
299 + fi
300 + fi
301 +
302 + # These are the userspace utilities that we also have source for.
303 + # We rebuild these later.
304 + rm \
305 + "${ARCH_DIR}"/usr/X11R6/bin/fgl_glxgears \
306 + || die "bin rm failed"
307 +
308 + # in this version amdcccle isn't static, thus we depend on qt4
309 + use qt4 || rm "${ARCH_DIR}"/usr/X11R6/bin/amdcccle
310 +
311 + # ACPI fixups
312 + sed -i \
313 + -e "s:/var/lib/xdm/authdir/authfiles/:/var/run/xauth/:" \
314 + -e "s:/var/lib/gdm/:/var/gdm/:" \
315 + "${S}/${FOLDER_PREFIX}etc/ati/authatieventsd.sh" \
316 + || die "ACPI fixups failed."
317 +
318 + # Since "who" is in coreutils, we're using that one instead of "finger".
319 + sed -i -e 's:finger:who:' \
320 + "${S}/${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh" \
321 + || die "Replacing 'finger' with 'who' failed."
322 + # Adjust paths in the script from /usr/X11R6/bin/ to /opt/bin/ and
323 + # add function to detect default state.
324 + epatch "${FILESDIR}"/ati-powermode-opt-path-3.patch
325 +
326 + # see http://ati.cchtml.com/show_bug.cgi?id=495
327 + #epatch "${FILESDIR}"/ati-drivers-old_rsp.patch
328 + # first hunk applied upstream second (x32 related) was not
329 + epatch "${FILESDIR}"/ati-drivers-x32_something_something.patch
330 +
331 + # compile fix for AGP-less kernel, bug #435322
332 + epatch "${FILESDIR}"/ati-drivers-12.9-KCL_AGP_FindCapsRegisters-stub.patch
333 +
334 + # Compile fix for kernel typesafe uid types #469160
335 + epatch "${FILESDIR}/typesafe-kuid.diff"
336 +
337 + epatch "${FILESDIR}/ati-drivers-13.8-beta-include-seq_file.patch"
338 +
339 + epatch "${FILESDIR}/check-for-iommu-only-if-iommu-is-supported.patch"
340 +
341 + # Compile fix, https://bugs.gentoo.org/show_bug.cgi?id=454870
342 + use pax_kernel && epatch "${FILESDIR}/const-notifier-block.patch"
343 +
344 + cd "${MODULE_DIR}"
345 +
346 + # bugged fglrx build system, this file should be copied by hand
347 + cp ${ARCH_DIR}/lib/modules/fglrx/build_mod/libfglrx_ip.a 2.6.x
348 +
349 + convert_to_m 2.6.x/Makefile || die "convert_to_m failed"
350 +
351 + # When built with ati's make.sh it defines a bunch of macros if
352 + # certain .config values are set, falling back to less reliable
353 + # detection methods if linux/autoconf.h is not available. We
354 + # simply use the linux/autoconf.h settings directly, bypassing the
355 + # detection script.
356 + sed -i -e 's/__SMP__/CONFIG_SMP/' *.c *h || die "SMP sed failed"
357 + sed -i -e 's/ifdef MODVERSIONS/ifdef CONFIG_MODVERSIONS/' *.c *.h \
358 + || die "MODVERSIONS sed failed"
359 + cd "${S}"
360 +
361 + mkdir extra || die "mkdir extra failed"
362 + cd extra
363 + unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
364 +
365 + # Get rid of watermark. Oldest known reference:
366 + # http://phoronix.com/forums/showthread.php?19875-Unsupported-Hardware-watermark
367 + if use disable-watermark; then
368 + ebegin "Disabling watermark"
369 + driver="${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
370 + for x in $(objdump -d ${driver}|awk '/call/&&/EnableLogo/{print "\\x"$2"\\x"$3"\\x"$4"\\x"$5"\\x"$6}'); do
371 + sed -i "s/${x/x5b/\x5b}/\x90\x90\x90\x90\x90/g" ${driver} || break 1
372 + done
373 + eend $? || die "Disabling watermark failed"
374 + fi
375 +}
376 +
377 +src_compile() {
378 + use modules && linux-mod_src_compile
379 +
380 + ebegin "Building fgl_glxgears"
381 + cd "${S}"/extra/fgl_glxgears
382 + # These extra libs/utils either have an Imakefile that does not
383 + # work very well without tweaking or a Makefile ignoring CFLAGS
384 + # and the like. We bypass those.
385 + # The -DUSE_GLU is needed to compile using nvidia headers
386 + # according to a comment in ati-drivers-extra-8.33.6.ebuild.
387 + "$(tc-getCC)" -o fgl_glxgears ${CFLAGS} ${LDFLAGS} -DUSE_GLU \
388 + -I"${S}"/${FOLDER_PREFIX}usr/include fgl_glxgears.c \
389 + -lGL -lGLU -lX11 -lm || die "fgl_glxgears build failed"
390 + eend $?
391 +}
392 +
393 +src_install() {
394 + use modules && linux-mod_src_install
395 +
396 + # We can do two things here, and neither of them is very nice.
397 +
398 + # For direct rendering libGL has to be able to load one or more
399 + # dri modules (files ending in _dri.so, like fglrx_dri.so).
400 + # Gentoo's mesa looks for these files in the location specified by
401 + # LIBGL_DRIVERS_PATH or LIBGL_DRIVERS_DIR, then in the hardcoded
402 + # location /usr/$(get_libdir)/dri. Ati's libGL does the same
403 + # thing, but the hardcoded location is /usr/X11R6/lib/modules/dri
404 + # on x86 and amd64 32bit, /usr/X11R6/lib64/modules/dri on amd64
405 + # 64bit. So we can either put the .so files in that (unusual,
406 + # compared to "normal" mesa libGL) location or set
407 + # LIBGL_DRIVERS_PATH. We currently do the latter. See also bug
408 + # 101539.
409 +
410 + # The problem with this approach is that LIBGL_DRIVERS_PATH
411 + # *overrides* the default hardcoded location, it does not extend
412 + # it. So if ati-drivers is merged but a non-ati libGL is selected
413 + # and its hardcoded path does not match our LIBGL_DRIVERS_PATH
414 + # (because it changed in a newer mesa or because it was compiled
415 + # for a different set of multilib abis than we are) stuff breaks.
416 +
417 + # We create one file per ABI to work with "native" multilib, see
418 + # below.
419 +
420 + echo "COLON_SEPARATED=LIBGL_DRIVERS_PATH" > "${T}/03ati-colon-sep"
421 + doenvd "${T}/03ati-colon-sep" || die
422 +
423 + # All libraries that we have a 32 bit and 64 bit version of on
424 + # amd64 are installed in src_install-libs. Everything else
425 + # (including libraries only available in native 64bit on amd64)
426 + # goes in here.
427 +
428 + # There used to be some code here that tried to detect running
429 + # under a "native multilib" portage ((precursor of)
430 + # http://dev.gentoo.org/~kanaka/auto-multilib/). I removed that, it
431 + # should just work (only doing some duplicate work). --marienz
432 + if has_multilib_profile; then
433 + local OABI=${ABI}
434 + for ABI in $(get_install_abis); do
435 + src_install-libs
436 + done
437 + ABI=${OABI}
438 + unset OABI
439 + else
440 + src_install-libs
441 + fi
442 +
443 + # This is sorted by the order the files occur in the source tree.
444 +
445 + # X modules.
446 + exeinto /usr/$(get_libdir)/xorg/modules/drivers
447 + doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
448 + exeinto /usr/$(get_libdir)/xorg/modules/linux
449 + doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/linux/libfglrxdrm.so
450 + exeinto /usr/$(get_libdir)/xorg/modules
451 + doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/{glesx.so,amdxmm.so}
452 +
453 + # Arch-specific files.
454 + # (s)bin.
455 + into /opt
456 + dosbin "${ARCH_DIR}"/usr/sbin/atieventsd
457 + use qt4 && dosbin "${ARCH_DIR}"/usr/sbin/amdnotifyui
458 + dobin "${ARCH_DIR}"/usr/bin/clinfo
459 + # We cleaned out the compilable stuff in src_unpack
460 + dobin "${ARCH_DIR}"/usr/X11R6/bin/*
461 +
462 + # Common files.
463 + # etc.
464 + insinto /etc/ati
465 + exeinto /etc/ati
466 + # Everything except for the authatieventsd.sh script.
467 + doins ${FOLDER_PREFIX}etc/ati/{logo*,control,atiogl.xml,signature,amdpcsdb.default}
468 + doexe ${FOLDER_PREFIX}etc/ati/authatieventsd.sh
469 +
470 + # include.
471 + insinto /usr
472 + doins -r ${FOLDER_PREFIX}usr/include
473 + insinto /usr/include/X11/extensions
474 +
475 + # Just the atigetsysteminfo.sh script.
476 + into /usr
477 + dosbin ${FOLDER_PREFIX}usr/sbin/*
478 +
479 + # data files for the control panel.
480 + if use qt4 ; then
481 + insinto /usr/share
482 + doins -r ${FOLDER_PREFIX}usr/share/ati
483 + insinto /usr/share/pixmaps
484 + doins ${FOLDER_PREFIX}usr/share/icons/ccc_large.xpm
485 + make_desktop_entry amdcccle 'AMD Catalyst Control Center' \
486 + ccc_large System
487 + fi
488 +
489 + # doc.
490 + dohtml -r ${FOLDER_PREFIX}usr/share/doc/fglrx
491 +
492 + doman ${FOLDER_PREFIX}usr/share/man/man8/atieventsd.8
493 +
494 + pushd ${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi > /dev/null
495 +
496 + exeinto /etc/acpi
497 + doexe ati-powermode.sh
498 + insinto /etc/acpi/events
499 + doins events/*
500 +
501 + popd > /dev/null
502 +
503 + # Done with the "source" tree. Install tools we rebuilt:
504 + dobin extra/fgl_glxgears/fgl_glxgears
505 + newdoc extra/fgl_glxgears/README README.fgl_glxgears
506 +
507 + # Gentoo-specific stuff:
508 + newinitd "${FILESDIR}"/atieventsd.init atieventsd
509 + echo 'ATIEVENTSDOPTS=""' > "${T}"/atieventsd.conf
510 + newconfd "${T}"/atieventsd.conf atieventsd
511 +
512 + # PowerXpress stuff
513 + exeinto /usr/$(get_libdir)/fglrx
514 + doexe "${FILESDIR}"/switchlibGL || die "doexe switchlibGL failed"
515 + cp "${FILESDIR}"/switchlibGL "${T}"/switchlibglx
516 + doexe "${T}"/switchlibglx || die "doexe switchlibglx failed"
517 +}
518 +
519 +src_install-libs() {
520 + if [[ "${ABI}" == "amd64" ]]; then
521 + local EX_BASE_DIR="${BASE_DIR}_64a"
522 + local pkglibdir=lib64
523 + local MY_ARCH_DIR="${S}/arch/x86_64"
524 + local oclsuffix=64
525 + else
526 + local EX_BASE_DIR="${BASE_DIR}"
527 + local pkglibdir=lib
528 + local MY_ARCH_DIR="${S}/arch/x86"
529 + local oclsuffix=32
530 + fi
531 + einfo "ati tree '${pkglibdir}' -> '$(get_libdir)' on system"
532 +
533 + local ATI_ROOT=/usr/$(get_libdir)/opengl/ati
534 + # To make sure we do not miss a spot when these change.
535 + local libmajor=1 libminor=2
536 + local libver=${libmajor}.${libminor}
537 +
538 + # The GLX libraries
539 + # (yes, this really is "lib" even on amd64/multilib --marienz)
540 + exeinto ${ATI_ROOT}/lib
541 + newexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/fglrx/fglrx-libGL.so.${libver} \
542 + libGL.so.${libver}
543 + dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so.${libmajor}
544 + dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so
545 +
546 + exeinto ${ATI_ROOT}/extensions
547 + doexe "${EX_BASE_DIR}"/usr/X11R6/${pkglibdir}/modules/extensions/fglrx/fglrx-libglx.so
548 + mv "${D}"/${ATI_ROOT}/extensions/{fglrx-,}libglx.so
549 +
550 + # other libs
551 + exeinto /usr/$(get_libdir)
552 + # Everything except for the libGL.so installed some row above
553 + doexe $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
554 + -maxdepth 1 -type f -name '*.so*' -not -name '*libGL.so*')
555 + insinto /usr/$(get_libdir)
556 + doins $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
557 + -maxdepth 1 -type f -not -name '*.so*')
558 +
559 + # DRI modules, installed into the path used by recent versions of mesa.
560 + exeinto /usr/$(get_libdir)/dri
561 + doexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/modules/dri/fglrx_dri.so
562 +
563 + # AMD Cal and OpenCL libraries
564 + exeinto /usr/$(get_libdir)/OpenCL/vendors/amd
565 + doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libamdocl*.so*
566 + doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libOpenCL*.so*
567 + dosym libOpenCL.so.${libmajor} /usr/$(get_libdir)/OpenCL/vendors/amd/libOpenCL.so
568 + exeinto /usr/$(get_libdir)
569 + doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libati*.so*
570 +
571 + # OpenCL vendor files
572 + insinto /etc/OpenCL/vendors/
573 + cat > "${T}"/amdocl${oclsuffix}.icd <<-EOF
574 + /usr/$(get_libdir)/OpenCL/vendors/amd/libamdocl${oclsuffix}.so
575 + EOF
576 + doins "${T}"/amdocl${oclsuffix}.icd
577 +
578 + local envname="${T}"/04ati-dri-path
579 + if [[ -n ${ABI} ]]; then
580 + envname="${envname}-${ABI}"
581 + fi
582 + echo "LIBGL_DRIVERS_PATH=/usr/$(get_libdir)/dri" > "${envname}"
583 + doenvd "${envname}"
584 +
585 + # Silence the QA notice by creating missing soname symlinks
586 + for so in $(find "${D}"/usr/$(get_libdir) -maxdepth 1 -name *.so.[0-9].[0-9])
587 + do
588 + local soname=${so##*/}
589 + local soname_one=${soname%.[0-9]}
590 + local soname_zero=${soname_one%.[0-9]}
591 + dosym ${soname} /usr/$(get_libdir)/${soname_one}
592 + dosym ${soname_one} /usr/$(get_libdir)/${soname_zero}
593 + done
594 +
595 + # See https://bugs.gentoo.org/show_bug.cgi?id=443466
596 + dodir /etc/revdep-rebuild/
597 + echo "SEARCH_DIRS_MASK=\"/opt/bin/clinfo\"" > "${ED}/etc/revdep-rebuild/62-ati-drivers"
598 +
599 + #remove static libs if not wanted
600 + use static-libs || rm -rf "${D}"/usr/$(get_libdir)/libfglrx_dm.a
601 +
602 + #install xvba sdk headers
603 + doheader xvba_sdk/include/amdxvba.h
604 +
605 + if use pax_kernel; then
606 + pax-mark m "${D}"/usr/lib*/opengl/ati/lib/libGL.so.1.2 || die "pax-mark failed"
607 + fi
608 +}
609 +
610 +pkg_postinst() {
611 + elog "To switch to AMD OpenGL, run \"eselect opengl set ati\""
612 + elog "To change your xorg.conf you can use the bundled \"aticonfig\""
613 + elog
614 + elog "If you experience unexplained segmentation faults and kernel crashes"
615 + elog "with this driver and multi-threaded applications such as wine,"
616 + elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
617 + elog
618 + elog "Fully rebooting the system after an ${PN} update is recommended"
619 + elog "Stopping Xorg, reloading fglrx kernel module and restart Xorg"
620 + elog "might not work"
621 + elog
622 + elog "Some cards need acpid running to handle events"
623 + elog "Please add it to boot runlevel with rc-update add acpid boot"
624 + elog
625 +
626 + use modules && linux-mod_pkg_postinst
627 + "${ROOT}"/usr/bin/eselect opengl set --use-old ati
628 + "${ROOT}"/usr/bin/eselect opencl set --use-old amd
629 +
630 + if has_version "x11-drivers/xf86-video-intel[sna]"; then
631 + ewarn "It is reported that xf86-video-intel built with USE=\"sna\" causes the X server"
632 + ewarn "to crash on systems that use hybrid AMD/Intel graphics. If you experience"
633 + ewarn "this crash, downgrade to xf86-video-intel-2.20.2 or earlier or"
634 + ewarn "try disabling sna for xf86-video-intel."
635 + ewarn "For details, see https://bugs.gentoo.org/show_bug.cgi?id=430000"
636 + fi
637 +
638 + if use pax_kernel; then
639 + ewarn "Please run \"revdep-pax -s libGL.so.1 -me\" after installation and"
640 + ewarn "after you have run \"eselect opengl set ati\". Executacle"
641 + ewarn "revdep-pax is part of package sys-apps/elfix."
642 + fi
643 +}
644 +
645 +pkg_preinst() {
646 + use modules && linux-mod_pkg_preinst
647 +}
648 +
649 +pkg_prerm() {
650 + "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
651 +}
652 +
653 +pkg_postrm() {
654 + use modules && linux-mod_pkg_postrm
655 + "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
656 +}
657
658 diff --git a/x11-drivers/ati-drivers/files/ati-drivers-13.8-beta-include-seq_file.patch b/x11-drivers/ati-drivers/files/ati-drivers-13.8-beta-include-seq_file.patch
659 new file mode 100644
660 index 0000000..fb1ba17
661 --- /dev/null
662 +++ b/x11-drivers/ati-drivers/files/ati-drivers-13.8-beta-include-seq_file.patch
663 @@ -0,0 +1,13 @@
664 +diff --git a/common/lib/modules/fglrx/build_mod/firegl_public.c b/common/lib/modules/fglrx/build_mod/firegl_public.c
665 +index 22561c5..fdfe65e 100755
666 +--- a/common/lib/modules/fglrx/build_mod/firegl_public.c
667 ++++ b/common/lib/modules/fglrx/build_mod/firegl_public.c
668 +@@ -520,6 +520,8 @@ static int func##_wrap(char *buf, char **start, kcl_off_t offset, \
669 + }
670 +
671 + #else
672 ++#include <linux/seq_file.h>
673 ++
674 + #define READ_PROC_WRAP(func) \
675 + static int func##_wrap(struct seq_file *m, void* data) \
676 + { \
677
678 diff --git a/x11-drivers/ati-drivers/files/check-for-iommu-only-if-iommu-is-supported.patch b/x11-drivers/ati-drivers/files/check-for-iommu-only-if-iommu-is-supported.patch
679 new file mode 100644
680 index 0000000..7932487
681 --- /dev/null
682 +++ b/x11-drivers/ati-drivers/files/check-for-iommu-only-if-iommu-is-supported.patch
683 @@ -0,0 +1,31 @@
684 +From 1633d55aa0fb9c2ceb0ae1eab15bdec5066d35ae Mon Sep 17 00:00:00 2001
685 +From: Emil Karlson <jekarlson@×××××.com>
686 +Date: Fri, 2 Aug 2013 01:18:41 +0300
687 +Subject: [PATCH 1/3] Check for iommu only, if iommu is supported.
688 +
689 +---
690 + common/lib/modules/fglrx/build_mod/kcl_iommu.c | 4 +++-
691 + 1 file changed, 3 insertions(+), 1 deletion(-)
692 +
693 +diff --git a/common/lib/modules/fglrx/build_mod/kcl_iommu.c b/common/lib/modules/fglrx/build_mod/kcl_iommu.c
694 +index c6602dd..803455c 100755
695 +--- a/common/lib/modules/fglrx/build_mod/kcl_iommu.c
696 ++++ b/common/lib/modules/fglrx/build_mod/kcl_iommu.c
697 +@@ -183,11 +183,13 @@ void ATI_API_CALL KCL_IOMMU_UnbindPasid( KCL_PCI_DevHandle pcidev,int pasid)
698 + */
699 + int ATI_API_CALL KCL_IOMMU_CheckInfo( KCL_PCI_DevHandle pcidev)
700 + {
701 ++#if defined(CONFIG_INTEL_IOMMU) || defined(CONFIG_AMD_IOMMU)
702 + struct pci_dev* pdev = (struct pci_dev*)pcidev;
703 +- if ( pdev->dev.archdata.iommu )
704 ++ if ( pdev->dev.archdata.iommu )
705 + {
706 + return 1;
707 + }
708 ++#endif
709 + return 0;
710 + }
711 +
712 +--
713 +1.8.1.5
714 +