ON to vgaswitcheroo/switch causes Mux to switch to ATI

Bug #1077675 reported by Kevin M
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Expired
Medium
Unassigned

Bug Description

The problem is reproducible on my ACER 3820 Notebook. switching the GPU via:
# echo "DDIS" > /sys/kernel/debug/vgaswicheroo
and:
# echo "DIGD" > /sys/kernel/debug/vgaswicheroo
works fine as root user. After the next restart the active GPU is the chosen one (marked in VGA switcheroo with a + and shown by glxinfo | grep vendor). When i stop lightdm and thus the Xwindow system i can also use:
# echo "DIS" > /sys/kernel/debug/vgaswicheroo
and:
# echo "IGD" > /sys/kernel/debug/vgaswicheroo
from the shell and the GPU is changed directly and everything works fine. However, as soon as I switch the ATI (DIS) off, I start running into problems. The moment I issue the command:
# echo "ON" > /sys/kernel/debug/vgaswicheroo
the screen goes black. It doesnt matter if X is active or not. The system is not crashing, but only not displaying anything any more. When I use the echo ON command in a script and use cat /sys/kernel/debug/vgaswitcheroo before and after the the echo ON, I can see that the discrete card changes state from Off to Pwr. The "+" still marks the IGD. On the X-window system I could not really find a way to recover and had to reisub.
On the console however (lightdm stopped) I could type echo "DIS" > /sys/kernel/debug/vgaswicheroo and the screen came back. Note that echo "IGD" > /sys/kernel/debug/vgaswicheroo does not work (since vgaswicheroo seems to think that the integrated card is already connected to the screen and does nothing). I can see the same effect when having the discrete card deactivated (Off) and using DIGD under X. I assume that is uses the same routine as ON, thus causing the same problem. Once I restart X again, (blindly using sysreq+K) the display comes back with the discrete card in use. Please note that switching having the dicrete card active (and connected) and the internal one switched off (power off) does not result in problems. One can use ON and DIGD and there is no problem. I now assume that in this particular notebook powering up the ATI card does change the mux(es) to this card. However, the switcheroo program/module/whatever does not notice this change and thus cannot be recovered without switching the gpu. Unfortunately this also effects my ability to use standby since (for whatever reason) one has to switch the discrete card on before going into sleep (either via a sleep.d or a rc0.d script). My suggestion for a fix is to either set the muxes to the currently active card right after switching the inactive one to ON.

WORKAROUND: WORKAROUND: /usr/lib/pm-utils/sleep.d/95switcheroo/sleep.d :
#!/bin/sh
[ -f /sys/kernel/debug/vgaswitcheroo/switch ] || exit $NA
case "$1" in
        hibernate|suspend)
                echo ON > /sys/kernel/debug/vgaswitcheroo/switch
                if grep -c 'IGD:+:Pwr' /sys/kernel/debug/vgaswitcheroo/switch
                then
                    echo MIGD > /sys/kernel/debug/vgaswitcheroo/switch
                fi
                ;;
        thaw|resume)
                echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
                ;;
        *) exit $NA
                ;;
esac

add:
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch

to /etc/rc.local

ProblemType: Bug
DistroRelease: Ubuntu 12.10
Package: linux-image-3.5.0-18-generic 3.5.0-18.29
ProcVersionSignature: Ubuntu 3.5.0-18.29-generic 3.5.7
Uname: Linux 3.5.0-18-generic x86_64
NonfreeKernelModules: wl
ApportVersion: 2.6.1-0ubuntu6
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC1: sumpfmensch 3041 F.... pulseaudio
 /dev/snd/controlC0: sumpfmensch 3041 F.... pulseaudio
CRDA: Error: command ['iw', 'reg', 'get'] failed with exit code 1: nl80211 not found.
Date: Sun Nov 11 18:00:21 2012
EcryptfsInUse: Yes
HibernationDevice: RESUME=UUID=ec5da51a-4745-4e26-98ae-d80f0ad6a1ef
InstallationDate: Installed on 2012-11-09 (2 days ago)
InstallationMedia: Ubuntu 12.10 "Quantal Quetzal" - Release amd64 (20121017.5)
MachineType: Acer Aspire 3820
MarkForUpload: True
ProcFB:
 0 radeondrmfb
 1 inteldrmfb
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-3.5.0-18-generic root=UUID=f564200f-27de-43a6-94dd-e7b3c76f9b9f ro quiet splash vt.handoff=7
PulseList:
 Error: command ['pacmd', 'list'] failed with exit code 1: Home directory /home/sumpfmensch not ours.
 No PulseAudio daemon running, or not running as session daemon.
RelatedPackageVersions:
 linux-restricted-modules-3.5.0-18-generic N/A
 linux-backports-modules-3.5.0-18-generic N/A
 linux-firmware 1.95
SourcePackage: linux
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 10/27/2010
dmi.bios.vendor: Phoenix Technologies LTD
dmi.bios.version: V1.19
dmi.board.asset.tag: No Asset Tag
dmi.board.name: JM31_CP
dmi.board.vendor: Acer
dmi.board.version: V1.19
dmi.chassis.asset.tag: No Asset Tag
dmi.chassis.type: 10
dmi.chassis.vendor: Acer
dmi.chassis.version: V1.19
dmi.modalias: dmi:bvnPhoenixTechnologiesLTD:bvrV1.19:bd10/27/2010:svnAcer:pnAspire3820:pvrV1.19:rvnAcer:rnJM31_CP:rvrV1.19:cvnAcer:ct10:cvrV1.19:
dmi.product.name: Aspire 3820
dmi.product.version: V1.19
dmi.sys.vendor: Acer

Revision history for this message
Kevin M (sumpfomat) wrote :
Revision history for this message
Brad Figg (brad-figg) wrote : Status changed to Confirmed

This change was made by a bot.

Changed in linux (Ubuntu):
status: New → Confirmed
Revision history for this message
Kevin M (sumpfomat) wrote :

Hey everybody,

I dug around in the source code of vga_switcheroo.c in the meantime and found the feature to only switch the Mux by passing MIGD and MDIS correspondingly. While issuing IGD, DIS, DDIS, DIGD or any combination of ON and OFFs in the sleep.d script did not work, passing MIGD does :) The screen comes back :)

Finally I got a working workaround (hehe) by writing the following sleep.d script (location: /usr/lib/pm-utils/sleep.d/95switcheroo):

#!/bin/sh

[ -f /sys/kernel/debug/vgaswitcheroo/switch ] || exit $NA

case "$1" in
        hibernate|suspend)
                echo ON > /sys/kernel/debug/vgaswitcheroo/switch
                if grep -c 'IGD:+:Pwr' /sys/kernel/debug/vgaswitcheroo/switch
                then
                    echo MIGD > /sys/kernel/debug/vgaswitcheroo/switch
                fi
                ;;
        thaw|resume)
                echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
                ;;
        *) exit $NA
                ;;
esac

Now i can finally add echo OFF > /sys/kernel/debug/vgaswitcheroo/switch to my /etc/rc.local and enjoy long battery life and a working standby mode :)

Since only switching the mux to the gpu where it should be (IGD) solves the black screen on ON issue, I think Its clear that the ON command (while the DIS is powered down) does switch the mux to the discrete gpu.

Note that this script does NOT solve the bug, its only a workaround.

Greetings

Revision history for this message
Joseph Salisbury (jsalisbury) wrote :

Would it be possible for you to test the latest upstream kernel? Refer to https://wiki.ubuntu.com/KernelMainlineBuilds . Please test the latest v3.7 kernel[0] (Not a kernel in the daily directory) and install both the linux-image and linux-image-extra .deb packages.

If this bug is fixed in the mainline kernel, please add the following tag 'kernel-fixed-upstream'.

If the mainline kernel does not fix this bug, please add the tag: 'kernel-bug-exists-upstream'.

If you are unable to test the mainline kernel, for example it will not boot, please add the tag: 'kernel-unable-to-test-upstream'.
Once testing of the upstream kernel is complete, please mark this bug as "Confirmed".

Thanks in advance.

[0] http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.7-rc5-raring/

Changed in linux (Ubuntu):
importance: Undecided → Medium
Revision history for this message
penalvch (penalvch) wrote :

Kevin M, could you please test the latest upstream kernel available following https://wiki.ubuntu.com/KernelMainlineBuilds ? It will allow additional upstream developers to examine the issue. Please do not test the daily folder, but the one all the way at the bottom. Once you've tested the upstream kernel, please comment on which kernel version specifically you tested. If this bug is fixed in the mainline kernel, please add the following tags:
kernel-fixed-upstream
kernel-fixed-upstream-VERSION-NUMBER

where VERSION-NUMBER is the version number of the kernel you tested. For example:
kernel-fixed-upstream-v3.11-rc4

This can be done by clicking on the yellow circle with a black pencil icon next to the word Tags located at the bottom of the bug description. As well, please remove the tag:
needs-upstream-testing

If the mainline kernel does not fix this bug, please add the following tags:
kernel-bug-exists-upstream
kernel-bug-exists-upstream-VERSION-NUMBER

As well, please remove the tag:
needs-upstream-testing

If you are unable to test the mainline kernel, please comment as to why specifically you were unable to test it and add the following tags:
kernel-unable-to-test-upstream
kernel-unable-to-test-upstream-VERSION-NUMBER

Once testing of the upstream kernel is complete, please mark this bug's Status as Confirmed. Please let us know your results. Thank you for your understanding.

description: updated
tags: added: latest-bios-v1.19 needs-upstream-testing regression-potential
description: updated
Changed in linux (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for linux (Ubuntu) because there has been no activity for 60 days.]

Changed in linux (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.