소스 검색

msm: sde: update histogram buffer submission for ltm

When histogram buffer is queued by driver client, during the display
commit buffer has to be submitted to hardware. Currently driver is
waiting for previous histogram to finish before submitting the new
buffer. This can cause the histogram to be invalid, change updates the
submission logic of buffer.

Change-Id: I76b595fa96d1c2dd01c841de3cf228d4fa7fd75d
Signed-off-by: Gopikrishnaiah Anandan <[email protected]>
Gopikrishnaiah Anandan 5 년 전
부모
커밋
8033050f92
1개의 변경된 파일22개의 추가작업 그리고 0개의 파일을 삭제
  1. 22 0
      msm/sde/sde_color_processing.c

+ 22 - 0
msm/sde/sde_color_processing.c

@@ -3525,10 +3525,15 @@ static void _sde_cp_crtc_queue_ltm_buffer(struct sde_crtc *sde_crtc, void *cfg)
 	struct sde_hw_cp_cfg *hw_cfg = cfg;
 	struct drm_msm_ltm_buffer *buf;
 	struct drm_msm_ltm_stats_data *ltm_data = NULL;
+	struct sde_ltm_buffer *free_buf;
 	u32 i;
 	bool found = false, already = false;
 	unsigned long irq_flags;
 	struct sde_ltm_buffer *buffer = NULL, *n = NULL;
+	u64 addr = 0;
+	bool submit_buf = false;
+	uint32_t num_mixers = 0;
+	struct sde_hw_dspp *hw_dspp = NULL;
 
 	if (!sde_crtc || !cfg) {
 		DRM_ERROR("invalid parameters sde_crtc %pK cfg %pK\n", sde_crtc,
@@ -3541,6 +3546,7 @@ static void _sde_cp_crtc_queue_ltm_buffer(struct sde_crtc *sde_crtc, void *cfg)
 		DRM_ERROR("invalid parameters payload %pK\n", buf);
 		return;
 	}
+	num_mixers = sde_crtc->num_mixers;
 
 	spin_lock_irqsave(&sde_crtc->ltm_lock, irq_flags);
 	if (!sde_crtc->ltm_buffer_cnt) {
@@ -3549,6 +3555,8 @@ static void _sde_cp_crtc_queue_ltm_buffer(struct sde_crtc *sde_crtc, void *cfg)
 		return;
 	}
 
+	if (list_empty(&sde_crtc->ltm_buf_free))
+		submit_buf = true;
 	for (i = 0; i < LTM_BUFFER_SIZE; i++) {
 		if (sde_crtc->ltm_buffers[i] && buf->fd ==
 				sde_crtc->ltm_buffers[i]->drm_fb_id) {
@@ -3569,6 +3577,20 @@ static void _sde_cp_crtc_queue_ltm_buffer(struct sde_crtc *sde_crtc, void *cfg)
 			found = true;
 		}
 	}
+	if (submit_buf && found) {
+		free_buf = list_first_entry(&sde_crtc->ltm_buf_free,
+				struct sde_ltm_buffer, node);
+		addr = free_buf->iova + free_buf->offset;
+
+		for (i = 0; i < num_mixers; i++) {
+			hw_dspp = sde_crtc->mixers[i].hw_dspp;
+			if (!hw_dspp) {
+				DRM_ERROR("invalid dspp for mixer %d\n", i);
+				break;
+			}
+			hw_dspp->ops.setup_ltm_hist_buffer(hw_dspp, addr);
+		}
+	}
 	spin_unlock_irqrestore(&sde_crtc->ltm_lock, irq_flags);
 
 	if (!found)