drm/nouveau/disp/dp: respect sink limits when selecting failsafe link configuration
authorBen Skeggs <bskeggs@redhat.com>
Fri, 10 May 2019 01:57:04 +0000 (11:57 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Tue, 14 May 2019 06:58:06 +0000 (16:58 +1000)
Where possible, we want the failsafe link configuration (one which won't
hang the OR during modeset because of not enough bandwidth for the mode)
to also be supported by the sink.

This prevents "link rate unsupported by sink" messages when link training
fails.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c

index 5f301e632599b471c54291797b59c0d51e18be9a..818d21bd28d3122898f11d88c87bc0fec348c5ee 100644 (file)
@@ -365,8 +365,15 @@ nvkm_dp_train(struct nvkm_dp *dp, u32 dataKBps)
         * and it's better to have a failed modeset than that.
         */
        for (cfg = nvkm_dp_rates; cfg->rate; cfg++) {
-               if (cfg->nr <= outp_nr && cfg->nr <= outp_bw)
-                       failsafe = cfg;
+               if (cfg->nr <= outp_nr && cfg->nr <= outp_bw) {
+                       /* Try to respect sink limits too when selecting
+                        * lowest link configuration.
+                        */
+                       if (!failsafe ||
+                           (cfg->nr <= sink_nr && cfg->bw <= sink_bw))
+                               failsafe = cfg;
+               }
+
                if (failsafe && cfg[1].rate < dataKBps)
                        break;
        }