drm/amd/display: Add extra mblk for DCC
authorSaaem Rizvi <SyedSaaem.Rizvi@amd.com>
Thu, 15 Dec 2022 15:38:16 +0000 (10:38 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 17 Jan 2023 20:40:04 +0000 (15:40 -0500)
[Why]
DCC meta was found to be detached from usable pixel data. Due to this
DCC meta and the end of the fetched part of the frame will be on not
be on the same mblk. Furthermore if the meta is not aligned to the mblk
size, then we require an extra mblk in MALL to account for this.

[How]
Always add an additional mblk when DCC is enabled for detachment and
misalignment.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Dillon Varone <Dillon.Varone@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Saaem Rizvi <SyedSaaem.Rizvi@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c

index a089be9..0932f49 100644 (file)
@@ -1833,15 +1833,15 @@ void dml32_CalculateSurfaceSizeInMall(
                        }
                        if (DCCEnable[k] == true) {
                                SurfaceSizeInMALL[k] = SurfaceSizeInMALL[k] +
-                                               dml_min(dml_ceil(DCCMetaPitchY[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]))
                                                        * dml_min(dml_ceil(SurfaceHeightY[k], 8 *
                                                        Read256BytesBlockHeightY[k]), dml_floor(ViewportYStartY[k] +
                                                        ViewportHeightY[k] + 8 * Read256BytesBlockHeightY[k] - 1, 8 *
-                                                       Read256BytesBlockHeightY[k]) - dml_floor(ViewportYStartY[k], 8
-                                                       * Read256BytesBlockHeightY[k])) * BytesPerPixelY[k] / 256;
+                                                       Read256BytesBlockHeightY[k]) - dml_floor(ViewportYStartY[k], 8 *
+                                                       Read256BytesBlockHeightY[k])) * BytesPerPixelY[k] / 256) + (64 * 1024);
                                if (Read256BytesBlockWidthC[k] > 0) {
                                        SurfaceSizeInMALL[k] = SurfaceSizeInMALL[k] +
                                                        dml_min(dml_ceil(DCCMetaPitchC[k], 8 *
@@ -1877,12 +1877,12 @@ void dml32_CalculateSurfaceSizeInMall(
                        }
                        if (DCCEnable[k] == true) {
                                SurfaceSizeInMALL[k] = SurfaceSizeInMALL[k] +
-                                               dml_ceil(dml_min(DCCMetaPitchY[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 *
                                                                Read256BytesBlockHeightY[k] - 1), 8 *
-                                                               Read256BytesBlockHeightY[k]) * BytesPerPixelY[k] / 256;
+                                                               Read256BytesBlockHeightY[k]) * BytesPerPixelY[k] / 256) + (64 * 1024);
 
                                if (Read256BytesBlockWidthC[k] > 0) {
                                        SurfaceSizeInMALL[k] = SurfaceSizeInMALL[k] +