koiuo / intelpwm-udev

Script and udev rule to set backlight PWM frequency on laptops with Intel i915 GPU
https://127001.me/post/eliminate-backlight-flicker-with-i915/
17 stars 6 forks source link

no noticable difference #3

Open jayenashar opened 3 years ago

jayenashar commented 3 years ago

not sure if there is supposed to be a visible difference, but when i do run the script with freq 800, i can't tell the difference and my head hurts the same. the default values seem to put the freq at 42, which just doesn't seem right to me.

default values:

                                    (0x000c6204): 0x00000018
                   BLC_PWM_PCH_CTL2 (0x000c8254): 0x1aa20050 (freq 6818, cycle 80)

though i am 100% sure BLC_PWM_PCH_CTL2 used to default to 0x1aa21aa2 (for which i calculate freq 42)

also i have found that the brightness control range is much smaller. that is, 10 is full brightness instead of 100.

koiuo commented 3 years ago

There's a visible difference. The easiest way to check is to use a so called pen(cil) test: move a pen, a pencil, or a hand with fingers wide open in front of the screen https://www.youtube.com/watch?v=BogPfvzTTPc

However with some values of the PWM period there may appear visible artifacts. Can't really explain why does this happen, perhaps with such values of the period PWM frequency appears to be out of range that your backlight driver can process.

As for the frequency, the formula is (it is also mentioned in my blog post)

f_pwm = ( reg_0xC6204 × 1,000,000 ) / 128 / reg_0xC8254[7..4]

Assuming your base frequency (reg_0xC6204) is 125 (0x7D), pwm frequency for your backlight by default will be ~143Hz. This is way too low (wouldn't be that bad for an old CRT monitors, but this is because those had very long afterglow, which smoothed out the pulsation).

Period of 0x0050 would give you 12207 Hz, which is very likely outside of the working range of your backlight. Try 0x0500, this will give you a decent 763 Hz.

jayenashar commented 3 years ago

i don't know why 0x000c6204 is 0x00000018 (24) but it seems very low, right? it's 1/5th of what you said (125 (0x7D)).

this is on a laptop, lenovo thinkpad L470, and the screen is really unusable.

the period was 0x50 yesterday when i left that comment but now it's back to 0x1aa2. i see now that it changes based on brightness.

reg_0xC8254[3..0] seems to scale linearly from 80-6818 proportionally to /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight/brightness

dpopchev commented 1 year ago

I can confirm @jayenashar readings on x270 with FHD IPS matrix and i5-7200.

I am confused what to make out of increasing to 800Hz using the software.

On one hand I do not observe flickering using pencil test at any brightness setting, but still got eyestrain when using with lower brightness.

There was visible flickering from time to time, so I disabled the intel psr option recently. I plan to use without messing with pwm freq, then increase the freq and report back.

PS: It is strange that xfce4-display-settings reports up to 120Hz capability of the laptop display, while such mode is missing from xrandr; the latter reports only up to 60Hz.

PS: Edit wording.

PS: Does frequency increase shorten the life of the screen? I am concerned, because the laptop is second hand and was kind of hard to find.

PS: I use Manjaro, btw. With i3 and disabled most auto started desktop entries shipped with xfce4 default minimal install.

jayenashar commented 1 year ago

@dpopchev i made that post when the laptop was still new to me. now that i have been using it for a couple of years (with an external monitor), i have found that the flickering is random. sometimes it boots up and is perfectly clear and doesn't cause eyestrain. sometimes the flicker is extremely noticeable, like what i expect if i record a video of an LCD screen. other than on boot, i don't see the screen as i close the lid, so i can't provide more info than that.