[PATCH 4/4] drm/i915/panel: sync panel prepared state at register

Lee, Shawn C shawn.c.lee at intel.com
Fri Jun 6 15:52:35 UTC 2025


On June 6, 2025, 9:05, Jani Nikula <jani.nikula at intel.com> wrote:
>If the panel is enabled at probe, and we take over the hardware state, the drm_panel prepared state will be out of sync. We'll need to notify drm_panel framework about the state at probe, so it can in turn notify the panel followers.
>
>Cc: Lee Shawn C <shawn.c.lee at intel.com>
>Signed-off-by: Jani Nikula <jani.nikula at intel.com>

This patch series was tested on my local device. And panel follower works well on it.

Tested-by: Lee Shawn C <shawn.c.lee at intel.com>

>---
> drivers/gpu/drm/i915/display/intel_panel.c | 41 ++++++++++++++++++++++
> 1 file changed, 41 insertions(+)
>
>diff --git a/drivers/gpu/drm/i915/display/intel_panel.c b/drivers/gpu/drm/i915/display/intel_panel.c
>index b1d549e6cf53..f956919dc648 100644
>--- a/drivers/gpu/drm/i915/display/intel_panel.c
>+++ b/drivers/gpu/drm/i915/display/intel_panel.c
>@@ -463,6 +463,45 @@ void intel_panel_fini(struct intel_connector *connector)
> 	}
> }
> 
>+/*
>+ * If the panel was already enabled at probe, and we took over the 
>+state, the
>+ * panel prepared state is out of sync, and the panel followers won't 
>+be
>+ * notified. We need to call drm_panel_prepare() on enabled panels.
>+ *
>+ * It would be natural to handle this e.g. in the connector 
>+->sync_state hook at
>+ * intel_modeset_readout_hw_state(), but that's unfortunately too 
>+early. We
>+ * don't have drm_connector::kdev at that time. For now, figure out the 
>+state at
>+ * ->late_register, and sync there.
>+ */
>+static void intel_panel_sync_state(struct intel_connector *connector) {
>+	struct intel_display *display = to_intel_display(connector);
>+	struct drm_connector_state *conn_state;
>+	struct intel_crtc *crtc;
>+	int ret;
>+
>+	ret = drm_modeset_lock(&display->drm->mode_config.connection_mutex, NULL);
>+	if (ret)
>+		return;
>+
>+	conn_state = connector->base.state;
>+
>+	crtc = to_intel_crtc(conn_state->crtc);
>+	if (crtc) {
>+		struct intel_crtc_state *crtc_state;
>+
>+		crtc_state = to_intel_crtc_state(crtc->base.state);
>+
>+		if (crtc_state->hw.active) {
>+			drm_dbg_kms(display->drm, "[CONNECTOR:%d:%s] Panel prepare\n",
>+				    connector->base.base.id, connector->base.name);
>+			intel_panel_prepare(crtc_state, conn_state);
>+		}
>+	}
>+
>+	drm_modeset_unlock(&display->drm->mode_config.connection_mutex);
>+}
>+
> const struct drm_panel_funcs dummy_panel_funcs = {  };
> 
>@@ -513,6 +552,8 @@ int intel_panel_register(struct intel_connector *connector)
> 		drm_dbg_kms(display->drm, "[CONNECTOR:%d:%s] Registered panel device '%s', has fwnode: %s\n",
> 			    connector->base.base.id, connector->base.name,
> 			    dev_name(dev), str_yes_no(dev_fwnode(dev)));
>+
>+		intel_panel_sync_state(connector);
> 	}
> 
> out:
>--
>2.39.5
>
>


More information about the Intel-xe mailing list