From: Jani Nikula <jani.nikula@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org,
Daniel Vetter <daniel.vetter@intel.com>,
Jeremiah Mahler <jmmahler@gmail.com>
Subject: Re: [PATCH] drm/i915: fix inconsistent brightness after resume
Date: Mon, 12 Jan 2015 12:31:09 +0200 [thread overview]
Message-ID: <877fwsxpci.fsf@intel.com> (raw)
In-Reply-To: <1420925135-1589-1-git-send-email-jmmahler@gmail.com>
On Sat, 10 Jan 2015, Jeremiah Mahler <jmmahler@gmail.com> wrote:
> Commit 6dda730e55f4 introduced a bug which resulted in inconsistent
> brightness levels on different machines. If a suspended was entered
> with the screen off some machines would resume with the screen
> at minimum brightness and others at maximum brightness.
>
> The following commands can be used to produce this behavior.
>
> xset dpms force off
> sleep 1
> sudo systemctl suspend
> (resume ...)
>
> The root cause of this problem is a comparison which checks to see if
> the backlight level is zero when the panel is enabled. If it is zero,
> it is set to the maximum level. Unfortunately, not all machines have a
> minimum level of zero. On those machines the level is left at the
> minimum instead of begin set to the maximum.
Good catch!
I think part of the problem is that the userspace sets brightness to
minimum before suspend, but apparently does not restore it after
resume. The dmesg would confirm this. But I guess it doesn't matter,
since we're pretty much stuck with having to do this anyway.
> Fix the bug by updating the comparison to check for the minimum
> backlight level instead of zero.
>
> Fixes: 6dda730e55f4 ("respect the VBT minimum backlight brightness")
> Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
> ---
> drivers/gpu/drm/i915/intel_panel.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index 4d63839..4ef4d66 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -962,7 +962,7 @@ void intel_panel_enable_backlight(struct intel_connector *connector)
>
> WARN_ON(panel->backlight.max == 0);
>
> - if (panel->backlight.level == 0) {
> + if (panel->backlight.level == panel->backlight.min) {
Perhaps <= instead of == would be safest?
BR,
Jani.
> panel->backlight.level = panel->backlight.max;
> if (panel->backlight.device)
> panel->backlight.device->props.brightness =
> --
> 2.1.4
>
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Jeremiah Mahler <jmmahler@gmail.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
David Airlie <airlied@linux.ie>,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org,
Jeremiah Mahler <jmmahler@gmail.com>
Subject: Re: [PATCH] drm/i915: fix inconsistent brightness after resume
Date: Mon, 12 Jan 2015 12:31:09 +0200 [thread overview]
Message-ID: <877fwsxpci.fsf@intel.com> (raw)
In-Reply-To: <1420925135-1589-1-git-send-email-jmmahler@gmail.com>
On Sat, 10 Jan 2015, Jeremiah Mahler <jmmahler@gmail.com> wrote:
> Commit 6dda730e55f4 introduced a bug which resulted in inconsistent
> brightness levels on different machines. If a suspended was entered
> with the screen off some machines would resume with the screen
> at minimum brightness and others at maximum brightness.
>
> The following commands can be used to produce this behavior.
>
> xset dpms force off
> sleep 1
> sudo systemctl suspend
> (resume ...)
>
> The root cause of this problem is a comparison which checks to see if
> the backlight level is zero when the panel is enabled. If it is zero,
> it is set to the maximum level. Unfortunately, not all machines have a
> minimum level of zero. On those machines the level is left at the
> minimum instead of begin set to the maximum.
Good catch!
I think part of the problem is that the userspace sets brightness to
minimum before suspend, but apparently does not restore it after
resume. The dmesg would confirm this. But I guess it doesn't matter,
since we're pretty much stuck with having to do this anyway.
> Fix the bug by updating the comparison to check for the minimum
> backlight level instead of zero.
>
> Fixes: 6dda730e55f4 ("respect the VBT minimum backlight brightness")
> Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
> ---
> drivers/gpu/drm/i915/intel_panel.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index 4d63839..4ef4d66 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -962,7 +962,7 @@ void intel_panel_enable_backlight(struct intel_connector *connector)
>
> WARN_ON(panel->backlight.max == 0);
>
> - if (panel->backlight.level == 0) {
> + if (panel->backlight.level == panel->backlight.min) {
Perhaps <= instead of == would be safest?
BR,
Jani.
> panel->backlight.level = panel->backlight.max;
> if (panel->backlight.device)
> panel->backlight.device->props.brightness =
> --
> 2.1.4
>
--
Jani Nikula, Intel Open Source Technology Center
next prev parent reply other threads:[~2015-01-12 10:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-09 4:06 [BUG] drm/i915: backlight off after resume Jeremiah Mahler
2015-01-09 4:06 ` Jeremiah Mahler
2015-01-09 8:21 ` Jani Nikula
2015-01-10 21:25 ` [PATCH] drm/i915: fix inconsistent brightness " Jeremiah Mahler
2015-01-10 21:25 ` Jeremiah Mahler
2015-01-12 10:31 ` Jani Nikula [this message]
2015-01-12 10:31 ` Jani Nikula
2015-01-12 18:47 ` Jeremiah Mahler
2015-01-12 18:47 ` Jeremiah Mahler
2015-01-12 19:01 ` [PATCH v2] " Jeremiah Mahler
2015-01-12 19:01 ` Jeremiah Mahler
2015-01-21 17:04 ` Jani Nikula
2015-01-21 17:04 ` Jani Nikula
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877fwsxpci.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jmmahler@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.