public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	Harry Pan <harry.pan@intel.com>,
	daniel.vetter@intel.com, gs0622@gmail.com
Subject: Re: [PATCH] drm/i915: minor corner case fix to respect user's backlight setting
Date: Fri, 27 Jan 2017 16:10:20 +0200	[thread overview]
Message-ID: <871svo4mr7.fsf@intel.com> (raw)
In-Reply-To: <1485521860-682-1-git-send-email-harry.pan@intel.com>

On Fri, 27 Jan 2017, Harry Pan <harry.pan@intel.com> wrote:
> When enabling panel backlight, if the current backlight level
> setting matches the panel's minimal, it would apply default policy to
> override the current level by the panel's maximum until next request
> to update brightness, this leads unexpected user confusion with
> temporary full power backlight.
>
> This odd could be reproduced as commands like these:
>  $ xbacklight -set 0
>  $ sudo sh -c 'echo mem > /sys/power/state'
>  (resume)
>
> To fix this, slightly tinker the backlight level comparison from
> 'less-and-equal-to' to 'less-than'.
>
> Before: (dmesg | grep backlight # with drm.debug=0xe)
> [   82.249265] [drm:intel_backlight_device_update_status [i915]] updating intel_backlight, brightness=0/5273
> [   82.249282] [drm:intel_panel_actually_set_backlight [i915]] set backlight PWM = 207
> [   82.249306] [drm:intel_edp_backlight_power [i915]] panel power control backlight disable
> [   92.066041] [drm:intel_edp_backlight_off [i915]]
> [   92.270489] [drm:intel_panel_actually_set_backlight [i915]] set backlight PWM = 0
> [   94.080434] [drm:intel_edp_backlight_on.part.25 [i915]]
> [   94.080476] [drm:intel_panel_enable_backlight [i915]] pipe A
> [   94.080539] [drm:intel_panel_actually_set_backlight [i915]] set backlight PWM = 5273
>
> After:
> [   72.874465] [drm:intel_backlight_device_update_status [i915]] updating intel_backlight, brightness=0/5273
> [   72.874499] [drm:intel_panel_actually_set_backlight [i915]] set backlight PWM = 207
> [   72.874540] [drm:intel_edp_backlight_power [i915]] panel power control backlight disable
> [   86.807928] [drm:intel_edp_backlight_off [i915]]
> [   87.013227] [drm:intel_panel_actually_set_backlight [i915]] set backlight PWM = 0
> [   89.001829] [drm:intel_edp_backlight_on.part.25 [i915]]
> [   89.001859] [drm:intel_panel_enable_backlight [i915]] pipe A
> [   89.001926] [drm:intel_panel_actually_set_backlight [i915]] set backlight PWM = 207
>
> Fixes: 13f3fbe827d0 ("fix inconsistent brightness after resume")

That reference is not really true. We've had this policy of setting the
backlight to max at enable if it was previously zero for eons. Yes, it's
policy, not mechanism, but it's basically ABI.

For some reason the expectation is that the sequence:

1. set backlight to 0
2. dpms off
3. dpms on

does not lead to a black screen regardless of the user request to have 0
backlight. Your change breaks this.

> Signed-off-by: Harry Pan <harry.pan@intel.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 08ab6d7..e882139 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -1104,7 +1104,7 @@ void intel_panel_enable_backlight(struct intel_connector *connector)
>  
>  	WARN_ON(panel->backlight.max == 0);
>  
> -	if (panel->backlight.level <= panel->backlight.min) {
> +	if (panel->backlight.level < panel->backlight.min) {
>  		panel->backlight.level = panel->backlight.max;

If we changed this to follow your logic, the sensible thing to do would
be to set the backlight to min, not max, in this case.

But the point is moot. I don't want to deal with the regressions that I
predict the change will inevitably cause.


BR,
Jani.


>  		if (panel->backlight.device)
>  			panel->backlight.device->props.brightness =

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2017-01-27 14:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-27 12:57 [PATCH] drm/i915: minor corner case fix to respect user's backlight setting Harry Pan
2017-01-27 14:10 ` Jani Nikula [this message]
2017-01-30 11:54 ` ✓ Fi.CI.BAT: success for " Patchwork

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=871svo4mr7.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gs0622@gmail.com \
    --cc=harry.pan@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox