Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3ee1c926 authored by jabashque's avatar jabashque Committed by MajorP93
Browse files

techpack: display: Set oplus_dimlayer_hbm when switching power modes

When switching to a power mode that isn't "ON", we want to set
oplus_dimlayer_hbm to 0. When switching back to "ON", we want to restore
the original oplus_dimlayer_hbm value *after* setting everything else
up.

We want to do this because otherwise, if we leave oplus_dimlayer_hbm set
to 1, then there's a possiblity of the dimlayer being set after HBM gets
enabled, resulting in the potential of a brief, bright flash when waking
the device from Always-on Display Mode. In addition, when restoring the
original oplus_dimlayer_hbm value, we want to do that *after* the rest
of the panel setup; otherwise, we still risk having brief flashes.

To do this, we're creating a separate oplus_dimlayer_hbm_saved variable,
which tracks the user-intended state of oplus_dimlayer_hbm. When the
panel is ON, the sysfs attribute and the ioctl for dimlayer_hbm writes
to both oplus_dimlayer_hbm_saved and oplus_dimlayer_hbm; otherwise, they
write only to the former. This gives us free reign to set and restore
oplus_dimlayer_hbm when switching power modes.

Since the sysfs attribute and ioctl get a vblank for 5 frames before
changing the oplus_dimlayer_hbm variable, we'll also do that when
changing oplus_dimlayer_hbm while switching panel power modes.

Change-Id: I73288152f7048d94b3081cfd536df37a17577950
parent 8a0e7d7e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment