Bug 60606 - vga_switcheroo / new Radeon DPM code mess up fbcon
Summary: vga_switcheroo / new Radeon DPM code mess up fbcon
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: Video(DRI - non Intel) (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: drivers_video-dri
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-22 19:55 UTC by Sebastien Fievet
Modified: 2016-03-23 18:59 UTC (History)
3 users (show)

See Also:
Kernel Version: 3.11.0-rc2
Subsystem:
Regression: No
Bisected commit-id:


Attachments
radeon switch OFF / switch ON experiment (14.96 KB, application/gzip)
2013-07-22 19:55 UTC, Sebastien Fievet
Details

Description Sebastien Fievet 2013-07-22 19:55:02 UTC
Created attachment 106987 [details]
radeon switch OFF / switch ON experiment

I am the happy owner of an hybrid Intel core i5 480M / AMD Radeon 6550M latop.
- IGP is Intel ironlake
- DGD is AMD radeon 6550M

I just installed kernel 3.11.0-rc2.
switching the discrete GPU OFF via the vgaswticheroo works from within X or from the console :
  echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
  cat /sys/kernel/debug/vgaswitcheroo/switch 
  0:IGD:+:Pwr:0000:00:02.0
  1:DIS: :Pwr:0000:02:00.0
  2:DIS-Audio: :Pwr:0000:02:00.1

I then tried to switch the radeon back ON from the console with X down :
  echo ON > /sys/kernel/debug/vgaswitcheroo/switch

It messed up the console display : screen turned to dominant grey scattered with coloured pixels making it unreadable, forcing me to reboot.
The attachment is the excerpt of my kern.log file for my radeon switch OFF / switch ON experiment.

switch off is at [   76.634983]
switch on is at  [ 2167.936488] or [ 2167.936517] 

I also noticed :
[    5.457569] ACPI Warning: \_SB_.PCI0.GFX0._DSM: Argument #4 type mismatch - Found [Integer], ACPI requires [Package] (20130517/nsarguments-95)
[    5.457739] ACPI Warning: \_SB_.PCI0.GFX0._DSM: Argument #4 type mismatch - Found [Integer], ACPI requires [Package] (20130517/nsarguments-95)

which seems to be related to vgaswitcheroo setup, but I don't know if it's relevant or not.

Let me know if you need anything else.
thanks for your help,
Seb.
Comment 1 Sebastien Fievet 2013-07-22 20:16:14 UTC
I did proofread my report, but missed a obvious mistake :
  
  cat /sys/kernel/debug/vgaswitcheroo/switch 
  0:IGD:+:Pwr:0000:00:02.0
  1:DIS: :Pwr:0000:02:00.0
  2:DIS-Audio: :Pwr:0000:02:00.1

  echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
  cat /sys/kernel/debug/vgaswitcheroo/switch 
  0:IGD:+:Pwr:0000:00:02.0
  1:DIS: :Off:0000:02:00.0
  2:DIS-Audio: :Off:0000:02:00.1

all apologies.
Comment 2 Sebastien Fievet 2013-08-05 12:33:43 UTC
After a *lot* of googling effort, I managed to narrow down and find a workaround to this bug.
- First, my mistake was to have an xorg.conf.d directory defining the video drivers. 
  Letting X auto detect the driver was the necessary first step.

- Second I applied the "drm/i915: do not disable backlight on vgaswitcheroo switch off" patch referenced in https://bugs.freedesktop.org/show_bug.cgi?id=59785
  It made switching from IGD to discrete functional, but switching away from IGD with discrete OFF was still screwing up the display.

- Finally, I found https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1077675, which was reporting the exact same bug as I was experiencing.
  Same hardware, same issue. Same workaround : echoing MIGD to /sys/kernel/debug/vgaswitcheroo/switch restores display when discrete is
  switched back ON

- I am now on 3.11.0-rc4 + drm/i915 patch and everything works fine (with the workaround)

Conclusion :
  1. DPM is not involved at all.
  2. Switcheroo doesn't fully support Acer 3820TG hybrid (muxed) laptop out of the box, but workaround exists.
  
If anyone wants to investigate further, I'll be glad to provide any relevant information.
Thanks,
Seb.
Comment 3 Jani Nikula 2013-08-08 07:00:43 UTC
Sebastien, to confirm, you need "drm/i915: do not disable backlight on vgaswitcheroo switch off" to be able to switch from IGD to DIS? So having that is an improvement? And without that, the workarounds won't help?
Comment 4 Sebastien Fievet 2013-08-08 10:10:36 UTC
(In reply to Jani Nikula from comment #3)
I reverted the patch and double checked. The workaround is enough for me.
What I do is :
1. echo OFF > /sys/kernel/debug/vgaswitcheroo/switch at init time with a rc script. Hence I always start on the IGD with the DIS OFF : 
  cat /sys/kernel/debug/vgaswitcheroo/switch
  0:DIS: :Off:0000:02:00.0
  1:DIS-Audio: :Off:0000:02:00.1
  2:IGD:+:Pwr:0000:00:02.0

2. to switch from IGD to DIS I do :
  for cmd in "ON MIGD DDIS"; do
    echo $cmd > /sys/kernel/debug/vgaswitcheroo/switch
  done
The screen flickers a bit during the OFF -> ON -> MIGD transition
  cat /sys/kernel/debug/vgaswitcheroo/switch
  0:DIS: :Pwr:0000:02:00.0
  1:DIS-Audio: :Pwr:0000:02:00.1
  2:IGD:+:Pwr:0000:00:02.0

3.I logout/login to X. To switch back to IGD I do :
  for cmd in "ON DIGD"; do
    echo $cmd > /sys/kernel/debug/vgaswitcheroo/switch
  done
The screen doesn't flicker.

=> I can cycle through IGD and DIS at will.

When testing your patch I was starting with both IGD and DIS ON. So initial
conditions were different :-(. Then :
1. echo DDIS > /sys/kernel/debug/vgaswitcheroo/switch worked, while without your patch it didn't.
2. logout/login to X
  echo DIGD > /sys/kernel/debug/vgaswitcheroo/switch worked.
3. logout/login to X
  echo DDIS > /sys/kernel/debug/vgaswitcheroo/switch screwed up the display.

So I think I have been abused by the favourable initial conditions I used when testing your patch. Let me know if you need anything else.

Note You need to log in before you can comment on or make changes to this bug.