Przeglądaj źródła

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 lat temu
rodzic
commit
610b71feb9
2 zmienionych plików z 10 dodań i 1 usunięć
  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);
 	INIT_LIST_HEAD(&sde_crtc->ltm_buf_free);
 	INIT_LIST_HEAD(&sde_crtc->ltm_buf_busy);
+	sde_crtc->disable_pending_cp = false;
 	sde_cp_crtc_disable(crtc);
 }
 
@@ -2094,6 +2095,7 @@ void sde_cp_crtc_apply_properties(struct drm_crtc *crtc)
 	int rc = 0;
 	bool need_flush = false;
 	struct sde_crtc_state *cstate;
+	bool disable_pending_cp = false;
 
 	if (!crtc || !crtc->dev) {
 		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);
 	_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) &&
 			list_empty(&sde_crtc->ad_dirty) &&
 			list_empty(&sde_crtc->ad_active) &&
@@ -2181,6 +2185,8 @@ void sde_cp_crtc_apply_properties(struct drm_crtc *crtc)
 	}
 exit:
 	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)
@@ -2724,8 +2730,9 @@ void sde_cp_crtc_clear(struct drm_crtc *crtc)
 		DRM_ERROR("sde_crtc %pK\n", sde_crtc);
 		return;
 	}
-	sde_cp_disable_features(crtc);
+
 	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_dirty_list);
 	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
  * @needs_hw_reset  : Initiate a hw ctl reset
  * @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
  * @target_bpp      : target bpp used to calculate compression ratio
  * @static_cache_read_work: delayed worker to transition cache state to read
@@ -417,6 +418,7 @@ struct sde_crtc {
 	spinlock_t ltm_lock;
 	bool needs_hw_reset;
 	int hist_irq_idx;
+	bool disable_pending_cp;
 
 	int src_bpp;
 	int target_bpp;