Similar to bug #1069694.

I have found out that the bug is somehow related to vgaswitcheroo. Here
is a way to reproduce it (installing lm-sensors is welcome):

1. Let's say you have both integrated and discrete. Then, `cat 
/sys/kernel/debug/vgaswitcheroo/switch` should give you something like
{{{0:DIS: :Pwr:0000:01:00.0
1:IGD:+:Pwr:0000:00:02.0}}}

2. If you `pm-suspend` now and resume, and then repeat step 1, you
should see the same results.

3. If you now try to turn ON the discrete card it should work well,
since it is already on and vgaswitcheroo is aware of this.

4. Now, turn discrete card off: `echo OFF > 
/sys/kernel/debug/vgaswitcheroo/switch`. If you read the status, it shoul render
{{{0:DIS: :Off:0000:01:00.0
1:IGD:+:Pwr:0000:00:02.0}}}

5. If you `pm-suspend` now and resume, you might get frozen screen.

6. If not, you can check vgaswitcheroo status, you'll see that discrete card is 
switched off:
{{{0:DIS: :Off:0000:01:00.0
1:IGD:+:Pwr:0000:00:02.0}}}

However, if you do `sensors` you'll see that discrete card reports it's
temperature - that is, it is on.

7. Now, if you try to turn it on by `echo ON >
/sys/kernel/debug/vgaswitcheroo/switch` you'll probably get freeze.

And since we know all this, we can create a workaround. Just make our discrete 
card turn on before suspend, and turn off in a few seconds after resume. In 
order to achieve this, just create file `/etc/pm/sleep.d/77_amd_toggle` with 
the following content:
{{{#!/bin/bash
# Script to disable and enable the discrete graphics card before suspend and 
after resume

case "${1}" in
suspend)
  # We turn it on before resume to prevent bugs
  echo ON > /sys/kernel/debug/vgaswitcheroo/switch
  ;;

resume)
  # Your GFX would freeze if you turn off discrete card immediately, that's why 
this delay:
  sleep 3
  # We turn it off after resume to save energy
  echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
  ;;
esac}}}

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1155501

Title:
  system hangs when switching between TTY and X (12.10)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/1155501/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to