]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/amd/display: fix mpo validation failure
authorDmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Mon, 6 Nov 2017 18:50:06 +0000 (13:50 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 6 Dec 2017 17:48:10 +0000 (12:48 -0500)
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: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.c

index ea661ee446741c174b8fe286fd74eaf71f9afc4c..a02c69d10399a6f1daf02551cdce4a1b6d5aa20d 100644 (file)
@@ -28,6 +28,8 @@
 
 #include "dml_inline_defs.h"
 
+#define BPP_INVALID 0
+#define BPP_BLENDED_PIPE 0xffffffff
 static const unsigned int NumberOfStates = DC__VOLTAGE_STATES;
 
 static void fetch_socbb_params(struct display_mode_lib *mode_lib);
@@ -3928,7 +3930,7 @@ static unsigned int TruncToValidBPP(
                        else if (DecimalBPP >= 12)
                                return 12;
                        else
-                               return 0;
+                               return BPP_INVALID;
                } else if (Format == dm_444) {
                        if (DecimalBPP >= 36)
                                return 36;
@@ -3937,7 +3939,7 @@ static unsigned int TruncToValidBPP(
                        else if (DecimalBPP >= 24)
                                return 24;
                        else
-                               return 0;
+                               return BPP_INVALID;
                } else {
                        if (DecimalBPP / 1.5 >= 24)
                                return 24;
@@ -3946,27 +3948,27 @@ static unsigned int TruncToValidBPP(
                        else if (DecimalBPP / 1.5 >= 16)
                                return 16;
                        else
-                               return 0;
+                               return BPP_INVALID;
                }
        } else {
                if (DSCEnabled) {
                        if (Format == dm_420) {
                                if (DecimalBPP < 6)
-                                       return 0;
+                                       return BPP_INVALID;
                                else if (DecimalBPP >= 1.5 * DSCInputBitPerComponent - 1 / 16)
                                        return 1.5 * DSCInputBitPerComponent - 1 / 16;
                                else
                                        return dml_floor(16 * DecimalBPP, 1) / 16;
                        } else if (Format == dm_n422) {
                                if (DecimalBPP < 7)
-                                       return 0;
+                                       return BPP_INVALID;
                                else if (DecimalBPP >= 2 * DSCInputBitPerComponent - 1 / 16)
                                        return 2 * DSCInputBitPerComponent - 1 / 16;
                                else
                                        return dml_floor(16 * DecimalBPP, 1) / 16;
                        } else {
                                if (DecimalBPP < 8)
-                                       return 0;
+                                       return BPP_INVALID;
                                else if (DecimalBPP >= 3 * DSCInputBitPerComponent - 1 / 16)
                                        return 3 * DSCInputBitPerComponent - 1 / 16;
                                else
@@ -3980,7 +3982,7 @@ static unsigned int TruncToValidBPP(
                        else if (DecimalBPP >= 12)
                                return 12;
                        else
-                               return 0;
+                               return BPP_INVALID;
                } else if (Format == dm_s422 || Format == dm_n422) {
                        if (DecimalBPP >= 24)
                                return 24;
@@ -3989,7 +3991,7 @@ static unsigned int TruncToValidBPP(
                        else if (DecimalBPP >= 16)
                                return 16;
                        else
-                               return 0;
+                               return BPP_INVALID;
                } else {
                        if (DecimalBPP >= 36)
                                return 36;
@@ -3998,7 +4000,7 @@ static unsigned int TruncToValidBPP(
                        else if (DecimalBPP >= 24)
                                return 24;
                        else
-                               return 0;
+                               return BPP_INVALID;
                }
        }
 }
@@ -4922,11 +4924,7 @@ static void ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
                mode_lib->vba.ViewportSizeSupport[i] = true;
                for (k = 0; k <= mode_lib->vba.NumberOfActivePlanes - 1; k++) {
                        if (mode_lib->vba.ODMCombineEnablePerState[i][k] == true) {
-                               if (dml_min(
-                                               mode_lib->vba.SwathWidthYSingleDPP[k],
-                                               dml_round(
-                                                               mode_lib->vba.HActive[k] / 2.0
-                                                                               * mode_lib->vba.HRatio[k]))
+                               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.MaximumSwathWidth[k]) {
                                        mode_lib->vba.ViewportSizeSupport[i] = false;
                                }
@@ -4980,12 +4978,8 @@ static void ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
                                        mode_lib->vba.RequiresDSC[i][k] = 0;
                                        mode_lib->vba.RequiresFEC[i][k] = 0;
                                        mode_lib->vba.OutputBppPerState[i][k] =
-                                                       TruncToValidBPP(
-                                                                       dml_min(
-                                                                                       600.0,
-                                                                                       mode_lib->vba.PHYCLKPerState[i])
-                                                                                       / mode_lib->vba.PixelClockBackEnd[k]
-                                                                                       * 24,
+                                                       TruncToValidBPP(dml_min(600.0, mode_lib->vba.PHYCLKPerState[i])
+                                                                               / mode_lib->vba.PixelClockBackEnd[k] * 24,
                                                                        false,
                                                                        mode_lib->vba.Output[k],
                                                                        mode_lib->vba.OutputFormat[k],
@@ -5000,30 +4994,16 @@ static void ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
                                        }
                                        if (mode_lib->vba.PHYCLKPerState[i] >= 270.0) {
                                                mode_lib->vba.Outbpp =
-                                                               TruncToValidBPP(
-                                                                               (1.0
-                                                                                               - mode_lib->vba.Downspreading
-                                                                                                               / 100.0)
-                                                                                               * 270.0
-                                                                                               * mode_lib->vba.OutputLinkDPLanes[k]
-                                                                                               / mode_lib->vba.PixelClockBackEnd[k]
-                                                                                               * 8.0,
+                                                               TruncToValidBPP((1.0 - mode_lib->vba.Downspreading / 100.0) * 270.0
+                                                                                       * mode_lib->vba.OutputLinkDPLanes[k] / mode_lib->vba.PixelClockBackEnd[k] * 8.0,
                                                                                false,
                                                                                mode_lib->vba.Output[k],
                                                                                mode_lib->vba.OutputFormat[k],
                                                                                mode_lib->vba.DSCInputBitPerComponent[k]);
                                                mode_lib->vba.OutbppDSC =
-                                                               TruncToValidBPP(
-                                                                               (1.0
-                                                                                               - mode_lib->vba.Downspreading
-                                                                                                               / 100.0)
-                                                                                               * (1.0
-                                                                                                               - mode_lib->vba.EffectiveFECOverhead
-                                                                                                                               / 100.0)
-                                                                                               * 270.0
-                                                                                               * mode_lib->vba.OutputLinkDPLanes[k]
-                                                                                               / mode_lib->vba.PixelClockBackEnd[k]
-                                                                                               * 8.0,
+                                                               TruncToValidBPP((1.0 - mode_lib->vba.Downspreading / 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,
                                                                                mode_lib->vba.Output[k],
                                                                                mode_lib->vba.OutputFormat[k],
@@ -5046,32 +5026,18 @@ static void ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
                                                mode_lib->vba.OutputBppPerState[i][k] =
                                                                mode_lib->vba.Outbpp;
                                        }
-                                       if (mode_lib->vba.Outbpp == 0) {
+                                       if (mode_lib->vba.Outbpp == BPP_INVALID) {
                                                mode_lib->vba.Outbpp =
-                                                               TruncToValidBPP(
-                                                                               (1.0
-                                                                                               - mode_lib->vba.Downspreading
-                                                                                                               / 100.0)
-                                                                                               * 540.0
-                                                                                               * mode_lib->vba.OutputLinkDPLanes[k]
-                                                                                               / mode_lib->vba.PixelClockBackEnd[k]
-                                                                                               * 8.0,
+                                                               TruncToValidBPP((1.0 - mode_lib->vba.Downspreading / 100.0) * 540.0
+                                                                                       * mode_lib->vba.OutputLinkDPLanes[k] / mode_lib->vba.PixelClockBackEnd[k] * 8.0,
                                                                                false,
                                                                                mode_lib->vba.Output[k],
                                                                                mode_lib->vba.OutputFormat[k],
                                                                                mode_lib->vba.DSCInputBitPerComponent[k]);
                                                mode_lib->vba.OutbppDSC =
-                                                               TruncToValidBPP(
-                                                                               (1.0
-                                                                                               - mode_lib->vba.Downspreading
-                                                                                                               / 100.0)
-                                                                                               * (1.0
-                                                                                                               - mode_lib->vba.EffectiveFECOverhead
-                                                                                                                               / 100.0)
-                                                                                               * 540.0
-                                                                                               * mode_lib->vba.OutputLinkDPLanes[k]
-                                                                                               / mode_lib->vba.PixelClockBackEnd[k]
-                                                                                               * 8.0,
+                                                               TruncToValidBPP((1.0 - mode_lib->vba.Downspreading / 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,
                                                                                mode_lib->vba.Output[k],
                                                                                mode_lib->vba.OutputFormat[k],
@@ -5094,40 +5060,26 @@ static void ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
                                                mode_lib->vba.OutputBppPerState[i][k] =
                                                                mode_lib->vba.Outbpp;
                                        }
-                                       if (mode_lib->vba.Outbpp == 0
+                                       if (mode_lib->vba.Outbpp == BPP_INVALID
                                                        && mode_lib->vba.PHYCLKPerState[i]
                                                                        >= 810.0) {
                                                mode_lib->vba.Outbpp =
-                                                               TruncToValidBPP(
-                                                                               (1.0
-                                                                                               - mode_lib->vba.Downspreading
-                                                                                                               / 100.0)
-                                                                                               * 810.0
-                                                                                               * mode_lib->vba.OutputLinkDPLanes[k]
-                                                                                               / mode_lib->vba.PixelClockBackEnd[k]
-                                                                                               * 8.0,
+                                                               TruncToValidBPP((1.0 - mode_lib->vba.Downspreading / 100.0) * 810.0
+                                                                                       * mode_lib->vba.OutputLinkDPLanes[k] / mode_lib->vba.PixelClockBackEnd[k] * 8.0,
                                                                                false,
                                                                                mode_lib->vba.Output[k],
                                                                                mode_lib->vba.OutputFormat[k],
                                                                                mode_lib->vba.DSCInputBitPerComponent[k]);
                                                mode_lib->vba.OutbppDSC =
-                                                               TruncToValidBPP(
-                                                                               (1.0
-                                                                                               - mode_lib->vba.Downspreading
-                                                                                                               / 100.0)
-                                                                                               * (1.0
-                                                                                                               - mode_lib->vba.EffectiveFECOverhead
-                                                                                                                               / 100.0)
-                                                                                               * 810.0
-                                                                                               * mode_lib->vba.OutputLinkDPLanes[k]
-                                                                                               / mode_lib->vba.PixelClockBackEnd[k]
-                                                                                               * 8.0,
+                                                               TruncToValidBPP((1.0 - mode_lib->vba.Downspreading / 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,
                                                                                mode_lib->vba.Output[k],
                                                                                mode_lib->vba.OutputFormat[k],
                                                                                mode_lib->vba.DSCInputBitPerComponent[k]);
                                                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;
                                                        if (mode_lib->vba.Output[k] == dm_dp) {
                                                                mode_lib->vba.RequiresFEC[i][k] =
@@ -5147,14 +5099,14 @@ static void ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
                                        }
                                }
                        } 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++) {
                mode_lib->vba.DIOSupport[i] = true;
                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.ProgressiveToInterlaceUnitInOPP
                                                                        == true)) {
@@ -5243,8 +5195,8 @@ static void ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
                        } else {
                                mode_lib->vba.slices = 1.0;
                        }
-                       if (mode_lib->vba.OutputBppPerState[i][k] == 0
-                                       || mode_lib->vba.OutputBppPerState[i][k] == 0) {
+                       if (mode_lib->vba.OutputBppPerState[i][k] == BPP_BLENDED_PIPE
+                                       || mode_lib->vba.OutputBppPerState[i][k] == BPP_INVALID) {
                                mode_lib->vba.bpp = 0.0;
                        } else {
                                mode_lib->vba.bpp = mode_lib->vba.OutputBppPerState[i][k];