From 8299d1f057439f94c6a4412e2e5c5082b82a30c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Sat, 21 Aug 2021 10:54:34 +0200 Subject: bcm27xx: add kernel 5.10 support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rebased RPi foundation patches on linux 5.10.59, removed applied and reverted patches, wireless patches and defconfig patches. bcm2708: boot tested on RPi B+ v1.2 bcm2709: boot tested on RPi 4B v1.1 4G bcm2711: boot tested on RPi 4B v1.1 4G Signed-off-by: Álvaro Fernández Rojas --- ...m-vc4-crtc-Fix-vc4_get_crtc_encoder-logic.patch | 83 ++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 target/linux/bcm27xx/patches-5.10/950-0598-drm-vc4-crtc-Fix-vc4_get_crtc_encoder-logic.patch (limited to 'target/linux/bcm27xx/patches-5.10/950-0598-drm-vc4-crtc-Fix-vc4_get_crtc_encoder-logic.patch') diff --git a/target/linux/bcm27xx/patches-5.10/950-0598-drm-vc4-crtc-Fix-vc4_get_crtc_encoder-logic.patch b/target/linux/bcm27xx/patches-5.10/950-0598-drm-vc4-crtc-Fix-vc4_get_crtc_encoder-logic.patch new file mode 100644 index 0000000000..0b73698805 --- /dev/null +++ b/target/linux/bcm27xx/patches-5.10/950-0598-drm-vc4-crtc-Fix-vc4_get_crtc_encoder-logic.patch @@ -0,0 +1,83 @@ +From bc75a1ca95c195508c7d9238a9dc31218ead3ad1 Mon Sep 17 00:00:00 2001 +From: Maxime Ripard +Date: Thu, 6 May 2021 17:07:07 +0200 +Subject: [PATCH] drm/vc4: crtc: Fix vc4_get_crtc_encoder logic + +The vc4_get_crtc_encoder function currently only works when the +connector->state->crtc pointer is set, which is only true when the +connector is currently enabled. + +However, we use it as part of the disable path as well, and our lookup +will fail in that case, resulting in it returning a null pointer we +can't act on. + +We can access the connector that used to be connected to that crtc +though using the old connector state in the disable path. + +Since we want to support both the enable and disable path, we can +support it by passing the state accessor variant as a function pointer, +together with the atomic state. + +Fixes: 792c3132bc1b ("drm/vc4: encoder: Add finer-grained encoder callbacks") +Signed-off-by: Maxime Ripard +--- + drivers/gpu/drm/vc4/vc4_crtc.c | 21 ++++++++++++++++----- + 1 file changed, 16 insertions(+), 5 deletions(-) + +--- a/drivers/gpu/drm/vc4/vc4_crtc.c ++++ b/drivers/gpu/drm/vc4/vc4_crtc.c +@@ -279,14 +279,22 @@ static u32 vc4_crtc_get_fifo_full_level_ + * allows drivers to push pixels to more than one encoder from the + * same CRTC. + */ +-static struct drm_encoder *vc4_get_crtc_encoder(struct drm_crtc *crtc) ++static struct drm_encoder *vc4_get_crtc_encoder(struct drm_crtc *crtc, ++ struct drm_atomic_state *state, ++ struct drm_connector_state *(*get_state)(struct drm_atomic_state *state, ++ struct drm_connector *connector)) + { + struct drm_connector *connector; + struct drm_connector_list_iter conn_iter; + + drm_connector_list_iter_begin(crtc->dev, &conn_iter); + drm_for_each_connector_iter(connector, &conn_iter) { +- if (connector->state->crtc == crtc) { ++ struct drm_connector_state *conn_state = get_state(state, connector); ++ ++ if (!conn_state) ++ continue; ++ ++ if (conn_state->crtc == crtc) { + drm_connector_list_iter_end(&conn_iter); + return connector->encoder; + } +@@ -309,7 +317,8 @@ static void vc4_crtc_config_pv(struct dr + { + struct drm_device *dev = crtc->dev; + struct vc4_dev *vc4 = to_vc4_dev(dev); +- struct drm_encoder *encoder = vc4_get_crtc_encoder(crtc); ++ struct drm_encoder *encoder = vc4_get_crtc_encoder(crtc, state, ++ drm_atomic_get_new_connector_state); + struct vc4_encoder *vc4_encoder = to_vc4_encoder(encoder); + struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc); + const struct vc4_pv_data *pv_data = vc4_crtc_to_vc4_pv_data(vc4_crtc); +@@ -425,7 +434,8 @@ static int vc4_crtc_disable(struct drm_c + struct drm_atomic_state *state, + unsigned int channel) + { +- struct drm_encoder *encoder = vc4_get_crtc_encoder(crtc); ++ struct drm_encoder *encoder = vc4_get_crtc_encoder(crtc, state, ++ drm_atomic_get_old_connector_state); + struct vc4_encoder *vc4_encoder = to_vc4_encoder(encoder); + struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc); + struct drm_device *dev = crtc->dev; +@@ -525,7 +535,8 @@ static void vc4_crtc_atomic_enable(struc + { + struct drm_device *dev = crtc->dev; + struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc); +- struct drm_encoder *encoder = vc4_get_crtc_encoder(crtc); ++ struct drm_encoder *encoder = vc4_get_crtc_encoder(crtc, state, ++ drm_atomic_get_new_connector_state); + struct vc4_encoder *vc4_encoder = to_vc4_encoder(encoder); + + require_hvs_enabled(dev); -- cgit v1.2.3