drm/amd/display: Prevent vtotal from being set to 0
authorjsg <jsg@openbsd.org>
Fri, 4 Aug 2023 09:12:01 +0000 (09:12 +0000)
committerjsg <jsg@openbsd.org>
Fri, 4 Aug 2023 09:12:01 +0000 (09:12 +0000)
From Daniel Miess
15c94c3151d9fa86294efb4c6618cae44530e49b in linux-6.1.y/6.1.43
2a9482e55968ed7368afaa9c2133404069117320 in mainline linux

sys/dev/pci/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c

index a2a32cb..8a88605 100644 (file)
@@ -302,7 +302,11 @@ int dcn314_populate_dml_pipes_from_context_fpu(struct dc *dc, struct dc_state *c
                pipe = &res_ctx->pipe_ctx[i];
                timing = &pipe->stream->timing;
 
-               pipes[pipe_cnt].pipe.dest.vtotal = pipe->stream->adjust.v_total_min;
+               if (pipe->stream->adjust.v_total_min != 0)
+                       pipes[pipe_cnt].pipe.dest.vtotal = pipe->stream->adjust.v_total_min;
+               else
+                       pipes[pipe_cnt].pipe.dest.vtotal = timing->v_total;
+
                pipes[pipe_cnt].pipe.dest.vblank_nom = timing->v_total - pipes[pipe_cnt].pipe.dest.vactive;
                pipes[pipe_cnt].pipe.dest.vblank_nom = min(pipes[pipe_cnt].pipe.dest.vblank_nom, dcn3_14_ip.VBlankNomDefaultUS);
                pipes[pipe_cnt].pipe.dest.vblank_nom = max(pipes[pipe_cnt].pipe.dest.vblank_nom, timing->v_sync_width);