drm/amd/display: Account for DCC Meta pitch in DML MALL surface calculations
authorDillon Varone <Dillon.Varone@amd.com>
Thu, 8 Dec 2022 18:46:47 +0000 (13:46 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 17 Jan 2023 20:37:46 +0000 (15:37 -0500)
DML incorrectly uses surface width for determining DCC meta size in MALL
allocation calculations.  Meta pitch should be used instead.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Alvin Lee <Alvin.Lee2@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Dillon Varone <Dillon.Varone@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/dcn32/display_mode_vba_util_32.c
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.h

index 4b8f5fa..8376500 100644 (file)
@@ -411,6 +411,8 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
                                v->BlockWidthC,
                                v->BlockHeightY,
                                v->BlockHeightC,
+                               mode_lib->vba.DCCMetaPitchY,
+                               mode_lib->vba.DCCMetaPitchC,
 
                                /* Output */
                                v->SurfaceSizeInMALL,
@@ -2650,6 +2652,8 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
                        mode_lib->vba.MacroTileWidthC,
                        mode_lib->vba.MacroTileHeightY,
                        mode_lib->vba.MacroTileHeightC,
+                       mode_lib->vba.DCCMetaPitchY,
+                       mode_lib->vba.DCCMetaPitchC,
 
                        /* Output */
                        mode_lib->vba.SurfaceSizeInMALL,
index b53feea..4279cd4 100644 (file)
@@ -1796,6 +1796,8 @@ void dml32_CalculateSurfaceSizeInMall(
                unsigned int ReadBlockWidthC[],
                unsigned int ReadBlockHeightY[],
                unsigned int ReadBlockHeightC[],
+               unsigned int DCCMetaPitchY[],
+               unsigned int DCCMetaPitchC[],
 
                /* Output */
                unsigned int    SurfaceSizeInMALL[],
@@ -1828,7 +1830,7 @@ void dml32_CalculateSurfaceSizeInMall(
                        }
                        if (DCCEnable[k] == true) {
                                SurfaceSizeInMALL[k] = SurfaceSizeInMALL[k] +
-                                               dml_min(dml_ceil(SurfaceWidthY[k], 8 * Read256BytesBlockWidthY[k]),
+                                               dml_min(dml_ceil(DCCMetaPitchY[k], 8 * Read256BytesBlockWidthY[k]),
                                                        dml_floor(ViewportXStartY[k] + ViewportWidthY[k] + 8 *
                                                        Read256BytesBlockWidthY[k] - 1, 8 * Read256BytesBlockWidthY[k])
                                                        - dml_floor(ViewportXStartY[k], 8 * Read256BytesBlockWidthY[k]))
@@ -1839,7 +1841,7 @@ void dml32_CalculateSurfaceSizeInMall(
                                                        * Read256BytesBlockHeightY[k])) * BytesPerPixelY[k] / 256;
                                if (Read256BytesBlockWidthC[k] > 0) {
                                        SurfaceSizeInMALL[k] = SurfaceSizeInMALL[k] +
-                                                       dml_min(dml_ceil(SurfaceWidthC[k], 8 *
+                                                       dml_min(dml_ceil(DCCMetaPitchC[k], 8 *
                                                                Read256BytesBlockWidthC[k]),
                                                                dml_floor(ViewportXStartC[k] + ViewportWidthC[k] + 8
                                                                * Read256BytesBlockWidthC[k] - 1, 8 *
@@ -1872,7 +1874,7 @@ void dml32_CalculateSurfaceSizeInMall(
                        }
                        if (DCCEnable[k] == true) {
                                SurfaceSizeInMALL[k] = SurfaceSizeInMALL[k] +
-                                               dml_ceil(dml_min(SurfaceWidthY[k], ViewportWidthY[k] + 8 *
+                                               dml_ceil(dml_min(DCCMetaPitchY[k], ViewportWidthY[k] + 8 *
                                                                Read256BytesBlockWidthY[k] - 1), 8 *
                                                                Read256BytesBlockWidthY[k]) *
                                                dml_ceil(dml_min(SurfaceHeightY[k], ViewportHeightY[k] + 8 *
@@ -1881,7 +1883,7 @@ void dml32_CalculateSurfaceSizeInMall(
 
                                if (Read256BytesBlockWidthC[k] > 0) {
                                        SurfaceSizeInMALL[k] = SurfaceSizeInMALL[k] +
-                                                       dml_ceil(dml_min(SurfaceWidthC[k], ViewportWidthC[k] + 8 *
+                                                       dml_ceil(dml_min(DCCMetaPitchC[k], ViewportWidthC[k] + 8 *
                                                                        Read256BytesBlockWidthC[k] - 1), 8 *
                                                                        Read256BytesBlockWidthC[k]) *
                                                        dml_ceil(dml_min(SurfaceHeightC[k], ViewportHeightC[k] + 8 *
index 779c680..83edfce 100644 (file)
@@ -358,6 +358,8 @@ void dml32_CalculateSurfaceSizeInMall(
                unsigned int ReadBlockWidthC[],
                unsigned int ReadBlockHeightY[],
                unsigned int ReadBlockHeightC[],
+               unsigned int DCCMetaPitchY[],
+               unsigned int DCCMetaPitchC[],
 
                /* Output */
                unsigned int    SurfaceSizeInMALL[],