Bug 448459 - Logarithmic brightness scaling
Summary: Logarithmic brightness scaling
Status: ASSIGNED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Power management & brightness (other bugs)
Version First Reported In: 6.2.4
Platform: Neon Linux
: NOR task
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2022-01-14 13:24 UTC by Eric Edlund
Modified: 2024-12-18 21:41 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
nacent but functional logarithmic brightness hack (7.24 KB, text/plain)
2022-01-23 15:43 UTC, Peter Newcomb
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Edlund 2022-01-14 13:24:44 UTC
SUMMARY
The brightness keys right now step in linear intervals (as far as I can tell). This makes adjustment steps about the right size in the middle of the scale, but not on the lower end. Humans actually perceive brightness logarithmically, so the same amount of change  in brightness appears to be much larger in lower levels of brightness than on higher ones. For people who typically keep their brightness pretty low, or those who use their computer in dark places, the last brightness step jumps from too bright to off.

Other platforms like android have had this feature, and although I don't have a mac or pc in front of me, I can't imagine they don't use logarithmic brightness. This is a very basic usability feature that almost every corporate operating system employs and plasma is behind because it doesn't have it.

Even right now, with a window behind me, 5% brightness is too dark and 10% is too bright and it's silly that I have to settle for one extreme while the people sitting next to me on their macs don't. I'm marking this bug's severity as "normal" because this is pretty unarguably a problem.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Neon 5.23 User Edition
(available in About System)
KDE Plasma Version: 5.23.5
KDE Frameworks Version: 5.89.0
Qt Version: 5.15.3
Comment 1 Eric Edlund 2022-01-15 22:00:43 UTC
Alright this is my new project this weekend wish me luck!
Comment 2 Peter Newcomb 2022-01-23 15:43:05 UTC
Created attachment 145804 [details]
nacent but functional logarithmic brightness hack

Hi Eric,

It turns out that I just implemented this for myself, though on 5.18.4.1.  I thought I had searched for such a thing before, but failed to find this bug before I started coding.  I think the code I have does the math and implements the functionality properly (at least for my X13 Yoga OLED), but it's currently an #ifdef hack rather than a proper configuration or heuristic switch.

The tricky thing turned out to be the need to segment the function into a linear (identity) portion on the low-end and a logarithmic/exponential portion on the high end, with a bit of interpolation to calculate percentages in between.

Anyway, I've attached my patch as-is in case it's helpful, happy to discuss if you're interested.  I'm also happy to help bring it up to snuff for a proper contribution, but I recognize that you probably have your own implementation well in hand already.  Either way, I'm looking forward to having the functionality mainlined so I won't have to keep patching forever.  :-)

Thanks for taking this on!
Comment 3 Eric Edlund 2022-01-23 15:52:05 UTC
I'll be honest Peter, I haven't been able to get PowerDevil to compile on my machine, the dev chat has been no help and I'm ready to throw in the towel. If you could get your patch pushed in and I can stop blinding myself in dark environments I'll be happy. :)

Thank you!
Comment 4 Peter Newcomb 2022-01-24 00:08:38 UTC
Sounds good.  I'll start looking into fully fleshing out the feature.
Comment 5 zzrakic 2022-09-17 14:08:07 UTC
Hi Peter, has there been any improvement on this? 

I'm linking this article that might help with development: https://konradstrack.ninja/blog/changing-screen-brightness-in-accordance-with-human-perception/
Comment 6 Eric Edlund 2022-09-17 14:30:28 UTC
Oops, probably should have said this, but I started working on it again and am basically done. 

https://invent.kde.org/plasma/powerdevil/-/merge_requests/102?diff_id=428455&start_sha=c526286525109a81c29eac8c04359831f9e61e69#d7c9d73080a4c9f53a724d270836b260b5d9db26
Comment 7 zzrakic 2022-09-17 14:37:31 UTC
Awesome news Eric! I think this is a very significant feature that laptop users will appreciate. Can't wait for it to be implemented. Great job.
Comment 8 Peter Newcomb 2022-09-17 15:02:44 UTC
Yes, great news, Eric!  I've been using the patch I posted above since I posted it, but got bogged down trying to set up a proper KDE build so that I could submit a complete contribution.  Then I got too busy with other things.
Comment 9 Bug Janitor Service 2023-02-07 18:53:49 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/powerdevil/-/merge_requests/134
Comment 10 Fieldservice4 2023-09-18 16:34:45 UTC
Thanks. This is indeed an issue.

A field service laptop (for police / military / emergency service / construction etc.) uses displays with 1000 - 1400 nits. Due to their multiple times brighter displays compared to ordinary laptops, the lowest jumps (e.g. 5% to 10%) has tremendous impact on the brightness, often making it impossible to adjust to a comfortable brightness level for indoor use.

Ordinary business and consumer laptops are also currently increasing their display brightness, and will therefore face the same issue, making this fix even more important.
Comment 11 Nate Graham 2023-09-18 19:27:58 UTC
Fieldservice4, can you clarify whether you *do* or *do not* want logarithmic brightness changes? Right now we do linear changes.
Comment 12 Fieldservice4 2023-09-19 15:28:57 UTC
(In reply to Nate Graham from comment #11)
> Fieldservice4, can you clarify whether you *do* or *do not* want logarithmic
> brightness changes? Right now we do linear changes.

Do want logarithmic. 

The author is correct. Linear changes does not work well with laptops with high brightness display (linked below), since the eye is sensitive to changes in low light environments but not high lights environment. 

So for an example, the 1400 nits display in the link below, a 10% change in brightness would be a 140 nits change. To illustrate this, it means 280 nits at only 20% brightness, which is almost equal to the maximum brightness of a normal consumer/business laptop (350 nits).

The issue is that it becomes difficult to find a comfortable setting working in a low light environment, or if you have the laptop mounted in the vehicle (e.g. law enforcement) and driving in night time, it is easily either too dark or too bright with a linear setting with these kind of laptops. So it should be logarithmic.

https://www.dell.com/en-us/shop/dell-laptops-and-notebooks/sf/rugged-laptops
Comment 13 Nate Graham 2023-09-19 15:41:28 UTC
Got it, thanks.