Bug 83021 - Brightness is automatically set to zero when switching from X session to tty
Summary: Brightness is automatically set to zero when switching from X session to tty
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Video(DRI - Intel) (show other bugs)
Hardware: x86-64 Linux
: P1 normal
Assignee: intel-gfx-bugs@lists.freedesktop.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-22 14:40 UTC by Gabriele Mazzotta
Modified: 2014-10-26 16:11 UTC (History)
3 users (show)

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


Attachments
dmesg with drm.debug=0xe (97.93 KB, text/plain)
2014-08-25 13:11 UTC, Gabriele Mazzotta
Details

Description Gabriele Mazzotta 2014-08-22 14:40:51 UTC
Switching from my X session to tty* sets actual_screen backlight to 0 even though brightness is not changed and is equal to max_brightness. Writing again the value of max_brightness to brightness immediately raises the screen backlight to the right value.
On boot, the brightness is correct until an X session is started.

The cause is 6dda730e55f412a6dfb181cae6784822ba463847 (drm/i915: respect the VBT minimum backlight brightness), reverting it fixes the problem.

lspci:
00:02.0 VGA compatible controller: Intel Corporation Haswell-ULT Integrated Graphics Controller (rev 09)
Comment 1 Gabriele Mazzotta 2014-08-23 19:52:48 UTC
The problem seems to be that when the panel is disabled, the actual brightness is set to 0, but right after that is set to backlight.min along with backlight.level, probably because of intel_backlight_device_update_status().

When the panel is enabled, backlight.level is compared against 0 in intel_panel_enable_backlight(), so the actual brightness is not changed since the current level is not 0, but backlight.min.
Comment 2 Jani Nikula 2014-08-25 11:55:40 UTC
1) Please attach dmesg with drm.debug=0xe module param set all the way from boot to the problem.

2) Please try this patch:

diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 59b028f0b1e8..ad2bbf1ae090 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -946,7 +946,8 @@ void intel_panel_enable_backlight(struct intel_connector *connector)
 
 	WARN_ON(panel->backlight.max == 0);
 
-	if (panel->backlight.level == 0) {
+	if (panel->backlight.level == 0 ||
+	    panel->backlight.level < panel->backlight.min) {
 		panel->backlight.level = panel->backlight.max;
 		if (panel->backlight.device)
 			panel->backlight.device->props.brightness =
Comment 3 Gabriele Mazzotta 2014-08-25 13:11:00 UTC
Created attachment 148021 [details]
dmesg with drm.debug=0xe

1) 29.866760 is when I switched back to my X session, the bug happens right
before that.

2) It doesn't work. The following works:

diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 59b028f..10f6ecd 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -946,7 +946,8 @@ void intel_panel_enable_backlight(struct intel_connector *connector)
 
 	WARN_ON(panel->backlight.max == 0);
 
-	if (panel->backlight.level == 0) {
+	if (panel->backlight.level == 0 ||
+	    panel->backlight.level <= panel->backlight.min) {
 		panel->backlight.level = panel->backlight.max;
 		if (panel->backlight.device)
 			panel->backlight.device->props.brightness =
Comment 4 Gabriele Mazzotta 2014-10-26 16:11:37 UTC
I'm currently using 3.18-rc1 and one of the changes fixed the problem (I didn't try 3.17).

Closing this.

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