Patch "drm/vc4: hdmi: Force modeset when bpc or format changes" has been added to the 5.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drm/vc4: hdmi: Force modeset when bpc or format changes

to the 5.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-vc4-hdmi-force-modeset-when-bpc-or-format-change.patch
and it can be found in the queue-5.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 1daa26c6aa4bde5a286d9cfd44ed9f5c019d0ab2
Author: Dom Cobley <popcornmix@xxxxxxxxx>
Date:   Mon Jun 13 16:47:58 2022 +0200

    drm/vc4: hdmi: Force modeset when bpc or format changes
    
    [ Upstream commit c94cd0620a922156c9ff9af9c3301b174b287677 ]
    
    Whenever the maximum BPC is changed, vc4_hdmi_encoder_compute_config()
    might pick up a different BPC or format depending on the display
    capabilities.
    
    That change will have a number of side effects, including the clock
    rates and whether the scrambling is enabled.
    
    However, only drm_crtc_state.connectors_changed will be set to true,
    since that properly only affects the connector.
    
    This means that while drm_atomic_crtc_needs_modeset() will return true,
    and thus drm_atomic_helper_commit_modeset_enables() will call our
    encoder atomic_enable() hook, mode_changed will be false.
    
    So crtc_set_mode() will not call our encoder .atomic_mode_set() hook. We
    use this hook in vc4 to set the vc4_hdmi_connector_state.output_bpc (and
    output_format), and will then reuse the value in .atomic_enable() to select
    whether or not scrambling should be enabled.
    
    However, since our clock rate is pre-computed during .atomic_check(), we
    end up with the clocks properly configured, but the scrambling disabled,
    leading to a blank screen.
    
    Let's set mode_changed to true in our HDMI driver to force the update of
    output_bpc, and thus prevent the issue entirely.
    
    Fixes: ba8c0faebbb0 ("drm/vc4: hdmi: Enable 10/12 bpc output")
    Signed-off-by: Dom Cobley <popcornmix@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20220613144800.326124-32-maxime@xxxxxxxxxx
    Signed-off-by: Maxime Ripard <maxime@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index 674bd29a7cf2..3829e13c8627 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -1620,9 +1620,14 @@ static int vc4_hdmi_encoder_atomic_check(struct drm_encoder *encoder,
 					 struct drm_crtc_state *crtc_state,
 					 struct drm_connector_state *conn_state)
 {
+	struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
+	struct drm_connector *connector = &vc4_hdmi->connector;
+	struct drm_connector_state *old_conn_state =
+		drm_atomic_get_old_connector_state(conn_state->state, connector);
+	struct vc4_hdmi_connector_state *old_vc4_state =
+		conn_state_to_vc4_hdmi_conn_state(old_conn_state);
 	struct vc4_hdmi_connector_state *vc4_state = conn_state_to_vc4_hdmi_conn_state(conn_state);
 	struct drm_display_mode *mode = &crtc_state->adjusted_mode;
-	struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
 	unsigned long long tmds_char_rate = mode->clock * 1000;
 	unsigned long long tmds_bit_rate;
 	int ret;
@@ -1651,6 +1656,11 @@ static int vc4_hdmi_encoder_atomic_check(struct drm_encoder *encoder,
 	if (ret)
 		return ret;
 
+	/* vc4_hdmi_encoder_compute_config may have changed output_bpc and/or output_format */
+	if (vc4_state->output_bpc != old_vc4_state->output_bpc ||
+	    vc4_state->output_format != old_vc4_state->output_format)
+		crtc_state->mode_changed = true;
+
 	return 0;
 }
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux