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

Commit 268d654d authored by Peter Cai's avatar Peter Cai
Browse files

drm: msm: default to FOD dimming when calculating alpha

* Since commit ac878e6b, DC dimming has been introduced, which shares
some logic with FOD. The original function to calculate alpha to dim the
screen to the same brightness before enabling HBM has been modified to
also work with DC dimming. It distinguishes the two cases (FOD and DC)
with the flag `dim_status`.

* However, in our user-space implementation of FOD, the `dim_status`
flag is only set AFTER the FOD icon has been pressed by the user, unlike
in official ROM where they enable dimming whenever the FOD icon shows
up which breaks the image quality terribly. Our different order caused
the userspace code to read the alpha value before the flag is actually
set, and thus being incorrect, causing severe blinking when using FOD.

* Fix this by defaulting to using the flag `op_dimlayer_bl_enable` for
distinguishing between FOD and DC, so as long as DC dimming is not
enabled (which is always the case because we haven't even implemented DC
dimming in our userspace), the value read by userspace is always the one
for FOD. If we were ever to implement DC dimming, we should probably
separate these two interfaces to two sysfs nodes instead of sharing a
common one to avoid confusion.

Change-Id: I1aa2bdad330a6b555f7025e6fff3fa1684052726
parent 794b511a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -3245,6 +3245,7 @@ int bl_to_alpha_dc(int brightness)
			brightness_alpha_lut_dc[i].alpha);
	return alpha;
}
extern int op_dimlayer_bl_enable;
int oneplus_get_panel_brightness_to_alpha(void)
{
	struct dsi_display *display = get_main_display();
@@ -3253,7 +3254,7 @@ int oneplus_get_panel_brightness_to_alpha(void)
		return 0;
	if (oneplus_panel_alpha)
		return oneplus_panel_alpha;
    if (display->panel->dim_status)
    if (!op_dimlayer_bl_enable || display->panel->dim_status)
		return brightness_to_alpha(display->panel->hbm_backlight);
    else
	return bl_to_alpha_dc(display->panel->hbm_backlight);
@@ -5524,7 +5525,6 @@ int op_dimlayer_bl_enabled = 0;
int op_dimlayer_bl_enable_real = 0;
int op_dimlayer_bl = 0;
extern bool finger_type;
extern int op_dimlayer_bl_enable;
extern int op_dp_enable;
extern int sde_plane_check_fingerprint_layer(const struct drm_plane_state *drm_state);
static int sde_crtc_onscreenfinger_atomic_check(struct sde_crtc_state *cstate,