Skip to content

Commit 7e40f64

Browse files
superm1alexdeucher
authored andcommitted
drm/amd/display: Avoid divide by zero by initializing dummy pitch to 1
[Why] If the dummy values in `populate_dummy_dml_surface_cfg()` aren't updated then they can lead to a divide by zero in downstream callers like CalculateVMAndRowBytes() [How] Initialize dummy value to a value to avoid divide by zero. Reviewed-by: Alex Hung <[email protected]> Signed-off-by: Mario Limonciello <[email protected]> Signed-off-by: Zaeem Mohamed <[email protected]> Tested-by: Mark Broadworth <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 724a4b4 commit 7e40f64

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,7 @@ static void populate_dummy_dml_surface_cfg(struct dml_surface_cfg_st *out, unsig
896896
out->SurfaceWidthC[location] = in->timing.h_addressable;
897897
out->SurfaceHeightC[location] = in->timing.v_addressable;
898898
out->PitchY[location] = ((out->SurfaceWidthY[location] + 127) / 128) * 128;
899-
out->PitchC[location] = 0;
899+
out->PitchC[location] = 1;
900900
out->DCCEnable[location] = false;
901901
out->DCCMetaPitchY[location] = 0;
902902
out->DCCMetaPitchC[location] = 0;

0 commit comments

Comments
 (0)