Skip to content

Commit

Permalink
drm/i915: misc build fixes for 6.5 kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
moetayuko committed Apr 14, 2024
1 parent fc2eb29 commit 29b6d31
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 1 deletion.
27 changes: 26 additions & 1 deletion backport-include/backport/backport_macro.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

#if LINUX_VERSION_IS_GEQ(6,7,0)
/*
* 4d70c74659d974
* 583cc9e4109529
* drm/i915: dynamically allocate the i915_gem_mm shrinker
*/
Expand Down Expand Up @@ -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()
Expand All @@ -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
Expand Down
7 changes: 7 additions & 0 deletions drivers/gpu/drm/i915/display/intel_display_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
31 changes: 31 additions & 0 deletions drivers/gpu/drm/i915/display/intel_dp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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)
{
Expand All @@ -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,
Expand Down
29 changes: 29 additions & 0 deletions drivers/gpu/drm/i915/display/intel_dp_mst.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -546,13 +551,27 @@ 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",
intel_dp->active_mst_links);

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);
}

Expand All @@ -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 =
Expand All @@ -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;

Expand All @@ -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);

Expand All @@ -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);

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 29b6d31

Please sign in to comment.