drm/amd/display: Add FAMS validation before trying to use it
authorjsg <jsg@openbsd.org>
Fri, 4 Aug 2023 09:05:41 +0000 (09:05 +0000)
committerjsg <jsg@openbsd.org>
Fri, 4 Aug 2023 09:05:41 +0000 (09:05 +0000)
From Rodrigo Siqueira
27931ea53ce59ff421c42c08d4ad3df4b632babe in linux-6.1.y/6.1.43
e3416e872f84086667df21daf166506fab97358d in mainline linux

sys/dev/pci/drm/amd/display/dc/core/amdgpu_dc.c
sys/dev/pci/drm/amd/display/dc/dc_stream.h
sys/dev/pci/drm/amd/display/dc/dcn30/dcn30_optc.c
sys/dev/pci/drm/amd/display/dmub/inc/dmub_cmd.h

index 6e2220e..27cec12 100644 (file)
@@ -2588,6 +2588,12 @@ static enum surface_update_type check_update_surfaces_for_stream(
 
                if (stream_update->mst_bw_update)
                        su_flags->bits.mst_bw = 1;
+
+               if (stream_update->stream && stream_update->stream->freesync_on_desktop &&
+                       (stream_update->vrr_infopacket || stream_update->allow_freesync ||
+                               stream_update->vrr_active_variable))
+                       su_flags->bits.fams_changed = 1;
+
                if (stream_update->crtc_timing_adjust && dc_extended_blank_supported(dc))
                        su_flags->bits.crtc_timing_adjust = 1;
 
index e2f4fe8..cb8d241 100644 (file)
@@ -131,6 +131,7 @@ union stream_update_flags {
                uint32_t dsc_changed : 1;
                uint32_t mst_bw : 1;
                uint32_t crtc_timing_adjust : 1;
+               uint32_t fams_changed : 1;
        } bits;
 
        uint32_t raw;
index 25749f7..94894fd 100644 (file)
@@ -292,7 +292,12 @@ void optc3_wait_drr_doublebuffer_pending_clear(struct timing_generator *optc)
 
 void optc3_set_vtotal_min_max(struct timing_generator *optc, int vtotal_min, int vtotal_max)
 {
-       optc1_set_vtotal_min_max(optc, vtotal_min, vtotal_max);
+       struct dc *dc = optc->ctx->dc;
+
+       if (dc->caps.dmub_caps.mclk_sw && !dc->debug.disable_fams)
+               dc_dmub_srv_drr_update_cmd(dc, optc->inst, vtotal_min, vtotal_max);
+       else
+               optc1_set_vtotal_min_max(optc, vtotal_min, vtotal_max);
 }
 
 void optc3_tg_init(struct timing_generator *optc)
index bb5f2ba..d66293b 100644 (file)
@@ -347,7 +347,7 @@ union dmub_fw_boot_status {
                uint32_t optimized_init_done : 1; /**< 1 if optimized init done */
                uint32_t restore_required : 1; /**< 1 if driver should call restore */
                uint32_t defer_load : 1; /**< 1 if VBIOS data is deferred programmed */
-               uint32_t reserved : 1;
+               uint32_t fams_enabled : 1; /**< 1 if VBIOS data is deferred programmed */
                uint32_t detection_required: 1; /**<  if detection need to be triggered by driver */
 
        } bits; /**< status bits */