-
Notifications
You must be signed in to change notification settings - Fork 82
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
Raspberry Pi 7" display brightness fix #166
base: develop
Are you sure you want to change the base?
Conversation
dfbed87
to
364e29f
Compare
ill test out with the new brightness range using the mocked plugin (essentially just adjusts opacity) but from an initial glance i think that may cause an issue it might be easy enough to get the min and max from the brightness module.. maybe? |
The range oddity is specific to that RPi first-party panel (mine is manufactured by element14), so the new range may break the mock plugin and every other display, whoops :) I'm thinking it may be possible to identify these specific panels and override the range only then. |
Had the idea to possibly relocate the brightness range/step integers from arbiter.cpp to the brightness plugins themselves (mocked, official_rpi, x). Each supported display type would define their ranges there, while session.cpp would only call for a unit step up or down to set brightness. This would be cleaner than identifying hardware and overriding the values in the session/arbiter to accommodate for one odd panel model. |
Looks like it's hard-coded currently. https://github.com/raspberrypi/linux/blob/da87f91ad8450ccc5274cd7b6ba8d823b396c96f/drivers/regulator/rpi-panel-attiny-regulator.c#L340 If some panels are brightest at 255 and others 200, it would be worthwhile changing the driver in the kernel to get the max-brightness from the DeviceTree so it can be configured based on the hardware in use, and then the sysfs max-brightness value would reflect that. |
364e29f
to
6c09cd5
Compare
6c09cd5
to
27c4432
Compare
Went for a night drive recently and realized I didn't have this patch installed on my device, just tested with it and for some reason the path check no longer seems to work. Separated the brightness range commit from the PR while I work on this, the old adjustment is here for reference: breakingspell@2d77123. Detecting the specific models and adjusting just for them is probably the best solution, can save that for another PR. C++ isn't my strong suit, I have a feeling the check was flawed and needs done another way. Will post once I have an update! |
Ignore most of my previous update: I was missing the required udev brightness rule from the installer 😅 Before merging, let's wait for some tests and feedback on the fix |
Brightness path:
Raspberry Pi's official DSI-based display will present itself differently when the unit is using the
vc4-kms-v3d
driver. This breaks the backlight level control provided with the dash brightness plugin. To replicate, set in/boot/firmware/config.txt
and observe path:dtoverlay=vc4-fkms-v3d
- /sys/class/backlight/rpi_backlight/brightnessdtoverlay=vc4-kms-v3d
- /sys/class/backlight/10-0045/brightnessThis PR fixes the path by checking for one and using the other if it doesn't exist.
It's worth noting that the DSI display seems to have trouble with the kms driver unless
dtoverlay=vc4-kms-dsi-7inch
is also loaded. I use the fkms fallback and it seems to works fine without hardware encoding. Also worth noting the existing RPi udev brightness permission works for both cases (/sys/class/backlight/%k/brightness
)Brightness range:
I noticed that the display's brightness range is rather odd, the brightest value is actually 200 while maximum value 255 is slightly dimmer. Plus, steps are much more pronounced between 0-100 as they are between 100-200. Someone made a comment about it ages ago, and about the energy draw as well.
I adjusted the min and max values from 76-255 to 20-180 (imperceptible from 200) and the step change to 20 units. However, I realize after posting the commit that this particular range affects all brightness operations using
Session::System::Brightness
, not just for the specific RPi display. Posting for review regardless, I may separate the range fix into it's own PR while seeing if it can be narrowed to only this panel.Related issue (if applicable): fixes #
#149