[KERNEL][G935] AMOLED PWM flicker free

Wootever

Senior Member
Jun 27, 2012
1,089
2,789
143
What is PWM?
PWM is used to regulate the brightness of LCD and LED displays. How does that concern us? The pulsations can be bad for your health and more specifically for the users eyesight. They can lead to migraines, headaches or other forms of discomfort after long-term usage. In most cases those pulsations have a frequency somewhere around 200Hz. They cause multiple contractions and expansions of the pupils, which bears down negatively on your health. They are especially harmful in models with LED backlight because the colors of the emitted light are not as inert as the colors of the CCFL backlight and so they reach high amplitudes and rapid luminance changes. Basically, the problem comes from the flickering light, not from the crystals of the LCD monitors.

Default PWM curve:
  • On 100% brightness it shows a rather flat curve with 60hz, this is tolerable even for flicker sensitive people.
  • On 75% brightness the PWM sequence changes to 240hz with high amplitude alternating, this can be already noticable for flicker insensitive people.
  • Below 50% you get the typical stroboscopic effect which can have a negative impact on your eyesight.




Adjusted PWM curve:
  • The lowest possible PWM sequence with a 60hz refresh cycle will be used on all brightness levels.




Here are two videos to show the difference in motion:
  • Recorded with S7 slow motion camera mode; Starting with 100% brightness -> 60% -> 20% -> 5%.
  • The first video shows the default Samsung kernel.
  • The second video shows the pwmfree kernel.


Download:

Links:
 
Last edited:

Wootever

Senior Member
Jun 27, 2012
1,089
2,789
143
The PWM mechanism used on Samsung displays is called AOR (AMOLED off ratio), the related function on the kernel driver is called AID (AMOLED impulsive driving).
Meanwhile, since the AID dimming driving during the fixing and dimming sections uses a principle of increasing currents of pixels and varying currents of pixels by adjusting a duty ratio with reference to a specific luminance (brightness), power consumption may be increased if the same AID driving principle is applied in the high luminance region.
As shown in FIG. 5 and FIG. 6, during the AID driving mode, the off duty is turned on and off according to the specified ratio. For example, during the AID fixing section, the reference luminance is set 273 cd/m2 when the conventional method is set at 180 cd/m2, but introduces off duty at 40% in accordance with the present invention to yield an equivalent 180 cd/m2 step as in the conventional method.



Here is a Picture of the visible scan lines:
  • Recorded with S7 slow motion camera mode.
  • The colorful stripes on the left shows the aggressive 240hz refreshment cycle (four indentation per frame with high intensity).
  • The red stripe on the right shows the 60hz refreshment cycle (one indentation per frame with low intensity).



Information source:

Kernel source:
 
Last edited:

Wootever

Senior Member
Jun 27, 2012
1,089
2,789
143
I'm currently testing a custom kernel with the suggested fix included.
The PWM frequency is consistent even on lowest brightness but it also shows the mentioned issues:
due to a low current for pixel driving at a low luminance/low grayscale [...] dispersion of the optical characteristics, such as color difference (MPCD: Minimum Perceptual Color Difference), color temperature, and grayscale linearity, may increase.
If the minimum luminance set to lower than 40 cd/m2, the optical characteristics deteriorates
Probably needs to include a slightly increased PWM on brightness <40 cd/m2.

You can test the PWM flicker by shaking your hand on a white background at 50% brightness, you will notice a stroboscopic effect.

 

Wootever

Senior Member
Jun 27, 2012
1,089
2,789
143
Some information about the mentioned deterioration that increases on low brightness; it is called mura defects:
Mura: The Japanese word for blemish has been widely adopted by the display industry to describe almost all irregular luminosity variation defects in liquid crystal displays.
Mura defects are caused by process flaws usually related to cell assembly, which affect the transmission of light through the display.
The cyclical nature, randomness, and often, low contrast of mura makes accurate detection and classification extremely difficult for LCD manufacturers.
In short: mura defects are small irregularities / deviations caused by the OLED production process.
Although this is a typical behaviour for AMOLED displays, the pwmfree kernel might increase the visibility of those mura defects due to the reduced pixel current on lower brightness.




