Bug 2000

Summary: X/Radeon makes Fn+F7 not function
Product: xorg Reporter: Sammy Umar <umar>
Component: Driver/RadeonAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: high CC: alexdeucher, alexeyp, amilo, bill.sheppard, borislav, brix, bruce.veidt, cbm, cgreco1, cyril.jaquier, erik.andren, freedesktop2eran, hhielscher, joshk, marius.andreiana, osos, shawn.starr, stefan, tuju
Version: 7.1 (2006.05)   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
enable bios hotkeys
none
new patch
none
this should work
none
default xorg.conf none

Description Sammy Umar 2004-12-02 18:26:56 UTC
I am running 6.8.1 from FC3 (latest devel) on an IBM Thinkpad T42. The key 
combination for toggling between LCD and external monitor, fn+f7, stops 
functioning as soon as X starts. The keys work fine in character mode (ctrl-alt-f1). 
Is X grabbing these keys somehow. I am using acpi to access the keys. All other 
fn+fx combinations work fine (with standard ibm-acpi and suspend2 setup). 
I need a reliable lcd/external switching since I use the laptop for presentations 
etc. 
 
Thanks
Comment 1 Alex Deucher 2004-12-03 06:32:12 UTC
the driver is disabling the hotkeys.  I'll post a fix shortly.
Comment 2 Alex Deucher 2004-12-03 16:04:01 UTC
Created attachment 1461 [details] [review]
enable bios hotkeys

please try this patch.	it provides a new option, BIOSHotkeys, that will enable
bios hotkey switching.	it's off by default since the driver does not support
ACPI thus there is no way to validate modes on an output switch and the bios
can potentially change things behind the drivers back.	however in a basic
single active crtc case it should work fine.
Comment 3 Alex Deucher 2004-12-03 16:06:20 UTC
here are some pre-build cvs binaries with the patch applied:

http://www.botchco.com/alex/xorg/ati_drv.o
http://www.botchco.com/alex/xorg/radeon_drv.o

back up your old ones first.
Comment 4 Sammy Umar 2004-12-05 10:11:17 UTC
I applied the patch and rebuilt the packages. Modified xorg.conf and put in the
option. xorg.0.log shows the bios keys are enabled.

However, fn+f7 still does not work under X but works in text mode. I am
getting a warning:

(WW) Open APM failed (/dev/apm_bios) (No such file or directory)

I am using ACPI and have APM turned off. Also, Fedora Core 3 is using udev
so perhaps this device needs to be created.

