Commit 95c454ca authored by Dillon Varone's avatar Dillon Varone Committed by Alex Deucher
Browse files

drm/amd/display: Account for DCC Meta pitch in DML MALL surface calculations



DML incorrectly uses surface width for determining DCC meta size in MALL
allocation calculations.  Meta pitch should be used instead.

Tested-by: default avatarDaniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: default avatarAlvin Lee <Alvin.Lee2@amd.com>
Acked-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: default avatarDillon Varone <Dillon.Varone@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 59b7e458
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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,
+6 −4
Original line number Diff line number Diff line
@@ -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 *
+2 −0
Original line number Diff line number Diff line
@@ -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[],