[RFC v2] drm/kms: control display brightness through drm_connector properties

Ville Syrjälä ville.syrjala at linux.intel.com
Mon Oct 3 09:29:01 UTC 2022


On Mon, Oct 03, 2022 at 11:37:50AM +0300, Pekka Paalanen wrote:
> On Fri, 30 Sep 2022 18:17:39 +0200
> Sebastian Wick <sebastian.wick at redhat.com> wrote:
> 
> > On Fri, Sep 30, 2022 at 5:27 PM Pekka Paalanen <ppaalanen at gmail.com> wrote:
> > >
> > > On Fri, 30 Sep 2022 17:44:17 +0300
> > > Ville Syrjälä <ville.syrjala at linux.intel.com> wrote:
> > >  
> > > > On Fri, Sep 30, 2022 at 04:20:29PM +0200, Sebastian Wick wrote:  
> > > > > On Fri, Sep 30, 2022 at 9:40 AM Pekka Paalanen <ppaalanen at gmail.com> wrote:  
> > > > > >
> > > > > > On Thu, 29 Sep 2022 20:06:50 +0200
> > > > > > Sebastian Wick <sebastian.wick at redhat.com> wrote:
> > > > > >  
> > > > > > > If it is supposed to be a non-linear luminance curve, which one is it?
> > > > > > > It would be much clearer if user space can control linear luminance
> > > > > > > and use whatever definition of perceived brightness it wants. The
> > > > > > > obvious downside of it is that it requires bits to encode changes that
> > > > > > > users can't perceive. What about backlights which only have a few
> > > > > > > predefined luminance levels? How would user space differentiate
> > > > > > > between the continuous and discrete backlight? What about
> > > > > > > self-emitting displays? They usually increase the dynamic range when
> > > > > > > they increase in brightness because the black level doesn't rise. They
> > > > > > > also probably employ some tonemapping to adjust for that. What about
> > > > > > > the range of the backlight? What about the absolute luminance of the
> > > > > > > backlight? I want to know about that all in user space.
> > > > > > >
> > > > > > > I understand that most of the time the kernel doesn't have answers to
> > > > > > > those questions right now but the API should account for all of that.  
> 
> ...
> 
> > > I'm saying that what looks realistic to me is somewhere *between*
> > > status quo and what Sebastian is asking for. Whatever you mean by "linear
> > > remapping" is probably a realistic goal, because you know you have some
> > > hardware/firmware delivering that information already.
> > >
> > > OTOH, designing UAPI for information that exists only in our dreams
> > > is... well.  
> > 
> > I also didn't say that we should design an UAPI for what doesn't
> > exist, just that we should design the UAPI we actually need in a way
> > that when we get more information we can properly expose that. So if
> > the UAPI exposes anything other than the luminance (e.g. "each step is
> > a perceptual step in brightness", "linear brightness", ..) we have to
> > put some human perception model into the kernel which is ridiculous
> > and it makes it impossible to expose luminance to user space if the
> > kernel has that information.
> 
> You don't need a human perception model in the kernel. You also cannot
> have one, because I would expect most or all backlight and their
> metadata to not define luminance at all. But that is just a guess.
> 
> I suppose the firmware may expose some tables that may allow mapping
> raw hardware values into something more pleasant to use. Like something
> where each step is more or less a visible change. That does not have to
> imply anything about linearity in any space, they may just be "good
> values" for e.g. keyboard-based changing of backlight levels with no
> mathematical or physical basis.
> 
> Ville, what kind of tables do you know about? What do they actually
> tell?

We just get a set of points (up to 20 originally, and I think up to
32 in later spec revisions) that map input brightness (in %) to
output duty cycle (0-0xff in old spec, 0-0xffff in new spec).
And I *think* we're supposed to just linearly inteprolate between
the entries, though the spec doesn't really state that in super
clear terms.

There is some mention in the spec about this being more or less
designed for Windows Vista, so a look through eg.
https://learn.microsoft.com/en-us/windows-hardware/drivers/display/supporting-brightness-controls-on-integrated-display-panels
might be a good idea here.

-- 
Ville Syrjälä
Intel


More information about the wayland-devel mailing list