Commit 26247e77 authored by Dmytro Laktyushkin's avatar Dmytro Laktyushkin Committed by Alex Deucher

drm/amd/display: fix mpo validation failure

There was an error in translation of mode support check.
"N/A" is a failure condition while "" was a special case.
This change will differentiate between the two by using a
define.
Signed-off-by: default avatarDmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Reviewed-by: default avatarTony Cheng <Tony.Cheng@amd.com>
Acked-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent e56dc89b
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include "dml_inline_defs.h" #include "dml_inline_defs.h"
#define BPP_INVALID 0
#define BPP_BLENDED_PIPE 0xffffffff
static const unsigned int NumberOfStates = DC__VOLTAGE_STATES; static const unsigned int NumberOfStates = DC__VOLTAGE_STATES;
static void fetch_socbb_params(struct display_mode_lib *mode_lib); static void fetch_socbb_params(struct display_mode_lib *mode_lib);
...@@ -3928,7 +3930,7 @@ static unsigned int TruncToValidBPP( ...@@ -3928,7 +3930,7 @@ static unsigned int TruncToValidBPP(
else if (DecimalBPP >= 12) else if (DecimalBPP >= 12)
return 12; return 12;
else else
return 0; return BPP_INVALID;
} else if (Format == dm_444) { } else if (Format == dm_444) {
if (DecimalBPP >= 36) if (DecimalBPP >= 36)
return 36; return 36;
...@@ -3937,7 +3939,7 @@ static unsigned int TruncToValidBPP( ...@@ -3937,7 +3939,7 @@ static unsigned int TruncToValidBPP(
else if (DecimalBPP >= 24) else if (DecimalBPP >= 24)
return 24; return 24;
else else
return 0; return BPP_INVALID;
} else { } else {
if (DecimalBPP / 1.5 >= 24) if (DecimalBPP / 1.5 >= 24)
return 24; return 24;
...@@ -3946,27 +3948,27 @@ static unsigned int TruncToValidBPP( ...@@ -3946,27 +3948,27 @@ static unsigned int TruncToValidBPP(
else if (DecimalBPP / 1.5 >= 16) else if (DecimalBPP / 1.5 >= 16)
return 16; return 16;
else else
return 0; return BPP_INVALID;
} }
} else { } else {
if (DSCEnabled) { if (DSCEnabled) {
if (Format == dm_420) { if (Format == dm_420) {
if (DecimalBPP < 6) if (DecimalBPP < 6)
return 0; return BPP_INVALID;
else if (DecimalBPP >= 1.5 * DSCInputBitPerComponent - 1 / 16) else if (DecimalBPP >= 1.5 * DSCInputBitPerComponent - 1 / 16)
return 1.5 * DSCInputBitPerComponent - 1 / 16; return 1.5 * DSCInputBitPerComponent - 1 / 16;
else else
return dml_floor(16 * DecimalBPP, 1) / 16; return dml_floor(16 * DecimalBPP, 1) / 16;
} else if (Format == dm_n422) { } else if (Format == dm_n422) {
if (DecimalBPP < 7) if (DecimalBPP < 7)
return 0; return BPP_INVALID;
else if (DecimalBPP >= 2 * DSCInputBitPerComponent - 1 / 16) else if (DecimalBPP >= 2 * DSCInputBitPerComponent - 1 / 16)
return 2 * DSCInputBitPerComponent - 1 / 16; return 2 * DSCInputBitPerComponent - 1 / 16;
else else
return dml_floor(16 * DecimalBPP, 1) / 16; return dml_floor(16 * DecimalBPP, 1) / 16;
} else { } else {
if (DecimalBPP < 8) if (DecimalBPP < 8)
return 0; return BPP_INVALID;
else if (DecimalBPP >= 3 * DSCInputBitPerComponent - 1 / 16) else if (DecimalBPP >= 3 * DSCInputBitPerComponent - 1 / 16)
return 3 * DSCInputBitPerComponent - 1 / 16; return 3 * DSCInputBitPerComponent - 1 / 16;
else else
...@@ -3980,7 +3982,7 @@ static unsigned int TruncToValidBPP( ...@@ -3980,7 +3982,7 @@ static unsigned int TruncToValidBPP(
else if (DecimalBPP >= 12) else if (DecimalBPP >= 12)
return 12; return 12;
else else
return 0; return BPP_INVALID;
} else if (Format == dm_s422 || Format == dm_n422) { } else if (Format == dm_s422 || Format == dm_n422) {
if (DecimalBPP >= 24) if (DecimalBPP >= 24)
return 24; return 24;
...@@ -3989,7 +3991,7 @@ static unsigned int TruncToValidBPP( ...@@ -3989,7 +3991,7 @@ static unsigned int TruncToValidBPP(
else if (DecimalBPP >= 16) else if (DecimalBPP >= 16)
return 16; return 16;
else else
return 0; return BPP_INVALID;
} else { } else {
if (DecimalBPP >= 36) if (DecimalBPP >= 36)
return 36; return 36;
...@@ -3998,7 +4000,7 @@ static unsigned int TruncToValidBPP( ...@@ -3998,7 +4000,7 @@ static unsigned int TruncToValidBPP(
else if (DecimalBPP >= 24) else if (DecimalBPP >= 24)
return 24; return 24;
else else
return 0; return BPP_INVALID;
} }
} }
} }
...@@ -4922,11 +4924,7 @@ static void ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_ ...@@ -4922,11 +4924,7 @@ static void ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
mode_lib->vba.ViewportSizeSupport[i] = true; mode_lib->vba.ViewportSizeSupport[i] = true;
for (k = 0; k <= mode_lib->vba.NumberOfActivePlanes - 1; k++) { for (k = 0; k <= mode_lib->vba.NumberOfActivePlanes - 1; k++) {
if (mode_lib->vba.ODMCombineEnablePerState[i][k] == true) { if (mode_lib->vba.ODMCombineEnablePerState[i][k] == true) {
if (dml_min( if (dml_min(mode_lib->vba.SwathWidthYSingleDPP[k], dml_round(mode_lib->vba.HActive[k] / 2.0 * mode_lib->vba.HRatio[k]))
mode_lib->vba.SwathWidthYSingleDPP[k],
dml_round(
mode_lib->vba.HActive[k] / 2.0
* mode_lib->vba.HRatio[k]))
> mode_lib->vba.MaximumSwathWidth[k]) { > mode_lib->vba.MaximumSwathWidth[k]) {
mode_lib->vba.ViewportSizeSupport[i] = false; mode_lib->vba.ViewportSizeSupport[i] = false;
} }
...@@ -4980,12 +4978,8 @@ static void ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_ ...@@ -4980,12 +4978,8 @@ static void ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
mode_lib->vba.RequiresDSC[i][k] = 0; mode_lib->vba.RequiresDSC[i][k] = 0;
mode_lib->vba.RequiresFEC[i][k] = 0; mode_lib->vba.RequiresFEC[i][k] = 0;
mode_lib->vba.OutputBppPerState[i][k] = mode_lib->vba.OutputBppPerState[i][k] =
TruncToValidBPP( TruncToValidBPP(dml_min(600.0, mode_lib->vba.PHYCLKPerState[i])
dml_min( / mode_lib->vba.PixelClockBackEnd[k] * 24,
600.0,
mode_lib->vba.PHYCLKPerState[i])
/ mode_lib->vba.PixelClockBackEnd[k]
* 24,
false, false,
mode_lib->vba.Output[k], mode_lib->vba.Output[k],
mode_lib->vba.OutputFormat[k], mode_lib->vba.OutputFormat[k],
...@@ -5000,30 +4994,16 @@ static void ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_ ...@@ -5000,30 +4994,16 @@ static void ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
} }
if (mode_lib->vba.PHYCLKPerState[i] >= 270.0) { if (mode_lib->vba.PHYCLKPerState[i] >= 270.0) {
mode_lib->vba.Outbpp = mode_lib->vba.Outbpp =
TruncToValidBPP( TruncToValidBPP((1.0 - mode_lib->vba.Downspreading / 100.0) * 270.0
(1.0 * mode_lib->vba.OutputLinkDPLanes[k] / mode_lib->vba.PixelClockBackEnd[k] * 8.0,
- mode_lib->vba.Downspreading
/ 100.0)
* 270.0
* mode_lib->vba.OutputLinkDPLanes[k]
/ mode_lib->vba.PixelClockBackEnd[k]
* 8.0,
false, false,
mode_lib->vba.Output[k], mode_lib->vba.Output[k],
mode_lib->vba.OutputFormat[k], mode_lib->vba.OutputFormat[k],
mode_lib->vba.DSCInputBitPerComponent[k]); mode_lib->vba.DSCInputBitPerComponent[k]);
mode_lib->vba.OutbppDSC = mode_lib->vba.OutbppDSC =
TruncToValidBPP( TruncToValidBPP((1.0 - mode_lib->vba.Downspreading / 100.0)
(1.0 * (1.0 - mode_lib->vba.EffectiveFECOverhead / 100.0) * 270.0
- mode_lib->vba.Downspreading * mode_lib->vba.OutputLinkDPLanes[k] / mode_lib->vba.PixelClockBackEnd[k] * 8.0,
/ 100.0)
* (1.0
- mode_lib->vba.EffectiveFECOverhead
/ 100.0)
* 270.0
* mode_lib->vba.OutputLinkDPLanes[k]
/ mode_lib->vba.PixelClockBackEnd[k]
* 8.0,
true, true,
mode_lib->vba.Output[k], mode_lib->vba.Output[k],
mode_lib->vba.OutputFormat[k], mode_lib->vba.OutputFormat[k],
...@@ -5046,32 +5026,18 @@ static void ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_ ...@@ -5046,32 +5026,18 @@ static void ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
mode_lib->vba.OutputBppPerState[i][k] = mode_lib->vba.OutputBppPerState[i][k] =
mode_lib->vba.Outbpp; mode_lib->vba.Outbpp;
} }
if (mode_lib->vba.Outbpp == 0) { if (mode_lib->vba.Outbpp == BPP_INVALID) {
mode_lib->vba.Outbpp = mode_lib->vba.Outbpp =
TruncToValidBPP( TruncToValidBPP((1.0 - mode_lib->vba.Downspreading / 100.0) * 540.0
(1.0 * mode_lib->vba.OutputLinkDPLanes[k] / mode_lib->vba.PixelClockBackEnd[k] * 8.0,
- mode_lib->vba.Downspreading
/ 100.0)
* 540.0
* mode_lib->vba.OutputLinkDPLanes[k]
/ mode_lib->vba.PixelClockBackEnd[k]
* 8.0,
false, false,
mode_lib->vba.Output[k], mode_lib->vba.Output[k],
mode_lib->vba.OutputFormat[k], mode_lib->vba.OutputFormat[k],
mode_lib->vba.DSCInputBitPerComponent[k]); mode_lib->vba.DSCInputBitPerComponent[k]);
mode_lib->vba.OutbppDSC = mode_lib->vba.OutbppDSC =
TruncToValidBPP( TruncToValidBPP((1.0 - mode_lib->vba.Downspreading / 100.0)
(1.0 * (1.0 - mode_lib->vba.EffectiveFECOverhead / 100.0) * 540.0
- mode_lib->vba.Downspreading * mode_lib->vba.OutputLinkDPLanes[k] / mode_lib->vba.PixelClockBackEnd[k] * 8.0,
/ 100.0)
* (1.0
- mode_lib->vba.EffectiveFECOverhead
/ 100.0)
* 540.0
* mode_lib->vba.OutputLinkDPLanes[k]
/ mode_lib->vba.PixelClockBackEnd[k]
* 8.0,
true, true,
mode_lib->vba.Output[k], mode_lib->vba.Output[k],
mode_lib->vba.OutputFormat[k], mode_lib->vba.OutputFormat[k],
...@@ -5094,40 +5060,26 @@ static void ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_ ...@@ -5094,40 +5060,26 @@ static void ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
mode_lib->vba.OutputBppPerState[i][k] = mode_lib->vba.OutputBppPerState[i][k] =
mode_lib->vba.Outbpp; mode_lib->vba.Outbpp;
} }
if (mode_lib->vba.Outbpp == 0 if (mode_lib->vba.Outbpp == BPP_INVALID
&& mode_lib->vba.PHYCLKPerState[i] && mode_lib->vba.PHYCLKPerState[i]
>= 810.0) { >= 810.0) {
mode_lib->vba.Outbpp = mode_lib->vba.Outbpp =
TruncToValidBPP( TruncToValidBPP((1.0 - mode_lib->vba.Downspreading / 100.0) * 810.0
(1.0 * mode_lib->vba.OutputLinkDPLanes[k] / mode_lib->vba.PixelClockBackEnd[k] * 8.0,
- mode_lib->vba.Downspreading
/ 100.0)
* 810.0
* mode_lib->vba.OutputLinkDPLanes[k]
/ mode_lib->vba.PixelClockBackEnd[k]
* 8.0,
false, false,
mode_lib->vba.Output[k], mode_lib->vba.Output[k],
mode_lib->vba.OutputFormat[k], mode_lib->vba.OutputFormat[k],
mode_lib->vba.DSCInputBitPerComponent[k]); mode_lib->vba.DSCInputBitPerComponent[k]);
mode_lib->vba.OutbppDSC = mode_lib->vba.OutbppDSC =
TruncToValidBPP( TruncToValidBPP((1.0 - mode_lib->vba.Downspreading / 100.0)
(1.0 * (1.0 - mode_lib->vba.EffectiveFECOverhead / 100.0) * 810.0
- mode_lib->vba.Downspreading * mode_lib->vba.OutputLinkDPLanes[k] / mode_lib->vba.PixelClockBackEnd[k] * 8.0,
/ 100.0)
* (1.0
- mode_lib->vba.EffectiveFECOverhead
/ 100.0)
* 810.0
* mode_lib->vba.OutputLinkDPLanes[k]
/ mode_lib->vba.PixelClockBackEnd[k]
* 8.0,
true, true,
mode_lib->vba.Output[k], mode_lib->vba.Output[k],
mode_lib->vba.OutputFormat[k], mode_lib->vba.OutputFormat[k],
mode_lib->vba.DSCInputBitPerComponent[k]); mode_lib->vba.DSCInputBitPerComponent[k]);
if (mode_lib->vba.DSCEnabled[k] == true if (mode_lib->vba.DSCEnabled[k] == true
|| mode_lib->vba.Outbpp == 0) { || mode_lib->vba.Outbpp == BPP_INVALID) {
mode_lib->vba.RequiresDSC[i][k] = true; mode_lib->vba.RequiresDSC[i][k] = true;
if (mode_lib->vba.Output[k] == dm_dp) { if (mode_lib->vba.Output[k] == dm_dp) {
mode_lib->vba.RequiresFEC[i][k] = mode_lib->vba.RequiresFEC[i][k] =
...@@ -5147,14 +5099,14 @@ static void ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_ ...@@ -5147,14 +5099,14 @@ static void ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
} }
} }
} else { } else {
mode_lib->vba.OutputBppPerState[i][k] = 0; mode_lib->vba.OutputBppPerState[i][k] = BPP_BLENDED_PIPE;
} }
} }
} }
for (i = 0; i <= DC__VOLTAGE_STATES; i++) { for (i = 0; i <= DC__VOLTAGE_STATES; i++) {
mode_lib->vba.DIOSupport[i] = true; mode_lib->vba.DIOSupport[i] = true;
for (k = 0; k <= mode_lib->vba.NumberOfActivePlanes - 1; k++) { for (k = 0; k <= mode_lib->vba.NumberOfActivePlanes - 1; k++) {
if (mode_lib->vba.OutputBppPerState[i][k] == 0 if (mode_lib->vba.OutputBppPerState[i][k] == BPP_INVALID
|| (mode_lib->vba.OutputFormat[k] == dm_420 || (mode_lib->vba.OutputFormat[k] == dm_420
&& mode_lib->vba.ProgressiveToInterlaceUnitInOPP && mode_lib->vba.ProgressiveToInterlaceUnitInOPP
== true)) { == true)) {
...@@ -5243,8 +5195,8 @@ static void ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_ ...@@ -5243,8 +5195,8 @@ static void ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
} else { } else {
mode_lib->vba.slices = 1.0; mode_lib->vba.slices = 1.0;
} }
if (mode_lib->vba.OutputBppPerState[i][k] == 0 if (mode_lib->vba.OutputBppPerState[i][k] == BPP_BLENDED_PIPE
|| mode_lib->vba.OutputBppPerState[i][k] == 0) { || mode_lib->vba.OutputBppPerState[i][k] == BPP_INVALID) {
mode_lib->vba.bpp = 0.0; mode_lib->vba.bpp = 0.0;
} else { } else {
mode_lib->vba.bpp = mode_lib->vba.OutputBppPerState[i][k]; mode_lib->vba.bpp = mode_lib->vba.OutputBppPerState[i][k];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment