-
Notifications
You must be signed in to change notification settings - Fork 471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
backlight: support nonlinear brightness #882
Conversation
Oops! I just realized I didn't update the docs. |
Out of interest, what kind of values does your hardware output? Is it the same kind of issue as #642? In any case the scaling is an interesting idea. |
83074ec
to
0a6c00d
Compare
#642 is different. My hardware is a Thinkpad T490, with I got the idea from https://github.com/arsv/xcubiclight but after reading up a bit realized that hardcoding a choice between 1.0 and 3.0 is not the best solution. |
0a6c00d
to
83c1756
Compare
What is the range of values you get for the below files? 0 to max_brightness(24242)? Just trying to understand the behaviours of different hardware.. /sys/class/backlight/xxx/actual_brightness |
@ammgws yes, the range is 0 to 24242.
I first thought the discontinuities are from polling |
So IIRC the current code would take your range of 0 to 24242 and scale it into a 0 to 100 percentile range, and when you scroll on the block it would lower or raise the brightness by x percent. So as it is now, you block is usable in terms of being able to go from 0% to 100% brightness. Is this correct so far? However, you find that the percentage displayed is not necessarily best at representing the brightness level your eyes perceive, so you want to introduce this new Sounds reasonable to me, it's kind of like the |
@ammgws yes, exactly. The minimum brightness is at value 1, the maximum at value 24242. The midpoint is visually something like 3000, so with the normal linear mapping most of the dynamic range falls in between 1..10%. What's worse, the 1% value 242 is much, much brighter than the hardware minimum of 1 (with a cubic scale it's around 20% brightness). I can't scroll to 0% but 0 turns the backlight off. By now I'm not sure if the documentation I've written is very good. And maybe there's a better name than |
Maybe something with "natural" like the other blocks, or maybe something with "nonlinear"? |
Another way to do this is to have an enum. I actually first implemented |
@GladOSkar What do you think? |
The general idea seems very reasonable (and also applicable to my usage, thx!) to me. As to the naming for the root parameter i don't have strong preferences. I think |
|
The raw brightness values are quite useless on some hardware. Add an option to scale the raw backlight PWM values on a power scale. Since there is no single correct exponent even in the CIELAB L* function and the mapping between raw hardware brightness value and relative luminance is unknown, the implementation allows user to fine-tune the exponent.
83c1756
to
8c408c3
Compare
Sounds good to me. Here's a rebased version of the commit with |
Thanks! |
Just tried it and i love it, thanks a lot! |
The raw brightness values are quite useless on some hardware. Add an
option to scale the raw backlight PWM values on a power scale.
Since there is no single correct exponent even in the CIELAB L* function
and the mapping between raw hardware brightness value and relative
luminance is unknown, the implementation allows user to fine-tune the
exponent.