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

Commit 2192a603 authored by Samantha Tran's avatar Samantha Tran
Browse files

drm/msm/sde: fix for buffer corruption issues with mst connectors



Current implementation of get_output_fence is depending on
atomic_state to extract the connector details. There is a
possibility to have no connectors in atomic_state if no
connector property is processed by the time of executing
get_output_fence property and this results in wrong fence
handling.

This change depends on crtc encoder_mask field to extract
the drm_encoder tied to drm_crtc and extracts the panel
mode, video or command, information from sde_encoder object.

Change-Id: I3145b543382dcac038f38ee2769309b179395b3c
Signed-off-by: default avatarSamantha Tran <samtran@codeaurora.org>
parent 568e87ad
Loading
Loading
Loading
Loading
+7 −17
Original line number Diff line number Diff line
@@ -5051,28 +5051,18 @@ static int _sde_crtc_get_output_fence(struct drm_crtc *crtc,
{
	struct sde_crtc *sde_crtc;
	struct sde_crtc_state *cstate;
	uint32_t offset, i;
	struct drm_connector_state *old_conn_state, *new_conn_state;
	struct drm_connector *conn;
	struct sde_connector *sde_conn = NULL;
	struct msm_display_info disp_info;
	uint32_t offset;
	bool is_vid = false;
	struct drm_encoder *encoder;

	sde_crtc = to_sde_crtc(crtc);
	cstate = to_sde_crtc_state(state);

	for_each_oldnew_connector_in_state(state->state, conn, old_conn_state,
							new_conn_state, i) {
		if (!new_conn_state || new_conn_state->crtc != crtc)
			continue;

		sde_conn = to_sde_connector(new_conn_state->connector);
		if (sde_conn->display && sde_conn->ops.get_info) {
			sde_conn->ops.get_info(conn, &disp_info,
							sde_conn->display);
			is_vid |= disp_info.capabilities &
						MSM_DISPLAY_CAP_VID_MODE;
		}
	drm_for_each_encoder_mask(encoder, crtc->dev, state->encoder_mask) {
		is_vid |= sde_encoder_check_mode(encoder,
						MSM_DISPLAY_CAP_VID_MODE);
		if (is_vid)
			break;
	}

	offset = sde_crtc_get_property(cstate, CRTC_PROP_OUTPUT_FENCE_OFFSET);