drm/amd/display: Fix divide by zero in DML
authorAric Cyr <aric.cyr@amd.com>
Wed, 24 Aug 2022 20:34:53 +0000 (16:34 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 13 Sep 2022 18:26:59 +0000 (14:26 -0400)
[why]
Incorrectly using MicroTileWidth instead of MacroTileWidth for
calculations.

[how]
Remove all unused references to MicroTile and change them to MacroTile.

Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Reviewed-by: Alvin Lee <Alvin.Lee2@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Pavle Kotarac <Pavle.Kotarac@amd.com>
Signed-off-by: Aric Cyr <aric.cyr@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c
drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.h

index cb20257..db8a019 100644 (file)
@@ -1806,10 +1806,10 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
                                &mode_lib->vba.Read256BlockHeightC[k],
                                &mode_lib->vba.Read256BlockWidthY[k],
                                &mode_lib->vba.Read256BlockWidthC[k],
-                               &mode_lib->vba.MicroTileHeightY[k],
-                               &mode_lib->vba.MicroTileHeightC[k],
-                               &mode_lib->vba.MicroTileWidthY[k],
-                               &mode_lib->vba.MicroTileWidthC[k]);
+                               &mode_lib->vba.MacroTileHeightY[k],
+                               &mode_lib->vba.MacroTileHeightC[k],
+                               &mode_lib->vba.MacroTileWidthY[k],
+                               &mode_lib->vba.MacroTileWidthC[k]);
        }
 
        /*Bandwidth Support Check*/
@@ -2659,10 +2659,10 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
                        mode_lib->vba.Read256BlockWidthC,
                        mode_lib->vba.Read256BlockHeightY,
                        mode_lib->vba.Read256BlockHeightC,
-                       mode_lib->vba.MicroTileWidthY,
-                       mode_lib->vba.MicroTileWidthC,
-                       mode_lib->vba.MicroTileHeightY,
-                       mode_lib->vba.MicroTileHeightC,
+                       mode_lib->vba.MacroTileWidthY,
+                       mode_lib->vba.MacroTileWidthC,
+                       mode_lib->vba.MacroTileHeightY,
+                       mode_lib->vba.MacroTileHeightC,
 
                        /* Output */
                        mode_lib->vba.SurfaceSizeInMALL,
@@ -2709,10 +2709,10 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
                                v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockHeight256BytesY = mode_lib->vba.Read256BlockHeightY[k];
                                v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockWidth256BytesC = mode_lib->vba.Read256BlockWidthC[k];
                                v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockHeight256BytesC = mode_lib->vba.Read256BlockHeightC[k];
-                               v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockWidthY = mode_lib->vba.MicroTileWidthY[k];
-                               v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockHeightY = mode_lib->vba.MicroTileHeightY[k];
-                               v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockWidthC = mode_lib->vba.MicroTileWidthC[k];
-                               v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockHeightC = mode_lib->vba.MicroTileHeightC[k];
+                               v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockWidthY = mode_lib->vba.MacroTileWidthY[k];
+                               v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockHeightY = mode_lib->vba.MacroTileHeightY[k];
+                               v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockWidthC = mode_lib->vba.MacroTileWidthC[k];
+                               v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockHeightC = mode_lib->vba.MacroTileHeightC[k];
                                v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].InterlaceEnable = mode_lib->vba.Interlace[k];
                                v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].HTotal = mode_lib->vba.HTotal[k];
                                v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].DCCEnable = mode_lib->vba.DCCEnable[k];
index 492aec6..2051dda 100644 (file)
@@ -651,10 +651,10 @@ struct vba_vars_st {
 
        unsigned int OutputTypeAndRatePerState[DC__VOLTAGE_STATES][DC__NUM_DPP__MAX];
        double RequiredDISPCLKPerSurface[DC__VOLTAGE_STATES][2][DC__NUM_DPP__MAX];
-       unsigned int MicroTileHeightY[DC__NUM_DPP__MAX];
-       unsigned int MicroTileHeightC[DC__NUM_DPP__MAX];
-       unsigned int MicroTileWidthY[DC__NUM_DPP__MAX];
-       unsigned int MicroTileWidthC[DC__NUM_DPP__MAX];
+       unsigned int MacroTileHeightY[DC__NUM_DPP__MAX];
+       unsigned int MacroTileHeightC[DC__NUM_DPP__MAX];
+       unsigned int MacroTileWidthY[DC__NUM_DPP__MAX];
+       unsigned int MacroTileWidthC[DC__NUM_DPP__MAX];
        bool ImmediateFlipRequiredFinal;
        bool DCCProgrammingAssumesScanDirectionUnknownFinal;
        bool EnoughWritebackUnits;
@@ -800,8 +800,6 @@ struct vba_vars_st {
        double PSCL_FACTOR[DC__NUM_DPP__MAX];
        double PSCL_FACTOR_CHROMA[DC__NUM_DPP__MAX];
        double MaximumVStartup[DC__VOLTAGE_STATES][2][DC__NUM_DPP__MAX];
-       unsigned int MacroTileWidthY[DC__NUM_DPP__MAX];
-       unsigned int MacroTileWidthC[DC__NUM_DPP__MAX];
        double AlignedDCCMetaPitch[DC__NUM_DPP__MAX];
        double AlignedYPitch[DC__NUM_DPP__MAX];
        double AlignedCPitch[DC__NUM_DPP__MAX];