From 9fd310830e02f049a2cbc5679d492d2933f789f0 Mon Sep 17 00:00:00 2001 From: Tatenda Chipeperekwa Date: Wed, 5 Feb 2020 19:33:53 -0800 Subject: [PATCH 1/7] disp: msm: sde: remove colorspace property from connector Remove colorspace property from connector until upstream changes are merged and we can validate the related features. This change is required to enable DP bring up activities. Change-Id: I6c1af61732e572b2ffd16e0a323d08154aa83b53 Signed-off-by: Tatenda Chipeperekwa --- msm/sde/sde_connector.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/msm/sde/sde_connector.c b/msm/sde/sde_connector.c index 939b4d03d64c..561c0d1724e3 100644 --- a/msm/sde/sde_connector.c +++ b/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, From dbe4ebc8fdba868bf8de5dc6a7c81cddf5126249 Mon Sep 17 00:00:00 2001 From: Tatenda Chipeperekwa Date: Wed, 5 Feb 2020 18:15:28 -0800 Subject: [PATCH 2/7] disp: msm: dp: skip edid reading for mst branch When DP is working in MST mode, reading native EDID from MST branch is not a valid operation. Change-Id: I297d2b25b2c3166d68ef3eba941ca787d8bce8d3 Signed-off-by: Xiaowen Wu Signed-off-by: Tatenda Chipeperekwa --- msm/dp/dp_panel.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/msm/dp/dp_panel.c b/msm/dp/dp_panel.c index b6ae4727a8cd..65c5fc748e9a 100644 --- a/msm/dp/dp_panel.c +++ b/msm/dp/dp_panel.c @@ -1790,12 +1790,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; From 6f0828d9a78dc8e327648c8886bc0754c67b2870 Mon Sep 17 00:00:00 2001 From: Tatenda Chipeperekwa Date: Mon, 25 Nov 2019 17:30:08 -0800 Subject: [PATCH 3/7] disp: msm: dp: update mode validation logic for widebus Update the mode validation logic by halving the mode clock when widebus is enabled. Change-Id: I8f060d8b60403aa5020496983bec0b3e2878b08b Signed-off-by: Tatenda Chipeperekwa --- msm/dp/dp_display.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/msm/dp/dp_display.c b/msm/dp/dp_display.c index a7420c7bb955..fec870b085ae 100644 --- a/msm/dp/dp_display.c +++ b/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; } From 27ec7895709a50d8dee641eef3bf7dab0123cafc Mon Sep 17 00:00:00 2001 From: Tatenda Chipeperekwa Date: Wed, 5 Feb 2020 18:19:35 -0800 Subject: [PATCH 4/7] disp: msm: dp: fix widebus-enable setting for dp Fix and decouple widebus-enable flag from dsc_en for dp. Change-Id: I2d31bc367f007d4c918babc1c051492544bbb05c Signed-off-by: Xiaowen Wu Signed-off-by: Tatenda Chipeperekwa --- msm/dp/dp_panel.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/msm/dp/dp_panel.c b/msm/dp/dp_panel.c index 65c5fc748e9a..885a8d6d6106 100644 --- a/msm/dp/dp_panel.c +++ b/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) From 56d984970505665123b8210194106c9581fbadc9 Mon Sep 17 00:00:00 2001 From: Tatenda Chipeperekwa Date: Wed, 5 Feb 2020 18:27:10 -0800 Subject: [PATCH 5/7] disp: msm: dp: add mixer count check in dp mode validation Add mixer count check in dp mode validation for mdp clock. Change-Id: I37fe3037d7f7efc7bdc2a7446457af8a8e34684c Signed-off-by: Xiaowen Wu Signed-off-by: Tatenda Chipeperekwa --- msm/sde/sde_kms.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/msm/sde/sde_kms.c b/msm/sde/sde_kms.c index a56087da645f..17624217605c 100644 --- a/msm/sde/sde_kms.c +++ b/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 * @@ -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); From 3b1a8807fd495e0d272fa4b7f950441ba036c3ad Mon Sep 17 00:00:00 2001 From: Tatenda Chipeperekwa Date: Fri, 17 Jan 2020 12:58:25 -0800 Subject: [PATCH 6/7] disp: msm: dp: use sde_drm.h shared header from techpack path Update sde_drm.h header to use the display techpack path for kernel-5.4. Change-Id: I2b7dcbbde8128eece7a2a8a652f9f7c427b38110 Signed-off-by: Tatenda Chipeperekwa --- msm/dp/dp_catalog.h | 4 ++-- msm/dp/dp_display.h | 4 ++-- msm/dp/dp_panel.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/msm/dp/dp_catalog.h b/msm/dp/dp_catalog.h index 0b1f00408e43..65e8f2b8e19f 100644 --- a/msm/dp/dp_catalog.h +++ b/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 -#include +#include #include "dp_parser.h" diff --git a/msm/dp/dp_display.h b/msm/dp/dp_display.h index 6091c709179a..d234d323cabd 100644 --- a/msm/dp/dp_display.h +++ b/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 #include -#include +#include #include "dp_panel.h" diff --git a/msm/dp/dp_panel.h b/msm/dp/dp_panel.h index 9120c476f348..f211639b0ade 100644 --- a/msm/dp/dp_panel.h +++ b/msm/dp/dp_panel.h @@ -6,7 +6,7 @@ #ifndef _DP_PANEL_H_ #define _DP_PANEL_H_ -#include +#include #include "dp_aux.h" #include "dp_link.h" From cf71a83fbaf4dc72ae13d7134494a663324524fc Mon Sep 17 00:00:00 2001 From: Tatenda Chipeperekwa Date: Mon, 20 Jan 2020 14:38:41 -0800 Subject: [PATCH 7/7] disp: msm: dp: update the definition of atomic_check function Update the definition of the atomic_check function for DisplayPort connectors to align with the DRM upstream changes. Change-Id: Id942c8ef16ae773540c4bc7221e0b784354a527c Signed-off-by: Tatenda Chipeperekwa --- msm/dp/dp_drm.c | 10 ++++++---- msm/dp/dp_mst_drm.c | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/msm/dp/dp_drm.c b/msm/dp/dp_drm.c index a2022cf47345..4ac9ff52ff90 100644 --- a/msm/dp/dp_drm.c +++ b/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); diff --git a/msm/dp/dp_mst_drm.c b/msm/dp/dp_mst_drm.c index f7ecb5542eed..007853ecf324 100644 --- a/msm/dp/dp_mst_drm.c +++ b/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;