Sfoglia il codice sorgente

Merge "disp: msm: dp: update the definition of atomic_check function"

qctecmdr 5 anni fa
parent
commit
0ee986b2f8

+ 2 - 2
msm/dp/dp_catalog.h

@@ -1,13 +1,13 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
  */
 
 #ifndef _DP_CATALOG_H_
 #define _DP_CATALOG_H_
 
 #include <drm/drm_dp_helper.h>
-#include <drm/msm_drm.h>
+#include <drm/sde_drm.h>
 
 #include "dp_parser.h"
 

+ 7 - 2
msm/dp/dp_display.c

@@ -2059,6 +2059,7 @@ static enum drm_mode_status dp_display_validate_mode(
 	bool dsc_en;
 	u32 num_lm = 0;
 	int rc = 0;
+	u32 pclk_khz = 0;
 
 	if (!dp_display || !mode || !panel ||
 			!avail_res || !avail_res->max_mixer_width) {
@@ -2099,8 +2100,12 @@ static enum drm_mode_status dp_display_validate_mode(
 		goto end;
 	}
 
-	if (mode->clock > dp_display->max_pclk_khz) {
-		DP_MST_DEBUG("clk:%d, max:%d\n", mode->clock,
+	pclk_khz = dp_mode.timing.widebus_en ?
+		(dp_mode.timing.pixel_clk_khz >> 1) :
+		(dp_mode.timing.pixel_clk_khz);
+
+	if (pclk_khz > dp_display->max_pclk_khz) {
+		DP_MST_DEBUG("clk:%d, max:%d\n", pclk_khz,
 				dp_display->max_pclk_khz);
 		goto end;
 	}

+ 2 - 2
msm/dp/dp_display.h

@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
  */
 
 #ifndef _DP_DISPLAY_H_
@@ -8,7 +8,7 @@
 
 #include <linux/list.h>
 #include <drm/drmP.h>
-#include <drm/msm_drm.h>
+#include <drm/sde_drm.h>
 
 #include "dp_panel.h"
 

+ 6 - 4
msm/dp/dp_drm.c

@@ -498,18 +498,20 @@ void dp_connector_post_open(struct drm_connector *connector, void *display)
 
 int dp_connector_atomic_check(struct drm_connector *connector,
 	void *display,
-	struct drm_connector_state *c_state)
+	struct drm_atomic_state *a_state)
 {
 	struct sde_connector *sde_conn;
 	struct drm_connector_state *old_state;
+	struct drm_connector_state *c_state;
 
-	if (!connector || !display)
+	if (!connector || !display || a_state)
 		return -EINVAL;
 
+	c_state = drm_atomic_get_new_connector_state(a_state, connector);
 	old_state =
-		drm_atomic_get_old_connector_state(c_state->state, connector);
+		drm_atomic_get_old_connector_state(a_state, connector);
 
-	if (!old_state)
+	if (!old_state || !c_state)
 		return -EINVAL;
 
 	sde_conn = to_sde_connector(connector);

+ 6 - 4
msm/dp/dp_mst_drm.c

@@ -1390,11 +1390,11 @@ static struct dp_mst_bridge *_dp_mst_get_bridge_from_encoder(
 }
 
 static int dp_mst_connector_atomic_check(struct drm_connector *connector,
-		void *display, struct drm_connector_state *new_conn_state)
+		void *display, struct drm_atomic_state *state)
 {
 	int rc = 0, slots, i;
-	struct drm_atomic_state *state;
 	struct drm_connector_state *old_conn_state;
+	struct drm_connector_state *new_conn_state;
 	struct drm_crtc *old_crtc;
 	struct drm_crtc_state *crtc_state;
 	struct dp_mst_bridge *bridge = NULL;
@@ -1412,13 +1412,15 @@ static int dp_mst_connector_atomic_check(struct drm_connector *connector,
 	if (mst->state == PM_SUSPEND)
 		return rc;
 
+	if (!state)
+		return rc;
+
+	new_conn_state = drm_atomic_get_new_connector_state(state, connector);
 	if (!new_conn_state)
 		return rc;
 
 	mutex_lock(&mst->mst_lock);
 
-	state = new_conn_state->state;
-
 	old_conn_state = drm_atomic_get_old_connector_state(state, connector);
 	if (!old_conn_state)
 		goto mode_set;

+ 5 - 2
msm/dp/dp_panel.c

@@ -1682,8 +1682,6 @@ static void dp_panel_decode_dsc_dpcd(struct dp_panel *dp_panel)
 		dp_panel->sink_dsc_caps.dsc_capable = false;
 		dp_panel->dsc_en = false;
 	}
-
-	dp_panel->widebus_en = dp_panel->dsc_en;
 }
 
 static void dp_panel_read_sink_dsc_caps(struct dp_panel *dp_panel)
@@ -1790,12 +1788,17 @@ static int dp_panel_read_sink_caps(struct dp_panel *dp_panel,
 		}
 	}
 
+	/* There is no need to read EDID from MST branch */
+	if (panel->parser->has_mst && dp_panel->read_mst_cap(dp_panel))
+		goto skip_edid;
+
 	rc = dp_panel_read_edid(dp_panel, connector);
 	if (rc) {
 		DP_ERR("panel edid read failed, set failsafe mode\n");
 		return rc;
 	}
 
+skip_edid:
 	dp_panel->widebus_en = panel->parser->has_widebus;
 	dp_panel->dsc_feature_enable = panel->parser->dsc_feature_enable;
 	dp_panel->fec_feature_enable = panel->parser->fec_feature_enable;

+ 1 - 1
msm/dp/dp_panel.h

@@ -6,7 +6,7 @@
 #ifndef _DP_PANEL_H_
 #define _DP_PANEL_H_
 
-#include <drm/msm_drm.h>
+#include <drm/sde_drm.h>
 
 #include "dp_aux.h"
 #include "dp_link.h"

+ 0 - 8
msm/sde/sde_connector.c

@@ -2440,7 +2440,6 @@ static int _sde_connector_install_properties(struct drm_device *dev,
 {
 	struct dsi_display *dsi_display;
 	int rc;
-	struct drm_connector *connector;
 
 	msm_property_install_blob(&c_conn->property_info, "capabilities",
 			DRM_MODE_PROP_IMMUTABLE, CONNECTOR_PROP_SDE_INFO);
@@ -2453,8 +2452,6 @@ static int _sde_connector_install_properties(struct drm_device *dev,
 		return rc;
 	}
 
-	connector = &c_conn->base;
-
 	msm_property_install_blob(&c_conn->property_info, "mode_properties",
 			DRM_MODE_PROP_IMMUTABLE, CONNECTOR_PROP_MODE_INFO);
 
@@ -2498,11 +2495,6 @@ static int _sde_connector_install_properties(struct drm_device *dev,
 			      &hdr,
 			      sizeof(hdr),
 			      CONNECTOR_PROP_EXT_HDR_INFO);
-
-		/* create and attach colorspace property for DP */
-		if (!drm_mode_create_colorspace_property(connector))
-			drm_object_attach_property(&connector->base,
-				connector->colorspace_property, 0);
 	}
 
 	msm_property_install_volatile_range(&c_conn->property_info,

+ 9 - 2
msm/sde/sde_kms.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved.
  * Copyright (C) 2013 Red Hat
  * Author: Rob Clark <[email protected]>
  *
@@ -2431,8 +2431,15 @@ static int sde_kms_get_mixer_count(const struct msm_kms *kms,
 	temp = drm_fixp_mul(temp, vrefresh_fp);
 	mode_clock_hz = drm_fixp_mul(temp, mdp_fudge_factor);
 	if (mode_clock_hz > max_mdp_clock_hz ||
-			mode->hdisplay > res->max_mixer_width)
+			mode->hdisplay > res->max_mixer_width) {
 		*num_lm = 2;
+		if ((mode_clock_hz >> 1) > max_mdp_clock_hz) {
+			SDE_DEBUG("[%s] clock %d exceeds max_mdp_clk %d\n",
+					mode->name, mode_clock_hz,
+					max_mdp_clock_hz);
+			return -EINVAL;
+		}
+	}
 	SDE_DEBUG("[%s] h=%d, v=%d, fps=%d, max_mdp_clk_hz=%llu, num_lm=%d\n",
 			mode->name, mode->htotal, mode->vtotal, mode->vrefresh,
 			sde_kms->perf.max_core_clk_rate, *num_lm);