[PATCH v3 13/16] drm/amd/display: Validate DSC caps on MST endpoints

Francis, David David.Francis at amd.com
Thu Aug 22 13:26:55 UTC 2019


Whoops, left in a test print.  Ignore this patch

________________________________________
From: David Francis <David.Francis at amd.com>
Sent: August 21, 2019 4:01 PM
To: dri-devel at lists.freedesktop.org; amd-gfx at lists.freedesktop.org
Cc: Francis, David; Liu, Wenjing; Cornij, Nikola
Subject: [PATCH v3 13/16] drm/amd/display: Validate DSC caps on MST endpoints

During MST mode enumeration, if a new dc_sink is created,
populate it with dsc caps as appropriate.

Use drm_dp_mst_dsc_caps_for_port to get the raw caps,
then parse them onto dc_sink with dc_dsc_parse_dsc_dpcd.

Cc: Wenjing Liu <Wenjing.Liu at amd.com>
Cc: Nikola Cornij <Nikola.Cornij at amd.com>
Signed-off-by: David Francis <David.Francis at amd.com>
---
 .../display/amdgpu_dm/amdgpu_dm_mst_types.c   | 27 ++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
index 16218a202b59..9978c1a01eb7 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
@@ -25,6 +25,7 @@

 #include <linux/version.h>
 #include <drm/drm_atomic_helper.h>
+#include <drm/drm_dp_mst_helper.h>
 #include "dm_services.h"
 #include "amdgpu.h"
 #include "amdgpu_dm.h"
@@ -189,6 +190,24 @@ static const struct drm_connector_funcs dm_dp_mst_connector_funcs = {
        .early_unregister = amdgpu_dm_mst_connector_early_unregister,
 };

+#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT
+static bool validate_dsc_caps_on_connector(struct amdgpu_dm_connector *aconnector)
+{
+       struct dc_sink *dc_sink = aconnector->dc_sink;
+       struct drm_dp_mst_port *port = aconnector->port;
+       u8 dsc_caps[16] = { 0 };
+
+       if (drm_dp_mst_dsc_caps_for_port(port, dsc_caps) < 0)
+               return false;
+
+       printk("Validated DSC caps 0x%x", dsc_caps[0]);
+       if (!dc_dsc_parse_dsc_dpcd(dsc_caps, NULL, &dc_sink->sink_dsc_caps.dsc_dec_caps))
+               return false;
+
+       return true;
+}
+#endif
+
 static int dm_dp_mst_get_modes(struct drm_connector *connector)
 {
        struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
@@ -231,10 +250,16 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector)
                /* dc_link_add_remote_sink returns a new reference */
                aconnector->dc_sink = dc_sink;

-               if (aconnector->dc_sink)
+               if (aconnector->dc_sink) {
                        amdgpu_dm_update_freesync_caps(
                                        connector, aconnector->edid);

+#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT
+                       if (!validate_dsc_caps_on_connector(aconnector))
+                               memset(&aconnector->dc_sink->sink_dsc_caps,
+                                      0, sizeof(aconnector->dc_sink->sink_dsc_caps));
+#endif
+               }
        }

        drm_connector_update_edid_property(
--
2.17.1



More information about the dri-devel mailing list