PDA

View Full Version : patch: vanilla fglrx for 2.6.29


damentz
03-24-2009, 03:50 PM
Someone released a giant patch for fglrx that makes it compatible with 2.6.29.

Well, I really don't know how they do it, but for some reason their patches have so many offset errors and doesn't work out of the box. They even copied the kernel headers from their kernel and put them into the patch... WTF, hahahaha. So the Mandriva guys fixed it (thanks!) and i modified the patch to work stand alone - as in, you extract the fglrx .run file and do patch -p1 < ../patch.file.

Please, the next person who makes a patch... it would be really nice if you could explain to us how you always seem to have a different source than the rest of us as the patches never seem work the first time.

It's as if the patches are designed to infuriate users or try to spread FUD over fglrx. Whatever the deal, it works, so keep it up if that's your objective!

Anyway, fixed the patch, gg noobs:

diff -Nparu a/common/lib/modules/fglrx/build_mod/firegl_public.c b/common/lib/modules/fglrx/build_mod/firegl_public.c
--- a/common/lib/modules/fglrx/build_mod/firegl_public.c 2009-01-23 20:00:26.000000000 -0200
+++ b/common/lib/modules/fglrx/build_mod/firegl_public.c 2009-02-13 15:25:00.000000000 -0200
@@ -1460,7 +1460,11 @@ KCL_TYPE_Pid ATI_API_CALL KCL_GetTgid(vo
*/
KCL_TYPE_Uid ATI_API_CALL KCL_GetEffectiveUid(void)
{
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)
+ return current->cred->euid;
+#else
return current->euid;
+#endif
}

/** /brief Delay execution for the specified number of microseconds
@@ -1832,15 +1836,30 @@ int ATI_API_CALL KCL_PosixSecurityCapChe
*/
void ATI_API_CALL KCL_PosixSecurityCapSetIPCLock(unsigned int lock)
{
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)
+ struct cred *new = prepare_creds();
+ if (!new) {
+ printk(KERN_ERR "fglrx: could not allocate memory\n");
+ return;
+ }
+#else
+#define new current
+#endif
if (lock == 0 )
{
- cap_lower(current->cap_effective, CAP_IPC_LOCK);
+ cap_lower(new->cap_effective, CAP_IPC_LOCK);
}
else
{
- cap_raise(current->cap_effective, CAP_IPC_LOCK);
+ cap_raise(new->cap_effective, CAP_IPC_LOCK);
}
- return;
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)
+ commit_creds(new);
+#else
+#undef new
+#endif
}

