⬢ DragonFlyBSD Kernel Audit
DF-3943 / 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
index 79f47496..22819f9b 100644
--- a/sys/dev/drm/amd/display/dc/core/dc_resource.c
+++ b/sys/dev/drm/amd/display/dc/core/dc_resource.c
@@ -1122,8 +1122,14 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx)
 
 	calculate_viewport(pipe_ctx);
 
-	if (pipe_ctx->plane_res.scl_data.viewport.height < 16 || pipe_ctx->plane_res.scl_data.viewport.width < 16)
+	if (pipe_ctx->plane_res.scl_data.viewport.height < 16 ||
+			pipe_ctx->plane_res.scl_data.viewport.width < 16) {
+		/* Balance the *= 2 above: the dc_stream_state is shared and
+		 * outlives this failed validation attempt. */
+		if (pipe_ctx->stream->timing.flags.INTERLACE)
+			pipe_ctx->stream->dst.height /= 2;
 		return false;
+	}
 
 	calculate_recout(pipe_ctx, &recout_full);