public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: "Eoff, Ullysses A" <ullysses.a.eoff@intel.com>"Eoff,
	Ullysses A" <ullysses.a.eoff@intel.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>
Subject: Re: [RFC PATCH] drm/i915: avoid round-trip scaling errors in actual_brightness
Date: Fri, 05 Dec 2014 15:09:48 +0200	[thread overview]
Message-ID: <87mw72jl9f.fsf@intel.com> (raw)
In-Reply-To: <8B5BDC21C48FAF4CA5D7E3FE1A63A90870922816@ORSMSX111.amr.corp.intel.com>

On Tue, 02 Dec 2014, "Eoff, Ullysses A" <ullysses.a.eoff@intel.com> wrote:
> bump

Talked about this with Daniel a while back, his take was, "preemptively
catering to bonghits userspace means we'll have less wiggle-room in the
future"

BR,
Jani.


>
>> -----Original Message-----
>> From: Intel-gfx [mailto:intel-gfx-bounces@lists.freedesktop.org] On Behalf Of Eoff, Ullysses A
>> Sent: Thursday, November 20, 2014 9:34 AM
>> To: Nikula, Jani; intel-gfx@lists.freedesktop.org
>> Subject: Re: [Intel-gfx] [RFC PATCH] drm/i915: avoid round-trip scaling errors in actual_brightness
>> 
>> > -----Original Message-----
>> > From: Nikula, Jani
>> > Sent: Thursday, November 20, 2014 3:59 AM
>> > To: intel-gfx@lists.freedesktop.org
>> > Cc: Nikula, Jani; Eoff, Ullysses A
>> > Subject: [RFC PATCH] drm/i915: avoid round-trip scaling errors in actual_brightness
>> >
>> > Due to scaling, the userspace and hardware brightness ranges might not
>> > have a 1:1 mapping, causing the backlight class sysfs actual_brightness
>> > not match the brightness attribute just written. While this is not a
>> > strict requirement per Documentation/ABI/stable/sysfs-class-backlight,
>> > try the userspace->hardware scaling for a match first and return the
>> > cached value to not confuse userspace.
>> >
>> > The problem was already mitigated by
>> >
>> > commit 673e7bbdb3920b62cfc6c710bea626b0a9b0f43a
>> > Author: U. Artie Eoff <ullysses.a.eoff@intel.com>
>> > Date:   Mon Sep 29 15:49:32 2014 -0700
>> >
>> >     drm/i915: intel_backlight scale() math WA
>> >
>> > but this should be more robust for cases where the userspace expects
>> > actual_brightness to match the just written brightness.
>> >
>> > Reference: http://mid.gmane.org/1415737838-9640-1-git-send-email-ullysses.a.eoff@intel.com
>> > Reference: https://bugzilla.kernel.org/show_bug.cgi?id=85861
>> > Cc: U. Artie Eoff <ullysses.a.eoff@intel.com>
>> > Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> 
>> Tested-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
>> 
>> > ---
>> >  drivers/gpu/drm/i915/intel_panel.c | 12 +++++++++++-
>> >  1 file changed, 11 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
>> > index 4d63839bd9b4..675b56e105e7 100644
>> > --- a/drivers/gpu/drm/i915/intel_panel.c
>> > +++ b/drivers/gpu/drm/i915/intel_panel.c
>> > @@ -1024,7 +1024,17 @@ static int intel_backlight_device_get_brightness(struct backlight_device *bd)
>> >  	drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
>> >
>> >  	hw_level = intel_panel_get_backlight(connector);
>> > -	ret = scale_hw_to_user(connector, hw_level, bd->props.max_brightness);
>> > +
>> > +	/*
>> > +	 * Check the userspace->hardware scaling for a match first to avoid
>> > +	 * scaling errors in the userspace->hardware->userspace round-trip.
>> > +	 */
>> > +	if (hw_level == scale_user_to_hw(connector, bd->props.brightness,
>> > +					 bd->props.max_brightness))
>> > +		ret = bd->props.brightness;
>> > +	else
>> > +		ret = scale_hw_to_user(connector, hw_level,
>> > +				       bd->props.max_brightness);
>> >
>> >  	drm_modeset_unlock(&dev->mode_config.connection_mutex);
>> >  	intel_runtime_pm_put(dev_priv);
>> > --
>> > 2.1.3
>> 
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

      reply	other threads:[~2014-12-05 13:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-20 11:58 [RFC PATCH] drm/i915: avoid round-trip scaling errors in actual_brightness Jani Nikula
2014-11-20 17:33 ` Eoff, Ullysses A
2014-12-02 19:00   ` Eoff, Ullysses A
2014-12-05 13:09     ` Jani Nikula [this message]

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=87mw72jl9f.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=ullysses.a.eoff@intel.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