drm/amd/display: Skip Invalid Streams from DSC Policy
authorFangzhi Zuo <Jerry.Zuo@amd.com>
Mon, 23 Sep 2024 20:20:40 +0000 (16:20 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 7 Oct 2024 18:16:25 +0000 (14:16 -0400)
Streams with invalid new connector state should be elimiated from
dsc policy.

Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Fangzhi Zuo <Jerry.Zuo@amd.com>
Signed-off-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c

index 68bd8e6b948de72ea29d52e2b22f8f331aa3e305..32b025c92c63cf618ffbc21b8aed90ad5be787a3 100644 (file)
@@ -1120,6 +1120,7 @@ static int compute_mst_dsc_configs_for_link(struct drm_atomic_state *state,
        int i, k, ret;
        bool debugfs_overwrite = false;
        uint16_t fec_overhead_multiplier_x1000 = get_fec_overhead_multiplier(dc_link);
+       struct drm_connector_state *new_conn_state;
 
        memset(params, 0, sizeof(params));
 
@@ -1127,7 +1128,7 @@ static int compute_mst_dsc_configs_for_link(struct drm_atomic_state *state,
                return PTR_ERR(mst_state);
 
        /* Set up params */
-       DRM_DEBUG_DRIVER("%s: MST_DSC Set up params for %d streams\n", __func__, dc_state->stream_count);
+       DRM_DEBUG_DRIVER("%s: MST_DSC Try to set up params from %d streams\n", __func__, dc_state->stream_count);
        for (i = 0; i < dc_state->stream_count; i++) {
                struct dc_dsc_policy dsc_policy = {0};
 
@@ -1143,6 +1144,14 @@ static int compute_mst_dsc_configs_for_link(struct drm_atomic_state *state,
                if (!aconnector->mst_output_port)
                        continue;
 
+               new_conn_state = drm_atomic_get_new_connector_state(state, &aconnector->base);
+
+               if (!new_conn_state) {
+                       DRM_DEBUG_DRIVER("%s:%d MST_DSC Skip the stream 0x%p with invalid new_conn_state\n",
+                                       __func__, __LINE__, stream);
+                       continue;
+               }
+
                stream->timing.flags.DSC = 0;
 
                params[count].timing = &stream->timing;
@@ -1175,6 +1184,8 @@ static int compute_mst_dsc_configs_for_link(struct drm_atomic_state *state,
                count++;
        }
 
+       DRM_DEBUG_DRIVER("%s: MST_DSC Params set up for %d streams\n", __func__, count);
+
        if (count == 0) {
                ASSERT(0);
                return 0;