Bug 63931

Summary: [7 Series] [Backlight] Incorrectly driver set backlight
Product: xorg Reporter: Igor Gnatenko <i.gnatenko.brain>
Component: Driver/intelAssignee: Chris Wilson <chris>
Status: RESOLVED NOTOURBUG QA Contact: Intel GFX Bugs mailing list <intel-gfx-bugs>
Severity: normal    
Priority: medium CC: aaron.lu, ajax, bugzilla, chg, i.gnatenko.brain
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Xorg.0.log
none
vbios.dump
none
Logfile from test xrandr
none
test xrandr from lenovo z580 (hd4000)
none
test xrandr from acer extensa 5220 (gma x3100) none

Description Igor Gnatenko 2013-04-25 20:28:50 UTC
Created attachment 78486 [details]
Xorg.0.log

Bug description:
Backlight work is incorrectly
https://bugzilla.gnome.org/show_bug.cgi?id=698271
Need ajax.

System environment:
-- chipset: 7 Series
-- system architecture: x86_64
-- xf86-video-intel: 2.21.6-1.fc18.x86_64 | 2.21.6-1.fc19.x86_64
-- xserver: 1.13.3-3.fc18.x86_64 | 1.14.0-6.fc19.x86_64
-- mesa: 9.1-3.fc18.x86_64 | 9.1-6.fc19.x86_64
-- libdrm: 2.4.42-1.fc18.x86_64 | 2.4.44-2.fc19.x86_64
-- kernel: 3.8.8-202.fc18.x86_64 | 3.9.0-0.rc8.git0.2.fc19.x86_64
-- Linux distribution: Fedora 18 | Fedora 19
-- Machine or mobo model: Lenovo ThinkPad X230 and Lenovo ThinkPad T430
-- Display connector: LVDS

Reproducing steps:
Change backlight in GNOME with Fn-keys or gdbus call  --session --dest org.gnome.SettingsDaemon --object-path /org/gnome/SettingsDaemon/Power --method org.gnome.SettingsDaemon.Power.Screen.StepDown

Additional info:
Comment 1 Igor Gnatenko 2013-04-25 20:34:13 UTC
Created attachment 78487 [details]
vbios.dump
Comment 2 Chris Wilson 2013-04-25 21:37:38 UTC
Your backlight is controlled through the acpi driver, not intel.
Comment 3 Igor Gnatenko 2013-04-25 21:42:43 UTC
(In reply to comment #2)
> Your backlight is controlled through the acpi driver, not intel.
But Ajax actually said that it was a bug in the intel-gfx driver, not that it was
fixed.
Please, watch comment.. https://bugzilla.gnome.org/show_bug.cgi?id=698271#c28
Comment 4 Chris Wilson 2013-04-26 07:03:17 UTC
It is not a bug in -intel or i915.ko, but in the acpi driver for your backlight.
Comment 5 Bastien Nocera 2013-04-26 11:25:06 UTC
(In reply to comment #4)
> It is not a bug in -intel or i915.ko, but in the acpi driver for your
> backlight.

The backlight works fine when you hit the sysfs node directly, but the backlight returned through XRandR (and xbacklight) always returns 100%. It's possible that the driver always exposes the backlight interface, and returns 100 when it can't actually access the sysfs node for whatever reason as per the commit below.

http://cgit.freedesktop.org/xorg/driver/xf86-video-intel/commit/?id=d7f0df27edb20b052ad39beb26a0b1924f432618
Comment 6 Chris Wilson 2013-04-26 12:35:11 UTC
No.
Comment 7 Bastien Nocera 2013-04-26 14:14:15 UTC
(In reply to comment #6)
> No.

No what?

xbacklight always returns 100% when the sysfs value underneath changes. How is this a bug in the kernel? Isn't the XRandR interface and its backlight property exposed by the driver?

I'd expect a little more explanation than a one-syllable answer.
Comment 8 Aaron Lu 2013-04-27 06:32:36 UTC
(In reply to comment #4)
> It is not a bug in -intel or i915.ko, but in the acpi driver for your
> backlight.

Yes the backlight is controller by acpi video driver, but video driver works correctly. The breaking part is xbacklight always return 100 while actual brightness level is not. I wonder how report information to xbacklight?
Comment 9 Aaron Lu 2013-04-27 06:33:22 UTC
(In reply to comment #8)
> (In reply to comment #4)
> > It is not a bug in -intel or i915.ko, but in the acpi driver for your
> > backlight.
> 
> Yes the backlight is controller by acpi video driver, but video driver works
> correctly. The breaking part is xbacklight always return 100 while actual
> brightness level is not. I wonder how report information to xbacklight?

I mean, who report information to xbacklight?
Comment 10 Bastien Nocera 2013-04-27 15:12:41 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > (In reply to comment #4)
> > > It is not a bug in -intel or i915.ko, but in the acpi driver for your
> > > backlight.
> > 
> > Yes the backlight is controller by acpi video driver, but video driver works
> > correctly. The breaking part is xbacklight always return 100 while actual
> > brightness level is not. I wonder how report information to xbacklight?
> 
> I mean, who report information to xbacklight?

The driver, through the backlight property of XRandR. So if the backlight reporting is broken in the driver's XRandR implementation, but works using the kernel directly, the driver has a problem.
Comment 11 Igor Gnatenko 2013-04-27 22:11:59 UTC
Created attachment 78560 [details]
Logfile from test xrandr

I wrote little script for test xrandr.
#!/bin/bash
LOGFILE=test_xrandr.log
echo -n > $LOGFILE
for b in {1..100}
do
  xrandr --output LVDS1 --set Backlight $b
  echo "Test $b value:" >> $LOGFILE
  xrandr --verbose | grep -i backlight  >> $LOGFILE
done
Comment 12 Igor Gnatenko 2013-04-28 09:14:14 UTC
I tested again..
# echo 95 > /sys/class/backlight/acpi_video0/brightness
But in real life brightness of my monitor not change..
$ cat /sys/class/backlight/acpi_video0/brightness
95
$ xbacklight
100
$ cat /sys/class/backlight/acpi_video0/brightness
100
This happens with all the values ​​that are specified in the above attachment.
Comment 13 Igor Gnatenko 2013-04-28 09:38:52 UTC
Created attachment 78573 [details]
test xrandr from lenovo z580 (hd4000)
Comment 14 Igor Gnatenko 2013-04-28 09:41:49 UTC
Created attachment 78574 [details]
test xrandr from acer extensa 5220 (gma x3100)

In lenovo z580 and acer 5220 backlight regulate correctly.
Bug in ACPI ?
Comment 15 Igor Gnatenko 2013-05-16 08:46:02 UTC
kernel bug:
https://bugzilla.kernel.org/show_bug.cgi?id=51231

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.