Enable seamless boot (fastboot) for PTL
cover Enable seamless boot (fastboot) for PTL
This RFC patch series proposes an implementation of seamless boot (fastboot) support for Panther Lake (PTL) platforms within the Xe driver, mirroring functionality already present in i915. The primary focus is on devices using MSO (Multi-Segment Operation) panels and EDP panels.
The goal of this series is to achieve a flicker-free transition from the bootloader (BIOS/UEFI) to the kernel driver by strictly adhering to the hardware state established by the firmware.
Key areas addressed in this revision:
1. **Boot State Preservation**: Where necessary, make amendments to initial hardware readouts and ensure that the framebuffer state as established by firmware is correctly passed into the driver as a memory object.
2. **Atomic State Handoff**: Adjusting the atomic commit path to prevent unnecessary pipe disables or power well toggles when inheriting a valid boot state.
3. **Passive Probing**: Introducing a "passive" initialization path that builds the DRM software state without triggering hardware resets.
This is an initial implementation subject to discussion.
---
Juasheem Sultan (10):
drm/i915/display: Implement passive initialization for splash screen preservation drm/xe/display: Implement seamless boot state reconstruction for PTL drm/i915/display: Implement aggressive boot state preservation for PTL drm/xe/display: Fix initial plane reconstruction and stolen memory handling drm/i915/display: Enable early PLL readout and robustify modeset setup drm/i915/display: Fix vblank timestamps and update logic for fastboot drm/i915/display: Implement seamless fastboot for MSO panels on PTL drm/i915/display: Robustify fastboot and power init for seamless boot drm/i915/display: Fix initial plane config readout and MSO stride for PTL drm/i915/display: Refactor initial plane readout and harden boot handover
drivers/gpu/drm/i915/display/intel_bios.c | 40 +- drivers/gpu/drm/i915/display/intel_cdclk.c | 36 - drivers/gpu/drm/i915/display/intel_cdclk.h | 41 +- drivers/gpu/drm/i915/display/intel_connector.c | 9 + drivers/gpu/drm/i915/display/intel_connector.h | 1 + drivers/gpu/drm/i915/display/intel_crtc.c | 62 +- drivers/gpu/drm/i915/display/intel_ddi.c | 205 +++++- drivers/gpu/drm/i915/display/intel_ddi.h | 2 + drivers/gpu/drm/i915/display/intel_display.c | 814 +++++++++++++++++++-- drivers/gpu/drm/i915/display/intel_display.h | 6 + drivers/gpu/drm/i915/display/intel_display_core.h | 2 + .../gpu/drm/i915/display/intel_display_driver.c | 329 ++++++++- drivers/gpu/drm/i915/display/intel_display_power.c | 16 +- drivers/gpu/drm/i915/display/intel_display_types.h | 8 + drivers/gpu/drm/i915/display/intel_dp.c | 372 ++++++++-- drivers/gpu/drm/i915/display/intel_dp.h | 5 + drivers/gpu/drm/i915/display/intel_dpll_mgr.c | 16 +- drivers/gpu/drm/i915/display/intel_dpll_mgr.h | 1 + drivers/gpu/drm/i915/display/intel_hdmi.c | 39 + drivers/gpu/drm/i915/display/intel_hdmi.h | 2 + drivers/gpu/drm/i915/display/intel_modeset_setup.c | 7 + .../gpu/drm/i915/display/intel_modeset_verify.c | 14 +- drivers/gpu/drm/i915/display/intel_panel.c | 41 +- drivers/gpu/drm/i915/display/intel_panel.h | 3 + drivers/gpu/drm/i915/display/intel_plane_initial.c | 53 ++ drivers/gpu/drm/i915/display/skl_universal_plane.c | 32 +- drivers/gpu/drm/xe/display/xe_display.c | 309 +++++++- drivers/gpu/drm/xe/display/xe_display.h | 2 + drivers/gpu/drm/xe/display/xe_plane_initial.c | 28 +- drivers/gpu/drm/xe/xe_device.c | 2 +- drivers/gpu/drm/xe/xe_ggtt.h | 3 + drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c | 2 + 32 files changed, 2302 insertions(+), 200 deletions(-)
---
base-commit: 812e4b8966d421afd4df8f794bf15f1a1a3ec7b6
change-id: 20260115-upstream-prep-b29156970a75
Best regards,
Signature · 1 line
Juasheem Sultan <[email protected]>
RFC PATCH 1/10 drm/i915/display: Implement passive initialization for splash screen preservation
To achieve a seamless transition from the bootloader to the kernel driver (fastboot) on Panther Lake (PTL), especially with MSO panels, we need to avoid resetting the hardware state during initialization.
Introduce a "passive" initialization path (intel_ddi_init_encoder_early) that constructs the necessary DRM software objects (encoders, connectors) to match the hardware state without issuing any hardware-resetting commands (like DP link training or full modesets).
Key changes include:
1. Early encoder/connector initialization that skips GMBUS/AUX activity where unsafe.
2. MSO-specific fixes:
* Hardcoded link parameters for 2256x1504 MSO mode.
* Forced positive sync polarity (required by hardware/panel).
* Manual handling of splitter state in get_config.
3. Improved DSC DPCD reading with retry logic to handle slow-to-wake panels.
This prevents the splash screen from flickering or disappearing during boot.
--- drivers/gpu/drm/i915/display/intel_connector.c | 9 + drivers/gpu/drm/i915/display/intel_connector.h | 1 + drivers/gpu/drm/i915/display/intel_ddi.c | 205 ++++++++++++- drivers/gpu/drm/i915/display/intel_ddi.h | 2 + drivers/gpu/drm/i915/display/intel_dp.c | 385 ++++++++++++++++++++++--- drivers/gpu/drm/i915/display/intel_dp.h | 5 + drivers/gpu/drm/i915/display/intel_hdmi.c | 39 +++ drivers/gpu/drm/i915/display/intel_hdmi.h | 2 + drivers/gpu/drm/i915/display/intel_panel.c | 41 ++- drivers/gpu/drm/i915/display/intel_panel.h | 3 + 10 files changed, 639 insertions(+), 53 deletions(-)
drivers/gpu/drm/i915/display/intel_connector.c +9 -0
@@ -118,6 +118,15 @@ struct intel_connector *intel_connector_alloc(void)return connector; } + +void intel_connector_destroy_early (struct drm_connector *connector) +{ +struct intel_connector *intel_connector =to_intel_connector (connector); + +intel_panel_fini (intel_connector); +kfree (connector); +} +/* * Free the bits allocated by intel_connector_alloc. * This should only be used after intel_connector_alloc has returned
drivers/gpu/drm/i915/display/intel_connector.h +1 -0
@@ -17,6 +17,7 @@ struct intel_encoder;struct intel_connector *intel_connector_alloc (void );void intel_connector_free (struct intel_connector *connector);void intel_connector_destroy (struct drm_connector *connector); +void intel_connector_destroy_early (struct drm_connector *connector);int intel_connector_register (struct drm_connector *connector);void intel_connector_unregister (struct drm_connector *connector); void intel_connector_attach_encoder(struct intel_connector *connector,
drivers/gpu/drm/i915/display/intel_ddi.c +204 -1
248 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_ddi.h +2 -0
@@ -56,6 +56,8 @@ void hsw_prepare_dp_ddi_buffers(struct intel_encoder *encoder,void intel_wait_ddi_buf_idle (struct intel_display *display,enum port port);void intel_ddi_init (struct intel_display *display,const struct intel_bios_encoder_data *devdata); +void intel_ddi_init_encoder_early (struct intel_display *display, +const struct intel_bios_encoder_data *devdata);bool intel_ddi_get_hw_state (struct intel_encoder *encoder,enum pipe *pipe);void intel_ddi_config_transcoder_func (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state);
drivers/gpu/drm/i915/display/intel_dp.c +337 -48
499 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_dp.h +5 -0
@@ -47,6 +47,8 @@ intel_dp_queue_modeset_retry_for_link(struct intel_atomic_state *state, const struct intel_crtc_state *crtc_state);bool intel_dp_init_connector (struct intel_digital_port *dig_port,struct intel_connector *intel_connector); +bool intel_dp_init_connector_early (struct intel_digital_port *dig_port, +struct intel_connector *intel_connector);void intel_dp_connector_sync_state (struct intel_connector *connector,const struct intel_crtc_state *crtc_state); void intel_dp_set_link_params(struct intel_dp *intel_dp,
@@ -215,5 +217,8 @@ int intel_dp_compute_min_hblank(struct intel_crtc_state *crtc_state,int intel_dp_dsc_bpp_step_x16 (const struct intel_connector *connector);void intel_dp_dpcd_set_probe (struct intel_dp *intel_dp,bool force_on_external);bool intel_dp_in_hdr_mode (const struct drm_connector_state *conn_state); +void intel_edp_mso_init (struct intel_dp *intel_dp); +void intel_edp_mso_mode_fixup (struct intel_connector *connector, +struct drm_display_mode *mode);#endif /* __INTEL_DP_H__ */
drivers/gpu/drm/i915/display/intel_hdmi.c +39 -0
@@ -3041,6 +3041,45 @@ void intel_infoframe_init(struct intel_digital_port *dig_port) } } +static void intel_hdmi_connector_reset_early (struct drm_connector *connector) +{ +drm_dbg_kms (to_intel_display (connector->dev)->drm, +"[CONNECTOR:%d:%s] skipping reset to preserve BIOS state\n" , + connector->base.id, connector->name); +} + +static const struct drm_connector_funcs intel_hdmi_connector_funcs_early = { + .reset = intel_hdmi_connector_reset_early, + .destroy = intel_connector_destroy_early, + .fill_modes = drm_helper_probe_single_connector_modes, + .atomic_duplicate_state = intel_digital_connector_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, + .atomic_set_property = intel_digital_connector_atomic_set_property, + .atomic_get_property = intel_digital_connector_atomic_get_property, +}; + +bool intel_hdmi_init_connector_early (struct intel_digital_port *dig_port, +struct intel_connector *intel_connector) +{ +struct drm_device *dev = dig_port->base.base.dev; +struct drm_connector *connector = &intel_connector->base; +struct intel_encoder *intel_encoder = &dig_port->base; + +drm_connector_init (dev, connector, &intel_hdmi_connector_funcs_early, +DRM_MODE_CONNECTOR_HDMIA ); +drm_connector_helper_add (connector, &intel_hdmi_connector_helper_funcs); + +/* For early init, we only create the software objects. +* Hardware state callbacks and other active setup are deferred. +*/ +intel_connector_attach_encoder (intel_connector, intel_encoder); + + +return true; + +} + +bool intel_hdmi_init_connector (struct intel_digital_port *dig_port,struct intel_connector *intel_connector) {
drivers/gpu/drm/i915/display/intel_hdmi.h +2 -0
@@ -23,6 +23,8 @@ union hdmi_infoframe;bool intel_hdmi_init_connector (struct intel_digital_port *dig_port,struct intel_connector *intel_connector); +bool intel_hdmi_init_connector_early (struct intel_digital_port *dig_port, +struct intel_connector *intel_connector);bool intel_hdmi_compute_has_hdmi_sink (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state,const struct drm_connector_state *conn_state);
drivers/gpu/drm/i915/display/intel_panel.c +37 -4
56 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_panel.h +3 -0
@@ -22,6 +22,9 @@ struct intel_encoder;void intel_panel_init_alloc (struct intel_connector *connector);int intel_panel_init (struct intel_connector *connector,const struct drm_edid *fixed_edid); +int intel_panel_init_early (struct intel_connector *connector, +const struct drm_edid *fixed_edid); +void intel_panel_fini (struct intel_connector *connector);int intel_panel_register (struct intel_connector *connector);void intel_panel_unregister (struct intel_connector *connector);
Signature · 1 line
2.52.0.457.g6b5491de43-goog
RFC PATCH 2/10 drm/xe/display: Implement seamless boot state reconstruction for PTL
In reply to Juasheem SultanTo achieve a flicker-free transition from bootloader to kernel (fastboot) on Panther Lake (PTL), the driver must accurately reconstruct the hardware state established by the BIOS before the first atomic commit.
Currently, the Xe driver initialization sequence may reset hardware or fail to populate essential state (like MSO configurations or DP link rates), leading to a blank screen or visual artifacts during boot.
This patch introduces a comprehensive state reconstruction path:
1. **Passive Encoder Setup**: Adds intel_setup_encoders to discover ports and create encoder objects based on VBT data without triggering disruptive probing sequences.
2. **BIOS State Readout**:
* Implements xe_initial_pll_enable to identify active pipes
and ensure PLLs, PPS, and VDD are correctly tracked in software.
* Reconstructs intel_dp state (link rates, lane counts) using
hardware readout, falling back to VBT values if DPCD reads fail (common during early init).
3. **MSO & VBT Fixes**:
* Parses EDID early to fix up MSO (Multi-Segment Operation)
timings and flags.
* Adds overrides for incorrect VBT link rate reports on PTL.
* Forces MSO configuration if detection fails but is required by
the platform.
4. **Power Management**:
* Grabs a persistent POWER_DOMAIN_INIT reference in
xe_display_register to prevent the hardware from power-gating active pipes when the initial wakerefs are dropped.
--- drivers/gpu/drm/i915/display/intel_bios.c | 40 ++- drivers/gpu/drm/i915/display/intel_cdclk.c | 36 --- drivers/gpu/drm/i915/display/intel_cdclk.h | 41 ++- drivers/gpu/drm/i915/display/intel_display.h | 4 + drivers/gpu/drm/i915/display/intel_display_core.h | 2 + drivers/gpu/drm/xe/display/xe_display.c | 309 +++++++++++++++++++++- drivers/gpu/drm/xe/display/xe_display.h | 2 + drivers/gpu/drm/xe/xe_device.c | 2 +- 8 files changed, 383 insertions(+), 53 deletions(-)
drivers/gpu/drm/i915/display/intel_bios.c +37 -3
@@ -43,6 +43,8 @@#include "intel_display_types.h" #include "intel_gmbus.h" +#include "intel_ddi.h" +#define _INTEL_BIOS_PRIVATE#include "intel_vbt_defs.h"
@@ -1540,10 +1542,22 @@ parse_edp(struct intel_display *display, panel->vbt.edp.drrs_msa_timing_delay =panel_bits (edp->sdrrs_msa_timing_delay, panel_type,2 ); -if (display->vbt.version >=244 ) - panel->vbt.edp.max_link_rate = - edp->edp_max_port_link_rate[panel_type] *20 ; +if (display->vbt.version >=244 ) { +u8 edp_max_port_link_rate = + edp->edp_max_port_link_rate[panel_type]; +if (display->vbt.version >=263 ) { + panel->vbt.edp.max_link_rate = + (edp_max_port_link_rate &0x7 ) *20 ; + }else { +/* +* HACK: The VBT is reporting a lower max link rate than supported. +* Override to HBR3 (8.1 Gbps) as per direct VBT hexdump analysis. +*/ + panel->vbt.edp.max_link_rate =810000 ;/* Force HBR3 (8.1 Gbps) */ + } + + }if (display->vbt.version >=251 ) panel->vbt.edp.dsc_disable =panel_bool (edp->edp_dsc_disable, panel_type);
@@ -3778,3 +3792,23 @@ void intel_bios_debugfs_register(struct intel_display *display)debugfs_create_file ("i915_vbt" ,0444 , display->drm->debugfs_root, display, &intel_bios_vbt_fops); } + +/** +* intel setup_encoders - minimally initialize encoders to identify ports +* @dev_priv: i915 device instance +* +* This functions is a stripped-down version of intel_setup_outputs(). Its sole purpose is to iterate over the VBT chidl devices to discover which physical prots exist and initialize the corresponding intel_encoder software objects. +* +* This is critical for the flicker-free boot path, where we need to identify +* the active encoder by its port number before a full modeset has occurred. +* This function populates the required encoder->port fields without creating +* connectors or triggering a full output probe, which would cause flicker. +*/ +void intel_setup_encoders (struct intel_display *display) +{ +if (HAS_DDI (display)) { +intel_bios_for_each_encoder (display, intel_ddi_init_encoder_early); + }else { +drm_dbg_kms (display->drm,"Non-DDI platform in minimal encoder setup, may need more\n" ); + } +}
drivers/gpu/drm/i915/display/intel_cdclk.c +0 -36
@@ -116,42 +116,6 @@* dividers can be programmed correctly. */ -struct intel_cdclk_state { -struct intel_global_state base; - -/* -* Logical configuration of cdclk (used for all scaling, -* watermark, etc. calculations and checks). This is -* computed as if all enabled crtcs were active. -*/ -struct intel_cdclk_config logical; - -/* -* Actual configuration of cdclk, can be different from the -* logical configuration only when all crtc's are DPMS off. -*/ -struct intel_cdclk_config actual; - -/* minimum acceptable cdclk to satisfy bandwidth requirements */ -int bw_min_cdclk; -/* minimum acceptable cdclk for each pipe */ -int min_cdclk[I915_MAX_PIPES ]; -/* minimum acceptable voltage level for each pipe */ -u8 min_voltage_level[I915_MAX_PIPES ]; - -/* pipe to which cd2x update is synchronized */ -enum pipe pipe; - -/* forced minimum cdclk for glk+ audio w/a */ -int force_min_cdclk; - -/* bitmask of active pipes */ -u8 active_pipes; - -/* update cdclk with pipes disabled */ -bool disable_pipes; -}; -struct intel_cdclk_funcs {void (*get_cdclk)(struct intel_display *display,struct intel_cdclk_config *cdclk_config);
drivers/gpu/drm/i915/display/intel_cdclk.h +39 -2
54 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_display.h +4 -0
@@ -529,6 +529,10 @@ void intel_setup_outputs(struct intel_display *display);int intel_initial_commit (struct intel_display *display);void intel_panel_sanitize_ssc (struct intel_display *display);void intel_update_czclk (struct intel_display *display); +void intel_setup_encoders (struct intel_display *display); +void intel_panel_sanitize_ssc (struct drm_i915_private *i915); +void intel_update_czclk (struct drm_i915_private *i915); +void intel_atomic_helper_free_state_worker (struct work_struct *work);enum drm_mode_status intel_mode_valid (struct drm_device *dev,const struct drm_display_mode *mode); int intel_atomic_commit(struct drm_device *dev, struct drm_atomic_state *_state,
drivers/gpu/drm/i915/display/intel_display_core.h +2 -0
@@ -74,6 +74,8 @@ struct intel_display_funcs {void (*crtc_disable)(struct intel_atomic_state *state,struct intel_crtc *crtc);void (*commit_modeset_enables)(struct intel_atomic_state *state); +void (*post_crtc_init_hook)(struct intel_display *display); +void (*initial_plane_config)(struct intel_display *display); };/* functions used for watermark calcs for display. */
drivers/gpu/drm/xe/display/xe_display.c +298 -11
381 lines not on this page · raw message
drivers/gpu/drm/xe/display/xe_display.h +2 -0
@@ -18,6 +18,7 @@ void xe_display_driver_set_hooks(struct drm_driver *driver);int xe_display_probe (struct xe_device *xe);int xe_display_init_early (struct xe_device *xe); +int xe_display_init_noirq (struct xe_device *xe);int xe_display_init (struct xe_device *xe);void xe_display_register (struct xe_device *xe);
@@ -47,6 +48,7 @@ static inline void xe_display_driver_remove(struct xe_device *xe) {}static inline int xe_display_probe (struct xe_device *xe) {return 0 ; }static inline int xe_display_init_early (struct xe_device *xe) {return 0 ; } +static inline int xe_display_init_noirq (struct xe_device *xe) {return 0 ; }static inline int xe_display_init (struct xe_device *xe) {return 0 ; }static inline void xe_display_register (struct xe_device *xe) {}
drivers/gpu/drm/xe/xe_device.c +1 -1
@@ -913,7 +913,7 @@ int xe_device_probe(struct xe_device *xe)if (err)return err; - err =xe_display_init (xe); + err =xe_display_init_noirq (xe);if (err)return err;
Signature · 1 line
2.52.0.457.g6b5491de43-goog
RFC PATCH 3/10 drm/i915/display: Implement aggressive boot state preservation for PTL
In reply to Juasheem SultanTo ensure a seamless, flicker-free boot on Panther Lake (PTL) platforms, especially those with MSO (Multi-Segment Operation) panels, the driver must rigidly adhere to the hardware state established by the BIOS. Standard state readout and re-computation often lead to mismatches (e.g., missing MSO flags, incorrect PLL parameters) that cause the hardware to reset or blank the screen.
This patch implements a mechanism to "steal" and lock the boot state:
1. **State Capture (intel_crtc_steal_state)**:
* Captures critical hardware state (PLLs, timings, MSO splitter
configuration, DSC parameters, etc.) into persistent "boot_" variables during the initial readout.
* Populates the initial atomic state (live_crtc_state) directly
from this captured data, creating necessary mode blobs manually to satisfy atomic checks without triggering hardware changes.
2. **State Restoration & Locking**:
* In intel_modeset_pipe_config, if the requested mode matches
the captured boot dimensions, the driver bypasses standard computation.
* Instead, it forcibly restores the captured boot parameters (PLLs,
timings, MSO flags like PHSYNC/PVSYNC) into the new CRTC state.
* Forces fastset to succeed for these matching states, ensuring
no full modeset occurs.
3. **Atomic Check Interventions**:
* Prevents the boot CRTC from being disabled during the initial
userspace handover. If active is false but matches the boot pipe, it forces active = true and re-attaches the mode.
* Fixes a potential issue where userspace sets a mode without
connectors by forcibly attaching the eDP connector.
4. **Hardware Update Bypass**:
* In intel_update_crtc, if the transition matches the boot state,
all hardware-touching functions (plane updates, scaler setup) are skipped. Only vblank events are handled, effectively syncing the software state to the running hardware.
5. **Backlight & Watermarks**:
* Forces backlight enable during the first fastset.
* Captures and restores initial watermark and DDB allocations.
This approach effectively treats the BIOS state as the "golden" state for the initial driver load, preventing the flicker associated with driver takeover.
--- drivers/gpu/drm/i915/display/intel_display.c | 813 +++++++++++++++++++++++++-- drivers/gpu/drm/i915/display/intel_display.h | 4 + 2 files changed, 783 insertions(+), 34 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +779 -34
@@ -44,7 +44,7 @@#include <drm/drm_probe_helper.h> #include <drm/drm_rect.h> #include <drm/drm_vblank.h> - +#include <drm/drm_atomic.h> #include "g4x_dp.h" #include "g4x_hdmi.h" #include "hsw_ips.h"
@@ -58,6 +58,7 @@#include "intel_alpm.h" #include "intel_atomic.h" #include "intel_audio.h" +#include "intel_backlight.h" #include "intel_bo.h" #include "intel_bw.h" #include "intel_cdclk.h"
@@ -72,6 +73,7 @@#include "intel_ddi.h" #include "intel_de.h" #include "intel_display_driver.h" +#include "intel_display_irq.h" #include "intel_display_power.h" #include "intel_display_regs.h" #include "intel_display_rpm.h"
@@ -101,6 +103,39 @@#include "intel_link_bw.h" #include "intel_lvds.h" #include "intel_lvds_regs.h" + +static bool boot_state_captured; +static struct intel_dpll_hw_state boot_pll_state; +static struct intel_dpll *boot_shared_dpll; +static int boot_port_clock; +static int boot_lane_count; +static enum transcoder boot_cpu_transcoder; +static struct drm_display_mode boot_adjusted_mode; +static int boot_hdisplay; +static int boot_vdisplay; +static int boot_pipe_bpp; +static struct intel_link_m_n boot_dp_m_n; +static struct intel_link_m_n boot_dp_m2_n2; +static bool boot_fec_enable; +static bool boot_enhanced_framing; +static bool boot_dsc_compression_enable; +static struct drm_dsc_config boot_dsc_config; +static struct intel_csc_matrix boot_csc; +static bool boot_limited_color_range; +static enum pipe boot_pipe =INVALID_PIPE ; +static unsigned int boot_output_types; +static struct { +bool enable; +int link_count; +int pixel_overlap; +} boot_splitter; +static struct skl_pipe_wm boot_wm; +static struct skl_ddb_entry boot_ddb[I915_MAX_PLANES ]; +static u32 boot_gamma_mode; +static u32 boot_csc_mode; +static u32 boot_linetime; +static bool initial_boot_handoff; +#include "intel_modeset_setup.h" #include "intel_modeset_verify.h" #include "intel_overlay.h"
@@ -2464,12 +2499,23 @@ static int intel_crtc_compute_config(struct intel_atomic_state *state, {struct intel_crtc_state *crtc_state =intel_atomic_get_new_crtc_state (state, crtc); +const struct intel_crtc_state *old_crtc_state = +intel_atomic_get_old_crtc_state (state, crtc);int ret; ret =intel_crtc_compute_vblank_delay (state, crtc);if (ret)return ret; +if (state->fastset) { + crtc_state->hw.adjusted_mode.crtc_clock = old_crtc_state->hw.adjusted_mode.crtc_clock; + +if (crtc_state->hw.adjusted_mode.crtc_clock) { + crtc_state->pixel_rate = crtc_state->hw.adjusted_mode.crtc_clock; +return 0 ; + } + } + ret =intel_dpll_crtc_compute_clock (state, crtc);if (ret)return ret;
@@ -2921,6 +2967,12 @@ static void intel_get_pipe_src_size(struct intel_crtc *crtc,REG_FIELD_GET (PIPESRC_WIDTH_MASK , tmp) +1 , REG_FIELD_GET(PIPESRC_HEIGHT_MASK, tmp) + 1); +/* [FB-FIX] Force pipe source size from boot state if HW readout is invalid (seamless handoff) */ +if (boot_state_captured && crtc->pipe == boot_pipe && + (drm_rect_width (&pipe_config->pipe_src) <=1 ||drm_rect_height (&pipe_config->pipe_src) <=1 )) { +drm_rect_init (&pipe_config->pipe_src,0 ,0 , boot_hdisplay, boot_vdisplay); + } +intel_joiner_adjust_pipe_src (pipe_config); }
@@ -4699,11 +4751,137 @@ intel_modeset_pipe_config(struct intel_atomic_state *state,drm_mode_set_crtcinfo (&crtc_state->hw.adjusted_mode,CRTC_STEREO_DOUBLE ); +/* +* FIX: Permanent Boot Lock (Moved to TOP). +* We check for boot state match BEFORE letting the driver calculate anything. +* This bypasses broken driver logic for MSO panels. +*/ +bool restore_boot = false; +int new_h =0 ; +int new_v =0 ; + +/* Only restore boot state if this is the initial inherited commit */ +if (boot_state_captured && crtc_state->uapi.enable && crtc_state->inherited) { + new_h = crtc_state->hw.adjusted_mode.crtc_hdisplay; + new_v = crtc_state->hw.adjusted_mode.crtc_vdisplay; + +if (new_h == boot_hdisplay && new_v == boot_vdisplay) { + restore_boot = true; + }else if (((boot_splitter.enable && boot_splitter.link_count >0 && + new_h == boot_hdisplay * boot_splitter.link_count) || + (new_h == boot_hdisplay *2 )) && + new_v == boot_vdisplay) { + restore_boot = true; + } + } + +if (restore_boot) { + + + + crtc_state->dpll_hw_state = boot_pll_state; + + crtc_state->intel_dpll = boot_shared_dpll; + +/* Restore boot port clock */ + + crtc_state->port_clock = boot_port_clock; + + + crtc_state->lane_count =4 ; + +if (boot_pipe_bpp ==0 ) { + crtc_state->pipe_bpp =24 ; + }else { + crtc_state->pipe_bpp = boot_pipe_bpp; + } + + crtc_state->dp_m_n = boot_dp_m_n; + + crtc_state->dp_m2_n2 = boot_dp_m2_n2; + crtc_state->fec_enable = boot_fec_enable; + crtc_state->enhanced_framing = boot_enhanced_framing; + crtc_state->dsc.compression_enable = boot_dsc_compression_enable; + crtc_state->dsc.config = boot_dsc_config; + crtc_state->csc = boot_csc; + crtc_state->limited_color_range = boot_limited_color_range; + + crtc_state->gamma_mode = boot_gamma_mode; + crtc_state->csc_mode = boot_csc_mode; + crtc_state->linetime = boot_linetime; + + crtc_state->cpu_transcoder = boot_cpu_transcoder; + crtc_state->output_types = boot_output_types; + +if (DISPLAY_VER (display) >=9 ) { +memcpy (&crtc_state->wm.skl.optimal, &boot_wm,sizeof (boot_wm)); +memcpy (&crtc_state->wm.skl.plane_ddb, boot_ddb,sizeof (boot_ddb)); + } + +/* Restore captured mode (already divided if MSO was active) */ +drm_mode_copy (&crtc_state->hw.adjusted_mode, &boot_adjusted_mode); +drm_mode_copy (&crtc_state->uapi.adjusted_mode, &boot_adjusted_mode); + +int src_w = boot_hdisplay; +int src_h = boot_vdisplay; + +if (boot_splitter.enable && boot_splitter.link_count >0 ) { + crtc_state->splitter.enable = true; + crtc_state->splitter.link_count = boot_splitter.link_count; + crtc_state->splitter.pixel_overlap = boot_splitter.pixel_overlap; + +/* +* If boot_hdisplay captured the divided pipe width (1128), scale it. +* If it captured the full logical width (2256), use it as is. +*/ +if (boot_hdisplay < new_h) + src_w = boot_hdisplay * boot_splitter.link_count - boot_splitter.pixel_overlap * (boot_splitter.link_count -1 ); +else + src_w = boot_hdisplay; + } + +/* Set pixel_rate to match clock */ + crtc_state->pixel_rate = crtc_state->hw.adjusted_mode.crtc_clock; + +/* Copy to pipe_mode */ +drm_mode_copy (&crtc_state->hw.pipe_mode, &crtc_state->hw.adjusted_mode); + +/* +* FIX: Force flags to PHSYNC | PVSYNC if we are restoring MSO state. +* The captured boot state might have lost them or they might be implicit. +* Hardware readout confirms 0xA (Positive/Positive) is active. +*/ +/* +if (crtc_state->splitter.enable) { +crtc_state->hw.adjusted_mode.flags |= (DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC); +crtc_state->hw.pipe_mode.flags |= (DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC); +crtc_state->uapi.adjusted_mode.flags |= (DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC); +} +*/ + +/* Set pixel_rate to match clock */ + crtc_state->pixel_rate = crtc_state->hw.adjusted_mode.crtc_clock; + +/* Restore pipe_src */ +drm_rect_init (&crtc_state->pipe_src,0 ,0 , src_w, src_h); + +/* +* Stop the driver from recalculating/overwriting these. +* We return early-ish or let the rest run? +* intel_modeset_pipe_config continues... +* But we overwrote the critical parts. +*/ +return 0 ; + } +/* Pass our mode to the connectors and the CRTC to give them a chance to * adjust it according to limitations or connector properties, and also * a chance to reject the mode entirely. */ for_each_new_connector_in_state (&state->base, connector, connector_state, i) { +if (restore_boot) +continue ; +struct intel_encoder *encoder =to_intel_encoder (connector_state->best_encoder);
@@ -4727,13 +4905,18 @@ intel_modeset_pipe_config(struct intel_atomic_state *state, crtc_state->port_clock = crtc_state->hw.adjusted_mode.crtc_clock * crtc_state->pixel_multiplier; - ret =intel_crtc_compute_config (state, crtc); -if (ret == -EDEADLK ) -return ret; -if (ret <0 ) { -drm_dbg_kms (display->drm,"[CRTC:%d:%s] config failure: %d\n" , - crtc->base.base.id, crtc->base.name, ret); -return ret; +/* Skip PLL computation if we are disabling the pipe */ +if (crtc_state->hw.enable && !restore_boot) { + ret =intel_crtc_compute_config (state, crtc); +if (ret == -EDEADLK ) +return ret; +if (ret <0 ) { +drm_dbg_kms (display->drm,"[CRTC:%d:%s] config failure: %d\n" , + crtc->base.base.id, crtc->base.name, ret); +return ret; + } + }else { + ret =0 ; }/* Dithering seems to not pass-through bits correctly when it should, so
@@ -5454,6 +5637,25 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,#undef PIPE_CONF_CHECK_RECT#undef PIPE_CONF_QUIRK +/* [] Hack to force fastset/verify success for seamless boot */ +if (!ret && boot_state_captured) { +struct intel_crtc *crtc =to_intel_crtc (current_config->uapi.crtc); + +if (crtc->pipe == boot_pipe) { +bool match = false; +int h = pipe_config->hw.pipe_mode.hdisplay; +int v = pipe_config->hw.pipe_mode.vdisplay; + +if ((h == boot_hdisplay || h == boot_hdisplay *2 ) && v == boot_vdisplay) + match = true; + +if (match) { + ret = true; + } + + } + } +return ret; }
@@ -5759,23 +5961,156 @@ static void intel_crtc_check_fastset(const struct intel_crtc_state *old_crtc_sta new_crtc_state->update_pipe = true; } +static int intel_crtc_add_planes_to_state (struct intel_atomic_state *state, +struct intel_crtc *crtc, +u8 plane_ids_mask) +{ +struct drm_i915_private *dev_priv =to_i915 (state->base.dev); +struct intel_plane *plane; + +for_each_intel_plane_on_crtc (&dev_priv->drm, crtc, plane) { +struct intel_plane_state *plane_state; + +if ((plane_ids_mask &BIT (plane->id)) ==0 ) +continue ; + + plane_state =intel_atomic_get_plane_state (state, plane); +if (IS_ERR (plane_state)) +return PTR_ERR (plane_state); + } + +return 0 ; +} + +static int __maybe_unused intel_atomic_add_affected_planes (struct intel_atomic_state *state, +struct intel_crtc *crtc) +{ +const struct intel_crtc_state *old_crtc_state = +intel_atomic_get_old_crtc_state (state, crtc); +const struct intel_crtc_state *new_crtc_state = +intel_atomic_get_new_crtc_state (state, crtc); + +return intel_crtc_add_planes_to_state (state, crtc, + old_crtc_state->enabled_planes | + new_crtc_state->enabled_planes); +} + +static bool __maybe_unused active_planes_affects_min_cdclk (struct drm_i915_private *dev_priv) +{ +struct intel_display *display = dev_priv->display; +/* See {hsw,vlv,ivb}_plane_ratio() */ +return IS_BROADWELL (dev_priv) ||IS_HASWELL (dev_priv) || +IS_CHERRYVIEW (dev_priv) ||IS_VALLEYVIEW (dev_priv) || + display->platform.ivybridge; +} + +static int intel_crtc_add_joiner_planes (struct intel_atomic_state *state, +struct intel_crtc *crtc, +struct intel_crtc *other) +{ +const struct intel_plane_state __maybe_unused *plane_state; +struct intel_plane *plane; +u8 plane_ids =0 ; +int i; + +for_each_new_intel_plane_in_state (state, plane, plane_state, i) { +if (plane->pipe == crtc->pipe) + plane_ids |=BIT (plane->id); + } + +return intel_crtc_add_planes_to_state (state, other, plane_ids); +} + +static int intel_joiner_add_affected_planes (struct intel_atomic_state *state) +{ +struct drm_i915_private *i915 =to_i915 (state->base.dev); +const struct intel_crtc_state *crtc_state; +struct intel_crtc *crtc; +int i; + +for_each_new_intel_crtc_in_state (state, crtc, crtc_state, i) { +struct intel_crtc *other; + +for_each_intel_crtc_in_pipe_mask (&i915->drm, other, + crtc_state->joiner_pipes) { +int ret; + +if (crtc == other) +continue ; + + ret =intel_crtc_add_joiner_planes (state, crtc, other); +if (ret) +return ret; + } + } + +return 0 ; +} + +static int __maybe_unused intel_atomic_check_planes (struct intel_atomic_state *state) +{ +struct intel_crtc_state *old_crtc_state, *new_crtc_state; +struct intel_plane_state __maybe_unused *plane_state; +struct intel_crtc *crtc; +int i, ret; + +/* ret = icl_add_linked_planes(state); */ +/* if (ret) */ +/* return ret; */ + + ret =intel_joiner_add_affected_planes (state); +if (ret) +return ret; + + ret =intel_plane_atomic_check (state); +if (ret) +return ret; + +for_each_oldnew_intel_crtc_in_state (state, crtc, old_crtc_state, + new_crtc_state, i) { + +/* if (ret) */ + +/* return ret; */ + + + + ret =intel_joiner_add_affected_planes (state); + + + } + +return 0 ; +} +static int intel_atomic_check_crtcs (struct intel_atomic_state *state) {struct intel_display *display =to_intel_display (state);struct intel_crtc_state __maybe_unused *crtc_state;struct intel_crtc *crtc; -int i; +struct intel_link_bw_limits limits; +int i, ret; -for_each_new_intel_crtc_in_state (state, crtc, crtc_state, i) { -int ret; +intel_link_bw_init_limits (state, &limits); + +for_each_new_intel_crtc_in_state (state, crtc, crtc_state, i) { ret =intel_crtc_atomic_check (state, crtc);if (ret) {drm_dbg_atomic (display->drm, -"[CRTC:%d:%s] atomic driver check failed\n" , - crtc->base.base.id, crtc->base.name); +"[CRTC:%d:%s] atomic driver check failed\n" , + crtc->base.base.id, crtc->base.name);return ret; } + +if (crtc_state->uapi.mode_changed || + crtc_state->uapi.connectors_changed || + crtc_state->update_pipe) { + ret =intel_modeset_pipe_config (state, crtc, + &limits); +if (ret) +return ret; + } }return 0 ;
@@ -6030,10 +6365,11 @@ static int intel_async_flip_check_hw(struct intel_atomic_state *state, struct inreturn -EINVAL ; } -if (old_crtc_state->active_planes != new_crtc_state->active_planes) { +if (old_crtc_state->active_planes != new_crtc_state->active_planes && + !new_crtc_state->inherited) {drm_dbg_kms (display->drm, -"[CRTC:%d:%s] Active planes cannot be in async flip\n" , - crtc->base.base.id, crtc->base.name); +"[CRTC:%d:%s] Active planes cannot be in async flip\n" , + crtc->base.base.id, crtc->base.name);return -EINVAL ; }
@@ -6361,15 +6697,81 @@ int intel_atomic_check(struct drm_device *dev,* crtc's state no longer considered to be inherited * after the first userspace/client initiated commit. */ -if (!state->internal) - new_crtc_state->inherited = false; +if (!state->internal) { +bool keep_inherited = false; + +if (boot_state_captured && new_crtc_state->uapi.active) { +/* Check if mode matches boot mode */ +if (boot_state_captured && new_crtc_state->uapi.active) { +/* Check if mode matches boot mode */ +if (new_crtc_state->uapi.mode.hdisplay == boot_hdisplay && + new_crtc_state->uapi.mode.vdisplay == boot_vdisplay) { + keep_inherited = true; + } + } + } -if (new_crtc_state->inherited != old_crtc_state->inherited) - new_crtc_state->uapi.mode_changed = true; +if (!keep_inherited) { + new_crtc_state->inherited = false; + } + }if (new_crtc_state->uapi.scaling_filter != old_crtc_state->uapi.scaling_filter) new_crtc_state->uapi.mode_changed = true; + +/* +* FIX: Aggressive Boot State Lock. +* If we have captured the boot state, we PREVENT the CRTC from being disabled. +* We force Active=1, Mode=BootMode, Connector=eDP. +*/ +if (boot_state_captured && !new_crtc_state->uapi.active) { +/* Only force if this CRTC matches the boot pipe to avoid forcing wrong pipe */ +if (crtc->pipe == boot_pipe) { + new_crtc_state->uapi.active = true; + new_crtc_state->uapi.enable = true; + +/* Restore mode if missing */ +if (!new_crtc_state->uapi.mode_blob) { +if (drm_atomic_set_mode_for_crtc (&new_crtc_state->uapi, &boot_adjusted_mode) <0 ) { +drm_err (display->drm,"Failed to set mode for boot captured crtc\n" ); + } + } + } + } + +/* +* FIX: Detect userspace setting mode without connectors (Android bug?). +* If we have a mode but no connectors, the atomic helper will error out or disable the pipe. +* We force the eDP connector to be attached to keep the display alive. +*/ +if (new_crtc_state->uapi.active && !new_crtc_state->uapi.connector_mask) { +struct drm_connector *connector; +struct drm_connector_list_iter conn_iter; + +drm_connector_list_iter_begin (dev, &conn_iter); +drm_for_each_connector_iter (connector, &conn_iter) { +if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { +struct drm_connector_state *conn_state; + + conn_state =drm_atomic_get_connector_state (&state->base, connector); +if (IS_ERR (conn_state)) { +continue ; + } + +/* Force CRTC set */ + conn_state->crtc = &crtc->base; + +/* Manually update masks */ + new_crtc_state->uapi.connector_mask |=drm_connector_mask (connector); +if (connector->encoder) + new_crtc_state->uapi.encoder_mask |=drm_encoder_mask (connector->encoder); + +break ;/* Only attach one eDP */ + } + } +drm_connector_list_iter_end (&conn_iter); + } }intel_vrr_check_modeset (state);
@@ -6690,8 +7092,22 @@ static void intel_enable_crtc(struct intel_atomic_state *state,struct intel_display *display =to_intel_display (state);const struct intel_crtc_state *new_crtc_state =intel_atomic_get_new_crtc_state (state, crtc); +const struct intel_crtc_state *old_crtc_state = +intel_atomic_get_old_crtc_state (state, crtc);struct intel_crtc *pipe_crtc; +if (new_crtc_state->inherited) { +return ; + } + +/* +* If we are transitioning from an inherited state (where disable was skipped), +* we must also skip enable because the hardware is already active. +*/ +if (old_crtc_state->inherited) { +return ; + } +if (!intel_crtc_needs_modeset (new_crtc_state))return ;
@@ -6733,7 +7149,8 @@ static void intel_pre_update_crtc(struct intel_atomic_state *state, intel_crtc_needs_color_update(new_crtc_state))intel_color_load_luts (new_crtc_state); -intel_pre_plane_update (state, crtc); +if (!old_crtc_state->inherited) +intel_pre_plane_update (state, crtc);if (intel_crtc_needs_fastset (new_crtc_state))intel_encoders_update_pipe (state, crtc);
@@ -6747,22 +7164,26 @@ static void intel_pre_update_crtc(struct intel_atomic_state *state,intel_vrr_set_transcoder_timings (new_crtc_state); } -intel_fbc_update (state, crtc); +if (!old_crtc_state->inherited) +intel_fbc_update (state, crtc);drm_WARN_ON (display->drm, !intel_display_power_is_enabled (display,POWER_DOMAIN_DC_OFF ));if (!modeset &&intel_crtc_needs_color_update (new_crtc_state) && - !new_crtc_state->use_dsb && !new_crtc_state->use_flipq) + !new_crtc_state->use_dsb && !new_crtc_state->use_flipq && + !old_crtc_state->inherited)intel_color_commit_noarm (NULL , new_crtc_state); -if (!new_crtc_state->use_dsb && !new_crtc_state->use_flipq) +if (!new_crtc_state->use_dsb && !new_crtc_state->use_flipq && + !old_crtc_state->inherited)intel_crtc_planes_update_noarm (NULL , state, crtc); }static void intel_update_crtc (struct intel_atomic_state *state,struct intel_crtc *crtc) { +struct intel_display *display =to_intel_display (state);const struct intel_crtc_state *old_crtc_state =intel_atomic_get_old_crtc_state (state, crtc); struct intel_crtc_state *new_crtc_state =
@@ -6775,6 +7196,31 @@ static void intel_update_crtc(struct intel_atomic_state *state,intel_flipq_add (crtc,INTEL_FLIPQ_PLANE_1 ,0 ,INTEL_DSB_0 , new_crtc_state->dsb_commit); + }else if (boot_state_captured && !old_crtc_state->hw.active && new_crtc_state->hw.active) { + +/* +* For the first commit on an inherited configuration we don't +* want to touch the hardware at all. We just want to sync the +* software state. +* +* 1. Skip commit_pipe_pre_planes (vblank evasion) +* 2. Skip intel_crtc_planes_update_arm (don't overwrite PLANE_SURF) +* 3. Skip commit_pipe_post_planes (don't wait for vblank) +*/ +intel_crtc_vblank_on (new_crtc_state); +gen8_irq_power_well_post_enable (display,BIT (crtc->pipe)); + +if (new_crtc_state->uapi.event) { +spin_lock_irq (&display->drm->event_lock); +drm_crtc_send_vblank_event (&crtc->base, new_crtc_state->uapi.event); +spin_unlock_irq (&display->drm->event_lock); + new_crtc_state->uapi.event =NULL ; + }else { + } + +if (new_crtc_state->uapi.commit) { +complete_all (&new_crtc_state->uapi.commit->flip_done); + } }else if (new_crtc_state->use_dsb) {intel_crtc_prepare_vblank_event (new_crtc_state, &crtc->dsb_event);
@@ -6792,6 +7238,19 @@ static void intel_update_crtc(struct intel_atomic_state *state,commit_pipe_post_planes (state, crtc); +/* Force backlight on for boot pipe fastset to ensure screen is visible */ +if (boot_state_captured && crtc->pipe == boot_pipe) { +struct drm_connector *conn; +const struct drm_connector_state *conn_state; +int i; + +for_each_new_connector_in_state (&state->base, conn, conn_state, i) { +if (conn_state->crtc == &crtc->base) { +intel_backlight_enable (new_crtc_state, conn_state); + } + } + } +intel_pipe_update_end (state, crtc); }
@@ -6812,8 +7271,9 @@ static void intel_update_crtc(struct intel_atomic_state *state,* of enabling them on the CRTC's first fastset. */ if (intel_crtc_needs_fastset (new_crtc_state) && - old_crtc_state->inherited) -intel_crtc_arm_fifo_underrun (crtc, new_crtc_state); + old_crtc_state->inherited) { +/* intel_crtc_arm_fifo_underrun(crtc, new_crtc_state); */ + } } static void intel_old_crtc_state_disables(struct intel_atomic_state *state,
@@ -6822,8 +7282,14 @@ static void intel_old_crtc_state_disables(struct intel_atomic_state *state,struct intel_display *display =to_intel_display (state);const struct intel_crtc_state *old_crtc_state =intel_atomic_get_old_crtc_state (state, crtc); +const struct intel_crtc_state *new_crtc_state = +intel_atomic_get_new_crtc_state (state, crtc);struct intel_crtc *pipe_crtc; +if (old_crtc_state->inherited && new_crtc_state->uapi.active) { +return ; + } +/* * We need to disable pipe CRC before disabling the pipe, * or we race against vblank off.
@@ -8151,23 +8617,209 @@ void intel_init_display_hooks(struct intel_display *display) } } +void intel_crtc_steal_state (struct intel_crtc_state *crtc_state) +{ +struct intel_display *display =to_intel_display (crtc_state->uapi.crtc->dev); +struct intel_crtc *crtc =to_intel_crtc (crtc_state->uapi.crtc); +struct intel_crtc_state *live_crtc_state = crtc_state; +struct intel_plane *primary =to_intel_plane (crtc->base.primary); +struct intel_plane_state *live_plane_state = +to_intel_plane_state (primary->base.state); +struct intel_encoder *encoder; +struct intel_connector *connector =NULL ; +struct drm_connector_list_iter conn_iter; +enum pipe pipe; +/* +* The pipe_config is already filled with the hw state, so just copy +* it to the uapi state. Use adjusted_mode since it has the correct +* clock after the encoder's get_config is called. +*/ + live_crtc_state->hw.active = crtc_state->hw.active; + live_crtc_state->uapi.active = crtc_state->uapi.active; + live_crtc_state->uapi.enable = crtc_state->uapi.enable; + live_crtc_state->inherited = true; +drm_mode_copy (&live_crtc_state->uapi.adjusted_mode, &crtc_state->hw.adjusted_mode); +drm_mode_copy (&live_crtc_state->hw.adjusted_mode, &crtc_state->hw.adjusted_mode); + live_crtc_state->pixel_rate = live_crtc_state->uapi.adjusted_mode.crtc_clock; + +/* FIX: Copy PLL state so the driver knows we are using a PLL */ + live_crtc_state->dpll_hw_state = crtc_state->dpll_hw_state; + live_crtc_state->dpll = crtc_state->dpll; + live_crtc_state->port_clock = crtc_state->port_clock; + live_crtc_state->lane_count = crtc_state->lane_count; + live_crtc_state->output_types = crtc_state->output_types; + +/* FIX: Also populate pipe_src so pfit doesn't complain */ +drm_rect_init (&live_crtc_state->pipe_src,0 ,0 , + crtc_state->hw.adjusted_mode.crtc_hdisplay, + crtc_state->hw.adjusted_mode.crtc_vdisplay); + +/* Capture boot state for persistence */ +if (!boot_state_captured && (crtc_state->hw.active || crtc_state->hw.adjusted_mode.crtc_clock >0 )) { + boot_pll_state = crtc_state->dpll_hw_state; + boot_shared_dpll = crtc_state->intel_dpll; + boot_port_clock = crtc_state->port_clock; + boot_lane_count = crtc_state->lane_count; + boot_pipe_bpp = crtc_state->pipe_bpp; + boot_dp_m_n = crtc_state->dp_m_n; + boot_dp_m2_n2 = crtc_state->dp_m2_n2; + boot_fec_enable = crtc_state->fec_enable; + boot_enhanced_framing = crtc_state->enhanced_framing; + boot_dsc_compression_enable = crtc_state->dsc.compression_enable; + boot_dsc_config = crtc_state->dsc.config; + boot_csc = crtc_state->csc; + boot_limited_color_range = crtc_state->limited_color_range; + boot_cpu_transcoder = crtc_state->cpu_transcoder; + + boot_gamma_mode = crtc_state->gamma_mode; + boot_csc_mode = crtc_state->csc_mode; + boot_linetime = crtc_state->linetime; + +/* [FB-FIX] Capture Watermark and DDB state */ +if (DISPLAY_VER (display) >=9 ) { +memcpy (&boot_wm, &crtc_state->wm.skl.optimal,sizeof (boot_wm)); +memcpy (&boot_ddb, &crtc_state->wm.skl.plane_ddb,sizeof (boot_ddb)); + } + +/* Capture pipe_mode which has the fixed-up logical MSO timings */ +drm_mode_copy (&boot_adjusted_mode, &crtc_state->hw.pipe_mode); + +/* +* pipe_mode might not have the clock populated (it's often 0 from readout), +* so copy the valid clock from adjusted_mode to prevent divide-by-zero later. +*/ + boot_adjusted_mode.crtc_clock = crtc_state->hw.adjusted_mode.crtc_clock; + boot_adjusted_mode.clock = crtc_state->hw.adjusted_mode.crtc_clock; + + boot_splitter.enable = crtc_state->splitter.enable; + boot_splitter.link_count = crtc_state->splitter.link_count; + boot_splitter.pixel_overlap = crtc_state->splitter.pixel_overlap; + boot_hdisplay = crtc_state->hw.pipe_mode.crtc_hdisplay; + boot_vdisplay = crtc_state->hw.pipe_mode.crtc_vdisplay; + boot_pipe = crtc->pipe; + boot_output_types = crtc_state->output_types; + + boot_state_captured = true; + } + +if (live_crtc_state->hw.active) { +/* +* This is filling in the uapi.mode and creating the blob for it. +* The blob is required for the initial commit to succeed. +*/ +memset (&live_crtc_state->uapi.mode,0 ,sizeof (live_crtc_state->uapi.mode)); + +struct drm_mode_modeinfo umode; +struct drm_property_blob *blob; + +/* Manually create the mode blob to avoid triggering a modeset */ +memset (&umode,0 ,sizeof (umode)); + umode.clock = crtc_state->hw.adjusted_mode.clock; + umode.hdisplay = crtc_state->hw.adjusted_mode.hdisplay; + umode.hsync_start = crtc_state->hw.adjusted_mode.hsync_start; + umode.hsync_end = crtc_state->hw.adjusted_mode.hsync_end; + umode.htotal = crtc_state->hw.adjusted_mode.htotal; + umode.hskew = crtc_state->hw.adjusted_mode.hskew; + umode.vdisplay = crtc_state->hw.adjusted_mode.vdisplay; + umode.vsync_start = crtc_state->hw.adjusted_mode.vsync_start; + umode.vsync_end = crtc_state->hw.adjusted_mode.vsync_end; + umode.vtotal = crtc_state->hw.adjusted_mode.vtotal; + +/* [FB-FIX] Ensure vtotal is populated to prevent scanline divide-by-zero */ +if (umode.vtotal ==0 ) { + umode.vtotal = crtc_state->hw.adjusted_mode.crtc_vtotal; + } +if (umode.vtotal ==0 ) { + umode.vtotal =1504 ;/* Fallback for MSO panel */ + } + + umode.vscan = crtc_state->hw.adjusted_mode.vscan; + umode.vrefresh =drm_mode_vrefresh (&crtc_state->hw.adjusted_mode); + umode.flags = crtc_state->hw.adjusted_mode.flags; + umode.type = crtc_state->hw.adjusted_mode.type; +strncpy (umode.name, crtc_state->hw.adjusted_mode.name,DRM_DISPLAY_MODE_LEN ); + + blob =drm_property_create_blob (display->drm,sizeof (umode), &umode); +if (IS_ERR (blob)) { + }else { +/* This is the key: replace the blob without marking mode_changed */ +drm_property_replace_blob (&live_crtc_state->uapi.mode_blob, blob); +drm_property_blob_put (blob); +drm_mode_copy (&live_crtc_state->uapi.mode, &crtc_state->hw.adjusted_mode); + live_crtc_state->uapi.enable = true; + } + }/* Mark the primary plane as visible in the live state */ + live_plane_state->uapi.visible = true; + live_crtc_state->uapi.plane_mask |=drm_plane_mask (&primary->base); + +/* Sync legacy state for consistency */ + crtc->base.enabled = crtc_state->uapi.enable; + crtc->active = crtc_state->hw.active; +drm_mode_copy (&crtc->base.mode, &crtc_state->hw.mode); +drm_mode_copy (&crtc->base.hwmode, &crtc_state->hw.adjusted_mode); + +/* +* Find the active encoder for this CRTC's pipe, then find the +* connector attached to it. This is the most reliable way to +* find the correct connector to steal. +*/ +for_each_intel_encoder (display->drm, encoder) { +if (encoder->get_hw_state (encoder, &pipe) && pipe == crtc->pipe) { +drm_connector_list_iter_begin (display->drm, &conn_iter); +for_each_intel_connector_iter (connector, &conn_iter) { +if (connector->encoder == encoder) +break ; + } +drm_connector_list_iter_end (&conn_iter); +break ; + } + } + +if (connector) { +struct drm_connector_state *live_connector_state = connector->base.state; + +/* +* Manually link the connector and CRTC in the live state. +* Using the atomic helper drm_atomic_set_crtc_for_connector() +* here is incorrect as we are not in an atomic commit. +*/ + live_connector_state->crtc = &crtc->base; + live_connector_state->best_encoder = &encoder->base; + live_crtc_state->uapi.connector_mask |= +drm_connector_mask (&connector->base); + live_crtc_state->uapi.encoder_mask |= +drm_encoder_mask (&encoder->base); + + connector->base.status = connector_status_connected; + }else { +drm_warn (display->drm,"[XE-STEAL] No active connector found for pipe %c!\n" , +pipe_name (crtc->pipe)); + }} +#ifdef CONFIG_DRM_I915 +EXPORT_SYMBOL_GPL (intel_crtc_steal_state); +#endif +int intel_initial_commit (struct intel_display *display) { +struct drm_device *dev = display->drm;struct drm_atomic_state *state =NULL ;struct drm_modeset_acquire_ctx ctx;struct intel_crtc *crtc;int ret =0 ; - state =drm_atomic_state_alloc (display->drm); -if (!state) -return -ENOMEM ; - + initial_boot_handoff = true;drm_modeset_acquire_init (&ctx,0 ); +retry: + state =drm_atomic_state_alloc (display->drm); +if (!state) { + ret = -ENOMEM ; + goto out_no_state; + } + state->acquire_ctx = &ctx;to_intel_atomic_state (state)->internal = true; -retry:for_each_intel_crtc (display->drm, crtc) {struct intel_crtc_state *crtc_state =intel_atomic_get_crtc_state (state, crtc);
@@ -8181,7 +8833,77 @@ int intel_initial_commit(struct intel_display *display) crtc_state->inherited = false;if (crtc_state->hw.active) { -struct intel_encoder *encoder; +struct intel_encoder *encoder =NULL ; +struct intel_connector *connector =NULL ; +struct drm_connector *iter_conn; +struct drm_connector_list_iter conn_iter; + + crtc_state->uapi.enable = true; + crtc_state->hw.enable = true;/* Force hw.enable to match uapi.enable */ + crtc_state->inherited = true; + + crtc_state->pixel_rate = + +to_intel_crtc_state (crtc->base.state)->uapi.adjusted_mode.crtc_clock; + + + +/* Find and link the connector for this CRTC */ + +for_each_intel_encoder (display->drm, encoder) { + +if (crtc_state->uapi.encoder_mask &drm_encoder_mask (&encoder->base)) { + +break ; + + } + + } + + + +if (encoder) { + +drm_connector_list_iter_begin (display->drm, &conn_iter); + +drm_for_each_connector_iter (iter_conn, &conn_iter) { + +if (to_intel_connector (iter_conn)->encoder == encoder) { + + connector =to_intel_connector (iter_conn); + + +break ; + } + } +drm_connector_list_iter_end (&conn_iter); + } + +if (connector) { +struct drm_connector_state *conn_state; + + conn_state =drm_atomic_get_connector_state (state, + &connector->base); +if (IS_ERR (conn_state)) { + ret =PTR_ERR (conn_state); + goto out; + } + +/* +* The state inherited from userspace has CRTC set, +* but not connector_mask. Clearing CRTC here +* forces drm_atomic_set_crtc_for_connector() to +* set both. +*/ + conn_state->crtc = &crtc->base; + + crtc_state->uapi.connector_mask |=drm_connector_mask (&connector->base); +if (connector->encoder) + crtc_state->uapi.encoder_mask |=drm_encoder_mask (&connector->encoder->base); + }else { +drm_warn (dev,"[FB-COMMIT] No connector found for CRTC %s\n" , + crtc->base.name); + } ret =drm_atomic_add_affected_planes (state, &crtc->base);if (ret)
@@ -8213,12 +8935,18 @@ int intel_initial_commit(struct intel_display *display) out:if (ret == -EDEADLK ) {drm_atomic_state_clear (state); +drm_atomic_state_put (state);drm_modeset_backoff (&ctx); goto retry; } -drm_atomic_state_put (state); - +if (ret) { +drm_atomic_state_put (state); + initial_boot_handoff = false; + }else { + initial_boot_handoff = false; + } +out_no_state:drm_modeset_drop_locks (&ctx);drm_modeset_acquire_fini (&ctx);
@@ -8339,3 +9067,20 @@ bool intel_scanout_needs_vtd_wa(struct intel_display *display)return IS_DISPLAY_VER (display,6 ,11 ) &&i915_vtd_active (i915); } + +bool intel_is_boot_mso_pipe (enum pipe pipe) +{ +if (!boot_state_captured || boot_pipe ==INVALID_PIPE ) +return false; + +return (pipe == boot_pipe && boot_splitter.enable); +} + +bool intel_is_boot_pipe (enum pipe pipe) +{ +if (!boot_state_captured || boot_pipe ==INVALID_PIPE ) +return false; + +return pipe == boot_pipe; +} +
drivers/gpu/drm/i915/display/intel_display.h +4 -0
@@ -522,6 +522,7 @@ void intel_modeset_get_crtc_power_domains(struct intel_crtc_state *crtc_state, struct intel_power_domain_mask *old_domains);void intel_modeset_put_crtc_power_domains (struct intel_crtc *crtc,struct intel_power_domain_mask *domains); +void intel_crtc_steal_state (struct intel_crtc_state *crtc_state);/* interface for intel_display_driver.c */ void intel_init_display_hooks (struct intel_display *display);
@@ -564,4 +565,7 @@ bool assert_port_valid(struct intel_display *display, enum port port);bool intel_scanout_needs_vtd_wa (struct intel_display *display);int intel_crtc_num_joined_pipes (const struct intel_crtc_state *crtc_state); +bool intel_is_boot_mso_pipe (enum pipe pipe); +bool intel_is_boot_pipe (enum pipe pipe); +#endif
Signature · 1 line
2.52.0.457.g6b5491de43-goog
RFC PATCH 4/10 drm/xe/display: Fix initial plane reconstruction and stolen memory handling
In reply to Juasheem SultanTo successfully hand off the display from BIOS to the Xe driver (fastboot), we must accurately reconstruct the initial plane state and wrap the firmware-allocated framebuffer.
This patch addresses several issues preventing this:
1. **Physical Address Resolution**: Instead of assuming a linear offset, read the GGTT PTEs directly in initial_plane_phys_smem to resolve the actual physical address of the BIOS framebuffer.
2. **Stolen Memory Management**: Register the TTM driver manager for XE_PL_STOLEN in xe_ttm_stolen_mgr_init. This is required to allocate/wrap buffer objects in stolen memory for the initial plane.
3. **Active State enforcement**: Force uapi.active to true for all CRTCs during intel_initial_plane_config. The software state might not yet reflect the hardware state (left active by BIOS), and this ensures the driver attempts to read out the configuration.
4. **Visual Verification**: Write a test gradient pattern to the initial framebuffer upon successful mapping to verify write access and correct mapping.
--- drivers/gpu/drm/i915/display/intel_plane_initial.c | 53 ++++++++++++++++++++++ drivers/gpu/drm/xe/display/xe_plane_initial.c | 28 +++++++++++- drivers/gpu/drm/xe/xe_ggtt.h | 3 ++ drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c | 2 + 4 files changed, 85 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_plane_initial.c +53 -0
@@ -121,6 +121,51 @@ initial_plane_phys(struct intel_display *display,return true; } +static bool +initial_plane_phys_smem (struct intel_display *display, +struct intel_initial_plane_config *plane_config) +{ +struct drm_i915_private *i915 =to_i915 (display->drm); +gen8_pte_t __iomem *gte =to_gt (i915)->ggtt->gsm; +struct intel_memory_region *mem; +dma_addr_t dma_addr; +gen8_pte_t pte; +u32 base; + + base =round_down (plane_config->base,I915_GTT_MIN_ALIGNMENT ); + + gte += base /I915_GTT_PAGE_SIZE ; + + pte =ioread64 (gte); + + dma_addr = pte &GEN12_GGTT_PTE_ADDR_MASK ; + + mem = i915->mm.stolen_region; +if (!mem) { +drm_dbg_kms (display->drm, +"Initial plane memory region not initialized\n" ); +return false; + } + +/* FIXME get and validate the dma_addr from the PTE */ + plane_config->phys_base = dma_addr; + plane_config->mem = mem; + +return true; +} + +static bool +initial_plane_phys (struct intel_display *display, +struct intel_initial_plane_config *plane_config) +{ +struct drm_i915_private *i915 =to_i915 (display->drm); + +if (IS_DGFX (i915) ||HAS_LMEMBAR_SMEM_STOLEN (i915)) +return initial_plane_phys_lmem (display, plane_config); +else +return initial_plane_phys_smem (display, plane_config); +} +static struct i915_vma *initial_plane_vma (struct intel_display *display,struct intel_initial_plane_config *plane_config)
@@ -405,6 +450,14 @@ void intel_initial_plane_config(struct intel_display *display)struct intel_initial_plane_config plane_configs[I915_MAX_PIPES ] = {};struct intel_crtc *crtc; +/* +* BIOS is messy and may leave the CRTCs active, but the driver's software +* state may not reflect that. We need to poke the driver to ensure that +* it thinks the CRTCs are active, otherwise the plane scan won't happen. +*/ +for_each_intel_crtc (display->drm, crtc) +to_intel_crtc_state (crtc->base.state)->uapi.active = true; +for_each_intel_crtc (display->drm, crtc) {struct intel_initial_plane_config *plane_config = &plane_configs[crtc->pipe];
drivers/gpu/drm/xe/display/xe_plane_initial.c +27 -1
@@ -192,6 +192,24 @@ intel_alloc_initial_plane_obj(struct intel_crtc *crtc, }/* Reference handed over to fb */ xe_bo_put (bo); +if (bo->vmap.vaddr && plane_config->fb) { +int x, y; +void *vaddr = bo->vmap.vaddr; +u32 height = plane_config->fb->base.height; +u32 width = plane_config->fb->base.width; +u32 pitch = plane_config->fb->base.pitches[0 ]; + +for (y =0 ; y < height; y++) { +u8 red =255 * (height - y) / height; +u8 blue =255 * y / height; +u32 color = (0xFF <<24 ) | (red <<16 ) | blue; +u32 *row = (u32 *)((u8 *)vaddr + y * pitch); + +for (x =0 ; x < width; x++) { + row[x] = color; + } + } + }return true;
@@ -268,6 +286,8 @@ intel_find_initial_plane_obj(struct intel_crtc *crtc,* simplest solution is to just disable the primary plane now and * pretend the BIOS never had it enabled. */ +to_intel_crtc_state (crtc->base.state)->hw.active = false; +to_intel_crtc_state (crtc->base.state)->uapi.active = false;intel_plane_disable_noatomic (crtc, plane); }
@@ -288,7 +308,13 @@ void intel_initial_plane_config(struct intel_display *display) {struct intel_initial_plane_config plane_configs[I915_MAX_PIPES ] = {};struct intel_crtc *crtc; - +/* +* BIOS is messy and may leave the CRTCs active, but the drive's software +* state may not reflect that. We need to poke the driver to ensure that +* it thinks the CRTCs are active, otherwise the plane scan wo't happen. +*/ +for_each_intel_crtc (display->drm, crtc) +to_intel_crtc_state (crtc->base.state)->uapi.active = true;for_each_intel_crtc (display->drm, crtc) {struct intel_initial_plane_config *plane_config = &plane_configs[crtc->pipe];
drivers/gpu/drm/xe/xe_ggtt.h +3 -0
@@ -6,8 +6,11 @@#ifndef _XE_GGTT_H_#define _XE_GGTT_H_ +#include <linux/bits.h> #include "xe_ggtt_types.h" +#define GEN12_GGTT_PTE_ADDR_MASK GENMASK_ULL(45, 12) +struct drm_printer ;struct xe_tile ;struct drm_exec ;
drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c +2 -0
@@ -256,6 +256,8 @@ int xe_ttm_stolen_mgr_init(struct xe_device *xe)if (io_size) mgr->mapping =devm_ioremap_wc (&pdev->dev, mgr->io_base, io_size); +ttm_set_driver_manager (&xe->ttm,XE_PL_STOLEN , &mgr->base.manager); +return 0 ; }
Signature · 1 line
2.52.0.457.g6b5491de43-goog
RFC PATCH 5/10 drm/i915/display: Enable early PLL readout and robustify modeset setup
In reply to Juasheem SultanTo support seamless boot and accurate state reconstruction on PTL:
1. Introduce intel_dpll_readout_hw_state_early() to capture shared DPLL states before the full modeset readout loop. This ensures PLL state is available when reconstructing CRTC states.
2. In intel_modeset_readout_hw_state(), explicitly set connector status to connected if an encoder is active. This prevents the framework from treating active boot connectors as disconnected if a subsequent detect() call hasn't run yet.
3. Add a NULL check for encoder->get_hw_state to prevent crashes during early readout if an encoder isn't fully initialized.
4. Suppress a warning in skl_ddi_dpll0_get_hw_state that can trigger during early boot transitions.
--- drivers/gpu/drm/i915/display/intel_dpll_mgr.c | 16 +++++++++++++--- drivers/gpu/drm/i915/display/intel_dpll_mgr.h | 1 + drivers/gpu/drm/i915/display/intel_modeset_setup.c | 7 +++++++ 3 files changed, 21 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_dpll_mgr.c +13 -3
@@ -1482,15 +1482,15 @@ static bool skl_ddi_dpll0_get_hw_state(struct intel_display *display,/* DPLL0 is always enabled since it drives CDCLK */ val =intel_de_read (display, regs[id].ctl); -if (drm_WARN_ON (display->drm, !(val &LCPLL_PLL_ENABLE ))) - goto out; +//if (drm_WARN_ON(display->drm, !(val & LCPLL_PLL_ENABLE))) +// goto out; val =intel_de_read (display,DPLL_CTRL1 ); hw_state->ctrl1 = (val >> (id *6 )) &0x3f ; ret = true; -out: +//out: intel_display_power_put (display,POWER_DOMAIN_DISPLAY_CORE , wakeref);return ret;
@@ -4513,6 +4513,16 @@ bool intel_dpll_get_hw_state(struct intel_display *display,return pll->info->funcs->get_hw_state (display, pll, dpll_hw_state); } +void intel_dpll_readout_hw_state_early (struct intel_display *display) +{ +struct intel_dpll *pll; +int i; + +for_each_dpll (display, pll, i) { + pll->on =intel_dpll_get_hw_state (display, pll, &pll->state.hw_state); + } +} +static void readout_dpll_hw_state (struct intel_display *display,struct intel_dpll *pll) {
drivers/gpu/drm/i915/display/intel_dpll_mgr.h +1 -0
@@ -424,6 +424,7 @@ void intel_dpll_swap_state(struct intel_atomic_state *state);void intel_dpll_init (struct intel_display *display);void intel_dpll_update_ref_clks (struct intel_display *display);void intel_dpll_readout_hw_state (struct intel_display *display); +void intel_dpll_readout_hw_state_early (struct intel_display *display);void intel_dpll_sanitize_state (struct intel_display *display); void intel_dpll_dump_hw_state(struct intel_display *display,
drivers/gpu/drm/i915/display/intel_modeset_setup.c +7 -0
@@ -696,6 +696,8 @@ static void intel_modeset_readout_hw_state(struct intel_display *display)struct intel_connector *connector;struct drm_connector_list_iter conn_iter; +intel_dpll_readout_hw_state_early (display); +for_each_intel_crtc (display->drm, crtc) {struct intel_crtc_state *crtc_state =to_intel_crtc_state (crtc->base.state);
@@ -724,6 +726,10 @@ static void intel_modeset_readout_hw_state(struct intel_display *display) pipe =0 ; +if (!encoder->get_hw_state) { +continue ; + } +if (encoder->get_hw_state (encoder, &pipe)) { crtc =intel_crtc_for_pipe (display, pipe); crtc_state =to_intel_crtc_state (crtc->base.state);
@@ -778,6 +784,7 @@ static void intel_modeset_readout_hw_state(struct intel_display *display)struct intel_crtc *crtc; connector->base.dpms =DRM_MODE_DPMS_ON ; + connector->base.status = connector_status_connected; encoder =intel_attached_encoder (connector); connector->base.encoder = &encoder->base;
Signature · 1 line
2.52.0.457.g6b5491de43-goog
RFC PATCH 6/10 drm/i915/display: Fix vblank timestamps and update logic for fastboot
In reply to Juasheem SultanWhen inheriting the display state from BIOS (fastboot/seamless boot), the DRM core's vblank timestamping constants (linedur_ns, framedur_ns) may not be correctly initialized, leading to warnings or incorrect timestamp values in pageflip events.
Additionally, the standard intel_pipe_update_start/end sequences perform operations (vblank evasion, PSR locking, tracepoints) that are unnecessary or harmful when we are merely synchronizing the software state to the already-active hardware.
This patch addresses these issues:
1. **Manual Timestamp Calculation**: Re-implements intel_calc_timestamping_constants to force-update vblank->hwmode and duration variables from the adjusted mode, ensuring valid timestamps even without a full modeset.
2. **Inherited State Bypass**: In intel_pipe_update_start and intel_pipe_update_end, skip the standard hardware-touching logic if the CRTC state is marked as inherited.
3. **Vblank Event Handling**: Within the intel_pipe_update_end bypass path, explicitly send any pending vblank events. This is critical to signal completion to userspace (e.g., SurfaceFlinger) without waiting for hardware vblanks that the driver isn't tracking yet.
4. **Assertion Fixes**: Skip assert_vblank_disabled in intel_crtc_vblank_on for inherited states, as the vblank interrupt might already be running or the hardware state is effectively active.
--- drivers/gpu/drm/i915/display/intel_crtc.c | 59 +++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_crtc.c +56 -3
@@ -20,6 +20,7 @@#include "intel_color.h" #include "intel_crtc.h" #include "intel_cursor.h" +#include "intel_display.h" #include "intel_display_debugfs.h" #include "intel_display_irq.h" #include "intel_display_trace.h"
@@ -120,15 +121,45 @@ u32 intel_crtc_max_vblank_count(const struct intel_crtc_state *crtc_state)return 0 ;/* Gen2 doesn't have a hardware frame counter */ } +static void intel_calc_timestamping_constants (struct drm_crtc *crtc, +const struct drm_display_mode *mode) +{ +struct drm_vblank_crtc *vblank =drm_crtc_vblank_crtc (crtc); +int linedur_ns =0 , framedur_ns =0 ; +int dotclock = mode->crtc_clock; + +if (dotclock >0 ) { +int frame_size = mode->crtc_htotal * mode->crtc_vtotal; + + linedur_ns =div_u64 ((u64 ) mode->crtc_htotal *1000000 , dotclock); + framedur_ns =div_u64 ((u64 ) frame_size *1000000 , dotclock); + } + + vblank->linedur_ns = linedur_ns; + vblank->framedur_ns = framedur_ns; + +if (drm_drv_uses_atomic_modeset (crtc->dev)) { +drm_mode_copy (&vblank->hwmode, mode); +drm_dbg_kms (crtc->dev,"[FB-FIX] Updated vblank->hwmode: clock=%d\n" , mode->crtc_clock); + } +} +void intel_crtc_vblank_on (const struct intel_crtc_state *crtc_state) {struct intel_crtc *crtc =to_intel_crtc (crtc_state->uapi.crtc); crtc->vblank_psr_notify =intel_psr_needs_vblank_notification (crtc_state); -assert_vblank_disabled (&crtc->base); -drm_crtc_set_max_vblank_count (&crtc->base, -intel_crtc_max_vblank_count (crtc_state)); +if (crtc_state->inherited) { + }else { +assert_vblank_disabled (&crtc->base); +drm_crtc_set_max_vblank_count (&crtc->base, +intel_crtc_max_vblank_count (crtc_state)); + } + +/* [FB-FIX] Force calculation of constants to ensure framedur_ns is set */ +intel_calc_timestamping_constants (&crtc->base, &crtc_state->hw.adjusted_mode); +drm_crtc_vblank_on (&crtc->base);/*
@@ -524,6 +555,13 @@ void intel_pipe_update_start(struct intel_atomic_state *state,struct intel_vblank_evade_ctx evade;int scanline; +/* [FB-FIX] Ensure timestamping constants are set for all updates */ +intel_calc_timestamping_constants (&crtc->base, &new_crtc_state->hw.adjusted_mode); + +if (new_crtc_state->inherited || old_crtc_state->inherited) { +return ; + } +drm_WARN_ON (display->drm, new_crtc_state->use_dsb);intel_psr_lock (new_crtc_state);
@@ -658,12 +696,27 @@ void intel_pipe_update_end(struct intel_atomic_state *state,struct intel_display *display =to_intel_display (state);struct intel_crtc_state *new_crtc_state =intel_atomic_get_new_crtc_state (state, crtc); +const struct intel_crtc_state *old_crtc_state = +intel_atomic_get_old_crtc_state (state, crtc);enum pipe pipe = crtc->pipe;int scanline_end =intel_get_crtc_scanline (crtc);u32 end_vbl_count =intel_crtc_get_vblank_counter (crtc);ktime_t end_vbl_time =ktime_get ();struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); +if (new_crtc_state->inherited || old_crtc_state->inherited) { +unsigned long irqflags; + +if (new_crtc_state->uapi.event) { +spin_lock_irqsave (&dev_priv->drm.event_lock, irqflags); +drm_crtc_send_vblank_event (&crtc->base, new_crtc_state->uapi.event); +spin_unlock_irqrestore (&dev_priv->drm.event_lock, irqflags); + new_crtc_state->uapi.event =NULL ; + } + +return ; + } +drm_WARN_ON (display->drm, new_crtc_state->use_dsb);if (new_crtc_state->do_async_flip)
Signature · 1 line
2.52.0.457.g6b5491de43-goog
RFC PATCH 7/10 drm/i915/display: Implement seamless fastboot for MSO panels on PTL
In reply to Juasheem SultanThe standard display probe and modeset setup path (intel_setup_outputs, intel_modeset_setup_hw_state) often resets the hardware or fails to perfectly match the BIOS configuration for dual-link MSO (Multi-Segment Operation) panels. This causes screen flickering or black screens during boot on Panther Lake (PTL).
This patch introduces a specialized "fastboot" probe path in intel_display_driver_probe_nogem:
1. **Active Pipe Detection**: Iterates through pipes to find the one left active by the BIOS.
2. **Hardware State Readout**: Uses intel_crtc_get_pipe_config to accurately read the current hardware state.
3. **MSO Timing Reconstruction**: Detects if the hardware is driving an MSO split mode (e.g., 1128px width) and manually scales the timings (hdisplay, htotal, clock, etc.) to the full logical resolution (2256px). This ensures the mode matches VBT/userspace expectations and prevents invalid mode rejection.
4. **Topology Reconstruction**: Identifies the active encoder and connector, links them to the CRTC, and synthesizes a valid DRM mode from the readout.
5. **State Locking**: Invokes intel_crtc_steal_state to persist this configuration as the initial atomic state.
6. **Cleanup & Bypass**: Removes unused connectors to prevent interference and skips the standard heavyweight output setup if a valid BIOS configuration is successfully reconstructed.
This ensures the kernel driver seamlessly takes over the display without an intermediate modeset, preserving the splash screen.
--- drivers/gpu/drm/i915/display/intel_display.h | 2 - .../gpu/drm/i915/display/intel_display_driver.c | 309 +++++++++++++++++++-- 2 files changed, 286 insertions(+), 25 deletions(-)
drivers/gpu/drm/i915/display/intel_display.h +0 -2
@@ -531,8 +531,6 @@ int intel_initial_commit(struct intel_display *display);void intel_panel_sanitize_ssc (struct intel_display *display);void intel_update_czclk (struct intel_display *display);void intel_setup_encoders (struct intel_display *display); -void intel_panel_sanitize_ssc (struct drm_i915_private *i915); -void intel_update_czclk (struct drm_i915_private *i915);void intel_atomic_helper_free_state_worker (struct work_struct *work);enum drm_mode_status intel_mode_valid (struct drm_device *dev,const struct drm_display_mode *mode);
drivers/gpu/drm/i915/display/intel_display_driver.c +286 -23
402 lines not on this page · raw message
Signature · 1 line
2.52.0.457.g6b5491de43-goog
RFC PATCH 8/10 drm/i915/display: Robustify fastboot and power init for seamless boot
In reply to Juasheem SultanTo support a seamless transition from BIOS to kernel driver (fastboot), especially on PTL with MSO panels, several adjustments are needed to avoid unnecessary hardware resets and verification failures.
1. **Power Well & CDCLK Preservation**: In icl_display_core_init, check if the display power well 1 is already enabled. If so, preserve the current CDCLK configuration instead of forcibly resetting it. This prevents the display from glitching or blanking during driver load.
2. **Verification Relaxation**:
* Skip the "connector not active" warning in intel_connector_verify_state
for MSO panels where the split link topology might confuse the standard checks during fastset.
* Bypass intel_modeset_verify_crtc for inherited states or the
boot pipe if no full modeset is required. This avoids verifying state that hasn't been fully touched by the driver yet but is known to be valid from BIOS.
3. **Type Extensions**: Add necessary fields to intel_atomic_state (fastset flag), intel_digital_port (DDI tracking), and intel_vbt_panel_data (MSO parameters) to support the enhanced fastboot logic.
--- drivers/gpu/drm/i915/display/intel_display_power.c | 16 +++++++++++++--- drivers/gpu/drm/i915/display/intel_display_types.h | 8 ++++++++ drivers/gpu/drm/i915/display/intel_modeset_verify.c | 14 ++++++++++++-- 3 files changed, 33 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/display/intel_display_power.c +13 -3
@@ -1661,8 +1661,7 @@ static void icl_display_core_init(struct intel_display *display, {struct i915_power_domains *power_domains = &display->power.domains;struct i915_power_well *well; - -gen9_set_dc_state (display,DC_STATE_DISABLE ); +bool was_enabled;/* Wa_14011294188:ehl,jsl,tgl,rkl,adl-s */ if (INTEL_PCH_TYPE(display) >= PCH_TGP &&
@@ -1685,6 +1684,7 @@ static void icl_display_core_init(struct intel_display *display,*/ mutex_lock (&power_domains->lock); well =lookup_power_well (display,SKL_DISP_PW_1 ); + was_enabled =intel_power_well_is_enabled (display, well);intel_power_well_enable (display, well);mutex_unlock (&power_domains->lock);
@@ -1693,7 +1693,17 @@ static void icl_display_core_init(struct intel_display *display, HOLD_PHY_PG1_LATCH | HOLD_PHY_CLKREQ_PG1_LATCH, 0);/* 4. Enable CDCLK. */ -intel_cdclk_init_hw (display); +if (was_enabled) { +struct intel_cdclk_config cdclk_config; + +intel_cdclk_get_cdclk (display, &cdclk_config); +if (intel_cdclk_clock_changed (&display->cdclk.hw, &cdclk_config)) { + display->cdclk.hw = cdclk_config; + } + }else { +gen9_set_dc_state (display,DC_STATE_DISABLE ); +intel_cdclk_init_hw (display); + }if (DISPLAY_VER (display) ==12 || display->platform.dg2)gen12_dbuf_slices_config (display);
drivers/gpu/drm/i915/display/intel_display_types.h +8 -0
@@ -350,6 +350,8 @@ struct intel_vbt_panel_data {bool low_vswing;bool hobl;bool dsc_disable; +u8 mso_link_count; +u8 mso_pixel_overlap; } edp;struct {
@@ -594,6 +596,8 @@ struct dpll {struct intel_atomic_state {struct drm_atomic_state base; +bool fastset; +struct ref_tracker *wakeref;struct intel_global_objs_state *global_objs;
@@ -1879,6 +1883,10 @@ struct intel_lspcon {struct intel_digital_port {struct intel_encoder base; +i915_reg_t ddi_buf_ctl_reg; +intel_wakeref_t ddi_power_wakeref; + +u32 saved_port_bits;struct intel_dp dp;struct intel_hdmi hdmi;struct intel_lspcon lspcon;
drivers/gpu/drm/i915/display/intel_modeset_verify.c +12 -2
@@ -55,8 +55,13 @@ static void intel_connector_verify_state(const struct intel_crtc_state *crtc_staINTEL_DISPLAY_STATE_WARN (display, conn_state->crtc != encoder->base.crtc,"attached encoder crtc differs from connector crtc\n" ); }else { -INTEL_DISPLAY_STATE_WARN (display, crtc_state && crtc_state->hw.active, -"attached crtc is active, but connector isn't\n" ); +/* +* HACK: Skip this warning for MSO panels if fastset is being tricky. +*/ +if (!crtc_state || !crtc_state->splitter.enable) +INTEL_DISPLAY_STATE_WARN (display, crtc_state && crtc_state->hw.active, +"attached crtc is active, but connector isn't\n" ); +INTEL_DISPLAY_STATE_WARN (display, !crtc_state && conn_state->best_encoder,"best encoder set without crtc!\n" ); }
@@ -236,6 +241,11 @@ void intel_modeset_verify_crtc(struct intel_atomic_state *state,const struct intel_crtc_state *new_crtc_state =intel_atomic_get_new_crtc_state (state, crtc); +if (new_crtc_state->inherited || + (intel_is_boot_pipe (crtc->pipe) && !intel_crtc_needs_modeset (new_crtc_state))) { +return ; + } +if (!intel_crtc_needs_modeset (new_crtc_state) && !intel_crtc_needs_fastset (new_crtc_state))return ;
Signature · 1 line
2.52.0.457.g6b5491de43-goog
RFC PATCH 9/10 drm/i915/display: Fix initial plane config readout and MSO stride for PTL
In reply to Juasheem SultanTo ensure a clean display handover from the bootloader on Panther Lake (PTL) platforms, particularly with MSO panels, the initial plane configuration readout must be robust against hardware state ambiguities.
This patch introduces several fixes to skl_get_initial_plane_config and plane update routines:
1. **Framebuffer Base Address**: The PLANE_SURF register readout can be unreliable during the early boot phase. Experience with Coreboot and previous i915 behavior indicates the boot framebuffer is typically located at offset 0 of the stolen memory. This patch forces the base offset to 0 to match this expectation.
2. **MSO Stride Workaround**: For 2256px wide MSO panels, the stride calculation needs a specific override (0x8d) to avoid display artifacts. This is applied in icl_plane_update_noarm when the state is inherited.
3. **Simplified Modifier Readout**: Complex checks for media/render decompression (CCS/MC/RC) are removed from the initial readout. The logic now falls back to standard tiling formats (Y, Yf, 4-tiled) to ensure a valid framebuffer is created even if the exact compression state is ambiguous.
4. **Inherited State Protection**: When the CRTC state is inherited (during the first atomic commit):
* Watermark programming is skipped to prevent corrupting the active
display.
* Specific PLANE_CTL bits (like bit 3) are preserved during updates
to maintain the BIOS configuration.
These changes prevent visual corruption and "garbage" pixels during the driver load sequence.
--- drivers/gpu/drm/i915/display/intel_crtc.c | 9 +- drivers/gpu/drm/i915/display/intel_display.c | 12 +- .../gpu/drm/i915/display/intel_display_driver.c | 73 ++++++++-- drivers/gpu/drm/i915/display/skl_universal_plane.c | 151 +++++++++++---------- 4 files changed, 150 insertions(+), 95 deletions(-)
drivers/gpu/drm/i915/display/intel_crtc.c +6 -3
@@ -558,9 +558,12 @@ void intel_pipe_update_start(struct intel_atomic_state *state,/* [FB-FIX] Ensure timestamping constants are set for all updates */ intel_calc_timestamping_constants (&crtc->base, &new_crtc_state->hw.adjusted_mode); -if (new_crtc_state->inherited || old_crtc_state->inherited) { -return ; - } +/* +* Allow updates even if inherited to fix skew/grayscale on seamless boot. +* if (new_crtc_state->inherited || old_crtc_state->inherited) { +* return; +* } +*/ drm_WARN_ON (display->drm, new_crtc_state->use_dsb);
drivers/gpu/drm/i915/display/intel_display.c +5 -7
@@ -4761,7 +4761,7 @@ intel_modeset_pipe_config(struct intel_atomic_state *state,int new_v =0 ;/* Only restore boot state if this is the initial inherited commit */ -if (boot_state_captured && crtc_state->uapi.enable && crtc_state->inherited) { +if (boot_state_captured && crtc_state->uapi.enable) { new_h = crtc_state->hw.adjusted_mode.crtc_hdisplay; new_v = crtc_state->hw.adjusted_mode.crtc_vdisplay;
@@ -7149,8 +7149,7 @@ static void intel_pre_update_crtc(struct intel_atomic_state *state, intel_crtc_needs_color_update(new_crtc_state))intel_color_load_luts (new_crtc_state); -if (!old_crtc_state->inherited) -intel_pre_plane_update (state, crtc); +intel_pre_plane_update (state, crtc);if (intel_crtc_needs_fastset (new_crtc_state))intel_encoders_update_pipe (state, crtc);
@@ -7164,19 +7163,18 @@ static void intel_pre_update_crtc(struct intel_atomic_state *state,intel_vrr_set_transcoder_timings (new_crtc_state); } -if (!old_crtc_state->inherited) -intel_fbc_update (state, crtc); +intel_fbc_update (state, crtc);drm_WARN_ON (display->drm, !intel_display_power_is_enabled (display,POWER_DOMAIN_DC_OFF ));if (!modeset &&intel_crtc_needs_color_update (new_crtc_state) && !new_crtc_state->use_dsb && !new_crtc_state->use_flipq && - !old_crtc_state->inherited) + !new_crtc_state->inherited)intel_color_commit_noarm (NULL , new_crtc_state);if (!new_crtc_state->use_dsb && !new_crtc_state->use_flipq && - !old_crtc_state->inherited) + !new_crtc_state->inherited)intel_crtc_planes_update_noarm (NULL , state, crtc); }
drivers/gpu/drm/i915/display/intel_display_driver.c +63 -10
102 lines not on this page · raw message
drivers/gpu/drm/i915/display/skl_universal_plane.c +76 -75
241 lines not on this page · raw message
Signature · 1 line
2.52.0.457.g6b5491de43-goog
RFC PATCH 10/10 drm/i915/display: Refactor initial plane readout and harden boot handover
In reply to Juasheem SultanRefactor the initial plane configuration and atomic commit path to ensure a seamless transition from the bootloader to the driver, specifically targeting Panther Lake (PTL) platforms.
Key changes include:
1. **Robust Initial Plane Readout**: Rewrote skl_get_initial_plane_config to correctly identify tiling modifiers (including CCS/MC variants) instead of relying on fallbacks. This ensures the framebuffer is created with the correct format layout and rotation.
2. **Hardened Atomic Handover**: Added checks for old_crtc_state->inherited in intel_pre_plane_update, intel_pre_update_crtc, and intel_old_crtc_state_disables. This prevents the driver from prematurely disabling the pipe, updating watermarks, or touching FBC during the initial takeover, preserving the boot image.
3. **Removal of Hardcoded Hacks**: Removed temporary workarounds, including hardcoded MSO stride (0x8d), link rate overrides (216000), and forced sync flags. The driver now relies on correct hardware readout and state persistence.
4. **Splash Screen Preservation**: Disabled the framebuffer clear loop in xe_plane_initial.c to prevent overwriting the BIOS splash screen during initialization.
--- drivers/gpu/drm/i915/display/intel_display.c | 195 +++++++++------------ .../gpu/drm/i915/display/intel_display_driver.c | 35 +--- drivers/gpu/drm/i915/display/intel_dp.c | 15 -- drivers/gpu/drm/i915/display/skl_universal_plane.c | 147 +++++++++------- drivers/gpu/drm/xe/display/xe_plane_initial.c | 4 +- 5 files changed, 167 insertions(+), 229 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +83 -112
@@ -1301,7 +1301,7 @@ static void intel_pre_plane_update(struct intel_atomic_state *state,* us to. */ if (!intel_initial_watermarks (state, crtc)) -if (new_crtc_state->update_wm_pre) +if (new_crtc_state->update_wm_pre && !old_crtc_state->inherited)intel_update_watermarks (display); }
@@ -2967,7 +2967,7 @@ static void intel_get_pipe_src_size(struct intel_crtc *crtc,REG_FIELD_GET (PIPESRC_WIDTH_MASK , tmp) +1 , REG_FIELD_GET(PIPESRC_HEIGHT_MASK, tmp) + 1); -/* [FB-FIX] Force pipe source size from boot state if HW readout is invalid (seamless handoff) */ +/* Force pipe source size from boot state if HW readout is invalid (seamless handoff) */ if (boot_state_captured && crtc->pipe == boot_pipe && (drm_rect_width (&pipe_config->pipe_src) <=1 ||drm_rect_height (&pipe_config->pipe_src) <=1 )) {drm_rect_init (&pipe_config->pipe_src,0 ,0 , boot_hdisplay, boot_vdisplay);
@@ -7149,7 +7149,8 @@ static void intel_pre_update_crtc(struct intel_atomic_state *state, intel_crtc_needs_color_update(new_crtc_state))intel_color_load_luts (new_crtc_state); -intel_pre_plane_update (state, crtc); +if (!old_crtc_state->inherited) +intel_pre_plane_update (state, crtc);if (intel_crtc_needs_fastset (new_crtc_state))intel_encoders_update_pipe (state, crtc);
@@ -7163,7 +7164,8 @@ static void intel_pre_update_crtc(struct intel_atomic_state *state,intel_vrr_set_transcoder_timings (new_crtc_state); } -intel_fbc_update (state, crtc); +if (!old_crtc_state->inherited) +intel_fbc_update (state, crtc);drm_WARN_ON (display->drm, !intel_display_power_is_enabled (display,POWER_DOMAIN_DC_OFF ));
@@ -7275,24 +7277,17 @@ static void intel_update_crtc(struct intel_atomic_state *state, }static void intel_old_crtc_state_disables (struct intel_atomic_state *state, -struct intel_crtc *crtc) -{ -struct intel_display *display =to_intel_display (state); -const struct intel_crtc_state *old_crtc_state = -intel_atomic_get_old_crtc_state (state, crtc); -const struct intel_crtc_state *new_crtc_state = -intel_atomic_get_new_crtc_state (state, crtc); -struct intel_crtc *pipe_crtc; - -if (old_crtc_state->inherited && new_crtc_state->uapi.active) { -return ; - } - -/* -* We need to disable pipe CRC before disabling the pipe, -* or we race against vblank off. -*/ -for_each_intel_crtc_in_pipe_mask (display->drm, pipe_crtc, +struct intel_crtc *crtc) + { +struct intel_display *display =to_intel_display (state); +const struct intel_crtc_state *old_crtc_state = +intel_atomic_get_old_crtc_state (state, crtc); +struct intel_crtc *pipe_crtc; + +/* +* We need to disable pipe CRC before disabling the pipe, +* or we race against vblank off. +*/ for_each_intel_crtc_in_pipe_mask (display->drm, pipe_crtc, intel_crtc_joined_pipe_mask(old_crtc_state))intel_crtc_disable_pipe_crc (pipe_crtc);
@@ -8649,8 +8644,8 @@ void intel_crtc_steal_state(struct intel_crtc_state *crtc_state)/* FIX: Also populate pipe_src so pfit doesn't complain */ drm_rect_init (&live_crtc_state->pipe_src,0 ,0 , - crtc_state->hw.adjusted_mode.crtc_hdisplay, - crtc_state->hw.adjusted_mode.crtc_vdisplay); + crtc_state->hw.adjusted_mode.crtc_hdisplay, + crtc_state->hw.adjusted_mode.crtc_vdisplay);/* Capture boot state for persistence */ if (!boot_state_captured && (crtc_state->hw.active || crtc_state->hw.adjusted_mode.crtc_clock >0 )) {
@@ -8673,7 +8668,7 @@ void intel_crtc_steal_state(struct intel_crtc_state *crtc_state) boot_csc_mode = crtc_state->csc_mode; boot_linetime = crtc_state->linetime; -/* [FB-FIX] Capture Watermark and DDB state */ +/* Capture Watermark and DDB state */ if (DISPLAY_VER (display) >=9 ) {memcpy (&boot_wm, &crtc_state->wm.skl.optimal,sizeof (boot_wm));memcpy (&boot_ddb, &crtc_state->wm.skl.plane_ddb,sizeof (boot_ddb));
@@ -8700,53 +8695,45 @@ void intel_crtc_steal_state(struct intel_crtc_state *crtc_state) boot_state_captured = true; } -if (live_crtc_state->hw.active) { -/* -* This is filling in the uapi.mode and creating the blob for it. -* The blob is required for the initial commit to succeed. -*/ -memset (&live_crtc_state->uapi.mode,0 ,sizeof (live_crtc_state->uapi.mode)); - -struct drm_mode_modeinfo umode; -struct drm_property_blob *blob; - -/* Manually create the mode blob to avoid triggering a modeset */ -memset (&umode,0 ,sizeof (umode)); - umode.clock = crtc_state->hw.adjusted_mode.clock; - umode.hdisplay = crtc_state->hw.adjusted_mode.hdisplay; - umode.hsync_start = crtc_state->hw.adjusted_mode.hsync_start; - umode.hsync_end = crtc_state->hw.adjusted_mode.hsync_end; - umode.htotal = crtc_state->hw.adjusted_mode.htotal; - umode.hskew = crtc_state->hw.adjusted_mode.hskew; - umode.vdisplay = crtc_state->hw.adjusted_mode.vdisplay; - umode.vsync_start = crtc_state->hw.adjusted_mode.vsync_start; - umode.vsync_end = crtc_state->hw.adjusted_mode.vsync_end; - umode.vtotal = crtc_state->hw.adjusted_mode.vtotal; - -/* [FB-FIX] Ensure vtotal is populated to prevent scanline divide-by-zero */ -if (umode.vtotal ==0 ) { - umode.vtotal = crtc_state->hw.adjusted_mode.crtc_vtotal; - } -if (umode.vtotal ==0 ) { - umode.vtotal =1504 ;/* Fallback for MSO panel */ - } - - umode.vscan = crtc_state->hw.adjusted_mode.vscan; - umode.vrefresh =drm_mode_vrefresh (&crtc_state->hw.adjusted_mode); - umode.flags = crtc_state->hw.adjusted_mode.flags; - umode.type = crtc_state->hw.adjusted_mode.type; -strncpy (umode.name, crtc_state->hw.adjusted_mode.name,DRM_DISPLAY_MODE_LEN ); - - blob =drm_property_create_blob (display->drm,sizeof (umode), &umode); -if (IS_ERR (blob)) { - }else { -/* This is the key: replace the blob without marking mode_changed */ -drm_property_replace_blob (&live_crtc_state->uapi.mode_blob, blob); -drm_property_blob_put (blob); -drm_mode_copy (&live_crtc_state->uapi.mode, &crtc_state->hw.adjusted_mode); - live_crtc_state->uapi.enable = true; - } - }/* Mark the primary plane as visible in the live state */ +if (live_crtc_state->hw.active) { +/* +* This is filling in the uapi.mode and creating the blob for it. +* The blob is required for the initial commit to succeed. +*/ +memset (&live_crtc_state->uapi.mode,0 ,sizeof (live_crtc_state->uapi.mode)); + +struct drm_mode_modeinfo umode; +struct drm_property_blob *blob; + +/* Manually create the mode blob to avoid triggering a modeset */ +memset (&umode,0 ,sizeof (umode)); + umode.clock = crtc_state->hw.adjusted_mode.clock; + umode.hdisplay = crtc_state->hw.adjusted_mode.hdisplay; + umode.hsync_start = crtc_state->hw.adjusted_mode.hsync_start; + umode.hsync_end = crtc_state->hw.adjusted_mode.hsync_end; + umode.htotal = crtc_state->hw.adjusted_mode.htotal; + umode.hskew = crtc_state->hw.adjusted_mode.hskew; + umode.vdisplay = crtc_state->hw.adjusted_mode.vdisplay; + umode.vsync_start = crtc_state->hw.adjusted_mode.vsync_start; + umode.vsync_end = crtc_state->hw.adjusted_mode.vsync_end; + umode.vtotal = crtc_state->hw.adjusted_mode.vtotal; + + umode.vscan = crtc_state->hw.adjusted_mode.vscan; + umode.vrefresh =drm_mode_vrefresh (&crtc_state->hw.adjusted_mode); + umode.flags = crtc_state->hw.adjusted_mode.flags; + umode.type = crtc_state->hw.adjusted_mode.type; +strncpy (umode.name, crtc_state->hw.adjusted_mode.name,DRM_DISPLAY_MODE_LEN ); + + blob =drm_property_create_blob (display->drm,sizeof (umode), &umode); +if (IS_ERR (blob)) { + }else { +/* This is the key: replace the blob without marking mode_changed */ +drm_property_replace_blob (&live_crtc_state->uapi.mode_blob, blob); +drm_property_blob_put (blob); +drm_mode_copy (&live_crtc_state->uapi.mode, &crtc_state->hw.adjusted_mode); + live_crtc_state->uapi.enable = true; + } +/* Mark the primary plane as visible in the live state */ live_plane_state->uapi.visible = true; live_crtc_state->uapi.plane_mask |=drm_plane_mask (&primary->base);
@@ -8789,10 +8776,12 @@ void intel_crtc_steal_state(struct intel_crtc_state *crtc_state)drm_encoder_mask (&encoder->base); connector->base.status = connector_status_connected; - }else { -drm_warn (display->drm,"[XE-STEAL] No active connector found for pipe %c!\n" , -pipe_name (crtc->pipe)); - }} + }else { +drm_warn (display->drm,"[XE-STEAL] No active connector found for pipe %c!\n" , +pipe_name (crtc->pipe)); + } + } +}#ifdef CONFIG_DRM_I915 EXPORT_SYMBOL_GPL (intel_crtc_steal_state);#endif
@@ -8840,37 +8829,21 @@ int intel_initial_commit(struct intel_display *display) crtc_state->hw.enable = true;/* Force hw.enable to match uapi.enable */ crtc_state->inherited = true; - crtc_state->pixel_rate = - -to_intel_crtc_state (crtc->base.state)->uapi.adjusted_mode.crtc_clock; - - - -/* Find and link the connector for this CRTC */ - -for_each_intel_encoder (display->drm, encoder) { - -if (crtc_state->uapi.encoder_mask &drm_encoder_mask (&encoder->base)) { - -break ; - - } + crtc_state->pixel_rate = +to_intel_crtc_state (crtc->base.state)->uapi.adjusted_mode.crtc_clock; - } - - - -if (encoder) { - -drm_connector_list_iter_begin (display->drm, &conn_iter); - -drm_for_each_connector_iter (iter_conn, &conn_iter) { - -if (to_intel_connector (iter_conn)->encoder == encoder) { +/* Find and link the connector for this CRTC */ +for_each_intel_encoder (display->drm, encoder) { +if (crtc_state->uapi.encoder_mask &drm_encoder_mask (&encoder->base)) { +break ; + } + } +if (encoder) { +drm_connector_list_iter_begin (display->drm, &conn_iter); +drm_for_each_connector_iter (iter_conn, &conn_iter) { +if (to_intel_connector (iter_conn)->encoder == encoder) { connector =to_intel_connector (iter_conn); - -break ; } }
@@ -8881,7 +8854,7 @@ int intel_initial_commit(struct intel_display *display)struct drm_connector_state *conn_state; conn_state =drm_atomic_get_connector_state (state, - &connector->base); + &connector->base);if (IS_ERR (conn_state)) { ret =PTR_ERR (conn_state); goto out;
@@ -8900,7 +8873,7 @@ int intel_initial_commit(struct intel_display *display) crtc_state->uapi.encoder_mask |=drm_encoder_mask (&connector->encoder->base); }else {drm_warn (dev,"[FB-COMMIT] No connector found for CRTC %s\n" , - crtc->base.name); + crtc->base.name); } ret =drm_atomic_add_affected_planes (state, &crtc->base);
@@ -8916,11 +8889,11 @@ int intel_initial_commit(struct intel_display *display) crtc_state->uapi.color_mgmt_changed = true;for_each_intel_encoder_mask (display->drm, encoder, - crtc_state->uapi.encoder_mask) { + crtc_state->uapi.encoder_mask) {if (encoder->initial_fastset_check && - !encoder->initial_fastset_check (encoder, crtc_state)) { + !encoder->initial_fastset_check (encoder, crtc_state)) { ret =drm_atomic_add_affected_connectors (state, - &crtc->base); + &crtc->base);if (ret) goto out; }
@@ -8938,11 +8911,9 @@ int intel_initial_commit(struct intel_display *display) goto retry; } + initial_boot_handoff = false;if (ret) {drm_atomic_state_put (state); - initial_boot_handoff = false; - }else { - initial_boot_handoff = false; } out_no_state:drm_modeset_drop_locks (&ctx);
drivers/gpu/drm/i915/display/intel_display_driver.c +1 -34
@@ -542,40 +542,7 @@ int intel_display_driver_probe_nogem(struct intel_display *display)*/ encoder->get_config (encoder, crtc_state); -/* -* HACK: MSO Fixup for readout (Fastboot path). -* If we read out the split MSO mode (1128), scale it up to the -* logical mode (2256) so it matches the VBT/User mode. -*/ -if (crtc_state->hw.pipe_mode.hdisplay ==1128 ) { - -/* Scale ALL horizontal timings to prevent invalid mode (Sync < Active) */ - crtc_state->hw.pipe_mode.hdisplay *=2 ; - crtc_state->hw.pipe_mode.hsync_start *=2 ; - crtc_state->hw.pipe_mode.hsync_end *=2 ; - crtc_state->hw.pipe_mode.htotal *=2 ; - - crtc_state->hw.pipe_mode.crtc_hdisplay *=2 ; - crtc_state->hw.pipe_mode.crtc_hsync_start *=2 ; - crtc_state->hw.pipe_mode.crtc_hsync_end *=2 ; - crtc_state->hw.pipe_mode.crtc_htotal *=2 ; - crtc_state->hw.pipe_mode.crtc_hblank_start *=2 ; - crtc_state->hw.pipe_mode.crtc_hblank_end *=2 ; - -/* Fix name */ -snprintf (crtc_state->hw.pipe_mode.name,DRM_DISPLAY_MODE_LEN ,"%dx%d" , - crtc_state->hw.pipe_mode.hdisplay, crtc_state->hw.pipe_mode.vdisplay); - }else if (crtc_state->hw.pipe_mode.hdisplay ==2256 && - crtc_state->hw.pipe_mode.crtc_hsync_start ==1152 ) { - -/* Geometry is already scaled, but Sync/Blank are raw. Fix them. */ - crtc_state->hw.pipe_mode.hsync_start *=2 ; - crtc_state->hw.pipe_mode.hsync_end *=2 ; - crtc_state->hw.pipe_mode.crtc_hsync_start *=2 ; - crtc_state->hw.pipe_mode.crtc_hsync_end *=2 ; - crtc_state->hw.pipe_mode.crtc_hblank_start *=2 ; - crtc_state->hw.pipe_mode.crtc_hblank_end *=2 ; - } +/* Link the encoder to the CRTC */ encoder->base.crtc = &crtc->base;
drivers/gpu/drm/i915/display/intel_dp.c +0 -15
@@ -3276,12 +3276,6 @@ intel_dp_compute_config(struct intel_encoder *encoder,if (ret)return ret; -/* [FB-FIX] Force 216000 link rate for MSO. Found 216000 in HW. Override compute result. */ -if (pipe_config->hw.pipe_mode.hdisplay ==2256 ) { - pipe_config->lane_count =4 ; - pipe_config->port_clock =216000 ; - } -if ((intel_dp_is_edp (intel_dp) && fixed_mode) || pipe_config->output_format ==INTEL_OUTPUT_FORMAT_YCBCR420 ) { ret =intel_pfit_compute_config (pipe_config, conn_state);
@@ -3314,15 +3308,6 @@ intel_dp_compute_config(struct intel_encoder *encoder, pipe_config->splitter.link_count = n; pipe_config->splitter.pixel_overlap = overlap; -/* -* [FB-FIX] Force Positive Sync for MSO panels. -* If we fell through here (skipped restore_boot), we must ensure flags are correct. -*/ -if ((adjusted_mode->flags & (DRM_MODE_FLAG_PHSYNC |DRM_MODE_FLAG_NHSYNC | -DRM_MODE_FLAG_PVSYNC |DRM_MODE_FLAG_NVSYNC )) ==0 ) { - adjusted_mode->flags |=DRM_MODE_FLAG_PHSYNC |DRM_MODE_FLAG_PVSYNC ; - } - adjusted_mode->crtc_hdisplay = adjusted_mode->crtc_hdisplay / n + overlap; adjusted_mode->crtc_hblank_start = adjusted_mode->crtc_hblank_start / n + overlap; adjusted_mode->crtc_hblank_end = adjusted_mode->crtc_hblank_end / n + overlap;
drivers/gpu/drm/i915/display/skl_universal_plane.c +81 -66
229 lines not on this page · raw message
drivers/gpu/drm/xe/display/xe_plane_initial.c +2 -2
@@ -192,7 +192,7 @@ intel_alloc_initial_plane_obj(struct intel_crtc *crtc, }/* Reference handed over to fb */ xe_bo_put (bo); -if (bo->vmap.vaddr && plane_config->fb) { +/*if (bo->vmap.vaddr && plane_config->fb) { int x, y; void *vaddr = bo->vmap.vaddr; u32 height = plane_config->fb->base.height;
@@ -209,7 +209,7 @@ intel_alloc_initial_plane_obj(struct intel_crtc *crtc,row[x] = color; } } - } +}*/ return true;
Signature · 1 line
2.52.0.457.g6b5491de43-goog
Patchwork
CI✗ Fi.CI.BUILD: failure for Enable seamless boot (fastboot) for PTL
In reply to Juasheem Sultan== Series Details ==
== Series Details ==
Series: Enable seamless boot (fastboot) for PTL
URL : https://patchwork.freedesktop.org/series/160188/
State : failure
== Summary ==
Error: patch https://patchwork.freedesktop.org/api/1.0/series/160188/revisions/1/mbox/ not applied
Applying: drm/i915/display: Implement passive initialization for splash screen preservation Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/display/intel_connector.c
M drivers/gpu/drm/i915/display/intel_ddi.c
M drivers/gpu/drm/i915/display/intel_dp.c
M drivers/gpu/drm/i915/display/intel_dp.h
M drivers/gpu/drm/i915/display/intel_hdmi.c
M drivers/gpu/drm/i915/display/intel_hdmi.h
Falling back to patching base and 3-way merge...
Auto-merging drivers/gpu/drm/i915/display/intel_hdmi.h
Auto-merging drivers/gpu/drm/i915/display/intel_hdmi.c
Auto-merging drivers/gpu/drm/i915/display/intel_dp.h
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/display/intel_dp.h Auto-merging drivers/gpu/drm/i915/display/intel_dp.c
Auto-merging drivers/gpu/drm/i915/display/intel_ddi.c
Auto-merging drivers/gpu/drm/i915/display/intel_connector.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 drm/i915/display: Implement passive initialization for splash screen preservation When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Build failed, no error log produced
Jani Nikula
maintainerQuoted 8 lines · Juasheem Sultan
This RFC patch series proposes an implementation of seamless boot (fastboot) support for Panther Lake (PTL) platforms within the Xe driver, mirroring functionality already present in i915. The primary focus is on devices using MSO (Multi-Segment Operation) panels and EDP panels.
The goal of this series is to achieve a flicker-free transition from the bootloader (BIOS/UEFI) to the kernel driver by strictly adhering to the hardware state established by the firmware.
The goal is something we obviously share.
Quoted 11 lines
Key areas addressed in this revision:
1. **Boot State Preservation**: Where necessary, make amendments to initial hardware readouts and ensure that the framebuffer state as established by firmware is correctly passed into the driver as a memory object.
2. **Atomic State Handoff**: Adjusting the atomic commit path to prevent unnecessary pipe disables or power well toggles when inheriting a valid boot state.
3. **Passive Probing**: Introducing a "passive" initialization path that builds the DRM software state without triggering hardware resets.This is an initial implementation subject to discussion.
- There's just way, *way* too much code duplication. I can't even make myself read through the entire thing because it's all familiar existing stuff, just subtly different. I can't stress this enough. There's so much duplication that I won't take on telling you what needs to be done. It's on you to figure out how to deduplicate.
- There's way too much magic values and hacking for a specific configuration.
- There's way too much code being added in xe_display.c when the goal is to unify and deduplicate everything under i915/display. All of this needs to happen in the i915/display directory, shared between i915 and xe drivers.
- There's way too many random unrelated unexplained things going on here. Things like unused struct members being added, commented out code being added, stuff being first added and then removed later in the series.
- There are way too many things being done in individual patches. The "key changes include" lists in commit messages are a pretty big clue. Each patch should do one thing, and one thing only. At times it feels like the changes in single patches aren't even related to each other.
All in all, I get the distinct feeling a lot of this is LLM generated, which is something you'd do well to disclose if it's indeed the case. Please see [1] for current discussion on the matter.
Again, the goal is something we share, but I honestly fear taking this series as the starting point for that will be counter-productive.
I would love to see small, focused patch series tackling existing issues one by one, instead of a giant hack attempting to fix everything at once.
BR,
Jani.
[1] https://lore.kernel.org/r/[email protected]
Quoted 54 lines
Change-Id I5cd3bdd4f6f687f007e91f6d0afbfeecfc06762bSigned-off-by Juasheem Sultan <[email protected]>---
Juasheem Sultan (10):
drm/i915/display: Implement passive initialization for splash screen preservation drm/xe/display: Implement seamless boot state reconstruction for PTL drm/i915/display: Implement aggressive boot state preservation for PTL drm/xe/display: Fix initial plane reconstruction and stolen memory handling drm/i915/display: Enable early PLL readout and robustify modeset setup drm/i915/display: Fix vblank timestamps and update logic for fastboot drm/i915/display: Implement seamless fastboot for MSO panels on PTL drm/i915/display: Robustify fastboot and power init for seamless boot drm/i915/display: Fix initial plane config readout and MSO stride for PTL drm/i915/display: Refactor initial plane readout and harden boot handoverdrivers/gpu/drm/i915/display/intel_bios.c | 40 +- drivers/gpu/drm/i915/display/intel_cdclk.c | 36 - drivers/gpu/drm/i915/display/intel_cdclk.h | 41 +- drivers/gpu/drm/i915/display/intel_connector.c | 9 + drivers/gpu/drm/i915/display/intel_connector.h | 1 + drivers/gpu/drm/i915/display/intel_crtc.c | 62 +- drivers/gpu/drm/i915/display/intel_ddi.c | 205 +++++- drivers/gpu/drm/i915/display/intel_ddi.h | 2 + drivers/gpu/drm/i915/display/intel_display.c | 814 +++++++++++++++++++-- drivers/gpu/drm/i915/display/intel_display.h | 6 + drivers/gpu/drm/i915/display/intel_display_core.h | 2 + .../gpu/drm/i915/display/intel_display_driver.c | 329 ++++++++- drivers/gpu/drm/i915/display/intel_display_power.c | 16 +- drivers/gpu/drm/i915/display/intel_display_types.h | 8 + drivers/gpu/drm/i915/display/intel_dp.c | 372 ++++++++-- drivers/gpu/drm/i915/display/intel_dp.h | 5 + drivers/gpu/drm/i915/display/intel_dpll_mgr.c | 16 +- drivers/gpu/drm/i915/display/intel_dpll_mgr.h | 1 + drivers/gpu/drm/i915/display/intel_hdmi.c | 39 + drivers/gpu/drm/i915/display/intel_hdmi.h | 2 + drivers/gpu/drm/i915/display/intel_modeset_setup.c | 7 + .../gpu/drm/i915/display/intel_modeset_verify.c | 14 +- drivers/gpu/drm/i915/display/intel_panel.c | 41 +- drivers/gpu/drm/i915/display/intel_panel.h | 3 + drivers/gpu/drm/i915/display/intel_plane_initial.c | 53 ++ drivers/gpu/drm/i915/display/skl_universal_plane.c | 32 +- drivers/gpu/drm/xe/display/xe_display.c | 309 +++++++- drivers/gpu/drm/xe/display/xe_display.h | 2 + drivers/gpu/drm/xe/display/xe_plane_initial.c | 28 +- drivers/gpu/drm/xe/xe_device.c | 2 +- drivers/gpu/drm/xe/xe_ggtt.h | 3 + drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c | 2 + 32 files changed, 2302 insertions(+), 200 deletions(-)---
base-commit:812e4b8966d421afd4df8f794bf15f1a1a3ec7b6
change-id: 20260115-upstream-prep-b29156970a75Best regards,
Signature · 1 line
Jani Nikula, Intel