kernel: bump 5.15 to 5.15.100
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.15 / 950-0808-drm-vc4_hdmi-Force-modeset-when-bpc-changes.patch
1 From 9c30f8d98ef2acd2599d2c074bce62133f82debb Mon Sep 17 00:00:00 2001
2 From: Dom Cobley <popcornmix@gmail.com>
3 Date: Wed, 6 Apr 2022 20:35:13 +0100
4 Subject: [PATCH] drm/vc4_hdmi: Force modeset when bpc changes
5
6 See: https://forum.libreelec.tv/thread/25427-le-10-0-2-on-rpi4-not-playing-files-that-10-0-1-had-no-problems-with/
7
8 The issue is that kodi changes hdmi mode to 3840x2160@24 initially with "max bcp=8"
9 After decoding the first frame it changes property to "max bpc=12".
10
11 Now vc4_hdmi_encoder_compute_config chooses vc4_state->output_bpc = 12 with output_format=VC4_HDMI_OUTPUT_RGB
12 This requires scrambling as clock > 300MHz (and we have hdmi_enable_4kp60=1).
13
14 vc4_hdmi_encoder_atomic_mode_set (without this PR's assignment to mode_changed) is currenly not called so we don't assign:
15 vc4_hdmi->output_bpc = vc4_state->output_bpc
16
17 which means vc4_hdmi_enable_scrambling never enables scrambling (as vc4_hdmi->output_bpc is still 8).
18
19 But we do set the pixel clock in phy_init() to a clock frequency that requires scrambling.
20
21 Signed-off-by: Dom Cobley <popcornmix@gmail.com>
22 ---
23 drivers/gpu/drm/vc4/vc4_hdmi.c | 8 ++++++++
24 1 file changed, 8 insertions(+)
25
26 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
27 +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
28 @@ -1810,6 +1810,9 @@ static int vc4_hdmi_encoder_atomic_check
29 struct vc4_hdmi_connector_state *vc4_state = conn_state_to_vc4_hdmi_conn_state(conn_state);
30 struct drm_display_mode *mode = &crtc_state->adjusted_mode;
31 struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
32 + struct drm_connector *connector = &vc4_hdmi->connector;
33 + struct drm_connector_state *old_conn_state = drm_atomic_get_old_connector_state(conn_state->state, connector);
34 + struct vc4_hdmi_connector_state *old_vc4_state = conn_state_to_vc4_hdmi_conn_state(old_conn_state);
35 unsigned long long pixel_rate = mode->clock * 1000;
36 unsigned long long tmds_rate;
37 int ret;
38 @@ -1838,6 +1841,11 @@ static int vc4_hdmi_encoder_atomic_check
39 if (ret)
40 return ret;
41
42 + /* vc4_hdmi_encoder_compute_config may have changed output_bpc and/or output_format */
43 + if (vc4_state->output_bpc != old_vc4_state->output_bpc ||
44 + vc4_state->output_format != old_vc4_state->output_format)
45 + crtc_state->mode_changed = true;
46 +
47 return 0;
48 }
49