Skip to content

Commit 6e3a143

Browse files
committed
drm/i915/panel: sync panel prepared state at register
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 <[email protected]> Tested-by: Lee Shawn C <[email protected]> Reviewed-by: Arun R Murthy <[email protected]> Reviewed-by: Maxime Ripard <[email protected]> Link: https://lore.kernel.org/r/a33e4fe5e9970aed9c4aef8c426c00a189149c32.1749199013.git.jani.nikula@intel.com Signed-off-by: Jani Nikula <[email protected]>
1 parent 3fdd5bf commit 6e3a143

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

drivers/gpu/drm/i915/display/intel_panel.c

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,45 @@ void intel_panel_fini(struct intel_connector *connector)
463463
}
464464
}
465465

466+
/*
467+
* If the panel was already enabled at probe, and we took over the state, the
468+
* panel prepared state is out of sync, and the panel followers won't be
469+
* notified. We need to call drm_panel_prepare() on enabled panels.
470+
*
471+
* It would be natural to handle this e.g. in the connector ->sync_state hook at
472+
* intel_modeset_readout_hw_state(), but that's unfortunately too early. We
473+
* don't have drm_connector::kdev at that time. For now, figure out the state at
474+
* ->late_register, and sync there.
475+
*/
476+
static void intel_panel_sync_state(struct intel_connector *connector)
477+
{
478+
struct intel_display *display = to_intel_display(connector);
479+
struct drm_connector_state *conn_state;
480+
struct intel_crtc *crtc;
481+
int ret;
482+
483+
ret = drm_modeset_lock(&display->drm->mode_config.connection_mutex, NULL);
484+
if (ret)
485+
return;
486+
487+
conn_state = connector->base.state;
488+
489+
crtc = to_intel_crtc(conn_state->crtc);
490+
if (crtc) {
491+
struct intel_crtc_state *crtc_state;
492+
493+
crtc_state = to_intel_crtc_state(crtc->base.state);
494+
495+
if (crtc_state->hw.active) {
496+
drm_dbg_kms(display->drm, "[CONNECTOR:%d:%s] Panel prepare\n",
497+
connector->base.base.id, connector->base.name);
498+
intel_panel_prepare(crtc_state, conn_state);
499+
}
500+
}
501+
502+
drm_modeset_unlock(&display->drm->mode_config.connection_mutex);
503+
}
504+
466505
const struct drm_panel_funcs dummy_panel_funcs = {
467506
};
468507

@@ -513,6 +552,8 @@ int intel_panel_register(struct intel_connector *connector)
513552
drm_dbg_kms(display->drm, "[CONNECTOR:%d:%s] Registered panel device '%s', has fwnode: %s\n",
514553
connector->base.base.id, connector->base.name,
515554
dev_name(dev), str_yes_no(dev_fwnode(dev)));
555+
556+
intel_panel_sync_state(connector);
516557
}
517558

518559
out:

0 commit comments

Comments
 (0)