From 29b6d31adff337582f6c0abef32874d655edf198 Mon Sep 17 00:00:00 2001 From: MoetaYuko Date: Sun, 14 Apr 2024 22:04:33 +0800 Subject: [PATCH] drm/i915: misc build fixes for 6.5 kernel --- backport-include/backport/backport_macro.h | 27 +++++++++++++++- .../drm/i915/display/intel_display_debugfs.c | 7 +++++ drivers/gpu/drm/i915/display/intel_dp.c | 31 +++++++++++++++++++ drivers/gpu/drm/i915/display/intel_dp_mst.c | 29 +++++++++++++++++ 4 files changed, 93 insertions(+), 1 deletion(-) diff --git a/backport-include/backport/backport_macro.h b/backport-include/backport/backport_macro.h index df341e6d..492cda38 100644 --- a/backport-include/backport/backport_macro.h +++ b/backport-include/backport/backport_macro.h @@ -13,7 +13,6 @@ #if LINUX_VERSION_IS_GEQ(6,7,0) /* - * 4d70c74659d974 * 583cc9e4109529 * drm/i915: dynamically allocate the i915_gem_mm shrinker */ @@ -1285,6 +1284,14 @@ */ #define BPM_DGLUT_24BIT_MTL_NOT_SUPPORTED +#if LINUX_VERSION_IS_LESS(6,8,0) +/* + * 7707dd6022593f + * drm/dp_mst: Fix fractional DSC bpp handling + */ +#define BPM_DRM_DP_CALC_PBN_MODE_DSC_PRESENT +#endif + #if LINUX_VERSION_IS_LESS(6,7,0) /* * 7218779efc46 drm/edid: add drm_edid_is_digital() @@ -1295,6 +1302,24 @@ * 82b599ece3b8 drm/edid: parse source physical address */ #define DRM_DISPLAY_INFO_SOURCE_PHYSICAL_ADDRESS_NOT_PRESENT + +/* + * e2272bfb18ee70 + * drm/dp: switch drm_dp_downstream_*() helpers to struct drm_edid + */ +#define BPM_DRM_DP_DOWNSTREAM_STRUCT_EDID + +/* + * fc93835bb0d7e2 + * drm: Add HPD state to drm_connector_oob_hotplug_event() + */ +#define BPM_DRM_CONNECTOR_OOB_HOTPLUG_EVENT_STATUS_NOT_PRESENT + +/* + * 5aa1dfcdf0a429 + * drm/mst: Refactor the flow for payload allocation/removement + */ +#define BPM_DRM_DP_REMOVE_PAYLOAD_AVAILABLE #endif #define BPM_DISABLE_DRM_DMABUF diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c index 54e78908..cca4c0ae 100644 --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c @@ -237,13 +237,20 @@ static void intel_dp_info(struct seq_file *m, struct intel_connector *connector) { struct intel_encoder *intel_encoder = intel_attached_encoder(connector); struct intel_dp *intel_dp = enc_to_intel_dp(intel_encoder); +#ifdef BPM_DRM_DP_DOWNSTREAM_STRUCT_EDID + const struct edid *edid = drm_edid_raw(connector->detect_edid); +#endif seq_printf(m, "\tDPCD rev: %x\n", intel_dp->dpcd[DP_DPCD_REV]); seq_printf(m, "\taudio support: %s\n", str_yes_no(connector->base.display_info.has_audio)); drm_dp_downstream_debug(m, intel_dp->dpcd, intel_dp->downstream_ports, +#ifdef BPM_DRM_DP_DOWNSTREAM_STRUCT_EDID + edid, &intel_dp->aux); +#else connector->detect_edid, &intel_dp->aux); +#endif } static void intel_dp_mst_info(struct seq_file *m, diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index 5c3f57b3..204c6e8c 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -5113,10 +5113,20 @@ intel_dp_update_dfp(struct intel_dp *intel_dp, { struct drm_i915_private *i915 = dp_to_i915(intel_dp); struct intel_connector *connector = intel_dp->attached_connector; +#ifdef BPM_DRM_DP_DOWNSTREAM_STRUCT_EDID + const struct edid *edid; + + /* FIXME: Get rid of drm_edid_raw() */ + edid = drm_edid_raw(drm_edid); +#endif intel_dp->dfp.max_bpc = drm_dp_downstream_max_bpc(intel_dp->dpcd, +#ifdef BPM_DRM_DP_DOWNSTREAM_STRUCT_EDID + intel_dp->downstream_ports, edid); +#else intel_dp->downstream_ports, drm_edid); +#endif intel_dp->dfp.max_dotclock = drm_dp_downstream_max_dotclock(intel_dp->dpcd, @@ -5125,11 +5135,19 @@ intel_dp_update_dfp(struct intel_dp *intel_dp, intel_dp->dfp.min_tmds_clock = drm_dp_downstream_min_tmds_clock(intel_dp->dpcd, intel_dp->downstream_ports, +#ifdef BPM_DRM_DP_DOWNSTREAM_STRUCT_EDID + edid); +#else drm_edid); +#endif intel_dp->dfp.max_tmds_clock = drm_dp_downstream_max_tmds_clock(intel_dp->dpcd, intel_dp->downstream_ports, +#ifdef BPM_DRM_DP_DOWNSTREAM_STRUCT_EDID + edid); +#else drm_edid); +#endif intel_dp->dfp.pcon_max_frl_bw = drm_dp_get_pcon_max_frl_bw(intel_dp->dpcd, @@ -5633,6 +5651,18 @@ static int intel_dp_connector_atomic_check(struct drm_connector *conn, return intel_modeset_synced_crtcs(state, conn); } +#ifdef BPM_DRM_CONNECTOR_OOB_HOTPLUG_EVENT_STATUS_NOT_PRESENT +static void intel_dp_oob_hotplug_event(struct drm_connector *connector) +{ + struct intel_encoder *encoder = intel_attached_encoder(to_intel_connector(connector)); + struct drm_i915_private *i915 = to_i915(connector->dev); + + spin_lock_irq(&i915->irq_lock); + i915->display.hotplug.event_bits |= BIT(encoder->hpd_pin); + spin_unlock_irq(&i915->irq_lock); + queue_delayed_work(i915->unordered_wq, &i915->display.hotplug.hotplug_work, 0); +} +#else static void intel_dp_oob_hotplug_event(struct drm_connector *connector, enum drm_connector_status hpd_state) { @@ -5654,6 +5684,7 @@ static void intel_dp_oob_hotplug_event(struct drm_connector *connector, if (need_work) queue_delayed_work(i915->unordered_wq, &i915->display.hotplug.hotplug_work, 0); } +#endif static const struct drm_connector_funcs intel_dp_connector_funcs = { .force = intel_dp_force, diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c index 0f0bb2b6..43dc663f 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -106,7 +106,12 @@ static int intel_dp_mst_find_vcpi_slots_for_bpp(struct intel_encoder *encoder, continue; crtc_state->pbn = drm_dp_calc_pbn_mode(adjusted_mode->crtc_clock, +#ifdef BPM_DRM_DP_CALC_PBN_MODE_DSC_PRESENT + dsc ? bpp << 4 : bpp, + dsc); +#else bpp << 4); +#endif slots = drm_dp_atomic_find_time_slots(state, &intel_dp->mst_mgr, connector->port, @@ -546,6 +551,16 @@ static void intel_mst_disable_dp(struct intel_atomic_state *state, struct intel_dp *intel_dp = &dig_port->dp; struct intel_connector *connector = to_intel_connector(old_conn_state->connector); +#ifdef BPM_DRM_DP_REMOVE_PAYLOAD_AVAILABLE + struct drm_dp_mst_topology_state *old_mst_state = + drm_atomic_get_old_mst_topology_state(&state->base, &intel_dp->mst_mgr); + struct drm_dp_mst_topology_state *new_mst_state = + drm_atomic_get_new_mst_topology_state(&state->base, &intel_dp->mst_mgr); + const struct drm_dp_mst_atomic_payload *old_payload = + drm_atomic_get_mst_payload_state(old_mst_state, connector->port); + struct drm_dp_mst_atomic_payload *new_payload = + drm_atomic_get_mst_payload_state(new_mst_state, connector->port); +#endif struct drm_i915_private *i915 = to_i915(connector->base.dev); drm_dbg_kms(&i915->drm, "active links %d\n", @@ -553,6 +568,10 @@ static void intel_mst_disable_dp(struct intel_atomic_state *state, intel_hdcp_disable(intel_mst->connector); +#ifdef BPM_DRM_DP_REMOVE_PAYLOAD_AVAILABLE + drm_dp_remove_payload(&intel_dp->mst_mgr, new_mst_state, + old_payload, new_payload); +#endif intel_audio_codec_disable(encoder, old_crtc_state, old_conn_state); } @@ -566,6 +585,7 @@ static void intel_mst_post_disable_dp(struct intel_atomic_state *state, struct intel_dp *intel_dp = &dig_port->dp; struct intel_connector *connector = to_intel_connector(old_conn_state->connector); +#ifndef BPM_DRM_DP_REMOVE_PAYLOAD_AVAILABLE struct drm_dp_mst_topology_state *old_mst_state = drm_atomic_get_old_mst_topology_state(&state->base, &intel_dp->mst_mgr); struct drm_dp_mst_topology_state *new_mst_state = @@ -574,6 +594,7 @@ static void intel_mst_post_disable_dp(struct intel_atomic_state *state, drm_atomic_get_mst_payload_state(old_mst_state, connector->port); struct drm_dp_mst_atomic_payload *new_payload = drm_atomic_get_mst_payload_state(new_mst_state, connector->port); +#endif struct drm_i915_private *dev_priv = to_i915(connector->base.dev); bool last_mst_stream; @@ -587,7 +608,9 @@ static void intel_mst_post_disable_dp(struct intel_atomic_state *state, intel_disable_transcoder(old_crtc_state); +#ifndef BPM_DRM_DP_REMOVE_PAYLOAD_AVAILABLE drm_dp_remove_payload_part1(&intel_dp->mst_mgr, new_mst_state, new_payload); +#endif clear_act_sent(encoder, old_crtc_state); @@ -596,8 +619,10 @@ static void intel_mst_post_disable_dp(struct intel_atomic_state *state, wait_for_act_sent(encoder, old_crtc_state); +#ifndef BPM_DRM_DP_REMOVE_PAYLOAD_AVAILABLE drm_dp_remove_payload_part2(&intel_dp->mst_mgr, new_mst_state, old_payload, new_payload); +#endif intel_ddi_disable_transcoder_func(old_crtc_state); @@ -930,7 +955,11 @@ intel_dp_mst_mode_valid_ctx(struct drm_connector *connector, return ret; if (mode_rate > max_rate || mode->clock > max_dotclk || +#ifdef BPM_DRM_DP_CALC_PBN_MODE_DSC_PRESENT + drm_dp_calc_pbn_mode(mode->clock, min_bpp, false) > port->full_pbn) { +#else drm_dp_calc_pbn_mode(mode->clock, min_bpp << 4) > port->full_pbn) { +#endif *status = MODE_CLOCK_HIGH; return 0; }