openwrt/target/linux/bcm27xx/patches-5.15/950-0553-drm-vc4-hvs-Force-modeset-on-gamma-lut-change.patch

106 lines
3.3 KiB
Diff
Raw Normal View History

From 0d33c9d1bf2f8eddefb00b426d47c0cb087aa173 Mon Sep 17 00:00:00 2001
From: Maxime Ripard <maxime@cerno.tech>
Date: Mon, 14 Jun 2021 15:28:30 +0200
Subject: [PATCH] drm/vc4: hvs: Force modeset on gamma lut change
The HVS Gamma block can only be updated when idle, so we need to disable
the HVS channel when the gamma property is set in an atomic commit.
Since the pixelvalve cannot have its assigned channel halted without
stalling unless it's disabled as well, in our case that means forcing a
full disable / enable cycle on the pipeline.
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
drivers/gpu/drm/vc4/vc4_crtc.c | 17 +++++++++++++++++
drivers/gpu/drm/vc4/vc4_drv.h | 3 +++
drivers/gpu/drm/vc4/vc4_hvs.c | 32 +++++++++++++++++++++++++++++++-
3 files changed, 51 insertions(+), 1 deletion(-)
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -294,6 +294,23 @@ struct drm_encoder *vc4_get_crtc_encoder
return NULL;
}
+#define drm_for_each_connector_mask(connector, dev, connector_mask) \
+ list_for_each_entry((connector), &(dev)->mode_config.connector_list, head) \
+ for_each_if ((connector_mask) & drm_connector_mask(connector))
+
+struct drm_connector *vc4_get_crtc_connector(struct drm_crtc *crtc,
+ struct drm_crtc_state *state)
+{
+ struct drm_connector *connector;
+
+ WARN_ON(hweight32(state->connector_mask) > 1);
+
+ drm_for_each_connector_mask(connector, crtc->dev, state->connector_mask)
+ return connector;
+
+ return NULL;
+}
+
static void vc4_crtc_pixelvalve_reset(struct drm_crtc *crtc)
{
struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -568,6 +568,9 @@ vc4_crtc_to_vc4_pv_data(const struct vc4
return container_of(data, struct vc4_pv_data, base);
}
+struct drm_connector *vc4_get_crtc_connector(struct drm_crtc *crtc,
+ struct drm_crtc_state *state);
+
struct drm_encoder *vc4_get_crtc_encoder(struct drm_crtc *crtc,
struct drm_crtc_state *state);
--- a/drivers/gpu/drm/vc4/vc4_hvs.c
+++ b/drivers/gpu/drm/vc4/vc4_hvs.c
kernel: bump 5.15 to 5.15.46 Deleted (upstreamed): generic/backport-5.15/400-mtdblock-warn-if-opened-on-NAND.patch [01] generic/backport-5.15/420-v5.19-01-mtd-spinand-gigadevice-fix-Quad-IO-for-GD5F1GQ5UExxG.patch [02] bcm27xx/patches-5.15/950-0029-Revert-mailbox-avoid-timer-start-from-callback.patch [03] bcm27xx/patches-5.15/950-0417-bcm2711_thermal-Don-t-clamp-temperature-at-zero.patch [04] bcm27xx/patches-5.15/950-0740-drm-vc4-hvs-Fix-frame-count-register-readout.patch [05] bcm27xx/patches-5.15/950-0755-drm-vc4-hvs-Reset-muxes-at-probe-time.patch [06] bcm27xx/patches-5.15/950-0759-drm-vc4-txp-Don-t-set-TXP_VSTART_AT_EOF.patch [07] bcm27xx/patches-5.15/950-0760-drm-vc4-txp-Force-alpha-to-be-0xff-if-it-s-disabled.patch [08] bcm53xx/patches-5.15/031-v5.17-0005-ARM-dts-BCM5301X-update-CRU-block-description.patch [09] mediatek/patches-5.15/102-mt7629-enable-arch-timer.patch [10] Manually rebased: bcm27xx/patches-5.15/950-0741-drm-vc4-hvs-Use-pointer-to-HVS-in-HVS_READ-and-HVS_W.patch [01] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.46&id=f41c9418c5898c01634675150696da290fb86796 [02] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.46&id=d5b66645305c6f3a1b2cf75cee4157b07f293309 [03] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.46&id=119f99209d8531359bcb935f252ec435f9d21b13 [04] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.46&id=c4e1280abead1552e1764684079a43e222ccd163 [05] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.46&id=08465a1889cb48ec64431e9db745b5be15399251 [06] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.46&id=0e26a6da02e63b75b629573d13966c36aa6264f0 [07] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.46&id=01c9020b2e7c85e394879f34851805179ac3d1d8 [08] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.46&id=d47f85cc0171a5d3c5bd8cbb8a98983ca3357cbd [09] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.46&id=5151f24ac937ff7eb1f078257c66e3c0f0296010 [10] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.46&id=ffea838686b82fbb2801cdfad6ba5309d15c032d Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2022-06-09 13:19:03 +00:00
@@ -542,6 +542,36 @@ void vc4_hvs_stop_channel(struct drm_dev
SCALER_DISPSTATX_EMPTY);
}
+static int vc4_hvs_gamma_check(struct drm_crtc *crtc,
+ struct drm_atomic_state *state)
+{
+ struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
+ struct drm_connector_state *conn_state;
+ struct drm_connector *connector;
+ struct drm_device *dev = crtc->dev;
+ struct vc4_dev *vc4 = to_vc4_dev(dev);
+
+ if (!vc4->hvs->hvs5)
+ return 0;
+
+ if (!crtc_state->color_mgmt_changed)
+ return 0;
+
+ connector = vc4_get_crtc_connector(crtc, crtc_state);
+ if (!connector)
+ return -EINVAL;
+
+ if (!(connector->connector_type == DRM_MODE_CONNECTOR_HDMIA))
+ return 0;
+
+ conn_state = drm_atomic_get_connector_state(state, connector);
+ if (!conn_state)
+ return -EINVAL;
+
+ crtc_state->mode_changed = true;
+ return 0;
+}
+
int vc4_hvs_atomic_check(struct drm_crtc *crtc, struct drm_atomic_state *state)
{
struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
kernel: bump 5.15 to 5.15.46 Deleted (upstreamed): generic/backport-5.15/400-mtdblock-warn-if-opened-on-NAND.patch [01] generic/backport-5.15/420-v5.19-01-mtd-spinand-gigadevice-fix-Quad-IO-for-GD5F1GQ5UExxG.patch [02] bcm27xx/patches-5.15/950-0029-Revert-mailbox-avoid-timer-start-from-callback.patch [03] bcm27xx/patches-5.15/950-0417-bcm2711_thermal-Don-t-clamp-temperature-at-zero.patch [04] bcm27xx/patches-5.15/950-0740-drm-vc4-hvs-Fix-frame-count-register-readout.patch [05] bcm27xx/patches-5.15/950-0755-drm-vc4-hvs-Reset-muxes-at-probe-time.patch [06] bcm27xx/patches-5.15/950-0759-drm-vc4-txp-Don-t-set-TXP_VSTART_AT_EOF.patch [07] bcm27xx/patches-5.15/950-0760-drm-vc4-txp-Force-alpha-to-be-0xff-if-it-s-disabled.patch [08] bcm53xx/patches-5.15/031-v5.17-0005-ARM-dts-BCM5301X-update-CRU-block-description.patch [09] mediatek/patches-5.15/102-mt7629-enable-arch-timer.patch [10] Manually rebased: bcm27xx/patches-5.15/950-0741-drm-vc4-hvs-Use-pointer-to-HVS-in-HVS_READ-and-HVS_W.patch [01] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.46&id=f41c9418c5898c01634675150696da290fb86796 [02] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.46&id=d5b66645305c6f3a1b2cf75cee4157b07f293309 [03] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.46&id=119f99209d8531359bcb935f252ec435f9d21b13 [04] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.46&id=c4e1280abead1552e1764684079a43e222ccd163 [05] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.46&id=08465a1889cb48ec64431e9db745b5be15399251 [06] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.46&id=0e26a6da02e63b75b629573d13966c36aa6264f0 [07] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.46&id=01c9020b2e7c85e394879f34851805179ac3d1d8 [08] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.46&id=d47f85cc0171a5d3c5bd8cbb8a98983ca3357cbd [09] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.46&id=5151f24ac937ff7eb1f078257c66e3c0f0296010 [10] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.46&id=ffea838686b82fbb2801cdfad6ba5309d15c032d Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2022-06-09 13:19:03 +00:00
@@ -572,7 +602,7 @@ int vc4_hvs_atomic_check(struct drm_crtc
if (ret)
return ret;
- return 0;
+ return vc4_hvs_gamma_check(crtc, state);
}
static void vc4_hvs_update_dlist(struct drm_crtc *crtc)