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

Commit fae4d81e authored by Harsh Sahu's avatar Harsh Sahu
Browse files

drm/msm/sde : cache crtc in sde phys wb encoder



DRM framework clears the crtc and connector links during normal display
commit work in drm_atomic_helper_update_legacy_modeset_state. This may
lead to race condition on accessing the crtc and connector pointer.
This change caches the crtc in sde phys wb encoder on enable and clears
it on disable.

Change-Id: I748567102739328e612a5ae66c6c16c89c020234
Signed-off-by: default avatarHarsh Sahu <hsahu@codeaurora.org>
parent 1e52ed04
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -379,6 +379,7 @@ struct sde_encoder_phys_cmd {
 * @end_time:		End time of writeback latest request
 * @bo_disable:		Buffer object(s) to use during the disabling state
 * @fb_disable:		Frame buffer to use during the disabling state
 * @crtc		Pointer to drm_crtc
 */
struct sde_encoder_phys_wb {
	struct sde_encoder_phys base;
@@ -403,6 +404,7 @@ struct sde_encoder_phys_wb {
	ktime_t end_time;
	struct drm_gem_object *bo_disable[SDE_MAX_PLANES];
	struct drm_framebuffer *fb_disable;
	struct drm_crtc *crtc;
};

/**
+13 −1
Original line number Diff line number Diff line
@@ -124,7 +124,12 @@ static void sde_encoder_phys_wb_set_qos_remap(
	}

	wb_enc = to_sde_encoder_phys_wb(phys_enc);
	crtc = phys_enc->parent->crtc;
	if (!wb_enc->crtc) {
		SDE_ERROR("invalid crtc");
		return;
	}

	crtc = wb_enc->crtc;

	if (!wb_enc->hw_wb || !wb_enc->hw_wb->caps) {
		SDE_ERROR("invalid writeback hardware\n");
@@ -1141,6 +1146,12 @@ static void sde_encoder_phys_wb_enable(struct sde_encoder_phys *phys_enc)
	wb_enc->wb_dev = sde_wb_connector_get_wb(connector);

	phys_enc->enable_state = SDE_ENC_ENABLED;

	/*
	 * cache the crtc in wb_enc on enable for duration of use case
	 * for correctly servicing asynchronous irq events and timers
	 */
	wb_enc->crtc = phys_enc->parent->crtc;
}

/**
@@ -1186,6 +1197,7 @@ static void sde_encoder_phys_wb_disable(struct sde_encoder_phys *phys_enc)
	sde_encoder_phys_wb_wait_for_commit_done(phys_enc);
exit:
	phys_enc->enable_state = SDE_ENC_DISABLED;
	wb_enc->crtc = NULL;
}

/**