Skip to content

Commit

Permalink
disp: msm: sde: Refactor fod dimming
Browse files Browse the repository at this point in the history
* Check oneplus_dimlayer_hbm_enable instead of
  fp_index to activate fod dimming mode.

Co-authored-by: alk3pInjection <[email protected]>
Signed-off-by: alk3pInjection <[email protected]>
Change-Id: I8cd87ccab8e8dbbd0653ddbeadb5d8bafb72cd71
  • Loading branch information
2 people authored and elginsk8r committed Jun 18, 2022
1 parent 91f25e8 commit 9105491
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions techpack/display/msm/sde/sde_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2914,6 +2914,7 @@ int bl_to_alpha_dc(int brightness)
return alpha;
}

bool oneplus_dimlayer_hbm_enable;
int oneplus_get_panel_brightness_to_alpha(void)
{
struct dsi_display *display = get_main_display();
Expand All @@ -2922,7 +2923,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 (oneplus_dimlayer_hbm_enable)
return brightness_to_alpha(display->panel->hbm_backlight);
else
return bl_to_alpha_dc(display->panel->hbm_backlight);
Expand Down Expand Up @@ -3011,6 +3012,7 @@ ssize_t notify_fppress_store(struct device *dev,

extern int aod_layer_hide;
extern bool HBM_flag;
extern bool oneplus_dimlayer_hbm_enable;
extern int dsi_panel_tx_cmd_set(struct dsi_panel *panel,
enum dsi_cmd_set_type type);
int oneplus_dim_status = 0;
Expand Down Expand Up @@ -3067,6 +3069,7 @@ ssize_t notify_dim_store(struct device *dev,
if (dim_status == oneplus_dim_status)
return count;
oneplus_dim_status = dim_status;
oneplus_dimlayer_hbm_enable = oneplus_dim_status != 0;
pr_err("notify dim %d,aod = %d press= %d aod_hide =%d\n",
oneplus_dim_status, dsi_display->panel->aod_status, oneplus_onscreenfp_status, aod_layer_hide);
if (oneplus_dim_status == 1 && HBM_flag) {
Expand Down Expand Up @@ -5286,7 +5289,7 @@ static int sde_crtc_onscreenfinger_atomic_check(struct sde_crtc_state *cstate,
}

SDE_DEBUG("fp_index=%d,fppressed_index=%d,aod_index=%d\n", fp_index, fppressed_index, aod_index);
if (fp_index >= 0 || fppressed_index >= 0 || oneplus_force_screenfp || dim_backlight == 1) {
if (oneplus_dimlayer_hbm_enable || oneplus_force_screenfp || dim_backlight == 1) {
if (fp_index >= 0 && fppressed_index >= 0) {
if (pstates[fp_index].stage >= pstates[fppressed_index].stage) {
SDE_ERROR("Bug!!@@@@: fp layer top of fppressed layer\n");
Expand Down Expand Up @@ -5323,7 +5326,7 @@ static int sde_crtc_onscreenfinger_atomic_check(struct sde_crtc_state *cstate,
zpos++;
}

if (fp_index >= 0)
if (oneplus_dimlayer_hbm_enable)
cstate->fingerprint_mode = true;
else
cstate->fingerprint_mode = false;
Expand All @@ -5341,6 +5344,7 @@ static int sde_crtc_onscreenfinger_atomic_check(struct sde_crtc_state *cstate,
cstate->fingerprint_pressed = false;
}
} else {
cstate->fingerprint_dim_layer = NULL;
cstate->fingerprint_pressed = false;
cstate->fingerprint_mode = false;
for (i = 0; i < cnt; i++) {
Expand All @@ -5349,8 +5353,10 @@ static int sde_crtc_onscreenfinger_atomic_check(struct sde_crtc_state *cstate,
}
}
}
if (fp_index < 0 && !dim_backlight) {
cstate->fingerprint_dim_layer = NULL;
if (fp_mode == 1 && !oneplus_dimlayer_hbm_enable) {
cstate->fingerprint_mode = true;
cstate->fingerprint_pressed = true;
return 0;
}

return 0;
Expand Down

0 comments on commit 9105491

Please sign in to comment.