Browse Source

disp: msm: sde: cache disable cp properties during last close

When all instances of driver fd's are closed by user-space client, drm driver
will be closed. When last close of driver is called, custom reset properties
api will be called where driver should cache the properties that it wants to
clear. Current behavior of color processing driver is to clear hardware
configuration instead of caching which can cause crashes if clocks are off.
Change updates the driver to cache the pending disable and update hardware
during display commit.

Change-Id: I9703f860ed0ae3c859d6fc3995b58be13203f259
Signed-off-by: Gopikrishnaiah Anandan <[email protected]>
Gopikrishnaiah Anandan 4 years ago
parent
commit
610b71feb9
2 changed files with 10 additions and 1 deletions
  1. 8 1
      msm/sde/sde_color_processing.c
  2. 2 0
      msm/sde/sde_crtc.h

+ 8 - 1
msm/sde/sde_color_processing.c

@@ -1280,6 +1280,7 @@ void sde_cp_crtc_init(struct drm_crtc *crtc)
 	spin_lock_init(&sde_crtc->ltm_lock);
 	spin_lock_init(&sde_crtc->ltm_lock);
 	INIT_LIST_HEAD(&sde_crtc->ltm_buf_free);
 	INIT_LIST_HEAD(&sde_crtc->ltm_buf_free);
 	INIT_LIST_HEAD(&sde_crtc->ltm_buf_busy);
 	INIT_LIST_HEAD(&sde_crtc->ltm_buf_busy);
+	sde_crtc->disable_pending_cp = false;
 	sde_cp_crtc_disable(crtc);
 	sde_cp_crtc_disable(crtc);
 }
 }
 
 
@@ -2094,6 +2095,7 @@ void sde_cp_crtc_apply_properties(struct drm_crtc *crtc)
 	int rc = 0;
 	int rc = 0;
 	bool need_flush = false;
 	bool need_flush = false;
 	struct sde_crtc_state *cstate;
 	struct sde_crtc_state *cstate;
+	bool disable_pending_cp = false;
 
 
 	if (!crtc || !crtc->dev) {
 	if (!crtc || !crtc->dev) {
 		DRM_ERROR("invalid crtc %pK dev %pK\n", crtc,
 		DRM_ERROR("invalid crtc %pK dev %pK\n", crtc,
@@ -2123,6 +2125,8 @@ void sde_cp_crtc_apply_properties(struct drm_crtc *crtc)
 	mutex_lock(&sde_crtc->crtc_cp_lock);
 	mutex_lock(&sde_crtc->crtc_cp_lock);
 	_sde_clear_ltm_merge_mode(sde_crtc);
 	_sde_clear_ltm_merge_mode(sde_crtc);
 
 
+	disable_pending_cp = sde_crtc->disable_pending_cp;
+	sde_crtc->disable_pending_cp = false;
 	if (list_empty(&sde_crtc->cp_dirty_list) &&
 	if (list_empty(&sde_crtc->cp_dirty_list) &&
 			list_empty(&sde_crtc->ad_dirty) &&
 			list_empty(&sde_crtc->ad_dirty) &&
 			list_empty(&sde_crtc->ad_active) &&
 			list_empty(&sde_crtc->ad_active) &&
@@ -2181,6 +2185,8 @@ void sde_cp_crtc_apply_properties(struct drm_crtc *crtc)
 	}
 	}
 exit:
 exit:
 	mutex_unlock(&sde_crtc->crtc_cp_lock);
 	mutex_unlock(&sde_crtc->crtc_cp_lock);
+	if (disable_pending_cp)
+		sde_cp_disable_features(crtc);
 }
 }
 
 
 void sde_cp_crtc_install_properties(struct drm_crtc *crtc)
 void sde_cp_crtc_install_properties(struct drm_crtc *crtc)
@@ -2724,8 +2730,9 @@ void sde_cp_crtc_clear(struct drm_crtc *crtc)
 		DRM_ERROR("sde_crtc %pK\n", sde_crtc);
 		DRM_ERROR("sde_crtc %pK\n", sde_crtc);
 		return;
 		return;
 	}
 	}
-	sde_cp_disable_features(crtc);
+
 	mutex_lock(&sde_crtc->crtc_cp_lock);
 	mutex_lock(&sde_crtc->crtc_cp_lock);
+	sde_crtc->disable_pending_cp = true;
 	list_del_init(&sde_crtc->cp_active_list);
 	list_del_init(&sde_crtc->cp_active_list);
 	list_del_init(&sde_crtc->cp_dirty_list);
 	list_del_init(&sde_crtc->cp_dirty_list);
 	list_del_init(&sde_crtc->ad_active);
 	list_del_init(&sde_crtc->ad_active);

+ 2 - 0
msm/sde/sde_crtc.h

@@ -319,6 +319,7 @@ struct sde_frame_data {
  * @ltm_lock        : Spinlock to protect ltm buffer_cnt, hist_en and ltm lists
  * @ltm_lock        : Spinlock to protect ltm buffer_cnt, hist_en and ltm lists
  * @needs_hw_reset  : Initiate a hw ctl reset
  * @needs_hw_reset  : Initiate a hw ctl reset
  * @hist_irq_idx    : hist interrupt irq idx
  * @hist_irq_idx    : hist interrupt irq idx
+ * @disable_pending_cp : flag tracks pending color processing features force disable
  * @src_bpp         : source bpp used to calculate compression ratio
  * @src_bpp         : source bpp used to calculate compression ratio
  * @target_bpp      : target bpp used to calculate compression ratio
  * @target_bpp      : target bpp used to calculate compression ratio
  * @static_cache_read_work: delayed worker to transition cache state to read
  * @static_cache_read_work: delayed worker to transition cache state to read
@@ -417,6 +418,7 @@ struct sde_crtc {
 	spinlock_t ltm_lock;
 	spinlock_t ltm_lock;
 	bool needs_hw_reset;
 	bool needs_hw_reset;
 	int hist_irq_idx;
 	int hist_irq_idx;
+	bool disable_pending_cp;
 
 
 	int src_bpp;
 	int src_bpp;
 	int target_bpp;
 	int target_bpp;