From: Jani Nikula <jani.nikula@linux.intel.com>
To: "Shih-Yuan Lee (FourDollars)" <sylee@canonical.com>,
intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2] drm/i915: Respect the brightness range from VBT.
Date: Tue, 10 Nov 2015 12:15:48 +0200 [thread overview]
Message-ID: <87y4e6i2i3.fsf@intel.com> (raw)
In-Reply-To: <20151110080110.GA8387@localhost>
On Tue, 10 Nov 2015, "Shih-Yuan Lee (FourDollars)" <sylee@canonical.com> wrote:
> Taking Dell XPS 13 (2015) as an example. The lowest PWM brightness is 10
> and the highest PWM brightness is 937. Before this change, we can only
> use from 37 to 937, and 37 is used to turn off the backlight because it
> is mapped to 0 of sysfs brightness however the maximum sysfs brightness
> is still 937 so it makes some sysfs brightness values are mapped to the
> same PWM brightness values.
>
> After this change, we can use the whole PWM brightness range from 10 to
> 937, and they are mapped into the range from 0 to 927 in the sysfs
> brightness and vice versa because they are 1-1 mapping.
>
> 10 is the lowest PWM brightness. We should make users able to use it for
> the extreme power saving reason and users can still see the display.
>
> Signed-off-by: Shih-Yuan Lee (FourDollars) <sylee@canonical.com>
> ---
> drivers/gpu/drm/i915/intel_panel.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index a24df35..57bc2fe 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -1154,8 +1154,7 @@ static int intel_backlight_device_update_status(struct backlight_device *bd)
> */
> if (panel->backlight.enabled) {
> if (panel->backlight.power) {
> - bool enable = bd->props.power == FB_BLANK_UNBLANK &&
> - bd->props.brightness != 0;
> + bool enable = bd->props.power == FB_BLANK_UNBLANK;
> panel->backlight.power(connector, enable);
This hunk would be a revert of
commit e6755fb78e8f20ecadf2a4080084121336624ad9
Author: Jani Nikula <jani.nikula@intel.com>
Date: Tue Aug 12 17:11:42 2014 +0300
drm/i915: switch off backlight for backlight class 0 brightness
> }
> } else {
> @@ -1211,7 +1210,7 @@ static int intel_backlight_device_register(struct intel_connector *connector)
> * Note: Everything should work even if the backlight device max
> * presented to the userspace is arbitrarily chosen.
> */
> - props.max_brightness = panel->backlight.max;
> + props.max_brightness = panel->backlight.max - panel->backlight.min;
IMO we should consider setting max to fixed 100 here instead. That was
the plan all along when I wrote the scaling stuff and added the Note:
above in
commit 6dda730e55f412a6dfb181cae6784822ba463847
Author: Jani Nikula <jani.nikula@intel.com>
Date: Tue Jun 24 18:27:40 2014 +0300
drm/i915: respect the VBT minimum backlight brightness
I just chickened out of it at that time. The commit message is worth
reading in full.
> props.brightness = scale_hw_to_user(connector,
> panel->backlight.level,
> props.max_brightness);
> @@ -1429,10 +1428,11 @@ static u32 get_backlight_min_vbt(struct intel_connector *connector)
> if (min != dev_priv->vbt.backlight.min_brightness) {
> DRM_DEBUG_KMS("clamping VBT min backlight %d/255 to %d/255\n",
> dev_priv->vbt.backlight.min_brightness, min);
> + /* vbt value is a coefficient in range [0..255] */
> + return scale(min, 0, 255, 0, panel->backlight.max);
> }
>
> - /* vbt value is a coefficient in range [0..255] */
> - return scale(min, 0, 255, 0, panel->backlight.max);
> + return min;
This change would interpret the VBT minimum value as a coefficient x/255
if it's in range 0..64, and as an absolute value x if it's in range
65..255. This seems like an odd thing to do, although I admit what I did
in
commit e1c412e75754ab7b7002f3e18a2652d999c40d4b
Author: Jani Nikula <jani.nikula@intel.com>
Date: Wed Nov 5 14:46:31 2014 +0200
drm/i915: safeguard against too high minimum brightness
is not that much better.
The problem is, there's a spec on VBT (internal, I'm afraid), there's a
tool to generate VBT (Windows only, probably not freely available) with
some interpretation of the spec, and then there are users of the tool
that tweak the variables until they see something they like on the
machine they're developing, running some Windows version with a driver
version with some interpretation of the spec.
So no, I don't agree with any of the changes you propose.
I do acknowledge that we have a minor bug that prevents the user from
setting the brightness to the minimum acceptable by the hardware if the
minimum is non-zero, and 0 means off. Keeping the 0 = off meaning, the
fix would be to have 1 mean the minimum brightness acceptable by the
hardware... which really isn't that much different from what 1 currently
means. The bigger problem is that the userspace probably never sets
brightness to 1 except by accident.
BR,
Jani.
> }
>
> static int lpt_setup_backlight(struct intel_connector *connector, enum pipe unused)
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-11-10 10:11 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-09 6:42 [PATCH] drm/i915: A better maximum brightness for users Shih-Yuan Lee (FourDollars)
2015-11-09 10:17 ` Jani Nikula
2015-11-09 10:30 ` Shih-Yuan Lee (FourDollars)
2015-11-09 10:51 ` Jani Nikula
2015-11-09 11:54 ` Shih-Yuan Lee (FourDollars)
2015-11-09 12:58 ` Jani Nikula
2015-11-09 14:02 ` Shih-Yuan Lee (FourDollars)
2015-11-09 15:25 ` Ville Syrjälä
2015-11-09 16:02 ` Paulo Zanoni
2015-11-09 16:57 ` Jani Nikula
2015-11-10 1:59 ` Shih-Yuan Lee (FourDollars)
2015-11-10 8:01 ` [PATCH v2] drm/i915: Respect the brightness range from VBT Shih-Yuan Lee (FourDollars)
2015-11-10 10:15 ` Jani Nikula [this message]
2015-11-10 11:26 ` Shih-Yuan Lee (FourDollars)
2015-11-10 12:57 ` Jani Nikula
2015-11-10 16:11 ` Shih-Yuan Lee (FourDollars)
2015-11-11 4:11 ` [PATCH v3] drm/i915: Set brightness maximum to a fixed value 100 Shih-Yuan Lee (FourDollars)
2015-11-11 4:57 ` kbuild test robot
2015-11-11 7:31 ` [PATCH v4] " Shih-Yuan Lee (FourDollars)
2015-11-11 12:05 ` Jani Nikula
2015-11-11 13:09 ` Shih-Yuan Lee (FourDollars)
2015-11-11 14:10 ` [PATCH v5] drm/i915: Set backlight class max to 100 and respect the VBT minimum again Shih-Yuan Lee (FourDollars)
2015-11-12 5:43 ` [PATCH v6] drm/i915: respect the VBT minimum backlight brightness again Shih-Yuan Lee (FourDollars)
2015-11-12 8:08 ` Stéphane ANCELOT
2015-11-12 8:28 ` Shih-Yuan Lee (FourDollars)
2015-11-12 8:40 ` Stéphane ANCELOT
2015-11-12 8:57 ` Shih-Yuan Lee (FourDollars)
2015-11-12 9:05 ` Stéphane ANCELOT
2015-11-12 10:01 ` Shih-Yuan Lee (FourDollars)
2015-11-18 9:06 ` Stéphane ANCELOT
2015-11-18 9:11 ` Shih-Yuan Lee (FourDollars)
2015-11-12 13:44 ` Jani Nikula
2015-11-13 3:50 ` [PATCH v7] drm/i915: A better backlight class brightness range Shih-Yuan Lee (FourDollars)
2015-11-13 3:50 ` Shih-Yuan Lee (FourDollars)
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=87y4e6i2i3.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=sylee@canonical.com \
/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