NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.82k stars 13.92k forks source link

ATI driver trouble #687

Closed matejc closed 11 years ago

matejc commented 11 years ago

I was having trouble with ati_nonfree video driver. After rebuild and restart of computer I saw the frozen random colored pixels screen, like you see on the old analog TV when it has no usable signal.

After hours of debugging and searching for solution I finally got it with a lot of help from aszlig and vcunat.

vcunat even written me a patch: http://sprunge.us/IGdO and for safe keeping: https://gist.github.com/matejc/5877641

I then only hard coded the driver to this one:

http://support.amd.com/us/gpudownload/linux/Pages/radeon_linux.aspx direct link: http://www2.ati.com/drivers/linux/amd-driver-installer-catalyst-13-4-linux-x86.x86_64.zip

And with combination with this line in configuration.nix: hardware.firmware = [ pkgs.radeonR600 pkgs.radeonR700 ];

Pros: It now works! :)

Cons: It works only with 3.2 kernel, with 3.4, 3.7, 3.8 and 3.9 there is the same result as written on beginning of this ticket.

I have to thank for the help on the IRC to aszlig and vcunat for the patch. I didn't create a push request, because I do not have time right now, so I opened a ticket and even this one with delay - sorry.

vcunat commented 11 years ago

cc @MarcWeber @aszlig

I hope this should be fixed here https://github.com/vcunat/nixpkgs/compare/vlada;ati.

