From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jesse Barnes Subject: Re: [PATCH 2/2] drm/i915: respect the VBT minimum backlight brightness Date: Mon, 30 Jun 2014 08:05:34 -0700 Message-ID: <20140630080534.2fcb3ccb@jbarnes-desktop> References: <1403623660-1257-1-git-send-email-jani.nikula@intel.com> <1403623660-1257-2-git-send-email-jani.nikula@intel.com> <20140627085111.43b95d59@jbarnes-desktop> <87d2dtjggw.fsf@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id E4E316E413 for ; Mon, 30 Jun 2014 08:06:20 -0700 (PDT) In-Reply-To: <87d2dtjggw.fsf@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Jani Nikula Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Sat, 28 Jun 2014 16:45:03 +0300 Jani Nikula wrote: > >> +/* Scale user_level in range [0..user_max] to [0..hw_max], clamping the result > >> + * to [hw_min..hw_max]. */ > >> +static inline u32 clamp_user_to_hw(struct intel_connector *connector, > >> + u32 user_level, u32 user_max) > >> +{ > >> + struct intel_panel *panel = &connector->panel; > >> + u32 hw_level; > >> + > >> + hw_level = scale(user_level, 0, user_max, 0, panel->backlight.max); > >> + hw_level = clamp(hw_level, panel->backlight.min, panel->backlight.max); > >> + > >> + return hw_level; > >> +} > > > > I like the direction here, but does this mean some user values will > > potentially be no-ops? E.g. the low 10 values or something would all > > map to backlight.min depending on the min? > > This patch doesn't really change the fact. For a max backlight of, say, > 100000, we're bound to not have user perceivable difference between > consecutive levels. I agree we should have a fixed, limited range here. > > This also depends on the backlight modulation frequency, see my earlier > message about this: http://mid.gmane.org/87iooecg1e.fsf@intel.com > > > I just want to make sure every value we expose to userspace is > > meaningful, and somehow equidistant from the values next to it, so we > > have nice, smooth backlight transitions, and fades look good (on that > > front, is 256 enough? or should we have a scaled range up to 1024 or > > so?) > > Probably even fewer than that is enough. > > But you bring up another requirement, equidistant - do you mean in terms > of luminance? Almost certainly a linear mapping to the duty cycle is not > going to give you a linear luminance! It's possible to define a curve > for this in the acpi opregion; patches to implement this are welcome. ;) Ok, I guess both of these are projects for future patches. For making the brightness levels evenly spaced, yeah I guess we'd need to apply a rough approximation of a luminosity function (doesn't look like a simple exponential curve, oh well). Jesse