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

Commit 6a9f3b75 authored by Kalyan Thota's avatar Kalyan Thota Committed by Jayant Shekhar
Browse files

drm/msm/sde: Use panel front porch for ROT and MDP fetch start



Keep the ROT and MDP fetch start to a fixed value such that they
are not affected when dynamic refresh rate changes the front porch.

Change-Id: Ic29a2d29e736801b1840538aeedadbf51ba5bb9f
Signed-off-by: default avatarKalyan Thota <kalyant@codeaurora.org>
Signed-off-by: default avatarJayant Shekhar <jshekhar@codeaurora.org>
parent 72cd1631
Loading
Loading
Loading
Loading
+47 −0
Original line number Diff line number Diff line
@@ -5190,6 +5190,53 @@ int dsi_display_get_modes(struct dsi_display *display,
	return rc;
}

int dsi_display_get_panel_vfp(void *dsi_display,
	int h_active, int v_active)
{
	int i, rc = 0;
	u32 count, refresh_rate = 0;
	struct dsi_dfps_capabilities dfps_caps;
	struct dsi_display *display = (struct dsi_display *)dsi_display;

	if (!display)
		return -EINVAL;

	rc = dsi_display_get_mode_count(display, &count);
	if (rc)
		return rc;

	mutex_lock(&display->display_lock);

	if (display->panel && display->panel->cur_mode)
		refresh_rate = display->panel->cur_mode->timing.refresh_rate;

	dsi_panel_get_dfps_caps(display->panel, &dfps_caps);
	if (dfps_caps.dfps_support)
		refresh_rate = dfps_caps.max_refresh_rate;

	if (!refresh_rate) {
		mutex_unlock(&display->display_lock);
		pr_err("Null Refresh Rate\n");
		return -EINVAL;
	}

	h_active *= display->ctrl_count;

	for (i = 0; i < count; i++) {
		struct dsi_display_mode *m = &display->modes[i];

		if (m && v_active == m->timing.v_active &&
			h_active == m->timing.h_active &&
			refresh_rate == m->timing.refresh_rate) {
			rc = m->timing.v_front_porch;
			break;
		}
	}
	mutex_unlock(&display->display_lock);

	return rc;
}

int dsi_display_find_mode(struct dsi_display *display,
		const struct dsi_display_mode *cmp,
		struct dsi_display_mode **out_mode)
+10 −0
Original line number Diff line number Diff line
@@ -647,4 +647,14 @@ enum dsi_pixel_format dsi_display_get_dst_format(void *display);
 * Return: Zero on Success
 */
int dsi_display_cont_splash_config(void *display);
/*
 * dsi_display_get_panel_vfp - get panel vsync
 * @display: Pointer to private display structure
 * @h_active: width
 * @v_active: height
 * Returns: v_front_porch on success error code on failure
 */
int dsi_display_get_panel_vfp(void *display,
	int h_active, int v_active);

#endif /* _DSI_DISPLAY_H_ */
+22 −0
Original line number Diff line number Diff line
@@ -1404,6 +1404,28 @@ int sde_connector_helper_reset_custom_properties(
	return 0;
}

int sde_connector_get_panel_vfp(struct drm_connector *connector,
	struct drm_display_mode *mode)
{
	struct sde_connector *c_conn;
	int vfp = -EINVAL;

	if (!connector || !mode) {
		SDE_ERROR("invalid connector\n");
		return vfp;
	}
	c_conn = to_sde_connector(connector);
	if (!c_conn->ops.get_panel_vfp)
		return vfp;

	vfp = c_conn->ops.get_panel_vfp(c_conn->display,
		mode->hdisplay, mode->vdisplay);
	if (vfp <= 0)
		SDE_ERROR("Failed get_panel_vfp %d\n", vfp);

	return vfp;
}

static int _sde_debugfs_conn_cmd_tx_open(struct inode *inode, struct file *file)
{
	/* non-seekable */
+18 −0
Original line number Diff line number Diff line
@@ -257,6 +257,15 @@ struct sde_connector_ops {
	 * Returns: zero for success, negetive for failure
	 */
	int (*cont_splash_config)(void *display);

	/**
	 * get_panel_vfp - returns original panel vfp
	 * @display: Pointer to private display handle
	 * @h_active: width
	 * @v_active: height
	 * Returns: v_front_porch on success error-code on failure
	 */
	int (*get_panel_vfp)(void *display, int h_active, int v_active);
};

/**
@@ -750,4 +759,13 @@ void sde_conn_timeline_status(struct drm_connector *conn);
 */
void sde_connector_helper_bridge_disable(struct drm_connector *connector);

/**
 * sde_connector_get_panel_vfp - helper to get panel vfp
 * @connector: pointer to drm connector
 * @h_active: panel width
 * @v_active: panel heigth
 * Returns: v_front_porch on success error-code on failure
 */
int sde_connector_get_panel_vfp(struct drm_connector *connector,
	struct drm_display_mode *mode);
#endif /* _SDE_CONNECTOR_H_ */
+4 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2015-2017 The Linux Foundation. All rights reserved.
 * Copyright (c) 2015-2018 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
@@ -263,6 +263,8 @@ struct sde_encoder_irq {
 * @irq:			IRQ tracking structures
 * @cont_splash_single_flush	Variable to check if single flush is enabled.
 * @cont_splash_settings	Variable to store continuous splash settings.
 * @vfp_cached:			cached vertical front porch to be used for
 *				programming ROT and MDP fetch start
 */
struct sde_encoder_phys {
	struct drm_encoder *parent;
@@ -292,6 +294,7 @@ struct sde_encoder_phys {
	struct sde_encoder_irq irq[INTR_IDX_MAX];
	u32 cont_splash_single_flush;
	bool cont_splash_settings;
	int vfp_cached;
};

static inline int sde_encoder_phys_inc_pending(struct sde_encoder_phys *phys)
Loading