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

Commit 346223ec authored by Alan Kwong's avatar Alan Kwong
Browse files

drm/msm/sde: add plane restore for idle pc restore



If a plane without state updated was power collapsed,
it will not be scheduled for atomic update by framework
and not be able to restore hardware state on next commit.
To help restore hardware state of these planes, add a
new plane callback for power restore in crtc flush such
that all attached planes can check if hardware state
needed to be restored prior to flush.

Change-Id: If0ab50c12188eb1bfb937c955918dfd9280a95f2
Signed-off-by: default avatarAlan Kwong <akwong@codeaurora.org>
parent fdec4807
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -2021,6 +2021,16 @@ static void sde_crtc_atomic_flush(struct drm_crtc *crtc,
	if (unlikely(!sde_crtc->num_mixers))
		return;

	/*
	 * For planes without commit update, drm framework will not add
	 * those planes to current state since hardware update is not
	 * required. However, if those planes were power collapsed since
	 * last commit cycle, driver has to restore the hardware state
	 * of those planes explicitly here prior to plane flush.
	 */
	drm_atomic_crtc_for_each_plane(plane, crtc)
		sde_plane_restore(plane);

	/* wait for acquire fences before anything else is done */
	_sde_crtc_wait_for_fences(crtc);

+23 −0
Original line number Diff line number Diff line
@@ -3598,6 +3598,29 @@ static void sde_plane_atomic_update(struct drm_plane *plane,
	}
}

void sde_plane_restore(struct drm_plane *plane)
{
	struct sde_plane *psde;

	if (!plane || !plane->state) {
		SDE_ERROR("invalid plane\n");
		return;
	}

	psde = to_sde_plane(plane);

	/*
	 * Revalidate is only true here if idle PC occurred and
	 * there is no plane state update in current commit cycle.
	 */
	if (!psde->revalidate)
		return;

	SDE_DEBUG_PLANE(psde, "\n");

	/* last plane state is same as current state */
	sde_plane_atomic_update(plane, plane->state);
}

/* helper to install properties which are common to planes and crtcs */
static void _sde_plane_install_properties(struct drm_plane *plane,
+6 −0
Original line number Diff line number Diff line
@@ -189,6 +189,12 @@ void sde_plane_get_ctl_flush(struct drm_plane *plane, struct sde_hw_ctl *ctl,
 */
bool sde_plane_is_sbuf_mode(struct drm_plane *plane, u32 *prefill);

/**
 * sde_plane_restore - restore hw state if previously power collapsed
 * @plane: Pointer to drm plane structure
 */
void sde_plane_restore(struct drm_plane *plane);

/**
 * sde_plane_flush - final plane operations before commit flush
 * @plane: Pointer to drm plane structure