The PWM effect is also used to mask those mura defects, so they become less visible:
Another aspect [of the PWM mechanism] is to provide an organic light emitting display device and a driving method thereof by which a transverse and longitudinal mura defect or irregular luminosity variation defects of a panel due to process flaws, for example, caused by a lack of driving currents of the panel can be prevented.
Samsung patent description of the mura defects:
However, although the smart dimming method according to the teachings of the present invention has the optical characteristics of a 300 cd/m2 luminance step, a mure defect may be generated by a deviation of a pixel current due to a low current for pixel driving at a low luminance/low grayscale, and a dispersion of the optical characteristics, such as color difference (MPCD: Minimum Perceptual Color Difference), color temperature, and grayscale linearity, may increase. Due to the problem associated with the increased dispersion of the optical characteristics at a low luminance, a expressible minimum luminance should be limited to 40 cd/m2. If the minimum luminance set to lower than 40 cd/m2, the optical characteristics deteriorates.
 
Last edited:

Wootever

Senior Member
Jun 27, 2012
1,089
2,789
143
Both files (Odin TAR and Recovery ZIP) are identical and includes SuperSU root. They are just using a different flashing process.

Edit:
Attached Odin3 flashing tool.
 
Last edited:
  • Like
Reactions: Has_anDroid

Wootever

Senior Member
Jun 27, 2012
1,089
2,789
143
I searched for some information if the modified PWM mechanism might (negatively) impact OLED lifetime.
But interestingly enough it seems that the pwm free approach might even increase it's lifetime:

The adjustment of the nominal current must be realized by the DC amplitude of the driver (see above). Nevertheless, dimming of OLEDs is allowed also by pulse width modulation (PWM).
  • Reduction of the DC amplitude for dimming will increase the OLED lifetime disproportionally (figure 7), but may lead to color shifts at white OLEDs.
  • Reduction of the mean current by pulse width modulation (PWM) will increase the OLED lifetime not that much (only proportionally, figure 7) but keeps the color point of white OLEDs stable.


Summary:
  • 150% OLED lifetime without PWM and more visible mura defects.
  • 100% OLED lifetime with PWM and less visible mura defects.
  • Color shifts are less noticeable due to better AMOLED panel quality and color correction mechanisms.
Source: Dimming of OLEDs - OSRAM
 
Last edited:

veper

Senior Member
Jul 10, 2010
95
15
0
Hi Wootever,

first let me thank you for your great work.

I've purchased S7 Edge today just to try PWMFree kernel (I wasn't able to use SAMOLED phones since Galaxy S3 / Note 3 onwards), but have to report that after flashing it (latest version 11) the phone is stuck on logo (Galaxy S7 Edge powered by Android).

Flashed with Odin, seemed to go through ok:

<ID:0/008> Added!!
<ID:0/008> Odin engine v(ID:3.1203)..
<ID:0/008> File analysis..
<ID:0/008> SetupConnection..
<ID:0/008> Initialzation..
<ID:0/008> Get PIT for mapping..
<ID:0/008> Firmware update start..
<ID:0/008> SingleDownload.
<ID:0/008> boot.img
<ID:0/008> RQT_CLOSE !!
<ID:0/008> RES OK !!
<ID:0/008> Remain Port .... 0
<OSM> All threads completed. (succeed 1 / failed 0)
<ID:0/008> Removed!!

The phone was running latest official version that was installed though OTA (G935FXXU1BPLB).

Any hints appreciated :)

UPDATE: did factory reset / wipe data from bootloader menu twice and the phone boots :good:
Will try to use the phone now and see how it goes.
 
Last edited:
  • Like
Reactions: Wootever

veper

Senior Member
Jul 10, 2010
95
15
0
Okay, I'm very happy to report that your PWMfree kernel does the magic!

Will have to use the phone for a few more days in order to make a final judgement whether that remaining 60Hz flicker makes any discomfort or not, but I can already confirm that with your kernel I can again use newer Samsung devices - the difference is night and day =)

Is there a way for you to make a test kernel even without 60Hz flicker for comparison?

And how/where can I donate?
 
  • Like
Reactions: Wootever