Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 530ee8fd authored by Gopikrishnaiah Anandan's avatar Gopikrishnaiah Anandan
Browse files

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: default avatarGopikrishnaiah Anandan <agopik@codeaurora.org>
parent 700f3cc7
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -2774,10 +2774,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,
@@ -2790,6 +2795,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) {
@@ -2798,6 +2804,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) {
@@ -2818,6 +2826,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)