On Sat, 28 Jun 2014 16:45:03 +0300 Jani Nikula <jani.nikula@xxxxxxxxx> 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@xxxxxxxxx > > > 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 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx