Bug 11527

Summary: [945GM] backlight brightness problems
Product: xorg Reporter: Tomas Janousek <tomi>
Component: Driver/intelAssignee: Jesse Barnes <jbarnes>
Status: VERIFIED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: brice.goglin, michael.skutek, nian.wu, sndirsch
Version: gitKeywords: regression
Hardware: x86 (IA32)   
OS: Linux (All)   
i915 platform: i915 features:
Bug Depends on: 12243    
Bug Blocks: 13027    
Description Flags
Backlight control methods patch
Updated backlight control methods
Fixed backlight patch
backlight control patch w/string values none

Description Tomas Janousek 2007-07-10 04:18:57 UTC
The commit a67c2965385001bcb8987265f698ff0f5809cd11 (Follow BIOS configuration for Legacy Backlight Brightness) caused this regression.

Whenever I start an application like mplayer, any opengl or sdl game etc., the backlight switches to maximum. This did not happen before. I use the two Fn-keys on the keyboard to manipulate the backlight intensity.

Reverting the commit solves the problem for me, though the x server has no idea about the backlight then.

My hardware:
HP Compaq nx7300
00:02.0 VGA compatible controller: Intel Corporation Mobile 945GM/GMS/940GML
Express Integrated Graphics Controller (rev 03)
(II) intel(0): Integrated Graphics Chipset: Intel(R) 945GM

xorg-server 1.3
intel driver (some git version a few commits after this one)
Comment 1 Jesse Barnes 2007-08-09 11:59:32 UTC
Does this still occur in the latest git tree?  I made some changes to the backlight code recently that should bring back the full backlight range that was available before.
Comment 2 Brice Goglin 2007-08-18 15:36:02 UTC
This bug is probably related to
where Alexandre Rossi sees the brightness switch to maximum after running mplayer or switching to VT.

However, Alexandre says it worked fine with 2.1.0 but is broken in 2.1.1. So it seems to be the contrary of this bug. Maybe because this bug is about i945 while Alexandre has an i855 and one of them have been broken when fixing the other one?
Comment 3 Brice Goglin 2007-08-19 03:49:02 UTC
Alexandre confirmed that the bug still occurs in current git master and that reverting 0da4f2b0cd7203377ad10407928a367b8c6d310e fixes his problem.
Comment 4 Brice Goglin 2007-08-28 11:46:00 UTC
Joey Hess says in [1] that xbacklight worked fine with driver 2.1.0 thanks to commit a67c2965385001bcb8987265f698ff0f5809cd11 on his Fujitsu P7120 (i915 board). But it's broken in 2.1.1, and reverting commit 0da4f2b0cd7203377ad10407928a367b8c6d310e (actually a85dd7adc35601a988b1001e8b3c8aa4d53de0c0 in the 2.1 branch) fixes the problem.

He says "With the broken version, xbacklight does still do something, but it seems that its scale 0..100 is not a linear gradient any more. For example, setting it to 10 yields about 100% brightness. 20 is about 20%. 22 is back to 100%. If xbacklight is allowed to do "smooth" scaling, what really happens is an epilepsy-inducing flicker."

It looks like both commits a67c2965385001bcb8987265f698ff0f5809cd11 and 0da4f2b0cd7203377ad10407928a367b8c6d310e fix some chipsets and break some others.

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=439744
Comment 5 Tomas Janousek 2007-09-06 09:17:51 UTC
Sorry for the late reply, I didn't have time to restart X until now.

0da4f2b0cd7203377ad10407928a367b8c6d310e did not help.

Reverting 0da4f2b0cd7203377ad10407928a367b8c6d310e and a67c2965385001bcb8987265f698ff0f5809cd11 remains the only option for me.
Comment 6 unggnu 2007-09-17 15:14:42 UTC
I have a similar problem with Ubuntu Gutsy Gibbon and Intel driver 2:2.1.1-0ubuntu3.
I am using a Sony TX2 laptop and normally brightness changes are only possible through sony-laptop kernel interface but Intel driver changes brightness to highest possible mode without changing kernel brightness values.
This happens on gdm start, after opening a movie, shutdown display, starting a simple sdl game or logout.

