[Intel-gfx] [RFC PATCH] drm/i915: avoid round-trip scaling errors in actual_brightness
Jani Nikula
jani.nikula at intel.com
Fri Dec 5 05:09:48 PST 2014
On Tue, 02 Dec 2014, "Eoff, Ullysses A" <ullysses.a.eoff at 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 at lists.freedesktop.org] On Behalf Of Eoff, Ullysses A
>> Sent: Thursday, November 20, 2014 9:34 AM
>> To: Nikula, Jani; intel-gfx at 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 at 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 at 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 at intel.com>
>> > Signed-off-by: Jani Nikula <jani.nikula at intel.com>
>>
>> Tested-by: U. Artie Eoff <ullysses.a.eoff at 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 at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Jani Nikula, Intel Open Source Technology Center
More information about the Intel-gfx
mailing list