]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.19/drm-nouveau-disp-dp-respect-sink-limits-when-selecti.patch
Linux 5.1.10
[thirdparty/kernel/stable-queue.git] / queue-4.19 / drm-nouveau-disp-dp-respect-sink-limits-when-selecti.patch
1 From 091b7fee43d441e0daadcca0d25eca50956434b3 Mon Sep 17 00:00:00 2001
2 From: Ben Skeggs <bskeggs@redhat.com>
3 Date: Fri, 10 May 2019 11:57:04 +1000
4 Subject: drm/nouveau/disp/dp: respect sink limits when selecting failsafe link
5 configuration
6
7 [ Upstream commit 13d03e9daf70dab032c03dc172e75bb98ad899c4 ]
8
9 Where possible, we want the failsafe link configuration (one which won't
10 hang the OR during modeset because of not enough bandwidth for the mode)
11 to also be supported by the sink.
12
13 This prevents "link rate unsupported by sink" messages when link training
14 fails.
15
16 Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
17 Signed-off-by: Sasha Levin <sashal@kernel.org>
18 ---
19 drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c | 11 +++++++++--
20 1 file changed, 9 insertions(+), 2 deletions(-)
21
22 diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c
23 index 5f301e632599..818d21bd28d3 100644
24 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c
25 +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c
26 @@ -365,8 +365,15 @@ nvkm_dp_train(struct nvkm_dp *dp, u32 dataKBps)
27 * and it's better to have a failed modeset than that.
28 */
29 for (cfg = nvkm_dp_rates; cfg->rate; cfg++) {
30 - if (cfg->nr <= outp_nr && cfg->nr <= outp_bw)
31 - failsafe = cfg;
32 + if (cfg->nr <= outp_nr && cfg->nr <= outp_bw) {
33 + /* Try to respect sink limits too when selecting
34 + * lowest link configuration.
35 + */
36 + if (!failsafe ||
37 + (cfg->nr <= sink_nr && cfg->bw <= sink_bw))
38 + failsafe = cfg;
39 + }
40 +
41 if (failsafe && cfg[1].rate < dataKBps)
42 break;
43 }
44 --
45 2.20.1
46