00:02.0 VGA compatible controller: Intel Corporation Mobile 915GM/GMS/910GML Express Graphics Controller (rev 03)
Comment 7 Matthias Flege 2007-09-26 16:31:45 UTC
I have got the same symptoms (backlight to maximum, as soon as I start a video playback with mplayer -vo gl or switch VTs) with driver version 2.1.0 on a Thinkpad X60s under Gentoo Linux.
Comment 8 WuNian 2007-10-08 22:43:28 UTC
I can reproduce this bug on 945gm(Lenovo R60e) with the latest tip.
Comment 9 unggnu 2007-10-09 02:11:39 UTC
Afaik this has been fixed upstream and made it into Ubuntu Gutsy Gibbon.
Comment 10 Gordon Jin 2007-10-11 19:16:38 UTC
backlight -- for Jesse.

From comment#8, it's not fixed in upstream yet.
Comment 11 Jesse Barnes 2007-10-11 20:36:27 UTC
Yeah this isn't yet fixed to our satisfaction.  The problem is that neither the current upstream code nor the old code (that works somewhat for Tomas) are correct--they'll both give you bad behavior in different situations.

For 945 however, the patch that Ubuntu picked up may be our best bet.  For 965, we're hoping to have this fixed properly by the next release (it requires updated BIOS interfaces only present on 965GM+ machines).

Tomas, in the meantime can you test the attached patch and confirm that it works for you?

Comment 12 Jesse Barnes 2007-10-11 20:37:33 UTC
Created attachment 12001 [details] [review]
Backlight control methods patch
Comment 13 WuNian 2007-10-11 23:06:07 UTC
With 2d driver tip, bug #12243 blocks the media player. So can not verify your patch against mplayer.
I can not reproduce this bug with opengl app, such as glxgears.
Comment 14 WuNian 2007-10-22 19:10:31 UTC
After bug #12243 fixed, I retry this bug with current 2D tip. when play video, the brightness does not restore to full bright.
I will change the bug status to FIXED. If you still have problem, you can reopen it.
Comment 15 Brice Goglin 2007-10-27 03:47:08 UTC
I don't see any relevant commit in git yet. So I am reopening the bug until the patch is applied for real to avoid confusion.
Comment 16 Jesse Barnes 2007-11-08 16:00:46 UTC
Created attachment 12414 [details]
Updated backlight control methods

Here's an updated patch that tries to use the sysfs backlight API if available.  This should allow backlight control to work well on machines with kernel drivers.
Comment 17 Jesse Barnes 2007-11-08 16:01:27 UTC
Nian, can you test the latest patch in this bug on your thinkpad?  Make sure the thinkpad_acpi driver is loaded...
Comment 18 WuNian 2007-11-09 01:28:28 UTC
My testing platform: Thinkpad R60e (945GM)
kernel: 2.6.23

With the latest patch, if not loaded thinkpad_acpi module, X crashed when start up.
After loaded thinkpad_acpi, X started up normally. Hotkey(Fn+home/end) worked fine when play video or 3D app. But xbacklight did not work at all.
Comment 19 Jesse Barnes 2007-11-09 09:19:10 UTC
Ok, I'll take a look.  That's what I get for asking someone to test a patch I haven't yet tested myself. :)

Comment 20 Jesse Barnes 2007-11-09 11:03:13 UTC
Created attachment 12431 [details]
Fixed backlight patch

Here's a new version that fixes the crash and seems to work on my T61 in the following cases:
  - no kernel backlight driver loaded
  - ACPI video driver loaded
  - thinkpad_acpi driver loaded

It'll prefer the thinkpad driver since that should give the best user experience, but both of the kernel drivers have problems.  They may not report the current backlight value correctly or may silently ignore updates.  I don't think there's much we can do about that without fixing the kernel drivers.
Comment 21 Jesse Barnes 2007-11-09 18:12:30 UTC
Created attachment 12433 [details]
backlight control patch w/string values

This one fixes the backlight control methods to be strings, so they'll be more descriptive to users.
Comment 22 WuNian 2007-11-11 21:51:49 UTC
The patch 4 works fine for me on 945GM no matter if thinkpad_acpi module is loaded. 
I think the bug can be closed.
Comment 23 Jesse Barnes 2007-11-11 21:58:08 UTC
Ok, I'll close it when I push the patch.  Can you re-test the other backlight bugs with the update patch too?  I'm hoping it'll fix some of the Thinkpad related ones at least...

Comment 24 Jesse Barnes 2007-11-12 12:30:49 UTC
Fixed by 43fbc547786cf26514f95bce79fab58a66c291bf.
Comment 25 Gordon Jin 2007-11-12 18:16:55 UTC
*** Bug 13204 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.