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

Commit 458f4825 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "drm/msm/sde: handle prepare_fb later during sec/non-sec transitions"

parents 7fe54ddc 47e718fa
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -1667,8 +1667,6 @@ int sde_crtc_get_secure_transition_ops(struct drm_crtc *crtc,
			smmu_state->transition_type = post_commit ?
				POST_COMMIT : PRE_COMMIT;
			ops |= SDE_KMS_OPS_CRTC_SECURE_STATE_CHANGE;
			if (translation_mode == SDE_DRM_FB_SEC)
				ops |= SDE_KMS_OPS_PREPARE_PLANE_FB;
			if (old_valid_fb)
				ops |= SDE_KMS_OPS_WAIT_FOR_TX_DONE;
		} else if ((smmu_state->state == DETACHED) ||
@@ -1676,8 +1674,7 @@ int sde_crtc_get_secure_transition_ops(struct drm_crtc *crtc,
			smmu_state->state = ATTACH_ALL_REQ;
			smmu_state->transition_type = post_commit ?
				POST_COMMIT : PRE_COMMIT;
			ops |= SDE_KMS_OPS_CRTC_SECURE_STATE_CHANGE |
				SDE_KMS_OPS_PREPARE_PLANE_FB;
			ops |= SDE_KMS_OPS_CRTC_SECURE_STATE_CHANGE;
			if (old_valid_fb)
				ops |= (SDE_KMS_OPS_WAIT_FOR_TX_DONE |
				 SDE_KMS_OPS_CLEANUP_PLANE_FB);
+74 −13
Original line number Diff line number Diff line
@@ -916,6 +916,22 @@ static inline void _sde_plane_set_scanout(struct drm_plane *plane,
		return;
	}

	/*
	 * framebuffer prepare is deferred for prepare_fb calls that
	 * happen during the transition from secure to non-secure.
	 * Handle the prepare at this point for such cases. This can be
	 * expected for one or two frames during the transition.
	 */
	if (aspace && pstate->defer_prepare_fb) {
		ret = msm_framebuffer_prepare(fb, pstate->aspace);
		if (ret) {
			SDE_ERROR_PLANE(psde,
				"failed to prepare framebuffer %d\n", ret);
			return;
		}
		pstate->defer_prepare_fb = false;
	}

	ret = sde_format_populate_layout(aspace, fb, &pipe_cfg->layout);
	if (ret == -EAGAIN)
		SDE_DEBUG_PLANE(psde, "not updating same src addrs\n");
@@ -2117,6 +2133,13 @@ static int sde_plane_rot_prepare_fb(struct drm_plane *plane,
		}
	}

	if (new_pstate->defer_prepare_fb) {
		SDE_DEBUG(
		    "plane%d, domain not attached, prepare fb handled later\n",
		    plane->base.id);
		return 0;
	}

	/* prepare rotator input buffer */
	ret = msm_framebuffer_prepare(new_state->fb, new_pstate->aspace);
	if (ret) {
@@ -2386,6 +2409,7 @@ static void sde_plane_rot_atomic_update(struct drm_plane *plane,
	struct drm_plane_state *state;
	struct sde_plane_state *pstate;
	struct sde_plane_rot_state *rstate;
	int ret = 0;

	if (!plane || !plane->state) {
		SDE_ERROR("invalid plane/state\n");
@@ -2407,7 +2431,40 @@ static void sde_plane_rot_atomic_update(struct drm_plane *plane,
	if (!rstate->out_sbuf || !rstate->rot_hw)
		return;

	/*
	 * framebuffer prepare is deferred for prepare_fb calls that
	 * happen during the transition from secure to non-secure.
	 * Handle the prepare at this point for rotator in such cases.
	 * This can be expected for one or two frames during the transition.
	 */
	if (pstate->aspace && pstate->defer_prepare_fb) {
		/* prepare rotator input buffer */
		ret = msm_framebuffer_prepare(state->fb, pstate->aspace);
		if (ret) {
			SDE_ERROR("p%d failed to prepare input fb %d\n",
							plane->base.id, ret);
			return;
		}

		/* prepare rotator output buffer */
		if (sde_plane_enabled(state) && rstate->out_fb) {
			ret = msm_framebuffer_prepare(rstate->out_fb,
						pstate->aspace);
			if (ret) {
				SDE_ERROR(
				  "p%d failed to prepare inline fb %d\n",
				  plane->base.id, ret);
				goto error_prepare_output_buffer;
			}
		}
	}

	sde_plane_rot_submit_command(plane, state, SDE_HW_ROT_CMD_COMMIT);

	return;

error_prepare_output_buffer:
	msm_framebuffer_cleanup(state->fb, pstate->aspace);
}

void sde_plane_kickoff(struct drm_plane *plane)
@@ -2767,27 +2824,31 @@ static int sde_plane_prepare_fb(struct drm_plane *plane,

	/* cache aspace */
	pstate->aspace = aspace;

	/*
	 * when transitioning from secure to non-secure,
	 * plane->prepare_fb happens before the commit. In such case,
	 * defer the prepare_fb and handled it late, during the commit
	 * after attaching the domains as part of the transition
	 */
	pstate->defer_prepare_fb = (aspace && !aspace->domain_attached) ?
							true : false;

	ret = sde_plane_rot_prepare_fb(plane, new_state);
	if (ret) {
		SDE_ERROR("failed to prepare rot framebuffer\n");
		return ret;
	}

	new_rstate = &to_sde_plane_state(new_state)->rot;

	if (pstate->aspace) {
		/*
		 * when transitioning from secure to non-secure,
		 * plane->prepare_fb happens before the commit. In such case,
		 * return early, as prepare_fb would be handled as part
		 * of the transition after attaching the domains,
		 * during the commit
		 */
		if (!pstate->aspace->domain_attached) {
	if (pstate->defer_prepare_fb) {
		SDE_DEBUG_PLANE(psde,
		    "domain not attached, prepare_fb handled later\n");
		return 0;
	}

	new_rstate = &to_sde_plane_state(new_state)->rot;

	if (pstate->aspace) {
		ret = msm_framebuffer_prepare(new_rstate->out_fb,
				pstate->aspace);
		if (ret) {
+2 −0
Original line number Diff line number Diff line
@@ -129,6 +129,7 @@ enum sde_plane_sclcheck_state {
 * @multirect_index: index of the rectangle of SSPP
 * @multirect_mode: parallel or time multiplex multirect mode
 * @pending:	whether the current update is still pending
 * @defer_prepare_fb:	indicate if prepare_fb call was deferred
 * @scaler3_cfg: configuration data for scaler3
 * @pixel_ext: configuration data for pixel extensions
 * @scaler_check_state: indicates status of user provided pixel extension data
@@ -146,6 +147,7 @@ struct sde_plane_state {
	uint32_t multirect_index;
	uint32_t multirect_mode;
	bool pending;
	bool defer_prepare_fb;

	/* scaler configuration */
	struct sde_hw_scaler3_cfg scaler3_cfg;