Bug 91211 - intel_backlight dims on switching to VT from X
Summary: intel_backlight dims on switching to VT from X
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Video(DRI - Intel) (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: intel-gfx-bugs@lists.freedesktop.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-12 04:07 UTC by gotyaoi
Modified: 2015-02-11 14:00 UTC (History)
4 users (show)

See Also:
Kernel Version: >3.17
Subsystem:
Regression: Yes
Bisected commit-id:


Attachments

Description gotyaoi 2015-01-12 04:07:03 UTC
Overview:

When switching to a VT from X (using ctrl-alt-f1 for example), the backlight is set to a very low level. Switching back (ctrl-alt-f7) puts the backlight back at it's previous value. On logging out of my WM, the same thing happens, but the brightness does not go up on logging in again (I am using xdm, slim and xmonad, for the record). when the brightness is low like this, /sys/class/backlight/intel_backlight/brightness shows whatever value it was at before. The actual_brightness file, however, shows 0.

Steps to Reproduce:

    1) While in X, switch to a VT using ctrl-alt-f1

Actual Results:

The laptop's backlight is set very low.

Expected Results:

The backlight should not have changed at all.

Build Date & Hardware:

This occurs on a clevo w670SZQ.

I first remember this happening ~3.15. It went away when I upgraded to 3.16.5, and the /sys/class/backlight/acpi_video0 folder went away at the same time. It cropped up again on upgrading to 3.17.7 and is still present in 3.18.1. I did a git bisect on the kernel tree, and it pointed to https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/?id=6dda730e55f412a6dfb181cae6784822ba463847 as the first bad commit.

Please let me know if there's any other information I can provide.
Comment 1 Aaron Lu 2015-01-16 02:47:56 UTC
Add Jani, the commit author, maybe he knows what happened.
Comment 2 Aaron Lu 2015-01-16 03:10:34 UTC
BTW, maybe the following thing is good to know.

Enable debug for backlight module like this:
# cd /sys/kernel/debug/dynamic_debug
# echo "module backlight +pft" > control

Then do the tty switch, see if there is anything appeared in the dmesg log. The log should tell us which process ID is doing the backlight level change, if there is any. Check with ps -elf to see what command it is.
Comment 3 Jani Nikula 2015-01-16 08:45:20 UTC
Please see if this patch helps:
http://patchwork.freedesktop.org/patch/40309
Comment 4 gotyaoi 2015-01-17 06:40:35 UTC
I just turned on debugging (hattip to Aaron), and the results are as follows. Very odd looking. I switched to the VT, waited a few seconds and then switched back, and it looks like two things fiddle with the brightness after switching, but only one on going back

[  119.717467] [4425] brightness_store: backlight: set brightness to 0
[  120.191197] [4425] brightness_store: backlight: set brightness to 1054
[  127.636070] [4425] brightness_store: backlight: set brightness to 1054

process 4425 is X, ps -ef output:

root      4425  4419  0 22:28 tty7     00:00:03 /usr/bin/X -nolisten tcp -br -deferglyphs 16 vt07 -auth /var/run/slim.auth

I'll give the patch a try soon and report back.
Comment 5 gotyaoi 2015-01-17 06:53:18 UTC
Patched the intel_panel.c file, rebuilt the kernel and rebooted. While the debug dmesg output is pretty much identical, the backlight is max brightness on switching to a VT now. Granted, this is not perfect, as it goes max brightness no matter what the setting in X is or what the previous setting in the VT was (I mention because X remembers what brightness it was at and restores it on switching back to X), but it's better than before..
Comment 6 Jani Nikula 2015-02-11 14:00:56 UTC
Better than nothing

commit 13f3fbe827d09e3182023c8c54058cbf97aa146e
Author: Jeremiah Mahler <jmmahler@gmail.com>
Date:   Mon Jan 12 11:01:03 2015 -0800

    drm/i915: fix inconsistent brightness after resume

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