Now it does build with 3.8 (release notes don't mention newer kernels, so they are likely not to work).

matejc commented 11 years ago

I tried it... well see for yourself: Image of my computer

This happens with kernel => 3.4, with 3.2 works fine... ... or does it? Here is the output of glxinfo:

$ glxinfo
name of display: :0.0
X Error of failed request:  BadRequest (invalid request code or no such operation)
  Major opcode of failed request:  155 (GLX)
  Minor opcode of failed request:  19 (X_GLXQueryServerString)
  Serial number of failed request:  16
  Current serial number in output stream:  16

dmesg doesn't show anything new when I run glxinfo. But there are errors in it: https://gist.github.com/anonymous/5888565 To be exact:

[   14.902644] [fglrx] ATIF platform detected with notification ID: 0x81
[   14.907826] [fglrx:firegl_get_console_mode_info] *ERROR* Get Console Mode failed
[   15.183446] mtrr: your BIOS has configured an incorrect mask, fixing it.

To be exact there is one more issue that I have, now I think it might be related: I can NOT get to the any of the ttyX, even enabled manual on 8 is unreachable - it is just a blank screen.

Thanks!

vcunat commented 11 years ago

What HW is that? I believe the X log usually has the most useful info.

matejc commented 11 years ago

There are two graphics cards in the laptop and I switched off the second one long time ago, I am using integrated graphics on the CPU: http://www.notebookcheck.net/AMD-A-Series-A8-4500M-Notebook-Processor.74884.0.html Second graphics card is: AMD Radeon HD 7670M 1GB,GDDR5, which I would like to test and use but for now I think the priority is on the integrated one. Here is the X log: https://gist.github.com/anonymous/5891064

offlinehacker commented 11 years ago

What about these lines:

(EE) AIGLX error: failed to load OpenGL driver (EE) AIGLX: reverting to software rendering

In my miner rig configuration with ATI cards i had to do this, because this has still not yet been patched:

Fix dri and link fglrx_dri.so

system.activationScripts.drifix = ''

  # Create the required /usr/lib/dri/fglrx_dri.so;
  mkdir -p /usr/lib/dri
  ln -fs /run/opengl-driver/lib/fglrx_dri.so /usr/lib/dri/fglrx_dri.so
'';

On Sat, Jun 29, 2013 at 3:33 PM, Matej Cotman notifications@github.comwrote:

There are two graphics cards in the laptop and I switched off the second one long time ago, I am using integrated graphics on the CPU: http://www.notebookcheck.net/AMD-A-Series-A8-4500M-Notebook-Processor.74884.0.html Second graphics card is: AMD Radeon HD 7670M 1GB,GDDR5, which I would like to test and use but for now I think the priority is on the integrated one. Here is the X log: https://gist.github.com/anonymous/5891064

— Reply to this email directly or view it on GitHubhttps://github.com/NixOS/nixpkgs/issues/687#issuecomment-20229881 .

vcunat commented 11 years ago

True, there were some comments about this in the source. Not very nice thing, but better than not working at all.

matejc commented 11 years ago

Hi offline, long time no see, must have a drink sometime soon..

As long as we are making symbolic link.. first file has to exists? I do not have this file /run/opengl-driver/lib/fglrx_dri.so

But...

$ sudo find / -name "fglrx_dri.so"
/nix/store/fcdfkrbdva5hrnn1yccynb7nfrajlz73-ati-drivers-12-8-3.9.7/lib/dri/fglrx_dri.so
/nix/store/8r0vgsg12ivzc65d9hzdbp12iad1idcr-ati-drivers-10-11-x86-3.2.47/lib/dri/fglrx_dri.so
/nix/store/8r0vgsg12ivzc65d9hzdbp12iad1idcr-ati-drivers-10-11-x86-3.2.47/lib/fglrx_dri.so
/nix/store/22x4zl06vcqcm6zqy4dgcb0wfkpjzm46-system-path/lib/fglrx_dri.so
/nix/store/h0ljnh0f7wxmkxmzh89410dp6q63nq8c-system-path/lib/fglrx_dri.so
/nix/store/krivnksqcrsd7bkc3z1jdrnzycvprxxq-ati-drivers-13-4-3.2.47/lib/dri/fglrx_dri.so
/nix/store/dh6dy7931sg7f1vcirr72kga301z79hj-ati-drivers-12-8-3.2.47/lib/dri/fglrx_dri.so
/nix/store/4r5hn39ph1zygsiqvvivdccyf8wcayia-ati-drivers-12-8-3.8.13/lib/dri/fglrx_dri.so
/nix/store/3dynw02g31gn48yghxm29jirrjkc5jvn-ati-drivers-10-11-x86-3.2.47/lib/dri/fglrx_dri.so
/nix/store/3dynw02g31gn48yghxm29jirrjkc5jvn-ati-drivers-10-11-x86-3.2.47/lib/fglrx_dri.so
/nix/store/8g3dn76rfs888rgyqv6rabyybhyvfyjb-ati-drivers-10-11-x86-3.2.47/lib/dri/fglrx_dri.so
/nix/store/8g3dn76rfs888rgyqv6rabyybhyvfyjb-ati-drivers-10-11-x86-3.2.47/lib/fglrx_dri.so
/nix/store/424f2skpwvnhdjidvhz8kqlcbc2n4a0a-kernel-modules/lib/fglrx_dri.so
/nix/store/p012n8r579h7iz4ihngczkgnnaix5np2-ati-drivers-12-8-3.2.47/lib/dri/fglrx_dri.so
/nix/store/ccfv7jy0qf5yj0jf4bivr0vjh9nf3kzi-kernel-modules/lib/fglrx_dri.so
/nix/store/ggd77pm48k2a2x7hsb5x3w5i7j11fjk4-ati-drivers-10-11-x86-3.2.47/lib/dri/fglrx_dri.so
/nix/store/ggd77pm48k2a2x7hsb5x3w5i7j11fjk4-ati-drivers-10-11-x86-3.2.47/lib/fglrx_dri.so
/nix/store/5pwslr35xdqws9xgv85njrr1pgymaad0-ati-drivers-12-8-3.2.47/lib/dri/fglrx_dri.so
/nix/store/2ga2ly9wixaa2g2xc616cq4plhg1y9gw-kernel-modules/lib/fglrx_dri.so
/nix/store/qc2zadlk3hd6dnfrlzcikqpnzajdy7ni-ati-drivers-13-4-3.4.47/lib/dri/fglrx_dri.so
/nix/store/jf9g9rl0g22a6f76rnjlq78b5rwdybpd-system-path/lib/fglrx_dri.so
/nix/store/g3sy1b6d9l6fsvn60n5i7l6c22nzfhs3-system-path/lib/fglrx_dri.so
/nix/store/731q360h0s2hh3qvrpsdi6z56ah8q068-ati-drivers-12-8-3.4.47/lib/dri/fglrx_dri.so
/nix/store/q0ncxama03rk88lbpnz1gmypzlrdyrkk-ati-drivers-13-4-3.8.13/lib/dri/fglrx_dri.so
/nix/store/cx7i69cjsgrqhy0xw2n7ssgv1gi2qxb3-kernel-modules/lib/fglrx_dri.so
matejc commented 11 years ago

I have been playing around with offline's code...

  # Fix dri and link fglrx_dri.so
  system.activationScripts.drifix = ''
      # Create the required /usr/lib/dri/fglrx_dri.so;
      mkdir -p /usr/lib/dri
      ln -fs /run/opengl-driver/lib/dri/fglrx_dri.so /usr/lib/dri/fglrx_dri.so
  '';

This changes everything (tested only on kernel 3.2)! Trying other kernels.. will report...

Thanks!

matejc commented 11 years ago

After linking fglrx_dri.so:

Report for kernel 3.2: glxinfo: https://gist.github.com/anonymous/5895892 x-0.log: https://gist.github.com/anonymous/5895905 dmesg: https://gist.github.com/anonymous/5895912

xonotic-sdl actualy runs now xrandr output (same as before):

$ xrandr --output LVDS --mode 1366x768 --pos 0x0 --output CRT1 --mode 1920x1080 --pos 1366x0
xrandr: screen cannot be larger than 1920x1920 (desired size 3286x1080)

I did this a long time ago:

virtualScreen = { x = 3286; y = 1080; };

Other kernels (well... tested only with 3.4 and 3.8) have this result

offlinehacker commented 11 years ago

Yes we could go for a drink/lunch, will write you on irc. Btw, will you go to nixos sprint?

Is this necessary?

hardware.firmware = [ pkgs.radeonR600 pkgs.radeonR700 ];

As far as i know ati_unfree provides it-s own firmwares and these are opensource ones.

What's the output from xorg log when you run with 3.4 and 3.8 kernels. Same as before? What do you think is the actual problem? Is fgrlx_dri.si really found and is it the right version?

matejc commented 11 years ago

I removed this line:

hardware.firmware = [ pkgs.radeonR600 pkgs.radeonR700 ];

Now with 3.2 kernel I can not set the second monitor to 1920x1080 because the max resolution for all screens combined is now 1600x1600

Kernel 3.4 has the same problem as before.

I finally enabled openssh server on that laptop and reboot it in 3.4 kernel so there I can get current logs, hoping to find some errors.

x-0.log: https://gist.github.com/anonymous/5912264 lightdm.log: https://gist.github.com/anonymous/5912280 dmesg: https://gist.github.com/anonymous/5912296

dmesg is interesting:

[   13.875340] [drm] Loading ARUBA Microcode
[   13.876852] ni_cp: Failed to load firmware "radeon/ARUBA_pfp.bin"
[   13.876942] [drm:cayman_startup] *ERROR* Failed to load firmware!
[   13.877016] radeon 0000:00:01.0: disabling GPU acceleration
matejc commented 11 years ago

Found it: http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/x11-drivers/radeon-ucode/radeon-ucode-20130626.ebuild?view=markup and then: http://people.freedesktop.org/~agd5f/radeon_ucode/

Anyone care to create a package or show me some package for example how to create one with firmware?

matejc commented 11 years ago

I did the package: https://gist.github.com/anonymous/5913594 and then:

hardware.firmware = [ pkgs.radeonARUBA ];

all of this on kernel 3.4 computer hangs before it reaches ssh server, but there is a bright side.. on both monitors I have optimal resolution 1366x786 (looks like that) and 1920x1080 (the monitor has info button on remote control)

well it hangs on the screen when it is checking/loading services

[ OK ] Something ....
[ OK ] Something else ...

or something like that... I disabled the last service, but it stops on some other service

It hangs the same way on 3.8 kernel also.

How can I get to dmesg on this point? I am running out of ideas...

matejc commented 11 years ago

@vcunat could you pack version 13.1 instead of 13.4, please? You are good at this and the builder.sh is a mystery for me. The version 13.4 is know to have bugs with ttyX, maybe this fixes the other problems also (like: 3.4 kernel issue). Here is the link: http://support.amd.com/us/gpudownload/windows/previous/13/Pages/radeon_linux.aspx?os=Linux%20x86&rev=13.1

vcunat commented 11 years ago

I'm currently out of time, which might easily persist for a week at least. To change version it should be enough to change just the attributes version and sha256. I was (and still am) oblivious to most of the workings of builder :-) I suppose it's the work of @MarcWeber.

offlinehacker commented 11 years ago

Why are you loading opensource firmware with proprieraty ati drivers. Ati should and does provide their own firmware with ati_unfree. i never had to do that.

matejc commented 11 years ago

@vcunat I did change version and sha256 but it fails to build

I tried opensource ATI driver and this firmware package I made and it works:

I do not know what is up with proprietary drivers... but opensource driver works for me, therefore I think this issue should be closed, unless someone wants to fix somehow ati_unfree package. (I will not close this issue because ati_unfree is not in working state, when I opened the issue I talked about proprietary driver and somehow it is not fair to people who want to use it)

Thanks everyone that helped me on this!

vcunat commented 11 years ago

@matejc: I understood the open-source driver didn't work before (for you), where was the problem?

matejc commented 11 years ago

I saved the gist to my account for safe keeping: https://gist.github.com/matejc/5917979 Will make a pull request (and fix my git problem) in a few days

@vcunat I think the problem was in the firmware, because that is the only thing changed as first time I tried opensource driver

vcunat commented 11 years ago

Ah, so I suppose we should improve nixos-hardware-scan for ATI graphics.

mornfall commented 11 years ago

Today, mm_freak in #nixos ran into a related problem, where X was being very sluggish (presumably also related to missing firmware). See also https://github.com/NixOS/nixos/pull/87

domenkozar commented 11 years ago

This can be now closed (ati drivers are upgraded). If issue persists, open a new one.