[display] Fix HBM and make it's path configurable#41
[display] Fix HBM and make it's path configurable#41Michal-Szczepaniak wants to merge 1 commit intosailfishos:masterfrom
Conversation
cb8a8a9 to
f732e83
Compare
|
Ping? Can I have any review on this? |
spiiroin
left a comment
There was a problem hiding this comment.
Using config to override hbm control path looks ok.
Changing interpretation of "hbm_and_level" value is not ok.
| gint new_brightness = (hbm_and_level >> 0) & 0xff; | ||
| gint new_hbm_level = (hbm_and_level >> 8) & 0xff; | ||
| gint new_brightness = hbm_and_level; | ||
| gint new_hbm_level = hbm_and_level == 100; |
There was a problem hiding this comment.
This change goes against design (excerpt from datapipe.c)
Display brightness;
bits 0-7 is brightness in percent (0-100)
upper 8 bits is high brightness boost (0-2)
AFAIK, IIRC, etc the idea is basically that
- hbm is triggered by automatic brightness tuning
- duration is limited even if conditions persist
- you can't choose hbm from settings (i.e. having 100 trigger hbm is not ok)
So, instead of code change like this you should have a custom als configuration file where high lux values yield brightness value like 356 instead of 100 and install it as e.g. "/etc/mce/60-als-devicename.ini" so that it overrides defaults originating from /etc/mce/20als-defaults.ini.
There was a problem hiding this comment.
Yeah limiting the input to 100 was very confusing to me so I'll check out what you wrote and see how it goes
But also from my testing on 2 different devices, HBM is just 0-1, writting 2 yields no difference
There was a problem hiding this comment.
@spiiroin I did the changes but I couldn't figure out the als values to get it to work reliably. I can force it if I put 500 in every spot but that's not really a solution and I can't figure out how it works, so could you suggest sample config?
f732e83 to
630ae32
Compare
630ae32 to
b9664ee
Compare
So, I discovered that my phone has HBM and that HBM is a thing and that MCE has HBM support but it doesn't work. So first I've investigated the
mdy_display_type_getmethod and my phone lands on themdy_display_type_get_from_sysfs_probemethod. Path/sys/class/graphics/fb0/device/paneldoesn't exist and/sys/class/backlightis just empty. So then it gets brightness and max_brightness value but never gets HBM path which does exist in/sys/class/graphics/fb0/hbmsodevice/panelwas close. So inmdy_display_type_get_from_configI added fetching the config for HBM and enabling it (if its wrong place I can move it) and I thought that would be it! But sadly, it wasn't.So the method that decides whether or not to enable hbm is here https://github.com/sailfishos/mce/blob/master/modules/display.c#L3705 it takes first 8 bits as brightness and other 8 bits as hbm? Now that is very strange because at 255 it will be max brightness and no hbm but at 256 it will enable hbm and set brightness to 0? That makes no sense. And if it goes any higher HBM won't accept input as it only accepts 0/1. But that's not the only strange thing. Another one is that the input is CAPPED AT 100 https://github.com/sailfishos/mce/blob/master/modules/display.c#L11726 so HBM won't ever be enabled!
Maybe its legacy code I don't know but I've fixed that too and now it works fine