Any Ideas? Thanks.
Comment 5 Alex Deucher 2004-12-05 10:50:52 UTC
(In reply to comment #4)
> I applied the patch and rebuilt the packages. Modified xorg.conf and put in the
> option. xorg.0.log shows the bios keys are enabled.
> 
> However, fn+f7 still does not work under X but works in text mode. I am
> getting a warning:
> 
> (WW) Open APM failed (/dev/apm_bios) (No such file or directory)
> 
> I am using ACPI and have APM turned off. Also, Fedora Core 3 is using udev
> so perhaps this device needs to be created.
> 
> Any Ideas? Thanks.


You can ignore that warning.  X has support for apm, but for power events, not
buttons. if you are running acpi, X will give you that warning.

please try the new patch.
Comment 6 Alex Deucher 2004-12-05 10:51:41 UTC
Created attachment 1477 [details] [review]
new patch

please try this one out.  new binaries also available at the links above.
Comment 7 Alex Deucher 2004-12-05 10:59:15 UTC
Created attachment 1478 [details] [review]
this should work

Argh! Sorry, forgot about about biosscratch 4, 6. please try this one instead. 
new binaries available as well.
Comment 8 Sammy Umar 2004-12-06 05:54:11 UTC
OK. I am at the office so I can try!

The toggling is still not working under X. There is one difference though
and that is after starting X the first time pressing fn+f7 triggers thinkpad
buttons to display "LCD on, CRT off" or something like this on the screen.
However, at this time they were both on and nothing changed in terms of switching.
Subsequent fn+f7 tries does not produce this message. I do see a flickerring on
the external display everytime I do fn+f7 though.

I have a feeling that fn+f7 is actually working behind X in the textmode screen.
Could this be?

Another thing is that for IBM ThinkPads when there is an external screen
plugged in this becomes the "primary".

Thanks
Comment 9 Sammy Umar 2004-12-06 13:06:14 UTC
One more observation:

When I do fn+f7 after the computer is rebooted, this changes the BIOS 
for boot display device to external(VGA) from Thinkpad(LCD). Thus, next
time you boot you only see stuff on the external monitor but nothing on
the LCD.
Comment 10 Alex Deucher 2004-12-06 13:21:47 UTC
try again with this part commented out, e.g.,


#if 0
	if (info->MergedFB || pRADEONEnt->HasSecondary)
	    save->bios_5_scratch = 0x01020201;
	else
#endif
Comment 11 Sammy Umar 2004-12-06 17:27:06 UTC
I tried that with the same outcome:

The first time I do fn+f7 I get the message from tpb (thinkpad buttons)
that "LCD off, CRT on". Subsequent fn+f7 attempts produce no message.
At the smae time thinkpad BIOS setting for boot display is changed from 
"ThinkPad LCD" to "VGA(external)".

Hope this helps!
Comment 12 Alex Deucher 2004-12-06 17:42:15 UTC
does fn-f7 work again after you quit X?
Comment 13 Sammy Umar 2004-12-06 18:06:59 UTC
Yes..if I do ctrl-alt-f1 and try fn+f7 it toggles perfectly fine. Here is the
comment from ibm-acpi regarding radeon:

"Note that on many models (particularly those using Radeon graphics
chips) the X driver configures the video card in a way which prevents
Fn-F7 from working. This also disables the video output switching
features of this driver, as it uses the same ACPI methods as
Fn-F7. Video switching on the console should still work."
Comment 14 Alex Deucher 2004-12-11 16:01:09 UTC
perhaps there's a problem with ibm acpi module.  This patch works perfectly on
my radeon laptop.
Comment 15 Alex Deucher 2004-12-11 16:17:18 UTC
This patch reverts to the previous driver behavior in the event that you set
BIOSHotkeys to true and it works on my laptop. committed to HEAD.
Comment 16 Sammy Umar 2004-12-13 11:10:01 UTC
The problem is ibm-acpi is part of the kernel since 2.6.10 and is the
only acpi module for thinkpads. It is not a matter of who is right or
wrong. There is some conflict between the radeon driver and the ibm-acpi
stuff. fn+f7 works fine with radeon driver on a non-ibm system, not running
ibm-acpi, similarly fn+f7 works fine with ibm-acpi for any other video
driver. I have written to the ibm-acpi author but he does not seem to respond.
Thank you.
Comment 17 Alex Deucher 2004-12-13 13:10:02 UTC
(In reply to comment #16)
> The problem is ibm-acpi is part of the kernel since 2.6.10 and is the
> only acpi module for thinkpads. It is not a matter of who is right or
> wrong. There is some conflict between the radeon driver and the ibm-acpi
> stuff. fn+f7 works fine with radeon driver on a non-ibm system, not running
> ibm-acpi, similarly fn+f7 works fine with ibm-acpi for any other video
> driver. I have written to the ibm-acpi author but he does not seem to respond.
> Thank you.

I didn't mean to come across as angry.  I'm not trying to argue right or wrong.
 With this patch and the BIOSHotkeys options set, X not longer messes with the
bios/acpi.  If it still doesn't work, all I can say is that we can rule out X. 
In terms of figuring this out, we should probably ask Borislav if the ibm_acpi
module does something weird with regard to the video bios; perhaps it doesn't
even try switching outputs when X is running, I just don't know.  FWIW, my
laptop is a thinkpad x24, I've just never had the time to try ibm_acpi.
Comment 18 Borislav Deianov 2004-12-14 19:22:54 UTC
(In reply to comment #17)
>  With this patch and the BIOSHotkeys options set, X not longer messes with the
> bios/acpi.  If it still doesn't work, all I can say is that we can rule out X. 
> In terms of figuring this out, we should probably ask Borislav if the ibm_acpi
> module does something weird with regard to the video bios;
[snip]

It's possible. It basically calls ACPI methods used by the code which handles
Fn-F7 and exposes that functionality through a different interface. It's
possible that it's not using some of the low-level methods correctly.

Sammy, can you please try the following: rename or delete the ibm_acpi module
(make sure it doesn't get loaded), reboot, start X with the latest driver and
try Fn-F7. Does it work? If yes, then I can work with you to get it to work with
ibm-acpi (as well as the software switching).
Comment 19 Sammy Umar 2004-12-15 06:49:57 UTC
I will test this as soon as I get home this afternoon.
Comment 20 Sammy Umar 2004-12-15 15:21:11 UTC
Unfortunately this did not work. I removed ibm-acpi module, rebooted, the
BiosHotkey option was enabled for X11 and shows up in the log file. No
response.

Furthermore, I also tried doing

tail -f /var/log/acpid

and then hit fn+f7 key...no response. Peculiar thing is that I tried it in the
text mode as well and did not see anything despite the fact that video was
toggling correctly!

What I observed is that when I do fn+f7 the BIOS setting in the computer's
bios does change from "ThinkPad LCD" to "external VGA" but only once i.e. it
does not go back if I hit it again. I can go into bios at startup and
revert it. Is something funny going on?
Thanks
Comment 21 Alex Deucher 2005-01-13 12:45:37 UTC
*** Bug 1230 has been marked as a duplicate of this bug. ***
Comment 22 Henrik Brix Andersen 2005-01-21 19:04:01 UTC
The patch works with my IBM ThinkPad X31.
Comment 23 Sammy Umar 2005-01-23 11:19:49 UTC
Could you tell me what you are running on X31. Kernel, acpi module, tpb etc. 
Are you using xorg-x11 or XFree86? 
Thanks 
Comment 24 Henrik Brix Andersen 2005-01-23 12:06:32 UTC
Kernel 2.6.11-rc1, ACPICA 20041210, ibm-acpi-0.10, tpb-0.6.3, xorg-x11-6.8.0 +
Gentoo patch set (-r4).
Comment 25 Sammy Umar 2005-01-24 05:17:45 UTC
I pretty much have the same software. I guess this is not too much of a
surprise since the compatibility table shows X31 working for just about
everything. The difference must be in bios/hardware. Did you do anything
special to get fn+f7 work?
Comment 26 Bruce Veidt 2005-01-25 12:20:46 UTC
I have this problem with my Thinkpad X30 which uses an i830M 
video chip, not a radeon.  
fn+f7 worked fine with xorg-x11-6.7.0 but stopped working with 6.8.0.  
This is not a kernel issue since I first noticed the problem  
running 2.4.26.  Moving to 2.6.10 has not made it better or worse.  
BTW, I am using gentoo and I am running apm, not acpi.  I am  
not using tpb.  
  
Comment 27 Alex Deucher 2005-01-25 12:28:35 UTC
(In reply to comment #26)
> I have this problem with my Thinkpad X30 which uses an i830M 
> video chip, not a radeon.  
> fn+f7 worked fine with xorg-x11-6.7.0 but stopped working with 6.8.0.  
> This is not a kernel issue since I first noticed the problem  
> running 2.4.26.  Moving to 2.6.10 has not made it better or worse.  
> BTW, I am using gentoo and I am running apm, not acpi.  I am  
> not using tpb.  
>   

The xorg i810 driver may have also done something similar (i.e., disabled bios
output handling in the video bios).  I don't know enough about the i810 driver
to comment much more than that.
Comment 28 Sammy Umar 2005-01-25 12:35:20 UTC
Could someone explain to me the difference betweek the text mode (ctrl-alt-f1)
and graphics mode. I am trying to understand what it means to that fn+f7 work
in text mode and not in graphics mode. Does this mean X/driver is not letting
acpi event for fn+f7?
Thanks
Comment 29 Bruce Veidt 2005-01-31 13:53:03 UTC
(In reply to comment #28)  
> Could someone explain to me the difference betweek the text mode  
(ctrl-alt-f1)  
> and graphics mode. I am trying to understand what it means to that fn+f7  
work  
> in text mode and not in graphics mode. Does this mean X/driver is not  
letting  
> acpi event for fn+f7?  
> Thanks  
  
Not quite.  See:  
  
------- Additional Comment #8 From Sammy Umar 2004-12-06 05:54 [reply] -------   
<snip>  
> Subsequent fn+f7 tries does not produce this message. I do see a flickerring  
on  
> the external display everytime I do fn+f7 though.  
  
I also observe this with my Thinkpad X30/i830M/APM: the output is momentarily  
switched (LCD off, external output on) but a fraction of a second later is   
switched back. 
  
  
  
Comment 30 Colin Macdonald 2005-02-11 03:15:44 UTC
On my ati rage (thinkpad A21e), I also see this problem using various gentoo
releases of 6.8.0 with acpi -- never tried with apm.

My partner has a A20m with same video card (I think -- mach64 anyway) and using
an older XFree release from before the fork where the fn-f7 key works correctly
-- never tried acpi on that machine however.

On the a21e I've just been using:
 Option      "crt_display"      "True"
 Option      "panel_display"    "True"
in xorg.conf to keep the crt on all the time (maybe this wastes some battery?)
as its inconvenient to have to restart X to give a presentation.
Comment 31 Carmine Greco 2005-02-24 18:50:16 UTC
Same problem on an IBM T30 (2366-85U).  /var/log/Xorg.0.log shows the laptop has
an "ATI Radeon Mobility M7 LW [Radeon Mobility 7500]" graphics card.  Tried ACPI
and APM. Tried the thinkpad.ko kernel module and tpctl.  Tried different
versions of "ATI Radeon" settings for the video card config in "Display
Settings."  None of these made any difference wrt to Fn-F7 and X.
Comment 32 Tim Mann 2005-04-24 21:23:57 UTC
Here's some info that may give someone a few clues.  On my IBM T41, with the
text console active, both /proc/acpi/ibm/video and the atitvout program
(http://0pointer.de/lennart/projects/atitvout/) work to switch among video
outputs.  Unsurprisingly, neither one works with unpatched Xorg 6.7 radeon
driver.  Perhaps interesting, though: with the Xorg 6.7 VESA driver, both
ibm-acpi and atitvout *do* work to switch amongst outputs.  (atitvout is better
for me because it can switch to the s-video output on my T41, which ibm-acpi can't.)

A minor thing that confused me briefly is that you can't turn off all the
outputs at once, so echo lcd_disable,crt_enable > /proc/acpi/ibm/video doesn't
work.  You have to do it in the other order: echo crt_enable,lcd_disable >
/proc/acpi/ibm/video.

BTW, I'm running Mandrake 10.1 with the 2.6.8.1-24mdk kernel and ibm-acpi-0.11.

Maybe this doesn't help much because the VESA driver pretty much doesn't touch
the hardware directly at all, so it's too different from the radeon driver for
comparisons to be useful.  :-(
Comment 33 FreeDesktop Bugzilla Database Corruption Fix User 2005-07-06 14:58:46 UTC
(In reply to comment #22)
> The patch works with my IBM ThinkPad X31.

The patch works with my IBM ThinkPad X31 only if the xorg-x11 server does not
get started with an external VGA monitor connected. It seems like it switches
off the internal display irrevertibly in that case... that is not nice because I
like to use an external display AND the internal one without having to restart
the X session every now and then...
Comment 34 FreeDesktop Bugzilla Database Corruption Fix User 2005-07-08 20:26:47 UTC
Another observation: when switching to the console (radeon frame buffer) and
back to the Xorg server, the Fn-F7 "setting" gets lost and, if only the external
VGA monitor was active, both heads get activated, again.
Comment 35 Marius Andreiana 2005-09-01 07:27:34 UTC
*** Bug 4329 has been marked as a duplicate of this bug. ***
Comment 36 Marius Andreiana 2005-09-07 22:25:25 UTC
Did anybody else here noticed other weird things with external display:
- sometimes the resolution of external diplay is lower than on laptop's LCD (is
it possible to change it?)
- the video clips played by a video player (totem, mplayer) don't appear on
external display (it shows black or blue area), but everything else it's ok.

Thanks
Comment 37 Colin Macdonald 2005-09-08 00:09:25 UTC
comment #34:  the "blue box" you're seeing with mplayer, etc is the overlay key
from XV accelleration.  Perhaps your video card cannot do the overlay  on both 
displays simultaneously.  "mplayer -vo x11 blah.ogg" would display correctly 
because it does not use XV accelleration.
Comment 38 Alex Deucher 2005-09-08 05:49:20 UTC
(In reply to comment #34)
> Did anybody else here noticed other weird things with external display:
> - sometimes the resolution of external diplay is lower than on laptop's LCD (is
> it possible to change it?)

If DDC information is not available on the vga port, the second crtc gets set up
with the default 640x480 mode.  By default the radeon driver drives each display
with it's own crtc.  If you'd rather have one crtc drive both displays, disable
mergedfb (Option "mergedfb" "false")

> - the video clips played by a video player (totem, mplayer) don't appear on
> external display (it shows black or blue area), but everything else it's ok.
> 

radeon only has one overlay and it can only be sourced to one crtc or the other.
 You can use the xv attribute xv_crtc (or something like that, I don't remember
the exact name offhand) to switch which head it displays on in clone mode.  If
you drive both displays with one crtc, the overlay with show on both outputs.

Let's try and keep future discussion more on topic.
Comment 39 Lars Roland 2005-09-18 06:22:40 UTC
Back on topic here:

I have a IBM T42 (Radeon 9600 (Mobility M10)), running Gentoo using
Xorg-6.8.99-15 and linux kernel 2.6.14rc1. I am experiencing the same problem as
the original poster: 

If I am using a external display it only works if I boot the laptop into X and
then plugs it in after X is started - if the laptop was booted with the external
display, then only the external display is avalibel in X - the internal LCD gets
switched off (everything is however dandy in the console).

As before fn+f7 only have any effect in console - I have tried switching off IBM
acpi, using APM and none of it works. My (partial) xorg.conf looks like this:

----------------------
 Section "Device"
        Identifier      "ATI"
        Driver          "radeon"
        # accelration
        Option          "AGPMode" "4"
        Option          "EnablePageFlip" "on"
        Option          "RenderAccel" "on"
        # enable PowerPlay features
        Option          "DynamicClocks" "on"
        # use bios hot keys on thinkpad (aka fn+f7)
        Option          "BIOSHotkeys" "on"
        # enable radeon specific xinerama
        Option          "MergedFB" "true"
        Option          "CRT2Position" "RightOf"
        Option          "CRT2Hsync" "50-75"
        Option          "CRT2VRefresh" "30-82"
        Option          "MetaModes" "1024x768-1280x1024"
        Option          "MergedNonRectangular" "true"
        BusID           "PCI:1:0:0"
EndSection
----------------------

I hope that someone in here can guide me the right way so I can supply you with
the right debuging info - this is really a anoying problem (I am however not
sure who is to blame X, IBM Bios or ibm_acpi ?) - it should be noted that if I
use the non-free ati drivers then I do not have this problem (but I have a ton
of other problems - like crappy xinerama support - so this is not a solution).
Comment 40 Andrew D. Stadler 2005-09-24 14:12:20 UTC
I am experiencing related problems with startup/BIOS/dual-head which I have submitted as bug # 3015.
Comment 41 Austin Yuan 2005-11-01 02:05:50 UTC
The patch works on HP nx6130 with local LCD and an external LCD. But when I 
connect a TV with S-Video, hotkey can't switch to TV. It can switch to TV under 
console mode, and If I use "vesa" driver, it can switch to TV too.
Comment 42 Neil Skrypuch 2005-12-09 18:48:31 UTC
After enabling BIOSHotkeys in xorg.conf, I can use Fn+F7 in the expected way 
both in X and on the console. Without enabling BIOSHotkeys, things only work 
on the console, Fn+F7 produces nothing. 
 
If I plug in a monitor while X is running I have to hit Fn+F7 twice (to enable 
both LCD and CRT output), while if I restart X with the CRT plugged in, the 
output gets switched on automatically -- minor detail, but I thought it would 
be worth mentioning. I believe it has to do with the "auto" setting in 
ibm-acpi (/proc/acpi/ibm/video). 
 
System info: 
Thinkpad T40 (ibm-acpi enabled, tpb not used, ACPI 20050902, custom 2.6.14 
kernel) 
Radeon 7500 Mobility 
Xorg 6.9 RC2 + cvs 
Comment 43 Johannes Hessellund 2005-12-10 00:23:16 UTC
I can't get Fn+F7 to switch monitor at all, not even console.

What is needed to get it to work on the console?

Is it handled by ibm_acpi module?
Do you have a special acpid script to handle Fn+F7 ?

I use Ubuntu Breezy. ibm_acpi v.0.12a.
Comment 44 Erik Andren 2006-04-27 06:44:39 UTC
Please try the current ati 1-0-0 branch of the ati driver. It has recently got
som e treatment on this issue. 
Comment 45 Erik Andren 2006-05-09 06:31:06 UTC
Ping to the bug submitter!
Comment 46 Michel Dänzer 2006-07-02 14:07:50 UTC
Is there any indication that there's still an issue in the radeon driver that
specifically prevents Fn+Fx from working? If not, please close this bug and
follow up to other ones about the other issues or file new ones about them.
Comment 47 Erik Andren 2006-07-28 10:23:57 UTC
Closing.
Comment 48 Marius Andreiana 2006-11-27 07:57:44 UTC
Still not working on Fedora Core 6

xorg-x11-server-Xorg-1.1.1-47.1.fc6
xorg-x11-drv-ati-6.6.3-1.fc6
Comment 49 Marius Andreiana 2006-11-27 07:58:22 UTC
Created attachment 7906 [details]
default xorg.conf
Comment 50 Keith Sharp 2006-12-12 02:20:40 UTC
Adding:

    Option      "BIOSHotkeys" "on"

to the device section of /etc/X11/xorg.conf on my T43p Fedora Core 6 system
enables Fn-F7 functionality.  I am using the default Fedora installed/updated
driver and the defailt xorg.conf (apart from the above change).

xorg-x11-server-Xorg-1.1.1-47.1.fc6
xorg-x11-drv-ati-6.6.3-1.fc6

Might be worth moving this to the Red Hat Bugzilla to have this option enabled
in the default Fedora install.
Comment 51 Marius Andreiana 2007-02-09 01:05:59 UTC
Adding
    Option      "BIOSHotkeys" "on"
fixes it for me too.

Please make this be the default in x.org and let users change the conf file only if they want it disabled (would there be a reason to have it disabled?). Note that there are more and more laptops which have this shortcut, it would be good to have it working out of the box.

Also on Fedora X doesn't require a conf file anymore to start, so having this the default makes sense.

Thanks
Comment 52 Daniel Stone 2007-02-27 01:24:43 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 53 Alex Deucher 2007-08-31 07:01:43 UTC
this option bas gone away in git master, however, it recommended that you not use fn-f7, etc. to toggle outputs with the current driver because the bios will likely scramble the chip good better to use xrandr with acpi events.
Comment 54 Alex Deucher 2007-08-31 07:33:06 UTC
*** Bug 6705 has been marked as a duplicate of this bug. ***

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.