]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/amd/display: use proper pipe_ctx index
authorSamson Tam <Samson.Tam@amd.com>
Fri, 7 Sep 2018 14:13:55 +0000 (10:13 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 27 Sep 2018 02:09:05 +0000 (21:09 -0500)
Use link->link_index as index to pipe_ctx[] to get proper link
information instead of using index 0 to avoid potential miss matches.

Signed-off-by: Samson Tam <Samson.Tam@amd.com>
Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc.c

index 1c438eedf77a750b27312e700409ddc82d9501a7..7d9be87140cc9e4b700681cbc17e6b870fdd4840 100644 (file)
@@ -460,9 +460,25 @@ void dc_link_set_preferred_link_settings(struct dc *dc,
                                         struct dc_link_settings *link_setting,
                                         struct dc_link *link)
 {
+       int i;
+       struct pipe_ctx *pipe;
+       struct dc_stream_state *link_stream;
        struct dc_link_settings store_settings = *link_setting;
-       struct dc_stream_state *link_stream =
-               link->dc->current_state->res_ctx.pipe_ctx[0].stream;
+
+       for (i = 0; i < MAX_PIPES; i++) {
+               pipe = &dc->current_state->res_ctx.pipe_ctx[i];
+               if (pipe->stream && pipe->stream->sink
+                       && pipe->stream->sink->link) {
+                       if (pipe->stream->sink->link == link)
+                               break;
+               }
+       }
+
+       /* Stream not found */
+       if (i == MAX_PIPES)
+               return;
+
+       link_stream = link->dc->current_state->res_ctx.pipe_ctx[i].stream;
 
        link->preferred_link_setting = store_settings;
        if (link_stream)