Skip to content

Commit

Permalink
drm: Handle dim for udfps
Browse files Browse the repository at this point in the history
* Apparently, los fod impl is better than udfps cuz it
  has onShow/HideFodView hook, which allows us to toggle
  dimlayer seamlessly.

  Since udfps only partially supports the former one,
  we'd better kill dim in kernel. This is kinda a hack
  but it works well, bringing perfect fod experience
  back to us.

Co-authored-by: Art_Chen <Chenxy0201@qq.com>
Signed-off-by: alk3pInjection <webmaster@raspii.tech>
Change-Id: I80bfd508dacac5db89f4fff0283529c256fb30ce
  • Loading branch information
2 people authored and luk1337 committed Feb 23, 2022
1 parent bd9fe82 commit 2c66467
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
12 changes: 12 additions & 0 deletions drivers/gpu/drm/msm/dsi-staging/dsi_panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -5070,6 +5070,11 @@ int dsi_panel_post_switch(struct dsi_panel *panel)
bool aod_fod_flag;
bool aod_complete;
bool real_aod_mode;

extern bool oneplus_dimlayer_hbm_enable;
bool backup_dimlayer_hbm = false;
extern int oneplus_dim_status;
int backup_dim_status = 0;
int dsi_panel_enable(struct dsi_panel *panel)
{
int rc = 0;
Expand Down Expand Up @@ -5115,6 +5120,10 @@ int dsi_panel_enable(struct dsi_panel *panel)
panel->panel_initialized = true;
pr_err("dsi_panel_enable aod_mode =%d\n",panel->aod_mode);

oneplus_dimlayer_hbm_enable = backup_dimlayer_hbm;
oneplus_dim_status = backup_dim_status;
pr_err("Restore dim when panel goes on");

blank = MSM_DRM_BLANK_UNBLANK_CHARGE;
notifier_data.data = &blank;
notifier_data.id = connector_state_crtc_index;
Expand Down Expand Up @@ -5192,6 +5201,9 @@ int dsi_panel_disable(struct dsi_panel *panel)
/* Avoid sending panel off commands when ESD recovery is underway */
if (!atomic_read(&panel->esd_recovery_pending)) {

oneplus_dimlayer_hbm_enable = false;
oneplus_dim_status = 0;
pr_err("Kill dim when panel goes off");
HBM_flag = false;
if(panel->aod_mode==2){
panel->aod_status=1;
Expand Down
14 changes: 11 additions & 3 deletions drivers/gpu/drm/msm/sde/sde_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3510,6 +3510,8 @@ ssize_t oneplus_display_notify_fp_press(struct device *dev,
return count;
}
extern int aod_layer_hide;
extern int backup_dim_status;
extern bool backup_dimlayer_hbm;
extern bool HBM_flag;
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 @@ -3568,8 +3570,10 @@ int oneplus_aod_dc = 0;
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);
backup_dimlayer_hbm = oneplus_dimlayer_hbm_enable;
backup_dim_status = oneplus_dim_status;
pr_err("notify dim %d,aod = %d press= %d aod_hide =%d oneplus_dimlayer_hbm_enable = %d\n",
oneplus_dim_status, dsi_display->panel->aod_status, oneplus_onscreenfp_status, aod_layer_hide, oneplus_dimlayer_hbm_enable);
if (oneplus_dim_status == 1 && HBM_flag) {
rc = dsi_panel_tx_cmd_set(dsi_display->panel, DSI_CMD_SET_HBM_ON_5);
if (rc) {
Expand Down Expand Up @@ -5788,8 +5792,12 @@ static int sde_crtc_onscreenfinger_atomic_check(struct sde_crtc_state *cstate,
}

aod_mode = oneplus_aod_hid;
if (oneplus_dim_status == 5 && display->panel->aod_status == 0)
if (oneplus_dim_status == 5 && display->panel->aod_status == 0) {
dim_mode = 0;
oneplus_dim_status = 0;
oneplus_dimlayer_hbm_enable = false;
pr_err("current dim = %d, oneplus_dimlayer_hbm_enable = %d\n", oneplus_dim_status, oneplus_dimlayer_hbm_enable);
}

for (i = 0; i < cnt; i++) {
mode = sde_plane_check_fingerprint_layer(pstates[i].drm_pstate);
Expand Down

0 comments on commit 2c66467

Please sign in to comment.