]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amd/display: Correct DML calculation to align HW formula
authorPaul Hsieh <Paul.Hsieh@amd.com>
Fri, 10 Feb 2023 04:00:16 +0000 (12:00 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 May 2023 16:32:34 +0000 (17:32 +0100)
[ Upstream commit 26a9f53198c955b15161da48cdb51041a38d5325 ]

[Why]
In 2560x1440@240p eDP panel, some use cases will enable MPC
combine with RGB MPO then underflow happened. This case is
not allowed from HW formula. 

[How]
Correct eDP, DP and DP2 output bpp calculation to align HW
formula.

Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Paul Hsieh <Paul.Hsieh@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c
drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c

index b612edb144172130a86a0a93bba1421cf6750aa7..77094035a26af8b01ec77693bcf102b5e6679514 100644 (file)
@@ -4305,11 +4305,11 @@ void dml31_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
                                                        v->AudioSampleRate[k],
                                                        v->AudioSampleLayout[k],
                                                        v->ODMCombineEnablePerState[i][k]);
-                               } else if (v->Output[k] == dm_dp || v->Output[k] == dm_edp) {
+                               } else if (v->Output[k] == dm_dp || v->Output[k] == dm_edp || v->Output[k] == dm_dp2p0) {
                                        if (v->DSCEnable[k] == true) {
                                                v->RequiresDSC[i][k] = true;
                                                v->LinkDSCEnable = true;
-                                               if (v->Output[k] == dm_dp) {
+                                               if (v->Output[k] == dm_dp || v->Output[k] == dm_dp2p0) {
                                                        v->RequiresFEC[i][k] = true;
                                                } else {
                                                        v->RequiresFEC[i][k] = false;
@@ -4317,107 +4317,201 @@ void dml31_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
                                        } else {
                                                v->RequiresDSC[i][k] = false;
                                                v->LinkDSCEnable = false;
-                                               v->RequiresFEC[i][k] = false;
-                                       }
-
-                                       v->Outbpp = BPP_INVALID;
-                                       if (v->PHYCLKPerState[i] >= 270.0) {
-                                               v->Outbpp = TruncToValidBPP(
-                                                               (1.0 - v->Downspreading / 100.0) * 2700,
-                                                               v->OutputLinkDPLanes[k],
-                                                               v->HTotal[k],
-                                                               v->HActive[k],
-                                                               v->PixelClockBackEnd[k],
-                                                               v->ForcedOutputLinkBPP[k],
-                                                               v->LinkDSCEnable,
-                                                               v->Output[k],
-                                                               v->OutputFormat[k],
-                                                               v->DSCInputBitPerComponent[k],
-                                                               v->NumberOfDSCSlices[k],
-                                                               v->AudioSampleRate[k],
-                                                               v->AudioSampleLayout[k],
-                                                               v->ODMCombineEnablePerState[i][k]);
-                                               v->OutputBppPerState[i][k] = v->Outbpp;
-                                               // TODO: Need some other way to handle this nonsense
-                                               // v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR"
-                                       }
-                                       if (v->Outbpp == BPP_INVALID && v->PHYCLKPerState[i] >= 540.0) {
-                                               v->Outbpp = TruncToValidBPP(
-                                                               (1.0 - v->Downspreading / 100.0) * 5400,
-                                                               v->OutputLinkDPLanes[k],
-                                                               v->HTotal[k],
-                                                               v->HActive[k],
-                                                               v->PixelClockBackEnd[k],
-                                                               v->ForcedOutputLinkBPP[k],
-                                                               v->LinkDSCEnable,
-                                                               v->Output[k],
-                                                               v->OutputFormat[k],
-                                                               v->DSCInputBitPerComponent[k],
-                                                               v->NumberOfDSCSlices[k],
-                                                               v->AudioSampleRate[k],
-                                                               v->AudioSampleLayout[k],
-                                                               v->ODMCombineEnablePerState[i][k]);
-                                               v->OutputBppPerState[i][k] = v->Outbpp;
-                                               // TODO: Need some other way to handle this nonsense
-                                               // v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR2"
-                                       }
-                                       if (v->Outbpp == BPP_INVALID && v->PHYCLKPerState[i] >= 810.0) {
-                                               v->Outbpp = TruncToValidBPP(
-                                                               (1.0 - v->Downspreading / 100.0) * 8100,
-                                                               v->OutputLinkDPLanes[k],
-                                                               v->HTotal[k],
-                                                               v->HActive[k],
-                                                               v->PixelClockBackEnd[k],
-                                                               v->ForcedOutputLinkBPP[k],
-                                                               v->LinkDSCEnable,
-                                                               v->Output[k],
-                                                               v->OutputFormat[k],
-                                                               v->DSCInputBitPerComponent[k],
-                                                               v->NumberOfDSCSlices[k],
-                                                               v->AudioSampleRate[k],
-                                                               v->AudioSampleLayout[k],
-                                                               v->ODMCombineEnablePerState[i][k]);
-                                               v->OutputBppPerState[i][k] = v->Outbpp;
-                                               // TODO: Need some other way to handle this nonsense
-                                               // v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR3"
-                                       }
-                                       if (v->Outbpp == BPP_INVALID && v->PHYCLKD18PerState[i] >= 10000.0 / 18) {
-                                               v->Outbpp = TruncToValidBPP(
-                                                               (1.0 - v->Downspreading / 100.0) * 10000,
-                                                               4,
-                                                               v->HTotal[k],
-                                                               v->HActive[k],
-                                                               v->PixelClockBackEnd[k],
-                                                               v->ForcedOutputLinkBPP[k],
-                                                               v->LinkDSCEnable,
-                                                               v->Output[k],
-                                                               v->OutputFormat[k],
-                                                               v->DSCInputBitPerComponent[k],
-                                                               v->NumberOfDSCSlices[k],
-                                                               v->AudioSampleRate[k],
-                                                               v->AudioSampleLayout[k],
-                                                               v->ODMCombineEnablePerState[i][k]);
-                                               v->OutputBppPerState[i][k] = v->Outbpp;
-                                               //v->OutputTypeAndRatePerState[i][k] = v->Output[k] & "10x4";
+                                               if (v->Output[k] == dm_dp2p0) {
+                                                       v->RequiresFEC[i][k] = true;
+                                               } else {
+                                                       v->RequiresFEC[i][k] = false;
+                                               }
                                        }
-                                       if (v->Outbpp == BPP_INVALID && v->PHYCLKD18PerState[i] >= 12000.0 / 18) {
-                                               v->Outbpp = TruncToValidBPP(
-                                                               12000,
-                                                               4,
-                                                               v->HTotal[k],
-                                                               v->HActive[k],
-                                                               v->PixelClockBackEnd[k],
-                                                               v->ForcedOutputLinkBPP[k],
-                                                               v->LinkDSCEnable,
-                                                               v->Output[k],
-                                                               v->OutputFormat[k],
-                                                               v->DSCInputBitPerComponent[k],
-                                                               v->NumberOfDSCSlices[k],
-                                                               v->AudioSampleRate[k],
-                                                               v->AudioSampleLayout[k],
-                                                               v->ODMCombineEnablePerState[i][k]);
-                                               v->OutputBppPerState[i][k] = v->Outbpp;
-                                               //v->OutputTypeAndRatePerState[i][k] = v->Output[k] & "12x4";
+                                       if (v->Output[k] == dm_dp2p0) {
+                                               v->Outbpp = BPP_INVALID;
+                                               if ((v->OutputLinkDPRate[k] == dm_dp_rate_na || v->OutputLinkDPRate[k] == dm_dp_rate_uhbr10) &&
+                                                       v->PHYCLKD18PerState[k] >= 10000.0 / 18.0) {
+                                                       v->Outbpp = TruncToValidBPP(
+                                                                       (1.0 - v->Downspreading / 100.0) * 10000,
+                                                                       v->OutputLinkDPLanes[k],
+                                                                       v->HTotal[k],
+                                                                       v->HActive[k],
+                                                                       v->PixelClockBackEnd[k],
+                                                                       v->ForcedOutputLinkBPP[k],
+                                                                       v->LinkDSCEnable,
+                                                                       v->Output[k],
+                                                                       v->OutputFormat[k],
+                                                                       v->DSCInputBitPerComponent[k],
+                                                                       v->NumberOfDSCSlices[k],
+                                                                       v->AudioSampleRate[k],
+                                                                       v->AudioSampleLayout[k],
+                                                                       v->ODMCombineEnablePerState[i][k]);
+                                                       if (v->Outbpp == BPP_INVALID && v->PHYCLKD18PerState[k] < 13500.0 / 18.0 &&
+                                                               v->DSCEnable[k] == true && v->ForcedOutputLinkBPP[k] == 0) {
+                                                               v->RequiresDSC[i][k] = true;
+                                                               v->LinkDSCEnable = true;
+                                                               v->Outbpp = TruncToValidBPP(
+                                                                               (1.0 - v->Downspreading / 100.0) * 10000,
+                                                                               v->OutputLinkDPLanes[k],
+                                                                               v->HTotal[k],
+                                                                               v->HActive[k],
+                                                                               v->PixelClockBackEnd[k],
+                                                                               v->ForcedOutputLinkBPP[k],
+                                                                               v->LinkDSCEnable,
+                                                                               v->Output[k],
+                                                                               v->OutputFormat[k],
+                                                                               v->DSCInputBitPerComponent[k],
+                                                                               v->NumberOfDSCSlices[k],
+                                                                               v->AudioSampleRate[k],
+                                                                               v->AudioSampleLayout[k],
+                                                                               v->ODMCombineEnablePerState[i][k]);
+                                                       }
+                                                       v->OutputBppPerState[i][k] = v->Outbpp;
+                                                       // TODO: Need some other way to handle this nonsense
+                                                       // v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " UHBR10"
+                                               }
+                                               if (v->Outbpp == BPP_INVALID &&
+                                                       (v->OutputLinkDPRate[k] == dm_dp_rate_na || v->OutputLinkDPRate[k] == dm_dp_rate_uhbr13p5) &&
+                                                       v->PHYCLKD18PerState[k] >= 13500.0 / 18.0) {
+                                                       v->Outbpp = TruncToValidBPP(
+                                                                       (1.0 - v->Downspreading / 100.0) * 13500,
+                                                                       v->OutputLinkDPLanes[k],
+                                                                       v->HTotal[k],
+                                                                       v->HActive[k],
+                                                                       v->PixelClockBackEnd[k],
+                                                                       v->ForcedOutputLinkBPP[k],
+                                                                       v->LinkDSCEnable,
+                                                                       v->Output[k],
+                                                                       v->OutputFormat[k],
+                                                                       v->DSCInputBitPerComponent[k],
+                                                                       v->NumberOfDSCSlices[k],
+                                                                       v->AudioSampleRate[k],
+                                                                       v->AudioSampleLayout[k],
+                                                                       v->ODMCombineEnablePerState[i][k]);
+                                                       if (v->Outbpp == BPP_INVALID && v->PHYCLKD18PerState[k] < 20000.0 / 18.0 &&
+                                                               v->DSCEnable[k] == true && v->ForcedOutputLinkBPP[k] == 0) {
+                                                               v->RequiresDSC[i][k] = true;
+                                                               v->LinkDSCEnable = true;
+                                                               v->Outbpp = TruncToValidBPP(
+                                                                               (1.0 - v->Downspreading / 100.0) * 13500,
+                                                                               v->OutputLinkDPLanes[k],
+                                                                               v->HTotal[k],
+                                                                               v->HActive[k],
+                                                                               v->PixelClockBackEnd[k],
+                                                                               v->ForcedOutputLinkBPP[k],
+                                                                               v->LinkDSCEnable,
+                                                                               v->Output[k],
+                                                                               v->OutputFormat[k],
+                                                                               v->DSCInputBitPerComponent[k],
+                                                                               v->NumberOfDSCSlices[k],
+                                                                               v->AudioSampleRate[k],
+                                                                               v->AudioSampleLayout[k],
+                                                                               v->ODMCombineEnablePerState[i][k]);
+                                                       }
+                                                       v->OutputBppPerState[i][k] = v->Outbpp;
+                                                       // TODO: Need some other way to handle this nonsense
+                                                       // v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " UHBR13p5"
+                                               }
+                                               if (v->Outbpp == BPP_INVALID &&
+                                                       (v->OutputLinkDPRate[k] == dm_dp_rate_na || v->OutputLinkDPRate[k] == dm_dp_rate_uhbr20) &&
+                                                       v->PHYCLKD18PerState[k] >= 20000.0 / 18.0) {
+                                                       v->Outbpp = TruncToValidBPP(
+                                                                       (1.0 - v->Downspreading / 100.0) * 20000,
+                                                                       v->OutputLinkDPLanes[k],
+                                                                       v->HTotal[k],
+                                                                       v->HActive[k],
+                                                                       v->PixelClockBackEnd[k],
+                                                                       v->ForcedOutputLinkBPP[k],
+                                                                       v->LinkDSCEnable,
+                                                                       v->Output[k],
+                                                                       v->OutputFormat[k],
+                                                                       v->DSCInputBitPerComponent[k],
+                                                                       v->NumberOfDSCSlices[k],
+                                                                       v->AudioSampleRate[k],
+                                                                       v->AudioSampleLayout[k],
+                                                                       v->ODMCombineEnablePerState[i][k]);
+                                                       if (v->Outbpp == BPP_INVALID && v->DSCEnable[k] == true &&
+                                                               v->ForcedOutputLinkBPP[k] == 0) {
+                                                               v->RequiresDSC[i][k] = true;
+                                                               v->LinkDSCEnable = true;
+                                                               v->Outbpp = TruncToValidBPP(
+                                                                               (1.0 - v->Downspreading / 100.0) * 20000,
+                                                                               v->OutputLinkDPLanes[k],
+                                                                               v->HTotal[k],
+                                                                               v->HActive[k],
+                                                                               v->PixelClockBackEnd[k],
+                                                                               v->ForcedOutputLinkBPP[k],
+                                                                               v->LinkDSCEnable,
+                                                                               v->Output[k],
+                                                                               v->OutputFormat[k],
+                                                                               v->DSCInputBitPerComponent[k],
+                                                                               v->NumberOfDSCSlices[k],
+                                                                               v->AudioSampleRate[k],
+                                                                               v->AudioSampleLayout[k],
+                                                                               v->ODMCombineEnablePerState[i][k]);
+                                                       }
+                                                       v->OutputBppPerState[i][k] = v->Outbpp;
+                                                       // TODO: Need some other way to handle this nonsense
+                                                       // v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " UHBR20"
+                                               }
+                                       } else {
+                                               v->Outbpp = BPP_INVALID;
+                                               if (v->PHYCLKPerState[i] >= 270.0) {
+                                                       v->Outbpp = TruncToValidBPP(
+                                                                       (1.0 - v->Downspreading / 100.0) * 2700,
+                                                                       v->OutputLinkDPLanes[k],
+                                                                       v->HTotal[k],
+                                                                       v->HActive[k],
+                                                                       v->PixelClockBackEnd[k],
+                                                                       v->ForcedOutputLinkBPP[k],
+                                                                       v->LinkDSCEnable,
+                                                                       v->Output[k],
+                                                                       v->OutputFormat[k],
+                                                                       v->DSCInputBitPerComponent[k],
+                                                                       v->NumberOfDSCSlices[k],
+                                                                       v->AudioSampleRate[k],
+                                                                       v->AudioSampleLayout[k],
+                                                                       v->ODMCombineEnablePerState[i][k]);
+                                                       v->OutputBppPerState[i][k] = v->Outbpp;
+                                                       // TODO: Need some other way to handle this nonsense
+                                                       // v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR"
+                                               }
+                                               if (v->Outbpp == BPP_INVALID && v->PHYCLKPerState[i] >= 540.0) {
+                                                       v->Outbpp = TruncToValidBPP(
+                                                                       (1.0 - v->Downspreading / 100.0) * 5400,
+                                                                       v->OutputLinkDPLanes[k],
+                                                                       v->HTotal[k],
+                                                                       v->HActive[k],
+                                                                       v->PixelClockBackEnd[k],
+                                                                       v->ForcedOutputLinkBPP[k],
+                                                                       v->LinkDSCEnable,
+                                                                       v->Output[k],
+                                                                       v->OutputFormat[k],
+                                                                       v->DSCInputBitPerComponent[k],
+                                                                       v->NumberOfDSCSlices[k],
+                                                                       v->AudioSampleRate[k],
+                                                                       v->AudioSampleLayout[k],
+                                                                       v->ODMCombineEnablePerState[i][k]);
+                                                       v->OutputBppPerState[i][k] = v->Outbpp;
+                                                       // TODO: Need some other way to handle this nonsense
+                                                       // v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR2"
+                                               }
+                                               if (v->Outbpp == BPP_INVALID && v->PHYCLKPerState[i] >= 810.0) {
+                                                       v->Outbpp = TruncToValidBPP(
+                                                                       (1.0 - v->Downspreading / 100.0) * 8100,
+                                                                       v->OutputLinkDPLanes[k],
+                                                                       v->HTotal[k],
+                                                                       v->HActive[k],
+                                                                       v->PixelClockBackEnd[k],
+                                                                       v->ForcedOutputLinkBPP[k],
+                                                                       v->LinkDSCEnable,
+                                                                       v->Output[k],
+                                                                       v->OutputFormat[k],
+                                                                       v->DSCInputBitPerComponent[k],
+                                                                       v->NumberOfDSCSlices[k],
+                                                                       v->AudioSampleRate[k],
+                                                                       v->AudioSampleLayout[k],
+                                                                       v->ODMCombineEnablePerState[i][k]);
+                                                       v->OutputBppPerState[i][k] = v->Outbpp;
+                                                       // TODO: Need some other way to handle this nonsense
+                                                       // v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR3"
+                                               }
                                        }
                                }
                        } else {
index 3afd3c80e6da8ee6256b3e046d44177f5af87488..69516cfdbc64a57619dcdf064f2aec2060c20aa0 100644 (file)
@@ -4403,11 +4403,11 @@ void dml314_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
                                                        v->AudioSampleRate[k],
                                                        v->AudioSampleLayout[k],
                                                        v->ODMCombineEnablePerState[i][k]);
-                               } else if (v->Output[k] == dm_dp || v->Output[k] == dm_edp) {
+                               } else if (v->Output[k] == dm_dp || v->Output[k] == dm_edp || v->Output[k] == dm_dp2p0) {
                                        if (v->DSCEnable[k] == true) {
                                                v->RequiresDSC[i][k] = true;
                                                v->LinkDSCEnable = true;
-                                               if (v->Output[k] == dm_dp) {
+                                               if (v->Output[k] == dm_dp || v->Output[k] == dm_dp2p0) {
                                                        v->RequiresFEC[i][k] = true;
                                                } else {
                                                        v->RequiresFEC[i][k] = false;
@@ -4415,107 +4415,201 @@ void dml314_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
                                        } else {
                                                v->RequiresDSC[i][k] = false;
                                                v->LinkDSCEnable = false;
-                                               v->RequiresFEC[i][k] = false;
-                                       }
-
-                                       v->Outbpp = BPP_INVALID;
-                                       if (v->PHYCLKPerState[i] >= 270.0) {
-                                               v->Outbpp = TruncToValidBPP(
-                                                               (1.0 - v->Downspreading / 100.0) * 2700,
-                                                               v->OutputLinkDPLanes[k],
-                                                               v->HTotal[k],
-                                                               v->HActive[k],
-                                                               v->PixelClockBackEnd[k],
-                                                               v->ForcedOutputLinkBPP[k],
-                                                               v->LinkDSCEnable,
-                                                               v->Output[k],
-                                                               v->OutputFormat[k],
-                                                               v->DSCInputBitPerComponent[k],
-                                                               v->NumberOfDSCSlices[k],
-                                                               v->AudioSampleRate[k],
-                                                               v->AudioSampleLayout[k],
-                                                               v->ODMCombineEnablePerState[i][k]);
-                                               v->OutputBppPerState[i][k] = v->Outbpp;
-                                               // TODO: Need some other way to handle this nonsense
-                                               // v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR"
-                                       }
-                                       if (v->Outbpp == BPP_INVALID && v->PHYCLKPerState[i] >= 540.0) {
-                                               v->Outbpp = TruncToValidBPP(
-                                                               (1.0 - v->Downspreading / 100.0) * 5400,
-                                                               v->OutputLinkDPLanes[k],
-                                                               v->HTotal[k],
-                                                               v->HActive[k],
-                                                               v->PixelClockBackEnd[k],
-                                                               v->ForcedOutputLinkBPP[k],
-                                                               v->LinkDSCEnable,
-                                                               v->Output[k],
-                                                               v->OutputFormat[k],
-                                                               v->DSCInputBitPerComponent[k],
-                                                               v->NumberOfDSCSlices[k],
-                                                               v->AudioSampleRate[k],
-                                                               v->AudioSampleLayout[k],
-                                                               v->ODMCombineEnablePerState[i][k]);
-                                               v->OutputBppPerState[i][k] = v->Outbpp;
-                                               // TODO: Need some other way to handle this nonsense
-                                               // v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR2"
-                                       }
-                                       if (v->Outbpp == BPP_INVALID && v->PHYCLKPerState[i] >= 810.0) {
-                                               v->Outbpp = TruncToValidBPP(
-                                                               (1.0 - v->Downspreading / 100.0) * 8100,
-                                                               v->OutputLinkDPLanes[k],
-                                                               v->HTotal[k],
-                                                               v->HActive[k],
-                                                               v->PixelClockBackEnd[k],
-                                                               v->ForcedOutputLinkBPP[k],
-                                                               v->LinkDSCEnable,
-                                                               v->Output[k],
-                                                               v->OutputFormat[k],
-                                                               v->DSCInputBitPerComponent[k],
-                                                               v->NumberOfDSCSlices[k],
-                                                               v->AudioSampleRate[k],
-                                                               v->AudioSampleLayout[k],
-                                                               v->ODMCombineEnablePerState[i][k]);
-                                               v->OutputBppPerState[i][k] = v->Outbpp;
-                                               // TODO: Need some other way to handle this nonsense
-                                               // v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR3"
-                                       }
-                                       if (v->Outbpp == BPP_INVALID && v->PHYCLKD18PerState[i] >= 10000.0 / 18) {
-                                               v->Outbpp = TruncToValidBPP(
-                                                               (1.0 - v->Downspreading / 100.0) * 10000,
-                                                               4,
-                                                               v->HTotal[k],
-                                                               v->HActive[k],
-                                                               v->PixelClockBackEnd[k],
-                                                               v->ForcedOutputLinkBPP[k],
-                                                               v->LinkDSCEnable,
-                                                               v->Output[k],
-                                                               v->OutputFormat[k],
-                                                               v->DSCInputBitPerComponent[k],
-                                                               v->NumberOfDSCSlices[k],
-                                                               v->AudioSampleRate[k],
-                                                               v->AudioSampleLayout[k],
-                                                               v->ODMCombineEnablePerState[i][k]);
-                                               v->OutputBppPerState[i][k] = v->Outbpp;
-                                               //v->OutputTypeAndRatePerState[i][k] = v->Output[k] & "10x4";
+                                               if (v->Output[k] == dm_dp2p0) {
+                                                       v->RequiresFEC[i][k] = true;
+                                               } else {
+                                                       v->RequiresFEC[i][k] = false;
+                                               }
                                        }
-                                       if (v->Outbpp == BPP_INVALID && v->PHYCLKD18PerState[i] >= 12000.0 / 18) {
-                                               v->Outbpp = TruncToValidBPP(
-                                                               12000,
-                                                               4,
-                                                               v->HTotal[k],
-                                                               v->HActive[k],
-                                                               v->PixelClockBackEnd[k],
-                                                               v->ForcedOutputLinkBPP[k],
-                                                               v->LinkDSCEnable,
-                                                               v->Output[k],
-                                                               v->OutputFormat[k],
-                                                               v->DSCInputBitPerComponent[k],
-                                                               v->NumberOfDSCSlices[k],
-                                                               v->AudioSampleRate[k],
-                                                               v->AudioSampleLayout[k],
-                                                               v->ODMCombineEnablePerState[i][k]);
-                                               v->OutputBppPerState[i][k] = v->Outbpp;
-                                               //v->OutputTypeAndRatePerState[i][k] = v->Output[k] & "12x4";
+                                       if (v->Output[k] == dm_dp2p0) {
+                                               v->Outbpp = BPP_INVALID;
+                                               if ((v->OutputLinkDPRate[k] == dm_dp_rate_na || v->OutputLinkDPRate[k] == dm_dp_rate_uhbr10) &&
+                                                       v->PHYCLKD18PerState[k] >= 10000.0 / 18.0) {
+                                                       v->Outbpp = TruncToValidBPP(
+                                                                       (1.0 - v->Downspreading / 100.0) * 10000,
+                                                                       v->OutputLinkDPLanes[k],
+                                                                       v->HTotal[k],
+                                                                       v->HActive[k],
+                                                                       v->PixelClockBackEnd[k],
+                                                                       v->ForcedOutputLinkBPP[k],
+                                                                       v->LinkDSCEnable,
+                                                                       v->Output[k],
+                                                                       v->OutputFormat[k],
+                                                                       v->DSCInputBitPerComponent[k],
+                                                                       v->NumberOfDSCSlices[k],
+                                                                       v->AudioSampleRate[k],
+                                                                       v->AudioSampleLayout[k],
+                                                                       v->ODMCombineEnablePerState[i][k]);
+                                                       if (v->Outbpp == BPP_INVALID && v->PHYCLKD18PerState[k] < 13500.0 / 18.0 &&
+                                                               v->DSCEnable[k] == true && v->ForcedOutputLinkBPP[k] == 0) {
+                                                               v->RequiresDSC[i][k] = true;
+                                                               v->LinkDSCEnable = true;
+                                                               v->Outbpp = TruncToValidBPP(
+                                                                               (1.0 - v->Downspreading / 100.0) * 10000,
+                                                                               v->OutputLinkDPLanes[k],
+                                                                               v->HTotal[k],
+                                                                               v->HActive[k],
+                                                                               v->PixelClockBackEnd[k],
+                                                                               v->ForcedOutputLinkBPP[k],
+                                                                               v->LinkDSCEnable,
+                                                                               v->Output[k],
+                                                                               v->OutputFormat[k],
+                                                                               v->DSCInputBitPerComponent[k],
+                                                                               v->NumberOfDSCSlices[k],
+                                                                               v->AudioSampleRate[k],
+                                                                               v->AudioSampleLayout[k],
+                                                                               v->ODMCombineEnablePerState[i][k]);
+                                                       }
+                                                       v->OutputBppPerState[i][k] = v->Outbpp;
+                                                       // TODO: Need some other way to handle this nonsense
+                                                       // v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " UHBR10"
+                                               }
+                                               if (v->Outbpp == BPP_INVALID &&
+                                                       (v->OutputLinkDPRate[k] == dm_dp_rate_na || v->OutputLinkDPRate[k] == dm_dp_rate_uhbr13p5) &&
+                                                       v->PHYCLKD18PerState[k] >= 13500.0 / 18.0) {
+                                                       v->Outbpp = TruncToValidBPP(
+                                                                       (1.0 - v->Downspreading / 100.0) * 13500,
+                                                                       v->OutputLinkDPLanes[k],
+                                                                       v->HTotal[k],
+                                                                       v->HActive[k],
+                                                                       v->PixelClockBackEnd[k],
+                                                                       v->ForcedOutputLinkBPP[k],
+                                                                       v->LinkDSCEnable,
+                                                                       v->Output[k],
+                                                                       v->OutputFormat[k],
+                                                                       v->DSCInputBitPerComponent[k],
+                                                                       v->NumberOfDSCSlices[k],
+                                                                       v->AudioSampleRate[k],
+                                                                       v->AudioSampleLayout[k],
+                                                                       v->ODMCombineEnablePerState[i][k]);
+                                                       if (v->Outbpp == BPP_INVALID && v->PHYCLKD18PerState[k] < 20000.0 / 18.0 &&
+                                                               v->DSCEnable[k] == true && v->ForcedOutputLinkBPP[k] == 0) {
+                                                               v->RequiresDSC[i][k] = true;
+                                                               v->LinkDSCEnable = true;
+                                                               v->Outbpp = TruncToValidBPP(
+                                                                               (1.0 - v->Downspreading / 100.0) * 13500,
+                                                                               v->OutputLinkDPLanes[k],
+                                                                               v->HTotal[k],
+                                                                               v->HActive[k],
+                                                                               v->PixelClockBackEnd[k],
+                                                                               v->ForcedOutputLinkBPP[k],
+                                                                               v->LinkDSCEnable,
+                                                                               v->Output[k],
+                                                                               v->OutputFormat[k],
+                                                                               v->DSCInputBitPerComponent[k],
+                                                                               v->NumberOfDSCSlices[k],
+                                                                               v->AudioSampleRate[k],
+                                                                               v->AudioSampleLayout[k],
+                                                                               v->ODMCombineEnablePerState[i][k]);
+                                                       }
+                                                       v->OutputBppPerState[i][k] = v->Outbpp;
+                                                       // TODO: Need some other way to handle this nonsense
+                                                       // v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " UHBR13p5"
+                                               }
+                                               if (v->Outbpp == BPP_INVALID &&
+                                                       (v->OutputLinkDPRate[k] == dm_dp_rate_na || v->OutputLinkDPRate[k] == dm_dp_rate_uhbr20) &&
+                                                       v->PHYCLKD18PerState[k] >= 20000.0 / 18.0) {
+                                                       v->Outbpp = TruncToValidBPP(
+                                                                       (1.0 - v->Downspreading / 100.0) * 20000,
+                                                                       v->OutputLinkDPLanes[k],
+                                                                       v->HTotal[k],
+                                                                       v->HActive[k],
+                                                                       v->PixelClockBackEnd[k],
+                                                                       v->ForcedOutputLinkBPP[k],
+                                                                       v->LinkDSCEnable,
+                                                                       v->Output[k],
+                                                                       v->OutputFormat[k],
+                                                                       v->DSCInputBitPerComponent[k],
+                                                                       v->NumberOfDSCSlices[k],
+                                                                       v->AudioSampleRate[k],
+                                                                       v->AudioSampleLayout[k],
+                                                                       v->ODMCombineEnablePerState[i][k]);
+                                                       if (v->Outbpp == BPP_INVALID && v->DSCEnable[k] == true &&
+                                                               v->ForcedOutputLinkBPP[k] == 0) {
+                                                               v->RequiresDSC[i][k] = true;
+                                                               v->LinkDSCEnable = true;
+                                                               v->Outbpp = TruncToValidBPP(
+                                                                               (1.0 - v->Downspreading / 100.0) * 20000,
+                                                                               v->OutputLinkDPLanes[k],
+                                                                               v->HTotal[k],
+                                                                               v->HActive[k],
+                                                                               v->PixelClockBackEnd[k],
+                                                                               v->ForcedOutputLinkBPP[k],
+                                                                               v->LinkDSCEnable,
+                                                                               v->Output[k],
+                                                                               v->OutputFormat[k],
+                                                                               v->DSCInputBitPerComponent[k],
+                                                                               v->NumberOfDSCSlices[k],
+                                                                               v->AudioSampleRate[k],
+                                                                               v->AudioSampleLayout[k],
+                                                                               v->ODMCombineEnablePerState[i][k]);
+                                                       }
+                                                       v->OutputBppPerState[i][k] = v->Outbpp;
+                                                       // TODO: Need some other way to handle this nonsense
+                                                       // v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " UHBR20"
+                                               }
+                                       } else {
+                                               v->Outbpp = BPP_INVALID;
+                                               if (v->PHYCLKPerState[i] >= 270.0) {
+                                                       v->Outbpp = TruncToValidBPP(
+                                                                       (1.0 - v->Downspreading / 100.0) * 2700,
+                                                                       v->OutputLinkDPLanes[k],
+                                                                       v->HTotal[k],
+                                                                       v->HActive[k],
+                                                                       v->PixelClockBackEnd[k],
+                                                                       v->ForcedOutputLinkBPP[k],
+                                                                       v->LinkDSCEnable,
+                                                                       v->Output[k],
+                                                                       v->OutputFormat[k],
+                                                                       v->DSCInputBitPerComponent[k],
+                                                                       v->NumberOfDSCSlices[k],
+                                                                       v->AudioSampleRate[k],
+                                                                       v->AudioSampleLayout[k],
+                                                                       v->ODMCombineEnablePerState[i][k]);
+                                                       v->OutputBppPerState[i][k] = v->Outbpp;
+                                                       // TODO: Need some other way to handle this nonsense
+                                                       // v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR"
+                                               }
+                                               if (v->Outbpp == BPP_INVALID && v->PHYCLKPerState[i] >= 540.0) {
+                                                       v->Outbpp = TruncToValidBPP(
+                                                                       (1.0 - v->Downspreading / 100.0) * 5400,
+                                                                       v->OutputLinkDPLanes[k],
+                                                                       v->HTotal[k],
+                                                                       v->HActive[k],
+                                                                       v->PixelClockBackEnd[k],
+                                                                       v->ForcedOutputLinkBPP[k],
+                                                                       v->LinkDSCEnable,
+                                                                       v->Output[k],
+                                                                       v->OutputFormat[k],
+                                                                       v->DSCInputBitPerComponent[k],
+                                                                       v->NumberOfDSCSlices[k],
+                                                                       v->AudioSampleRate[k],
+                                                                       v->AudioSampleLayout[k],
+                                                                       v->ODMCombineEnablePerState[i][k]);
+                                                       v->OutputBppPerState[i][k] = v->Outbpp;
+                                                       // TODO: Need some other way to handle this nonsense
+                                                       // v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR2"
+                                               }
+                                               if (v->Outbpp == BPP_INVALID && v->PHYCLKPerState[i] >= 810.0) {
+                                                       v->Outbpp = TruncToValidBPP(
+                                                                       (1.0 - v->Downspreading / 100.0) * 8100,
+                                                                       v->OutputLinkDPLanes[k],
+                                                                       v->HTotal[k],
+                                                                       v->HActive[k],
+                                                                       v->PixelClockBackEnd[k],
+                                                                       v->ForcedOutputLinkBPP[k],
+                                                                       v->LinkDSCEnable,
+                                                                       v->Output[k],
+                                                                       v->OutputFormat[k],
+                                                                       v->DSCInputBitPerComponent[k],
+                                                                       v->NumberOfDSCSlices[k],
+                                                                       v->AudioSampleRate[k],
+                                                                       v->AudioSampleLayout[k],
+                                                                       v->ODMCombineEnablePerState[i][k]);
+                                                       v->OutputBppPerState[i][k] = v->Outbpp;
+                                                       // TODO: Need some other way to handle this nonsense
+                                                       // v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR3"
+                                               }
                                        }
                                }
                        } else {