Browse Source

disp: msm: sde: add input fence dump upon commit done timeout

This change adds debug changes to dump the input fences during a
commit done timeout, when input hw-fences are enabled.

Change-Id: Ia778d3d73ab8ee795613587da70ef9bebb7c73ca
Signed-off-by: Christina Oliveira <[email protected]>
Christina Oliveira 2 years ago
parent
commit
87bee41901
5 changed files with 53 additions and 0 deletions
  1. 8 0
      msm/sde/sde_crtc.c
  2. 9 0
      msm/sde/sde_crtc.h
  3. 10 0
      msm/sde/sde_fence.h
  4. 20 0
      msm/sde/sde_plane.c
  5. 6 0
      msm/sde/sde_plane.h

+ 8 - 0
msm/sde/sde_crtc.c

@@ -4510,6 +4510,14 @@ static void _sde_crtc_remove_pipe_flush(struct drm_crtc *crtc)
 	}
 }
 
+void sde_crtc_dump_fences(struct drm_crtc *crtc)
+{
+	struct drm_plane *plane = NULL;
+
+	drm_atomic_crtc_for_each_plane(plane, crtc)
+		sde_plane_dump_input_fence(plane);
+}
+
 /**
  * sde_crtc_reset_hw - attempt hardware reset on errors
  * @crtc: Pointer to DRM crtc instance

+ 9 - 0
msm/sde/sde_crtc.h

@@ -647,6 +647,12 @@ static inline void sde_crtc_set_needs_hw_reset(struct drm_crtc *crtc)
 int sde_crtc_reset_hw(struct drm_crtc *crtc, struct drm_crtc_state *old_state,
 	bool recovery_events);
 
+/**
+ * sde_crtc_dump_fences - dump info for input fences of each crtc plane
+ * @crtc: Pointer to DRM crtc instance
+ */
+void sde_crtc_dump_fences(struct drm_crtc *crtc);
+
 /**
  * sde_crtc_request_frame_reset - requests for next frame reset
  * @crtc: Pointer to drm crtc object
@@ -657,6 +663,9 @@ static inline int sde_crtc_request_frame_reset(struct drm_crtc *crtc,
 {
 	struct sde_crtc *sde_crtc = to_sde_crtc(crtc);
 
+	if (test_bit(HW_FENCE_IN_FENCES_ENABLE, sde_crtc->hwfence_features_mask))
+		sde_crtc_dump_fences(crtc);
+
 	if (sde_crtc->frame_trigger_mode == FRAME_DONE_WAIT_POSTED_START ||
 			!sde_encoder_is_dsi_display(encoder))
 		sde_crtc_reset_hw(crtc, crtc->state, false);

+ 10 - 0
msm/sde/sde_fence.h

@@ -260,6 +260,12 @@ void sde_debugfs_timeline_dump(struct sde_fence_context *ctx,
  */
 void sde_fence_list_dump(struct dma_fence *fence, struct seq_file **s);
 
+/**
+ * sde_fence_dump - dumps fence info for specified fence
+ * @fence: Pointer to fence to dump info for
+ */
+void sde_fence_dump(struct dma_fence *fence);
+
 #else
 static inline void *sde_sync_get(uint64_t fd)
 {
@@ -331,6 +337,10 @@ void sde_fence_list_dump(struct dma_fence *fence, struct seq_file **s)
 	/* do nothing */
 }
 
+void sde_fence_dump(struct dma_fence *fence)
+{
+	/* do nothing */
+}
 #endif /* IS_ENABLED(CONFIG_SW_SYNC) */
 
 #endif /* _SDE_FENCE_H_ */

+ 20 - 0
msm/sde/sde_plane.c

@@ -594,6 +594,26 @@ static void _sde_plane_set_input_fence(struct sde_plane *psde,
 	SDE_DEBUG_PLANE(psde, "0x%llX\n", fd);
 }
 
+void sde_plane_dump_input_fence(struct drm_plane *plane)
+{
+	struct sde_plane *psde;
+	struct sde_plane_state *pstate;
+	void *input_fence;
+
+	if (!plane) {
+		SDE_ERROR("invalid plane\n");
+	} else if (!plane->state) {
+		SDE_ERROR_PLANE(to_sde_plane(plane), "invalid state\n");
+	} else {
+		psde = to_sde_plane(plane);
+		pstate = to_sde_plane_state(plane->state);
+		input_fence = pstate->input_fence;
+
+		if (input_fence)
+			sde_fence_dump(input_fence);
+	}
+}
+
 int sde_plane_wait_input_fence(struct drm_plane *plane, uint32_t wait_ms)
 {
 	struct sde_plane *psde;

+ 6 - 0
msm/sde/sde_plane.h

@@ -425,4 +425,10 @@ void sde_plane_static_img_control(struct drm_plane *plane,
 		enum sde_sys_cache_state state, enum sde_sys_cache_type type);
 
 void sde_plane_add_data_to_minidump_va(struct drm_plane *plane);
+
+/**
+ * sde_plane_dump_input_fence - dumps plane input fence info
+ * @plane: Pointer to drm plane structure with the input fence we want to dump
+ */
+void sde_plane_dump_input_fence(struct drm_plane *plane);
 #endif /* _SDE_PLANE_H_ */