Bug 87286 - [i915 intel_backlight] can't regulate brightness at GDM login prompt if HDMI monitor connected
Summary: [i915 intel_backlight] can't regulate brightness at GDM login prompt if HDMI ...
Status: CLOSED FIXED
Alias: None
Product: DRI
Classification: Unclassified
Component: DRM/Intel (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Intel GFX Bugs mailing list
QA Contact: Intel GFX Bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-13 15:38 UTC by jre.winesim
Modified: 2017-07-24 22:49 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
/var/log/dmesg with kernel option drm.debug=0x06 (49.50 KB, text/plain)
2014-12-13 15:38 UTC, jre.winesim
no flags Details
Xorg.0.log (27.72 KB, text/plain)
2014-12-13 15:39 UTC, jre.winesim
no flags Details
Contents of all files in /sys/class/backlight/intel_backlight/ (979 bytes, text/plain)
2014-12-13 15:40 UTC, jre.winesim
no flags Details
Output of dmidecode (20.21 KB, text/plain)
2014-12-13 15:49 UTC, jre.winesim
no flags Details
Disable native backlight for SAMSUNG 900X3C/900X3D/900X3E/900X4C/900X4D (632 bytes, patch)
2014-12-15 12:15 UTC, jre.winesim
no flags Details | Splinter Review
acpidump -o acpidump (243.51 KB, text/plain)
2014-12-15 12:17 UTC, jre.winesim
no flags Details

Description jre.winesim 2014-12-13 15:38:37 UTC
Created attachment 110819 [details]
/var/log/dmesg with kernel option drm.debug=0x06

Bug description:
================

Brightness can only be regulated up to 5% while being at the GDM login
prompt if an external HDMI monitor is connected.

It works again after logging in to Gnome.
If the HDMI monitor is not connected it also works.

With kernel 3.14 (or later versions if I set the kernel option
video.use_native_backlight=0) this works just fine. (There I have
/sys/class/backlight/acpi_video0 next to intel_backlight.)


System environment:
===================

-- chipset: i915 (Intel HD Graphics 4000)
-- system architecture: x86_64
-- xf86-video-intel: xserver-xorg-video-intel 2:2.21.15-2+b2
-- xserver: xserver-xorg-core 2:1.16.1.901-1
-- mesa: 10.3.2-1
-- libdrm: libdrm-intel1:amd64 2.4.58-2
-- kernel: 3.18-1~exp1
-- Linux distribution: Debian Jessie (testing)
-- Machine or mobo model: Samsung NP900X4C-A07DE Notebook
-- Display connector: Internal + Micro HDMI

I tested it with the following official Debian packages:
linux-image-3.14-2-amd64       3.14.15-2
linux-image-3.16-2-amd64       3.16.3-2
linux-image-3.16-3-amd64       3.16.5-1
linux-image-3.16.0-4-amd64     3.16.7-2
linux-image-3.16.0-4-amd64     3.16.7-ckt2-1
linux-image-3.17.0-trunk-amd64 3.17.4-1~exp1
linux-image-3.18.0-trunk-amd64 3.18-1~exp1

... and with a self-compiled (3.18), based on
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git, head at
92a578b064d0227a3a7fbbdb9e29dbab7f8d400e (Linus Torvalds, 2014-12-11
06:17:00), using the Debian 3.16.0-4 kernel config, compiled with "make
deb-pkg").

$ ls /sys/class/backlight/
intel_backlight


Reproducing steps:
==================

The problem exists in most cases (perhaps 80 to 90%).


Additional info:
================

With kernel 3.16 the internal display was also completely dimmed (=black), but
since kernel 3.17 the initial brightness is ok again.

Due to bug #84372 I've enabled sna. Disabling it again makes no difference.
Comment 1 jre.winesim 2014-12-13 15:39:36 UTC
Created attachment 110820 [details]
Xorg.0.log
Comment 2 jre.winesim 2014-12-13 15:40:24 UTC
Created attachment 110821 [details]
Contents of all files in /sys/class/backlight/intel_backlight/
Comment 3 jre.winesim 2014-12-13 15:49:09 UTC
Created attachment 110822 [details]
Output of dmidecode
Comment 4 jre.winesim 2014-12-13 15:54:10 UTC
I forgot that in the report:

Big thanks in advance and for all your other work! I'd be happy to help any further.

Jens
Comment 5 Jani Nikula 2014-12-15 08:27:32 UTC
(In reply to jre.winesim from comment #0)
> Brightness can only be regulated up to 5% while being at the GDM login
> prompt if an external HDMI monitor is connected.
> 
> It works again after logging in to Gnome.
> If the HDMI monitor is not connected it also works.

If you boot without HDMI, ensure backlight control works, then hotplug HDMI, does the backlight control cease to work?

Vice versa, if you boot with HDMI, confirm the bug is present, then unplug HDMI ,does the problem go away?
Comment 6 jre.winesim 2014-12-15 12:15:14 UTC
Created attachment 110859 [details] [review]
Disable native backlight for SAMSUNG 900X3C/900X3D/900X3E/900X4C/900X4D

Based upon a patch by Aaron Lu (https://bugzilla.kernel.org/show_bug.cgi?id=84561) for a similar issue.
Applies to git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git,
head at 9ea18f8cab5f1c36cdd0f09717e35ceb48c36a87, Linus Torvalds 2014-12-13 23:22:26
Comment 7 jre.winesim 2014-12-15 12:17:36 UTC
Created attachment 110860 [details]
acpidump -o acpidump
Comment 8 jre.winesim 2014-12-15 12:19:13 UTC
(In reply to Jani Nikula from comment #5)
> If you boot without HDMI, ensure backlight control works, then hotplug HDMI,
> does the backlight control cease to work?

Yes, without it works, after hotpluging it stops working. 


> Vice versa, if you boot with HDMI, confirm the bug is present, then unplug
> HDMI ,does the problem go away?

No, it doesn't work even after unpluging.


Just to clarify: with "does not work" I mean the backlight control OSD bar moves, but only between 0 and about 5%. This has no practical effect (especially not if the screen is dimmed to complete black as it was with kernel 3.16).


I successfully tested the attached patch which fixes the issue by disabling the native backlight (based upon a patch by Aaron Lu for a similar bug (84561) for *another* product).
I can't judge if this is sufficient, or if we should try to fix intel_backlight. For the latter I'll also include the output of acpidump.


Thanks again
Jens Reyer
Comment 9 Jani Nikula 2014-12-15 13:00:55 UTC
Aaron, maybe another one that needs firmware backlight.
Comment 10 jre.winesim 2015-02-10 23:51:43 UTC
This is still in 3.18.6.

A friend of mine has a laptop from the same product family SAMSUNG 900X3C/900X3D/900X3E/900X4C/900X4D running Debian Wheezy (contrary to my Debian Jessie) without an external monitor connected (I have one connected on HDMI):
There with all kernel >3.14 (from Debian backports) the GDM login screen is black and brightness not adjustable at all until she logs in. Disabling intel_backlight also fixes the problem there.

So my proposed patch would help both of us.
Comment 11 Aaron Lu 2015-02-12 06:01:52 UTC
Forgot this issue, sorry about that.

Jre,
so we already have this patch that works for you and your friend, please make sure it applies on top of Rafael's linux-next branch:
https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
and then send it to linux-acpi(linux-acpi@vger.kernel.org) and the maintainer "Rafael J. Wysocki" <rjw@rjwysocki.net>.

Thanks for the fix.
Comment 12 jre.winesim 2015-02-15 17:55:22 UTC
(In reply to Aaron Lu from comment #11)
> so we already have this patch that works for you and your friend, please
> make sure it applies on top of Rafael's linux-next branch:
> https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
> linux-next
> and then send it to linux-acpi(linux-acpi@vger.kernel.org) and the
> maintainer "Rafael J. Wysocki" <rjw@rjwysocki.net>.

Done.
Comment 13 Luca Boccassi 2015-02-17 19:19:04 UTC
Hello,

I have a Dell Latitude E5540, running an Intel Haswell i7-4600U with GPU HD Graphics 4400, and I have the same problem. But I noticed that upgrading the Intel driver to a version that ships a new backlight helper binary fixes the problem.

In my case, I am running Debian Jessie. The driver is part of the package xserver-xorg-video-intel and the version that ships the new backlight helper, according to the changelog, is:

xserver-xorg-video-intel (2:2.99.911+git20140529-1~exp1) experimental;
urgency=low

  * New upstream prerelease. (closes: #748753)
  * Install new backlight helper.

Kind regards,
Luca Boccassi
Comment 14 jre.winesim 2015-02-17 20:33:53 UTC
Confirmed, Debian's xserver-xorg-video-intel 2:2.99.917-1~exp1 fixes both the brightness control issue and the initally black screen when I'm testing with Linux 3.16.

So there is another way to fix this. No idea what this means for my proposed kernel patch and all those other similar disable_native_backlight quirks.
Comment 15 Luca Boccassi 2015-02-19 23:16:31 UTC
(In reply to jre.winesim from comment #14)
> Confirmed, Debian's xserver-xorg-video-intel 2:2.99.917-1~exp1 fixes both
> the brightness control issue and the initally black screen when I'm testing
> with Linux 3.16.
> 
> So there is another way to fix this. No idea what this means for my proposed
> kernel patch and all those other similar disable_native_backlight quirks.

If the native backlight helper works, my opinion would be that it's best to keep using it.
Comment 16 jre.winesim 2015-02-23 15:06:20 UTC
My patch has been accepted by Rafael and subsequently merged to:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/ master

  commit 3120d03cf64d7f9fd71231827af2c1550aa4caa7
  Author: Jens Reyer <jens.reyer@gmail.com>
  Date:   Tue Feb 17 19:07:29 2015 +0100
  ACPI / video: Disable native backlight on Samsung Series 9 laptops

Thanks Aaron Lu for guiding me through my first kernel patch submission.

So this bug will be fixed in Linux 3.20/4.0 and this report here may be closed.

Still I'd like to know if there are any plans to reenable native backlight, now that we know (thanks Luca Boccassi) that a newer xserver-xorg-video-intel also fixes the issues. Aaron?

Thanks again
jre/Jens Reyer
Comment 17 Jani Nikula 2015-02-24 08:48:17 UTC
(In reply to jre.winesim from comment #16)
> So this bug will be fixed in Linux 3.20/4.0 and this report here may be
> closed.

Closing, thanks for the report - and the fix!
Comment 18 Aaron Lu 2015-02-26 06:24:02 UTC
(In reply to jre.winesim from comment #16)
> My patch has been accepted by Rafael and subsequently merged to:
> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/ master
> 
>   commit 3120d03cf64d7f9fd71231827af2c1550aa4caa7
>   Author: Jens Reyer <jens.reyer@gmail.com>
>   Date:   Tue Feb 17 19:07:29 2015 +0100
>   ACPI / video: Disable native backlight on Samsung Series 9 laptops
> 
> Thanks Aaron Lu for guiding me through my first kernel patch submission.
> 
> So this bug will be fixed in Linux 3.20/4.0 and this report here may be
> closed.
> 
> Still I'd like to know if there are any plans to reenable native backlight,
> now that we know (thanks Luca Boccassi) that a newer
> xserver-xorg-video-intel also fixes the issues. Aaron?

I'm not sure how exactly the updated xserver-xorg-video-intel package fixed the problem. The native backlight control interface is provided by the in kernel i915 driver and shouldn't be possible to be fixed by an user space package. If this remains true, I don't see there is a need to enable the native backlight interface.
Comment 19 Luca Boccassi 2015-02-26 15:02:09 UTC
(In reply to Aaron Lu from comment #18)
> (In reply to jre.winesim from comment #16)
> > My patch has been accepted by Rafael and subsequently merged to:
> > git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/ master
> > 
> >   commit 3120d03cf64d7f9fd71231827af2c1550aa4caa7
> >   Author: Jens Reyer <jens.reyer@gmail.com>
> >   Date:   Tue Feb 17 19:07:29 2015 +0100
> >   ACPI / video: Disable native backlight on Samsung Series 9 laptops
> > 
> > Thanks Aaron Lu for guiding me through my first kernel patch submission.
> > 
> > So this bug will be fixed in Linux 3.20/4.0 and this report here may be
> > closed.
> > 
> > Still I'd like to know if there are any plans to reenable native backlight,
> > now that we know (thanks Luca Boccassi) that a newer
> > xserver-xorg-video-intel also fixes the issues. Aaron?
> 
> I'm not sure how exactly the updated xserver-xorg-video-intel package fixed
> the problem. The native backlight control interface is provided by the in
> kernel i915 driver and shouldn't be possible to be fixed by an user space
> package. If this remains true, I don't see there is a need to enable the
> native backlight interface.

Hello Aaron,

That package ships a binary, xf86-video-intel-backlight-helper, which apparently is used to regulate the brightness. I'm not familiar with the code myself or the project itself, but with a quick Google search this Xorg mailer thread came up and it does shed some light on how this is used:
http://lists.x.org/archives/xorg-devel/2014-February/040575.html

Kind regards,
Luca Boccassi
Comment 20 Aaron Lu 2015-02-27 03:16:29 UTC
(In reply to Luca Boccassi from comment #19)
> Hello Aaron,
> 
> That package ships a binary, xf86-video-intel-backlight-helper, which
> apparently is used to regulate the brightness. I'm not familiar with the
> code myself or the project itself, but with a quick Google search this Xorg
> mailer thread came up and it does shed some light on how this is used:
> http://lists.x.org/archives/xorg-devel/2014-February/040575.html

Thanks for the pointer. The helper is used to write a value to the /sys/class/backlight/X/brightness and the fact that it now works means that the native interface works and the original problem may be due to broken user space tool. You can verify by doing this(when the native interface is still there):
# cd /sys/class/backlight/intel_backlight
# cat max_brightness
XXX
# echo some_value_less_than_max > brightness
See if backlight level changes. Of source you will also need to verify if the interface still works after hotplug as your original scenario.

If the backlight indeed works, then we have mistakenly disabled the native interface and I think we should revert that patch.
Comment 21 Luca Boccassi 2015-02-27 10:18:37 UTC
(In reply to Aaron Lu from comment #20)
> (In reply to Luca Boccassi from comment #19)
> > Hello Aaron,
> > 
> > That package ships a binary, xf86-video-intel-backlight-helper, which
> > apparently is used to regulate the brightness. I'm not familiar with the
> > code myself or the project itself, but with a quick Google search this Xorg
> > mailer thread came up and it does shed some light on how this is used:
> > http://lists.x.org/archives/xorg-devel/2014-February/040575.html
> 
> Thanks for the pointer. The helper is used to write a value to the
> /sys/class/backlight/X/brightness and the fact that it now works means that
> the native interface works and the original problem may be due to broken
> user space tool. You can verify by doing this(when the native interface is
> still there):
> # cd /sys/class/backlight/intel_backlight
> # cat max_brightness
> XXX
> # echo some_value_less_than_max > brightness
> See if backlight level changes. Of source you will also need to verify if
> the interface still works after hotplug as your original scenario.
> 
> If the backlight indeed works, then we have mistakenly disabled the native
> interface and I think we should revert that patch.

Hello Aaron,

I just tested and it works as expected, brightness changes. Tested on Jessie with both 3.18 and 3.19, and the 2.99.917-1 xserver-xorg-video-intel.

But please note that, although I believe the problem is the same since the GPU family and drivers are the same, I have a different laptop: Dell Latitude E5540, running an Intel Haswell i7-4600U with GPU HD Graphics 4400.
So we should have someone with the Samsung laptop (which has an HD4000 I think) to confirm as well, to be sure.

Kind regards,
Luca Boccassi
Comment 22 jre.winesim 2015-02-27 16:39:09 UTC
1.)
I can confirm that indeed the xserver-xorg-video-intel backlight helper fixes the issue (and not an unrelated change).

If I build my own packages based on the preceding commit [1] the problem still exists. After applying the next 2 commits [2] everything works (there are some more related commits in the repo, but this is the minimal changeset).

[1]:
git://anonscm.debian.org/pkg-xorg/driver/xserver-xorg-video-intel
commit a01548ccf192a5b1fa1f4a3e31e1634db39f6b39
    intel: export fd_set_cloexec / fd_set_nonblock

[2]:
commit b71f3d8bd4d6773899c1bdc903911cf240e68ead
    Backlight helper build fixes
commit 3d629c91cfa98b75c6685c2a2003e64fd1b612c4
    intel: Add a helper for setting backlight without root rights


2.)
I can also confirm that while the problem exists (GDM login screen black and brightness not adjustable) I can adjust the brightness with e.g.:
# echo 4647 > /sys/class/backlight/intel_backlight/brightness

(In reply to Aaron Lu from comment #20)
> (In reply to Luca Boccassi from comment #19)
> > Hello Aaron,
> > 
> > That package ships a binary, xf86-video-intel-backlight-helper, which
> > apparently is used to regulate the brightness. I'm not familiar with the
> > code myself or the project itself, but with a quick Google search this Xorg
> > mailer thread came up and it does shed some light on how this is used:
> > http://lists.x.org/archives/xorg-devel/2014-February/040575.html
> 
> Thanks for the pointer. The helper is used to write a value to the
> /sys/class/backlight/X/brightness and the fact that it now works means that
> the native interface works and the original problem may be due to broken
> user space tool.

If I understood it correctly, the helper is used to write a value to the /sys/class/backlight/X/brightness *with root rights*, because xf86-video-intel requires them (contrary to all other drivers). Still I don't understand why this is a problem here before login to Gnome, but not after. (I'm running a "normal" Debian Jessie here with Xorg/gdm3 running as root.) So probably yes, broken user space tool.


(In reply to Aaron Lu from comment #20)
> If the backlight indeed works, then we have mistakenly disabled the native
> interface and I think we should revert that patch.

Based on Linus "We do not break userspace" I disagree. Everything works fine here with an older kernel <3.16. And it works again for every newer kernel I tested if I disable intel_backlight. So there was a regression in the kernel which had to be fixed.

Having said that the above mentioned thread (and it links) show that the complete backlight implementation would gain from a redesign coordinated between X/kernel/... . Until then IMO the ugly blacklist to disable native blacklight has to remain.

Greets
jre
Comment 23 Aaron Lu 2015-02-28 02:06:43 UTC
(In reply to jre.winesim from comment #22)
> (In reply to Aaron Lu from comment #20)
> > If the backlight indeed works, then we have mistakenly disabled the native
> > interface and I think we should revert that patch.
> 
> Based on Linus "We do not break userspace" I disagree. Everything works fine
> here with an older kernel <3.16. And it works again for every newer kernel I
> tested if I disable intel_backlight. So there was a regression in the kernel
> which had to be fixed.

I still don't understand what the problem is: if setting a brightness value requires root privilege, then it is true for both acpi_video and intel_backlight and if intel_backlight always works(i.e. by doing echo), I don't see why the broken user space tool works with acpi_video but not with intel_backlight...


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.