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

Commit 50f04f76 authored by Ping Li's avatar Ping Li
Browse files

drm/msm/sde: Update code for LTM buffer control property



Update LTM code to get buffer size from gem object directly instead of
from gem->dma_buf. The dma_buf pointer of gem object might be set to
NULL due to handle_count is reduced to 0, but the dma_buf is actually
still valid.

This change also update the log for LTM buffer control to prevent
unnecessary logs been printed out during idle power collapse and
suspend/resume.

Change-Id: I57a34f1c325c38e505b7faa2ab79fb676a7f6c72
Signed-off-by: default avatarPing Li <pingli@codeaurora.org>
parent b451b394
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -2620,7 +2620,6 @@ static void _sde_cp_crtc_set_ltm_buffer(struct sde_crtc *sde_crtc, void *cfg)
	struct drm_msm_ltm_buffers_ctrl *buf_cfg;
	struct drm_framebuffer *fb;
	struct drm_crtc *crtc;
	struct dma_buf *dmabuf;
	u32 size = 0, expected_size = 0;
	u32 i = 0, j = 0, num = 0, iova_aligned;
	int ret = 0;
@@ -2648,7 +2647,7 @@ static void _sde_cp_crtc_set_ltm_buffer(struct sde_crtc *sde_crtc, void *cfg)
	spin_lock_irqsave(&sde_crtc->ltm_lock, irq_flags);
	if (sde_crtc->ltm_buffer_cnt) {
		spin_unlock_irqrestore(&sde_crtc->ltm_lock, irq_flags);
		DRM_ERROR("%d ltm_buffers already allocated\n",
		DRM_DEBUG("%d ltm_buffers already allocated\n",
			sde_crtc->ltm_buffer_cnt);
		return;
	}
@@ -2676,13 +2675,7 @@ static void _sde_cp_crtc_set_ltm_buffer(struct sde_crtc *sde_crtc, void *cfg)
			goto exit;
		}

		dmabuf = sde_crtc->ltm_buffers[i]->gem->dma_buf;
		if (!dmabuf) {
			DRM_ERROR("failed to get dma_buf\n");
			goto exit;
		}

		size = PAGE_ALIGN(dmabuf->size);
		size = PAGE_ALIGN(sde_crtc->ltm_buffers[i]->gem->size);
		if (size < expected_size) {
			DRM_ERROR("Invalid buffer size\n");
			goto exit;