Skip to content
This repository has been archived by the owner on Jan 27, 2025. It is now read-only.

[Mi Pad 4] Flickering Backlight #128

Closed
Asureus opened this issue Jul 25, 2018 · 11 comments
Closed

[Mi Pad 4] Flickering Backlight #128

Asureus opened this issue Jul 25, 2018 · 11 comments
Labels
validation pending A potential fix has been commited, this needs to be validated with next release

Comments

@Asureus
Copy link

Asureus commented Jul 25, 2018

v22 booted on Mi Pad 4, a Treble-enabled tablet.
Everything seems to be working except I get similar backlight issue as #121

Backlight can be set in a lottery way, with 24 very bright, 25 darkest, 27 brightest, 31 darker etc.
Seems most of the time it sticks to brighter backlight.
Because of this, a should-be smooth backlight transition, like during the seconds when screen goes on or turns off, backlight jumps rapidly hence the flicker.

After boot I waited 30 minutes before change brightness then logcat:
MiPad4_brightness_logcat.txt

Backlight is working smoothly on the stock ROM which I installed v22 on

@Asureus
Copy link
Author

Asureus commented Jul 25, 2018

I'm adjusting the backlight slider really slow and observing the brightness I actually get.
Here's what I found:

The backlight slider on this device is exactly like 15-16 normal slider concat together.
Within each tiny slider segment, brightness changes smoothly, when my finger crosses segment border backlight suddenly jumps between darkest and brightest.
I think that explains the flickers when I adjust the slider normally.

Please let me know if there's anything or any file you want.

@phhusson
Copy link
Owner

phhusson commented Jul 25, 2018 via email

@Asureus
Copy link
Author

Asureus commented Jul 25, 2018

Thanks for the quick reply!

I find the situation similar to #72
Except I don't have /sys/class/backlight

/system/bin/sh: cd: /sys/class/backlight: No such file or directory

phhgsi_arm64_a:/ # cat /sys/class/backlight/panel0-backlight/max_brightness cat: /sys/class/backlight/panel0-backlight/max_brightness: No such file or directory

I blindly went on with
setprop persist.display.max_brightness 4095
or
setprop persist.display.max_brightness 255
and reboot

nothing changes, still got about 16 segments

phhgsi_arm64_a:/ $ getprop ro.vendor.build.fingerprint Xiaomi/clover/clover:8.1.0/OPM1.171019.019/8.7.19:user/release-keys

@phhusson
Copy link
Owner

phhusson commented Jul 25, 2018 via email

@Asureus
Copy link
Author

Asureus commented Jul 25, 2018

setprop persist.sys.qcom-brightness 4093
Thanks it's working! Now the backlight slider is a whole segment. Flicker is completely gone.

On the other hand it seems the lowest possible brightness is much higher than before. Now if I set brightness to lowest, when the screen dims (like when it's idle) it can dims much more.

Is it the right time to send you my framework-res.apk?

@phhusson
Copy link
Owner

phhusson commented Jul 25, 2018 via email

@Asureus
Copy link
Author

Asureus commented Jul 25, 2018

Thanks got it:

phhgsi_arm64_a:/sys/class/leds/lcd-backlight # cat max_brightness
4095

when setting brightness slider to lowest:

phhgsi_arm64_a:/sys/class/leds/lcd-backlight # cat brightness
160

I can safely do echo 1 > brightness and get a much lower backlight

You are right auto backlight is not working here. I took the liberty to attach framework-res.apk from latest stock ROM

Also when first installed v22, the UI is ridiculously large and it's phone UI
We have to copy 2 lines from stock /system/build.prop

ro.sf.lcd_density=320
ro.build.characteristics=tablet

Then it's working great. Is it OK for you to somehow integrate this tweak for our device?

thank you

AndroPlus-org added a commit to FlokoROM-GSI/device_phh_treble that referenced this issue Aug 18, 2018

Verified

This commit was signed with the committer’s verified signature.
targos Michaël Zasso
@phhusson
Copy link
Owner

Possibly fixed with phhusson/device_phh_treble@5efefba
please try v103

@markg85
Copy link

markg85 commented Sep 1, 2018

I've tried v103 yesterday and it has the same issue as i outlined in issue #168, so that release certainly doesn't fix it for the Mi 6x.

However, the fix mentioned in this thread does work!
Calling:
setprop persist.sys.qcom-brightness 4095 (4095 is my max brightness) makes it work.
Also, the brightness slider works perfectly when that property is set.

The reason it aint working is probably because the fix in #5efefba specifically checks for "Xiaomi/clover/clover" whereas my fingerprint seems to be:
xiaomi/wayne/wayne:8.1.0/OPM1.171019.011/V9.5.7.0.OEIMIFA:user/release-keys

I "think" you might be best off to check if "persist.sys.qcom-brightness" is set and if not then set it. Regardless of device. Of if that's too generic, set it for all Xiaomi devices?

@suwakowww
Copy link

suwakowww commented Sep 2, 2018

About Xiaomi Mi 6X (wayne):
from #168
Version: AOSP v103 (EDIT: This bug since AOSP v22, the early version is untested.)
Base version(before flash this GSI): MIUI v8.7.26 (dev)
Brightness percent was shown on phone, and the log is the last log what shown in logcat.
Brightness: 0% (lowest value)
09-02 13:45:39.890 983 983 D qdlights: entry write_int path = /sys/class/leds/lcd-backlight/brightness, value=2570
Brightnesss: 44%
09-02 13:46:55.349 983 983 D qdlights: entry write_int path = /sys/class/leds/lcd-backlight/brightness, value=2586
Brightness: 19%
09-02 13:48:22.278 983 983 D qdlights: entry write_int path = /sys/class/leds/lcd-backlight/brightness, value=3341
Brightness: 70%
09-02 13:49:59.145 983 983 D qdlights: entry write_int path = /sys/class/leds/lcd-backlight/brightness, value=3389
Brightness: 100% (highest value, lightest)
09-02 13:50:33.117 983 983 D qdlights: entry write_int path = /sys/class/leds/lcd-backlight/brightness, value=4095
Brightness: 27% (darkest)
09-02 13:51:37.520 983 983 D qdlights: entry write_int path = /sys/class/leds/lcd-backlight/brightness, value=16
And there are some loops, about 0%-26% 27%-51% 52%-70% 71%-75% (dark-->light) ,after those are change too fast to find the loop point.
full log here (change from 0% to 100%):
brightness.log

@phhusson phhusson added the validation pending A potential fix has been commited, this needs to be validated with next release label Sep 4, 2018
@Asureus
Copy link
Author

Asureus commented Sep 7, 2018

greetings,

tested v103 and also v104 on Mi Pad 4
Both manual and auto brightness are working great! Thank you very much!

Enabling auto brightness also practically fix the issue of min brightness not being low enough.
when use manual brightness and slide to leftmost:
cat /sys/class/leds/lcd-backlight/brightness returns 160 same as before

turn on "adaptive brightness" on v104 and cover the ambient light sensor,
I see brightness gets lower to 48, which is much easier for the eyes in common low light environment.

The case becomes more drastic on Mi 8 SE, where manual brightness minimum is
40 on v104
2 on stock MIUI
(auto brightness is N/A on v104 as of now)

But that's another issue on another device. I'll provide more info to #148 later

For Mi Pad 4, it's now completely solved. Thank you again.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
validation pending A potential fix has been commited, this needs to be validated with next release
Projects
None yet
Development

No branches or pull requests

4 participants