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

Commit 6d4a281c authored by Kalyan Thota's avatar Kalyan Thota
Browse files

drm:msm:sde allow qsync support along with VRR



Allow Qsync and VRR features to be supported independently
by display driver. Restrict the feature availability in
the same composition cycle.

Change-Id: I696eb72a2b4f9451e142ffdc5acccc8987c36b6d
Signed-off-by: default avatarKalyan Thota <kalyant@codeaurora.org>
parent 3d026858
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -3239,12 +3239,14 @@ struct dsi_panel *dsi_panel_get(struct device *parent,
	if (rc)
		pr_err("failed to parse dfps configuration, rc=%d\n", rc);

	if (!(panel->dfps_caps.dfps_support)) {
		/* qsync and dfps are mutually exclusive features */
	rc = dsi_panel_parse_qsync_caps(panel, of_node);
	if (rc)
		pr_err("failed to parse qsync features, rc=%d\n", rc);
	}

	/* allow qsync support only if DFPS is with VFP approach */
	if ((panel->dfps_caps.dfps_support) &&
	    !(panel->dfps_caps.type == DSI_DFPS_IMMEDIATE_VFP))
		panel->qsync_min_fps = 0;

	rc = dsi_panel_parse_dyn_clk_caps(panel);
	if (rc)
@@ -3273,7 +3275,6 @@ struct dsi_panel *dsi_panel_get(struct device *parent,
			goto error;
	}


	rc = dsi_panel_parse_misc_features(panel);
	if (rc)
		pr_err("failed to parse misc features, rc=%d\n", rc);
+38 −6
Original line number Diff line number Diff line
@@ -564,17 +564,24 @@ static int _sde_connector_update_bl_scale(struct sde_connector *c_conn)

void sde_connector_set_qsync_params(struct drm_connector *connector)
{
	struct sde_connector *c_conn = to_sde_connector(connector);
	u32 qsync_propval;
	struct sde_connector *c_conn;
	struct sde_connector_state *c_state;
	u32 qsync_propval = 0;
	bool prop_dirty;

	if (!connector)
		return;

	c_conn = to_sde_connector(connector);
	c_state = to_sde_connector_state(connector->state);
	c_conn->qsync_updated = false;

	prop_dirty = msm_property_is_dirty(&c_conn->property_info,
					&c_state->property_state,
					CONNECTOR_PROP_QSYNC_MODE);
	if (prop_dirty) {
		qsync_propval = sde_connector_get_property(c_conn->base.state,
						CONNECTOR_PROP_QSYNC_MODE);

	if (qsync_propval != c_conn->qsync_mode) {
		SDE_DEBUG("updated qsync mode %d -> %d\n", c_conn->qsync_mode,
				qsync_propval);
		c_conn->qsync_updated = true;
@@ -1209,6 +1216,10 @@ static int sde_connector_atomic_set_property(struct drm_connector *connector,
		c_conn->bl_scale_ad = val;
		c_conn->bl_scale_dirty = true;
		break;
	case CONNECTOR_PROP_QSYNC_MODE:
		msm_property_set_dirty(&c_conn->property_info,
				&c_state->property_state, idx);
		break;
	default:
		break;
	}
@@ -1804,13 +1815,34 @@ static int sde_connector_atomic_check(struct drm_connector *connector,
		struct drm_connector_state *new_conn_state)
{
	struct sde_connector *c_conn;
	struct drm_crtc_state *crtc_state;
	struct sde_connector_state *c_state;
	bool qsync_dirty;

	if (!connector) {
		SDE_ERROR("invalid connector\n");
		return 0;
		return -EINVAL;
	}

	if (!new_conn_state) {
		SDE_ERROR("invalid connector state\n");
		return -EINVAL;
	}

	c_conn = to_sde_connector(connector);
	c_state = to_sde_connector_state(new_conn_state);

	crtc_state = drm_atomic_get_new_crtc_state(new_conn_state->state,
						   new_conn_state->crtc);

	qsync_dirty = msm_property_is_dirty(&c_conn->property_info,
					&c_state->property_state,
					CONNECTOR_PROP_QSYNC_MODE);

	if (drm_atomic_crtc_needs_modeset(crtc_state) && qsync_dirty) {
		SDE_ERROR("invalid qsync update during modeset\n");
		return -EINVAL;
	}

	if (c_conn->ops.atomic_check)
		return c_conn->ops.atomic_check(connector,
+2 −2
Original line number Diff line number Diff line
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -417,7 +417,7 @@ static void _sde_encoder_phys_vid_setup_avr(
			return;
		}

		if (qsync_min_fps >= default_fps) {
		if (qsync_min_fps > default_fps) {
			SDE_ERROR_VIDENC(vid_enc,
				"qsync fps %d must be less than default %d\n",
				qsync_min_fps, default_fps);
+5 −2
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ static int sde_hw_intf_avr_setup(struct sde_hw_intf *ctx,
	u32 min_fps, default_fps, diff_fps;
	u32 vsync_period_slow;
	u32 avr_vtotal;
	u32 add_porches;
	u32 add_porches = 0;

	if (!ctx || !params || !avr_params) {
		SDE_ERROR("invalid input parameter(s)\n");
@@ -153,7 +153,10 @@ static int sde_hw_intf_avr_setup(struct sde_hw_intf *ctx,
	vsync_period = params->vsync_pulse_width +
			params->v_back_porch + params->height +
			params->v_front_porch;

	if (diff_fps)
		add_porches = mult_frac(vsync_period, diff_fps, min_fps);

	vsync_period_slow = vsync_period + add_porches;
	avr_vtotal = vsync_period_slow * hsync_period;