⬢ DragonFlyBSD Kernel Audit
DF-1301 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/drm/amd/display/dc/core/dc_resource.c b/sys/dev/drm/amd/display/dc/core/dc_resource.c
--- a/sys/dev/drm/amd/display/dc/core/dc_resource.c
+++ b/sys/dev/drm/amd/display/dc/core/dc_resource.c
@@ -632,10 +632,10 @@
 	if (stream->src.x < surf_clip.x)
 		pipe_ctx->plane_res.scl_data.recout.x += (surf_clip.x
 			- stream->src.x) * stream->dst.width
-						/ stream->src.width;
+						/ (stream->src.width ? stream->src.width : 1);
 
 	pipe_ctx->plane_res.scl_data.recout.width = surf_clip.width *
-			stream->dst.width / stream->src.width;
+			stream->dst.width / (stream->src.width ? stream->src.width : 1);
 	if (pipe_ctx->plane_res.scl_data.recout.width + pipe_ctx->plane_res.scl_data.recout.x >
 			stream->dst.x + stream->dst.width)
 		pipe_ctx->plane_res.scl_data.recout.width =
@@ -693,14 +693,14 @@
 	recout_full->x = stream->dst.x + (plane_state->dst_rect.x - stream->src.x)
 					* stream->dst.width / stream->src.width -
 			surf_src.x * plane_state->dst_rect.width / surf_src.width
-					* stream->dst.width / stream->src.width;
+					* stream->dst.width / (stream->src.width ? stream->src.width : 1);
 	recout_full->y = stream->dst.y + (plane_state->dst_rect.y - stream->src.y)
 					* stream->dst.height / stream->src.height -
 			surf_src.y * plane_state->dst_rect.height / surf_src.height
 					* stream->dst.height / stream->src.height;
 
 	recout_full->width = plane_state->dst_rect.width
-					* stream->dst.width / stream->src.width;
+					* stream->dst.width / (stream->src.width ? stream->src.width : 1);
 	recout_full->height = plane_state->dst_rect.height
 					* stream->dst.height / stream->src.height;
 }