/** \brief Get number of available RAM pages
diff -Nparu a/common/lib/modules/fglrx/build_mod/firegl_public.h b/common/lib/modules/fglrx/build_mod/firegl_public.h
--- a/common/lib/modules/fglrx/build_mod/firegl_public.h 2009-01-23 20:00:26.000000000 -0200
+++ b/common/lib/modules/fglrx/build_mod/firegl_public.h 2009-02-16 14:02:50.000000000 -0300
@@ -18,6 +18,7 @@
#define _FIREGL_PUBLIC_H_

#include <stdarg.h>
+#include <asm/pgtable.h>
#include "kcl_pci.h"
#include "kcl_io.h"

@@ -590,6 +591,11 @@ extern unsigned long KCL_SYSINFO_
#define cpu_has_pge test_bit(X86_FEATURE_PGE, &boot_cpu_data.x86_capability)
#endif

+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)
+#undef pgprot_writecombine
+#undef pgprot_noncached
+#endif
+
#ifndef pgprot_writecombine
#define pgprot_writecombine(prot) __pgprot((pgprot_val(prot) & ~(_PAGE_PCD)) | _PAGE_PWT)
#endif
@@ -598,6 +604,7 @@ extern unsigned long KCL_SYSINFO_
#define pgprot_noncached(prot) __pgprot(pgprot_val(prot) | _PAGE_PCD | _PAGE_PWT)
#endif

+
#endif //FIREGL_USWC_SUPPORT


diff -Nparu a/common/lib/modules/fglrx/build_mod/kcl_acpi.c b/common/lib/modules/fglrx/build_mod/kcl_acpi.c
--- a/common/lib/modules/fglrx/build_mod/kcl_acpi.c 2009-01-23 20:00:26.000000000 -0200
+++ b/common/lib/modules/fglrx/build_mod/kcl_acpi.c 2009-02-13 15:25:00.000000000 -0200
@@ -18,6 +18,12 @@
#include <linux/autoconf.h>
#include <linux/acpi.h>

+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)
+#include <acpi/acpica/acconfig.h>
+#include <acpi/acpica/aclocal.h>
+#include <acpi/acpica/acobject.h>
+#endif
+
#include "kcl_config.h"
#include "kcl_type.h"
#include "kcl_acpi.h"
#include "kcl_acpi.h"




PS, add an empty return line to this patch otherwise you'll get a "patch ended unexpectedly" error or related.

Kano
03-24-2009, 04:15 PM
Looks better, then you provide the url to that patch. Must be from a dkms package I guess.

gfxdrone
03-24-2009, 05:08 PM
patch runs, but module build on 32 bit Debian Sid fails at: /lib/modules/fglrx/build_mod/2.6.x/kcl_acpi.o, ati module builder exits with error, X fails to start though it doesn't totally fail, there is something there, but not usable.

ctrl alt f1 works to return to console.

Update: kcl_acpi.o module builder requires the missing files acpi/acpica/acconf.h, aclocal.h, and acobject.h

This error is shown in the ati installer error logs, so that's the problem, it's why that acpi part fails. So those things need to go somewhere or other, and not be removed.

damentz
03-24-2009, 05:19 PM
Kano pointed out earlier:

+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)
+#include <acpi/acpica/acconfig.h>
+#include <acpi/acpica/aclocal.h>
+#include <acpi/acpica/acobject.h>
+#endif


These headers don't actually exist, so they were copied from the kernel source - that's why the previous patch was so large.

DeX77
03-24-2009, 05:41 PM
Perhaps you should have a look at: /usr/src/linux/drivers/acpi/acpica ;)

PuckPoltergeist
03-24-2009, 05:51 PM
Kano pointed out earlier:



These headers don't actually exist, so they were copied from the kernel source - that's why the previous patch was so large.

The problem is, most of the code fglrx uses was made private to the kernel in 2.6.29.

damentz
03-24-2009, 06:02 PM
Ok, new patch -> http://liquorix.net/patches/

It's a modification of Kano's, same procedure as the original patch.

Kano
03-24-2009, 06:35 PM
The problem is that Debian/Ubuntu header packages are just wrong and do not include the new acpi dir.

Smorg
03-24-2009, 09:33 PM
1) Is this safe?
2) Will ati be releasing their own fix for this anytime soon?

FunkyRider
03-24-2009, 11:27 PM
But does it work on X-Server 1.6?

acolomb
03-25-2009, 12:06 AM
Ok, new patch -> http://liquorix.net/patches/

It's a modification of Kano's, same procedure as the original patch.

I've just successfully compiled and used the Catalyst 8.12-4 driver package from Debian stable with the 2.6.29 kernel. The above patch also worked for the older kernel module sources.

This is a workaround for http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=513222 which also affects me with my Radeon HD 3650. Shame on AMD for this regression ever since 9.1 (even 8.12 for some users apparently)! I hope it will be fixed with their next release.

Regards, Andre

Kano
03-25-2009, 03:47 AM
This patch has nothing to do with xserver 1.6 support, only with 2.6.29 support. The huge patch is basically wrong, it only shows a packageing problem within the header packages which do not ship with the new acpi subdir.

Sril
03-25-2009, 03:51 PM
Hi,

Patch from liquorix.net applied and compile fine, but the patch simply reboot the debian(unstable) linux(2.6.29) X Window(1.4.2) box(Amd64X2).

Best regards.
See ya.

acolomb
03-25-2009, 06:14 PM
My success story from last night was tainted this morning when X froze up the computer again. The changes since then had been an update of libdrm2 from Debian version 2.4.4+git+20090205+8b88036-1 to 2.4.5-1 and module-init-tools 3.4-1 to 3.7-pre9-1.

I don't think the latter has anything to do with the problem (although there were some warning messages about module symbols on the console). Anyway, reverting those two packages to their prior versions made the patched fglrx 8.12-4 driver work with kernel 2.6.29 again.

Hope this helps somebody to regain their GUI :-)

tettamanti
03-25-2009, 06:17 PM
The problem is that Debian/Ubuntu header packages are just wrong and do not include the new acpi dir.
Well, they are not wrong, the headers expose internal details of the interpreter and have been made private.

Kano
03-25-2009, 06:24 PM
Thats nice, but when that crappy driver wants em, what do do? I added those to the kernel header package and did not include em in my script. But the example code from mandriva did not work - and i doubt it will ever work even with mandriva that way because they are not in the includes dir but in the drivers dir. A bad hack would be using ../drivers/ then.

tettamanti
03-25-2009, 06:56 PM
Thats nice, but when that crappy driver wants em, what do do?

Rework using the proper API: for getting the child (the code assumes that there's only one...) you can use acpi_get_next_object, the notifier part is harder to fix since there's no API for updating the context nor the handler of an event... you'd have to write it. Or go for a workaround:

A bad hack would be using ../drivers/ then.

Well it seems that the only problem is the acpi_namespace_node struct, so maybe you can just put a definition of that in one of ATI's headers.

Kano
03-25-2009, 07:06 PM
Good idea, please provide a nicer patch then :)

tettamanti
03-27-2009, 09:20 AM
Good idea, please provide a nicer patch then :)
I'm somewhat uninterested in fixing the closed source driver :rolleyes:

Vighy
03-27-2009, 11:14 AM
I'm somewhat uninterested in fixing the closed source driver :rolleyes:

you lazy italian!
(Anche io lo sono, e ti capisco :D :P)

mewtwo
03-27-2009, 05:49 PM
I tried to install fglrx 9.3 on the 2.6.29 32bit kernel, I applied the 'big and ugly' patch, however, the kernel module got compiled and can be loaded.

[fglrx] Maximum main memory to use for locked dma buffers: 1898 MBytes.
[fglrx] vendor: 1002 device: 7280 count: 1
[fglrx] ioport: bar 4, base 0x7000, size: 0x100
[fglrx] Kernel PAT support detected, disabling driver built-in PAT support
[fglrx] module loaded - fglrx 8.59.2 [Mar 13 2009] with 1 minors

Still, I don't get X running with it

(EE) fglrx(0): [FB] Can not get FB MC address range.
(EE) fglrx(0): atiddxDriScreenInit failed, GPS not been initialized.
(EE) fglrx(0): XMM failed to open CMMQS connection.
(EE) fglrx(0): firegl_SetSuspendResumeState FAILED -9.
(EE) fglrx(0): firegl_GetSuspendResumeState FAILED -9.

The Card used is a X1950Pro.

Phlogiston
03-30-2009, 07:28 PM
Thats what I get when I try to load it:

[fglrx] Maximum main memory to use for locked dma buffers: 1412 MBytes.
[fglrx:drm_alloc] *ERROR* [driver] Allocating 0 bytes
[fglrx:firegl_init_device_list] *ERROR* Out of memory when allocating device heads
[fglrx:firegl_init_module] *ERROR* firegl_init_devices failed

I get this on .28 as well without patch...

Snacksou
04-01-2009, 10:14 AM
Hello everybody,

i've also tried to install 2.6.29 kernel with fglrx driver and i also get an error, probably the same as mentionned before. I also tried to patch with this (http://liquorix.net/patches/FGLRX-2.6.29-9.2-5.diff) one but i'm not able to find the files. I get an error line 11 with this:

a/common/lib/modules/fglrx/build_mod/2.6.x/Makefile


i searched in /usr/src/linux-source-2.6.29 and in modules but i didn't find them. Can anyone tell me where are they ?

Thks.

Kano
04-01-2009, 12:22 PM
The patch is not against the kernel, it is against fglrx (extracted).

Snacksou
04-01-2009, 03:20 PM
The patch is not against the kernel, it is against fglrx (extracted).

i've installed fglrx-driver and fglrx-driver-src, i've extracted it and so there is a tree like this:

$ cd /usr/src
$ tar xvjf fglrx.tar.bz2
$ cd modules/fglrx
$ ls
debian
drm_compat.h
drm.h
drm_os_linux.h
drmP.h
drm_proc.h
...
firegl_public.c
firegl_public.h
...
kcl_agp.c
...
kcl_io.c
...
Makefile
make.sh


so i think i've got a right tree but there's not any folder like:

a/common/lib/modules/fglrx/build_mod/common/lib/common/lib/modules/fglrx/build_mod/modules/fglrx/build_mod/2.6.x/


in line 8. Is there other source i haven't dl or i'm stupid ?

Can you exactly explain me what is to way to do. Sorry for this, i've never used any patch or things like that.

Thanks a lot.

P.S: i've forget to precise that i'm on Debian testing 64 on an Turion64.

Snacksou
04-02-2009, 08:13 AM
Sorry to replay but have you got any idea or suggestions ?

Is it the package fglrx come from debian or another one or...?

Thanks.

Sril
04-02-2009, 10:52 AM
Hi,

I'm sorry to made mystakes, the patch were and is correct, independantly where the sources come from.

The trouble which froze X Window come from libdrm 2.4.5. This will be probably fixed with libdrm 2.4.6.

So, get the libdrm 2.4.4, then configure, make, make install. All library files goes by default to /usr/local/lib which comes _before_ /usr/lib !

Don't forgot ldconfig if you don't want to reboot your linux box.

see http://groups.google.com/group/linux.debian.bugs.dist/browse_thread/thread/60aa10174b98bd72/93dd78e4def45058?lnk=raot

or google.com/linux === query ===> fglrx libdrm

See ya.
Sril

Nota : libdrm on freedesktop.org !

http://dri.freedesktop.org/libdrm/libdrm-2.4.4.tar.bz2
MD5: c183ee614b25f61ea325d57882a2fab2 libdrm-2.4.4.tar.bz2
SHA1: 5da1a685d2028168e87c6e2855fb7cca00a02aed libdrm-2.4.4.tar.bz2

http://dri.freedesktop.org/libdrm/libdrm-2.4.4.tar.gz
MD5: b83c65c87329127ab1e714c661a7f8b9 libdrm-2.4.4.tar.gz
SHA1: 4b904e4eafc368d9f1b827a7439fc80a41746cb3 libdrm-2.4.4.tar.gz

Sril
04-02-2009, 10:59 AM
Hi,

Patch works fine.

Take a look at : http://groups.google.com/group/linux.debian.bugs.dist/browse_thread/thread/60aa10174b98bd72/93dd78e4def45058?lnk=raot

Error come from libdrm, see : http://dri.freedesktop.org/libdrm

Don't forgot ldconfig if you don't want to reboot.

See ya.
Sril

DeX77
04-03-2009, 06:17 AM
Hi,

Error come from libdrm, see : http://dri.freedesktop.org/libdrm

See ya.
Sril

FYI: fglrx 9.3 on kernel 2.6.28.x with libdrm 2.4.5 is not affected.