Skip to content

Commit c94cd06

Browse files
popcornmixmripard
authored andcommitted
drm/vc4: hdmi: Force modeset when bpc or format changes
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: ba8c0fa ("drm/vc4: hdmi: Enable 10/12 bpc output") Signed-off-by: Dom Cobley <popcornmix@gmail.com> Link: https://lore.kernel.org/r/20220613144800.326124-32-maxime@cerno.tech Signed-off-by: Maxime Ripard <maxime@cerno.tech>
1 parent 0ee5a40 commit c94cd06

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

drivers/gpu/drm/vc4/vc4_hdmi.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1605,9 +1605,14 @@ static int vc4_hdmi_encoder_atomic_check(struct drm_encoder *encoder,
16051605
struct drm_crtc_state *crtc_state,
16061606
struct drm_connector_state *conn_state)
16071607
{
1608+
struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
1609+
struct drm_connector *connector = &vc4_hdmi->connector;
1610+
struct drm_connector_state *old_conn_state =
1611+
drm_atomic_get_old_connector_state(conn_state->state, connector);
1612+
struct vc4_hdmi_connector_state *old_vc4_state =
1613+
conn_state_to_vc4_hdmi_conn_state(old_conn_state);
16081614
struct vc4_hdmi_connector_state *vc4_state = conn_state_to_vc4_hdmi_conn_state(conn_state);
16091615
struct drm_display_mode *mode = &crtc_state->adjusted_mode;
1610-
struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
16111616
unsigned long long tmds_char_rate = mode->clock * 1000;
16121617
unsigned long long tmds_bit_rate;
16131618
int ret;
@@ -1636,6 +1641,11 @@ static int vc4_hdmi_encoder_atomic_check(struct drm_encoder *encoder,
16361641
if (ret)
16371642
return ret;
16381643

1644+
/* vc4_hdmi_encoder_compute_config may have changed output_bpc and/or output_format */
1645+
if (vc4_state->output_bpc != old_vc4_state->output_bpc ||
1646+
vc4_state->output_format != old_vc4_state->output_format)
1647+
crtc_state->mode_changed = true;
1648+
16391649
return 0;
16401650
}
16411651

0 commit comments

Comments
 (0)