https://bugzilla.kernel.org/show_bug.cgi?id=34252
Summary: Unexpected behaviour when switching video cards with vga_switcheroo Product: Drivers Version: 2.5 Kernel Version: 2.6.39-rc5+ (1be6a1f89f131e9c3d22f819ec542be9cda8c9e3) Platform: All OS/Version: Linux Tree: Mainline Status: NEW Severity: normal Priority: P1 Component: Video(DRI - non Intel) AssignedTo: drivers_video-dri@kernel-bugs.osdl.org ReportedBy: e-mail@date.by CC: alexdeucher@gmail.com Regression: Yes
Created an attachment (id=56262) --> (https://bugzilla.kernel.org/attachment.cgi?id=56262) Kernel config
Trying to setup script, that switches video cards, I ran into the situation when I left with a black screen not possible to do anything with the system. Here is an example:
# cat /sys/kernel/debug/vgaswitcheroo/switch 0:IGD:+:Pwr:0000:01:05.0 1:DIS: :Pwr:0000:02:00.0 # echo IGD > /sys/kernel/debug/vgaswitcheroo/switch # cat /sys/kernel/debug/vgaswitcheroo/switch 0:IGD:+:Off:0000:01:05.0 1:DIS: :Pwr:0000:02:00.0
I think that this behaviour is buggy and this should not happen.
Environment: # lspci | grep -i vga 01:05.0 VGA compatible controller: ATI Technologies Inc RS780M/RS780MN [Radeon HD 3200 Graphics] 02:00.0 VGA compatible controller: ATI Technologies Inc M93 [Mobility Radeon HD 4500 Series] # uname -a Linux garik-laptop 2.6.39-rc5+ #8 SMP Sat Apr 30 18:36:12 MSD 2011 x86_64 AMD Athlon(tm) Neo Processor MV-40 AuthenticAMD GNU/Linux
https://bugzilla.kernel.org/show_bug.cgi?id=34252
Andrew Morton akpm@linux-foundation.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |akpm@linux-foundation.org
--- Comment #1 from Andrew Morton akpm@linux-foundation.org 2011-05-02 22:45:36 ---
From which kernel is this a regression? 2.6.38, I assume?
https://bugzilla.kernel.org/show_bug.cgi?id=34252
Rafael J. Wysocki rjw@sisk.pl changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |florian@mickler.org, | |maciej.rutecki@gmail.com, | |rjw@sisk.pl Blocks| |32012
https://bugzilla.kernel.org/show_bug.cgi?id=34252
--- Comment #2 from Igor Murzov e-mail@date.by 2011-05-02 22:51:51 --- This is a regression from linux 2.6.37 actually. I had black screen since 2.6.38rc4, I suppose.
https://bugzilla.kernel.org/show_bug.cgi?id=34252
Rafael J. Wysocki rjw@sisk.pl changed:
What |Removed |Added ---------------------------------------------------------------------------- Blocks|32012 |27352
https://bugzilla.kernel.org/show_bug.cgi?id=34252
--- Comment #3 from Florian Mickler florian@mickler.org 2011-05-09 19:18:48 --- Do you have a guess, why this is happening (for example, any error messages from the kernel) ? Can you login via ssh when the system freezes with a black screen? Do you think the system completely froze, or are, for example, the sysrq-keys still working? Is there anything in the dmesg that gives a clue? If there is nothing in the logs, can you try netconsole?
https://bugzilla.kernel.org/show_bug.cgi?id=34252
--- Comment #4 from Igor Murzov e-mail@date.by 2011-05-09 21:53:21 --- @Florian Mickler:
System is not frozen, only screen is black, because active graphical card gets turned off. I can log into the system via ssh and turn graphics on.
If I do `echo IGD > /sys/kernel/debug/vgaswitcheroo/switch` just after system boot, I get following new lines in dmesg:
[ 1230.530299] fbcon: Remapping primary device, fb0, to tty 1-63 [ 1230.570734] radeon: switched off [ 1230.591094] [drm] Disabling audio support [ 1230.718090] radeon 0000:01:05.0: PCI INT A disabled
https://bugzilla.kernel.org/show_bug.cgi?id=34252
--- Comment #5 from Igor Murzov e-mail@date.by 2011-05-09 21:56:04 --- Created an attachment (id=57042) --> (https://bugzilla.kernel.org/attachment.cgi?id=57042) dmesg output
This is a full dmesg output after sending IGD to vgaswitcheroo/switch.
https://bugzilla.kernel.org/show_bug.cgi?id=34252
--- Comment #6 from Florian Mickler florian@mickler.org 2011-05-10 13:17:32 --- Am I understanding correctly that in your opinion the `echo IGD > /sys/.../switch` should be ignored if already on IGD? I.e. nothing should happen?
https://bugzilla.kernel.org/show_bug.cgi?id=34252
--- Comment #7 from Igor Murzov e-mail@date.by 2011-05-10 18:08:50 --- Either ignored, or DIS card should be turned off, not IGD. I don't know what exactly should happen as there is seems no official docs for vga_switcheroo, only various tutorials and wikis. For example ubuntu tutorial (https://help.ubuntu.com/community/HybridGraphics) says:
echo IGD > /sys/kernel/debug/vgaswitcheroo/switch Connects integrated graphics with outputs.
-- absolutely nothing is said if some card should be turned on / off.
https://bugzilla.kernel.org/show_bug.cgi?id=34252
--- Comment #8 from Florian Mickler florian@mickler.org 2011-05-11 06:18:49 --- Hm.. according to the original commit description "ON" / "OFF" is used to turn the not-in-use-card on/off...
What was the behavior before v2.6.38-rc4? I don't know if this was an intended change in behavior or an unintended side effect of some other change. Dave Airlie can probably tell though...
p.s.: Anyway, I presume working around that in userspace is not the issue? (i.e. maybe doing something like this:
IGDINUSE=`grep IGD /sys/kernel/debug/vgaswitcheroo/switch | awk -F":" '{ $3 }'` if [ "x$IGDINUSE" != "x+" ]; then echo IGD > /sys/kernel/debug/vgaswitcheroo/switch fi
)
https://bugzilla.kernel.org/show_bug.cgi?id=34252
--- Comment #9 from Igor Murzov e-mail@date.by 2011-05-11 22:49:30 ---
What was the behavior before v2.6.38-rc4?
On 2.6.37.6 nothing happens if card is already active:
# cat /sys/kernel/debug/vgaswitcheroo/switch 0:+:Pwr:0000:01:05.0 1: :Pwr:0000:02:00.0 # echo IGD > /sys/kernel/debug/vgaswitcheroo/switch # cat /sys/kernel/debug/vgaswitcheroo/switch 0:+:Pwr:0000:01:05.0 1: :Pwr:0000:02:00.0
Anyway, I presume working around that in userspace is not the issue?
You are right. I wrote simple script for this already. Thanks.
https://bugzilla.kernel.org/show_bug.cgi?id=34252
--- Comment #10 from Florian Mickler florian@mickler.org 2011-05-12 14:04:20 --- Created an attachment (id=57582) --> (https://bugzilla.kernel.org/attachment.cgi?id=57582) Proposed fix
Can you test this patch? I don't have any switcheroo setup, but it makes sense and compiles.
https://bugzilla.kernel.org/show_bug.cgi?id=34252
--- Comment #11 from Igor Murzov e-mail@date.by 2011-05-12 23:01:32 --- I've tested the patch. It works just fine. It seems that with this patch vga_switcheroo works the same way as before 2.6.38. Thank you, Florian.
https://bugzilla.kernel.org/show_bug.cgi?id=34252
Rafael J. Wysocki rjw@sisk.pl changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |PATCH_ALREADY_AVAILABLE
--- Comment #12 from Rafael J. Wysocki rjw@sisk.pl 2011-05-14 22:19:01 --- Patch : https://bugzilla.kernel.org/attachment.cgi?id=57582 Handled-By : Florian Mickler florian@mickler.org
https://bugzilla.kernel.org/show_bug.cgi?id=34252
--- Comment #13 from Florian Mickler florian@mickler.org 2011-05-19 07:21:09 --- A patch referencing this bug report has been merged in v2.6.39:
commit a67b8887ced9d54cab7759bdb19deafed37481eb Author: Florian Mickler florian@mickler.org Date: Sun May 15 16:32:50 2011 +0200
vga_switcheroo: don't toggle-switch devices
https://bugzilla.kernel.org/show_bug.cgi?id=34252
Florian Mickler florian@mickler.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED Resolution|PATCH_ALREADY_AVAILABLE |CODE_FIX
dri-devel@lists.freedesktop.org