mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hamza Mahfooz <hamza.mahfooz@amd.com>
To: <linux-kernel@vger.kernel.org>
Cc: "Harry Wentland" <harry.wentland@amd.com>,
	"Fangzhi Zuo" <Jerry.Zuo@amd.com>,
	"Wayne Lin" <Wayne.Lin@amd.com>,
	"Aurabindo Pillai" <aurabindo.pillai@amd.com>,
	hersenxs.wu@amd.com, "Hamza Mahfooz" <hamza.mahfooz@amd.com>,
	"Leo Li" <sunpeng.li@amd.com>,
	"Rodrigo Siqueira" <Rodrigo.Siqueira@amd.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Pan, Xinhui" <Xinhui.Pan@amd.com>,
	"David Airlie" <airlied@linux.ie>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Lyude Paul" <lyude@redhat.com>, "Claudio Suarez" <cssk@net-c.es>,
	"Mikita Lipski" <mikita.lipski@amd.com>,
	"Bhawanpreet Lakha" <Bhawanpreet.Lakha@amd.com>,
	"Roman Li" <Roman.Li@amd.com>, "Ian Chen" <ian.chen@amd.com>,
	"Colin Ian King" <colin.king@intel.com>,
	"Nicholas Kazlauskas" <nicholas.kazlauskas@amd.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Jani Nikula" <jani.nikula@intel.com>,
	"Imran Khan" <imran.f.khan@oracle.com>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"Javier Martinez Canillas" <javierm@redhat.com>,
	"Kees Cook" <keescook@chromium.org>,
	"Imre Deak" <imre.deak@intel.com>,
	"Sankeerth Billakanti" <quic_sbillaka@quicinc.com>,
	amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: [PATCH v2 3/3] drm/amd/display: implement DSC pass-through support
Date: Fri, 5 Aug 2022 17:13:05 -0400	[thread overview]
Message-ID: <20220805211317.176672-3-hamza.mahfooz@amd.com> (raw)
In-Reply-To: <20220805211317.176672-1-hamza.mahfooz@amd.com>

Currently, we only attempt to setup DSC at the virtual DPCD port,
however many modern displays come with DSC support and MST hubs can now
support DSC pass-through. So, to more optimally make use of the
available bandwidth, use DSC pass-through when possible by adding DSC
pass-through enablement support into the DSC enable sequence.

Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
---
v2: print the correct type of port that we are writing to using dsc_aux
    in dm_helpers_dp_write_dsc_enable().
---
 .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 45 +++++++++++++++++--
 1 file changed, 41 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
index a0154a5f7183..bd364d2cc4f7 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
@@ -729,8 +729,14 @@ bool dm_helpers_dp_write_dsc_enable(
 		const struct dc_stream_state *stream,
 		bool enable)
 {
-	uint8_t enable_dsc = enable ? 1 : 0;
+	static const uint8_t DSC_DISABLE;
+	static const uint8_t DSC_DECODING = 0x01;
+	static const uint8_t DSC_PASSTHROUGH = 0x02;
+
 	struct amdgpu_dm_connector *aconnector;
+	struct drm_dp_mst_port *port;
+	uint8_t enable_dsc = enable ? DSC_DECODING : DSC_DISABLE;
+	uint8_t enable_passthrough = enable ? DSC_PASSTHROUGH : DSC_DISABLE;
 	uint8_t ret = 0;
 
 	if (!stream)
@@ -750,8 +756,39 @@ bool dm_helpers_dp_write_dsc_enable(
 				aconnector->dsc_aux, stream, enable_dsc);
 #endif
 
-		ret = drm_dp_dpcd_write(aconnector->dsc_aux, DP_DSC_ENABLE, &enable_dsc, 1);
-		DC_LOG_DC("Send DSC %s to MST RX\n", enable_dsc ? "enable" : "disable");
+		port = aconnector->port;
+
+		if (enable) {
+			if (port->passthrough_aux) {
+				ret = drm_dp_dpcd_write(port->passthrough_aux,
+							DP_DSC_ENABLE,
+							&enable_passthrough, 1);
+				DC_LOG_DC("Sent DSC pass-through enable to virtual dpcd port, ret = %u\n",
+					  ret);
+			}
+
+			ret = drm_dp_dpcd_write(aconnector->dsc_aux,
+						DP_DSC_ENABLE, &enable_dsc, 1);
+			DC_LOG_DC("Sent DSC decoding enable to %s port, ret = %u\n",
+				  (port->passthrough_aux) ? "remote RX" :
+				  "virtual dpcd",
+				  ret);
+		} else {
+			ret = drm_dp_dpcd_write(aconnector->dsc_aux,
+						DP_DSC_ENABLE, &enable_dsc, 1);
+			DC_LOG_DC("Sent DSC decoding disable to %s port, ret = %u\n",
+				  (port->passthrough_aux) ? "remote RX" :
+				  "virtual dpcd",
+				  ret);
+
+			if (port->passthrough_aux) {
+				ret = drm_dp_dpcd_write(port->passthrough_aux,
+							DP_DSC_ENABLE,
+							&enable_passthrough, 1);
+				DC_LOG_DC("Sent DSC pass-through disable to virtual dpcd port, ret = %u\n",
+					  ret);
+			}
+		}
 	}
 
 	if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT || stream->signal == SIGNAL_TYPE_EDP) {
@@ -768,7 +805,7 @@ bool dm_helpers_dp_write_dsc_enable(
 #endif
 	}
 
-	return (ret > 0);
+	return ret;
 }
 
 bool dm_helpers_is_dp_sink_present(struct dc_link *link)
-- 
2.37.1


  parent reply	other threads:[~2022-08-05 21:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-05 21:13 [PATCH v2 1/3] drm/dp_mst: add passthrough_aux to struct drm_dp_mst_port Hamza Mahfooz
2022-08-05 21:13 ` [PATCH v2 2/3] drm/amd/display: consider DSC pass-through during mode validation Hamza Mahfooz
2022-08-11 11:02   ` Anders Roxell
2022-08-05 21:13 ` Hamza Mahfooz [this message]
2022-08-05 21:17 ` [PATCH v2 1/3] drm/dp_mst: add passthrough_aux to struct drm_dp_mst_port Lyude Paul
2022-08-09 15:15   ` Hamza Mahfooz
2022-08-09 22:01     ` Lyude Paul
2022-08-10 13:23       ` Hamza Mahfooz
2022-08-10 21:24         ` Lyude Paul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220805211317.176672-3-hamza.mahfooz@amd.com \
    --to=hamza.mahfooz@amd.com \
    --cc=Bhawanpreet.Lakha@amd.com \
    --cc=Jerry.Zuo@amd.com \
    --cc=Rodrigo.Siqueira@amd.com \
    --cc=Roman.Li@amd.com \
    --cc=Wayne.Lin@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=aurabindo.pillai@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=colin.king@intel.com \
    --cc=cssk@net-c.es \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harry.wentland@amd.com \
    --cc=hersenxs.wu@amd.com \
    --cc=ian.chen@amd.com \
    --cc=imran.f.khan@oracle.com \
    --cc=imre.deak@intel.com \
    --cc=jani.nikula@intel.com \
    --cc=javierm@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lyude@redhat.com \
    --cc=mikita.lipski@amd.com \
    --cc=nicholas.kazlauskas@amd.com \
    --cc=quic_sbillaka@quicinc.com \
    --cc=sunpeng.li@amd.com \
    --cc=tzimmermann@suse.de \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®