drm/amd/display: Skip inactive planes within ModeSupportAndSystemConfiguration
authorjsg <jsg@openbsd.org>
Mon, 9 Sep 2024 09:03:58 +0000 (09:03 +0000)
committerjsg <jsg@openbsd.org>
Mon, 9 Sep 2024 09:03:58 +0000 (09:03 +0000)
From Hersen Wu
8406158a546441b73f0b216aedacbf9a1e5748fb in linux-6.6.y/6.6.50
a54f7e866cc73a4cb71b8b24bb568ba35c8969df in mainline linux

sys/dev/pci/drm/amd/display/dc/dml/display_mode_vba.c

index 9a3ded3..85453bb 100644 (file)
@@ -1099,8 +1099,13 @@ void ModeSupportAndSystemConfiguration(struct display_mode_lib *mode_lib)
 
        // Total Available Pipes Support Check
        for (k = 0; k < mode_lib->vba.NumberOfActivePlanes; ++k) {
-               total_pipes += mode_lib->vba.DPPPerPlane[k];
                pipe_idx = get_pipe_idx(mode_lib, k);
+               if (pipe_idx == -1) {
+                       ASSERT(0);
+                       continue; // skip inactive planes
+               }
+               total_pipes += mode_lib->vba.DPPPerPlane[k];
+
                if (mode_lib->vba.cache_pipes[pipe_idx].clks_cfg.dppclk_mhz > 0.0)
                        mode_lib->vba.DPPCLK[k] = mode_lib->vba.cache_pipes[pipe_idx].clks_cfg.dppclk_mhz;
                else