mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-12 08:56:47 +07:00
drm/i915: Introduce a for_each_intel_encoder() macro
Following the established idom, let's provide a macro to iterate through the encoders. spatch helps, once more, for the substitution: @@ iterator name list_for_each_entry; iterator name for_each_intel_encoder; struct intel_encoder * encoder; struct drm_device * dev; @@ -list_for_each_entry(encoder, &dev->mode_config.encoder_list, base.head) { +for_each_intel_encoder(dev, encoder) { ... } I also modified a few call sites by hand where a pointer to mode_config was directly used (to avoid overflowing 80 chars). Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> [danvet: Wrap paramters correctly in the macro and remove spurious space checkpatch noticed.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
4079b8d1c3
commit
b2784e1519
@ -2708,8 +2708,7 @@ static int i9xx_pipe_crc_auto_source(struct drm_device *dev, enum pipe pipe,
|
||||
*source = INTEL_PIPE_CRC_SOURCE_PIPE;
|
||||
|
||||
drm_modeset_lock_all(dev);
|
||||
list_for_each_entry(encoder, &dev->mode_config.encoder_list,
|
||||
base.head) {
|
||||
for_each_intel_encoder(dev, encoder) {
|
||||
if (!encoder->base.crtc)
|
||||
continue;
|
||||
|
||||
|
@ -171,6 +171,11 @@ enum hpd_pin {
|
||||
#define for_each_intel_crtc(dev, intel_crtc) \
|
||||
list_for_each_entry(intel_crtc, &dev->mode_config.crtc_list, base.head)
|
||||
|
||||
#define for_each_intel_encoder(dev, intel_encoder) \
|
||||
list_for_each_entry(intel_encoder, \
|
||||
&(dev)->mode_config.encoder_list, \
|
||||
base.head)
|
||||
|
||||
#define for_each_encoder_on_crtc(dev, __crtc, intel_encoder) \
|
||||
list_for_each_entry((intel_encoder), &(dev)->mode_config.encoder_list, base.head) \
|
||||
if ((intel_encoder)->base.crtc == (__crtc))
|
||||
|
@ -3522,18 +3522,17 @@ static void cherryview_irq_preinstall(struct drm_device *dev)
|
||||
static void ibx_hpd_irq_setup(struct drm_device *dev)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct drm_mode_config *mode_config = &dev->mode_config;
|
||||
struct intel_encoder *intel_encoder;
|
||||
u32 hotplug_irqs, hotplug, enabled_irqs = 0;
|
||||
|
||||
if (HAS_PCH_IBX(dev)) {
|
||||
hotplug_irqs = SDE_HOTPLUG_MASK;
|
||||
list_for_each_entry(intel_encoder, &mode_config->encoder_list, base.head)
|
||||
for_each_intel_encoder(dev, intel_encoder)
|
||||
if (dev_priv->hpd_stats[intel_encoder->hpd_pin].hpd_mark == HPD_ENABLED)
|
||||
enabled_irqs |= hpd_ibx[intel_encoder->hpd_pin];
|
||||
} else {
|
||||
hotplug_irqs = SDE_HOTPLUG_MASK_CPT;
|
||||
list_for_each_entry(intel_encoder, &mode_config->encoder_list, base.head)
|
||||
for_each_intel_encoder(dev, intel_encoder)
|
||||
if (dev_priv->hpd_stats[intel_encoder->hpd_pin].hpd_mark == HPD_ENABLED)
|
||||
enabled_irqs |= hpd_cpt[intel_encoder->hpd_pin];
|
||||
}
|
||||
@ -4452,7 +4451,6 @@ static int i965_irq_postinstall(struct drm_device *dev)
|
||||
static void i915_hpd_irq_setup(struct drm_device *dev)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct drm_mode_config *mode_config = &dev->mode_config;
|
||||
struct intel_encoder *intel_encoder;
|
||||
u32 hotplug_en;
|
||||
|
||||
@ -4463,7 +4461,7 @@ static void i915_hpd_irq_setup(struct drm_device *dev)
|
||||
hotplug_en &= ~HOTPLUG_INT_EN_MASK;
|
||||
/* Note HDMI and DP share hotplug bits */
|
||||
/* enable bits are the same for all generations */
|
||||
list_for_each_entry(intel_encoder, &mode_config->encoder_list, base.head)
|
||||
for_each_intel_encoder(dev, intel_encoder)
|
||||
if (dev_priv->hpd_stats[intel_encoder->hpd_pin].hpd_mark == HPD_ENABLED)
|
||||
hotplug_en |= hpd_mask_i915[intel_encoder->hpd_pin];
|
||||
/* Programming the CRT detection parameters tends
|
||||
|
@ -6405,7 +6405,6 @@ static bool i9xx_get_pipe_config(struct intel_crtc *crtc,
|
||||
static void ironlake_init_pch_refclk(struct drm_device *dev)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct drm_mode_config *mode_config = &dev->mode_config;
|
||||
struct intel_encoder *encoder;
|
||||
u32 val, final;
|
||||
bool has_lvds = false;
|
||||
@ -6415,8 +6414,7 @@ static void ironlake_init_pch_refclk(struct drm_device *dev)
|
||||
bool can_ssc = false;
|
||||
|
||||
/* We need to take the global config into account */
|
||||
list_for_each_entry(encoder, &mode_config->encoder_list,
|
||||
base.head) {
|
||||
for_each_intel_encoder(dev, encoder) {
|
||||
switch (encoder->type) {
|
||||
case INTEL_OUTPUT_LVDS:
|
||||
has_panel = true;
|
||||
@ -6723,11 +6721,10 @@ static void lpt_disable_clkout_dp(struct drm_device *dev)
|
||||
|
||||
static void lpt_init_pch_refclk(struct drm_device *dev)
|
||||
{
|
||||
struct drm_mode_config *mode_config = &dev->mode_config;
|
||||
struct intel_encoder *encoder;
|
||||
bool has_vga = false;
|
||||
|
||||
list_for_each_entry(encoder, &mode_config->encoder_list, base.head) {
|
||||
for_each_intel_encoder(dev, encoder) {
|
||||
switch (encoder->type) {
|
||||
case INTEL_OUTPUT_ANALOG:
|
||||
has_vga = true;
|
||||
@ -9902,8 +9899,7 @@ static void intel_modeset_update_staged_output_state(struct drm_device *dev)
|
||||
to_intel_encoder(connector->base.encoder);
|
||||
}
|
||||
|
||||
list_for_each_entry(encoder, &dev->mode_config.encoder_list,
|
||||
base.head) {
|
||||
for_each_intel_encoder(dev, encoder) {
|
||||
encoder->new_crtc =
|
||||
to_intel_crtc(encoder->base.crtc);
|
||||
}
|
||||
@ -9934,8 +9930,7 @@ static void intel_modeset_commit_output_state(struct drm_device *dev)
|
||||
connector->base.encoder = &connector->new_encoder->base;
|
||||
}
|
||||
|
||||
list_for_each_entry(encoder, &dev->mode_config.encoder_list,
|
||||
base.head) {
|
||||
for_each_intel_encoder(dev, encoder) {
|
||||
encoder->base.crtc = &encoder->new_crtc->base;
|
||||
}
|
||||
|
||||
@ -10105,8 +10100,7 @@ static bool check_single_encoder_cloning(struct intel_crtc *crtc,
|
||||
struct drm_device *dev = crtc->base.dev;
|
||||
struct intel_encoder *source_encoder;
|
||||
|
||||
list_for_each_entry(source_encoder,
|
||||
&dev->mode_config.encoder_list, base.head) {
|
||||
for_each_intel_encoder(dev, source_encoder) {
|
||||
if (source_encoder->new_crtc != crtc)
|
||||
continue;
|
||||
|
||||
@ -10122,8 +10116,7 @@ static bool check_encoder_cloning(struct intel_crtc *crtc)
|
||||
struct drm_device *dev = crtc->base.dev;
|
||||
struct intel_encoder *encoder;
|
||||
|
||||
list_for_each_entry(encoder,
|
||||
&dev->mode_config.encoder_list, base.head) {
|
||||
for_each_intel_encoder(dev, encoder) {
|
||||
if (encoder->new_crtc != crtc)
|
||||
continue;
|
||||
|
||||
@ -10207,8 +10200,7 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
|
||||
* adjust it according to limitations or connector properties, and also
|
||||
* a chance to reject the mode entirely.
|
||||
*/
|
||||
list_for_each_entry(encoder, &dev->mode_config.encoder_list,
|
||||
base.head) {
|
||||
for_each_intel_encoder(dev, encoder) {
|
||||
|
||||
if (&encoder->new_crtc->base != crtc)
|
||||
continue;
|
||||
@ -10286,8 +10278,7 @@ intel_modeset_affected_pipes(struct drm_crtc *crtc, unsigned *modeset_pipes,
|
||||
1 << connector->new_encoder->new_crtc->pipe;
|
||||
}
|
||||
|
||||
list_for_each_entry(encoder, &dev->mode_config.encoder_list,
|
||||
base.head) {
|
||||
for_each_intel_encoder(dev, encoder) {
|
||||
if (encoder->base.crtc == &encoder->new_crtc->base)
|
||||
continue;
|
||||
|
||||
@ -10361,8 +10352,7 @@ intel_modeset_update_state(struct drm_device *dev, unsigned prepare_pipes)
|
||||
struct intel_crtc *intel_crtc;
|
||||
struct drm_connector *connector;
|
||||
|
||||
list_for_each_entry(intel_encoder, &dev->mode_config.encoder_list,
|
||||
base.head) {
|
||||
for_each_intel_encoder(dev, intel_encoder) {
|
||||
if (!intel_encoder->base.crtc)
|
||||
continue;
|
||||
|
||||
@ -10636,8 +10626,7 @@ check_encoder_state(struct drm_device *dev)
|
||||
struct intel_encoder *encoder;
|
||||
struct intel_connector *connector;
|
||||
|
||||
list_for_each_entry(encoder, &dev->mode_config.encoder_list,
|
||||
base.head) {
|
||||
for_each_intel_encoder(dev, encoder) {
|
||||
bool enabled = false;
|
||||
bool active = false;
|
||||
enum pipe pipe, tracked_pipe;
|
||||
@ -10716,8 +10705,7 @@ check_crtc_state(struct drm_device *dev)
|
||||
WARN(crtc->active && !crtc->base.enabled,
|
||||
"active crtc, but not enabled in sw tracking\n");
|
||||
|
||||
list_for_each_entry(encoder, &dev->mode_config.encoder_list,
|
||||
base.head) {
|
||||
for_each_intel_encoder(dev, encoder) {
|
||||
if (encoder->base.crtc != &crtc->base)
|
||||
continue;
|
||||
enabled = true;
|
||||
@ -10739,8 +10727,7 @@ check_crtc_state(struct drm_device *dev)
|
||||
if (crtc->pipe == PIPE_A && dev_priv->quirks & QUIRK_PIPEA_FORCE)
|
||||
active = crtc->active;
|
||||
|
||||
list_for_each_entry(encoder, &dev->mode_config.encoder_list,
|
||||
base.head) {
|
||||
for_each_intel_encoder(dev, encoder) {
|
||||
enum pipe pipe;
|
||||
if (encoder->base.crtc != &crtc->base)
|
||||
continue;
|
||||
@ -11108,7 +11095,7 @@ static void intel_set_config_restore_state(struct drm_device *dev,
|
||||
}
|
||||
|
||||
count = 0;
|
||||
list_for_each_entry(encoder, &dev->mode_config.encoder_list, base.head) {
|
||||
for_each_intel_encoder(dev, encoder) {
|
||||
encoder->new_crtc =
|
||||
to_intel_crtc(config->save_encoder_crtcs[count++]);
|
||||
}
|
||||
@ -11267,8 +11254,7 @@ intel_modeset_stage_output_state(struct drm_device *dev,
|
||||
}
|
||||
|
||||
/* Check for any encoders that needs to be disabled. */
|
||||
list_for_each_entry(encoder, &dev->mode_config.encoder_list,
|
||||
base.head) {
|
||||
for_each_intel_encoder(dev, encoder) {
|
||||
int num_connectors = 0;
|
||||
list_for_each_entry(connector,
|
||||
&dev->mode_config.connector_list,
|
||||
@ -11301,9 +11287,7 @@ intel_modeset_stage_output_state(struct drm_device *dev,
|
||||
for_each_intel_crtc(dev, crtc) {
|
||||
crtc->new_enabled = false;
|
||||
|
||||
list_for_each_entry(encoder,
|
||||
&dev->mode_config.encoder_list,
|
||||
base.head) {
|
||||
for_each_intel_encoder(dev, encoder) {
|
||||
if (encoder->new_crtc == crtc) {
|
||||
crtc->new_enabled = true;
|
||||
break;
|
||||
@ -11340,7 +11324,7 @@ static void disable_crtc_nofb(struct intel_crtc *crtc)
|
||||
connector->new_encoder = NULL;
|
||||
}
|
||||
|
||||
list_for_each_entry(encoder, &dev->mode_config.encoder_list, base.head) {
|
||||
for_each_intel_encoder(dev, encoder) {
|
||||
if (encoder->new_crtc == crtc)
|
||||
encoder->new_crtc = NULL;
|
||||
}
|
||||
@ -11972,8 +11956,7 @@ static int intel_encoder_clones(struct intel_encoder *encoder)
|
||||
int index_mask = 0;
|
||||
int entry = 0;
|
||||
|
||||
list_for_each_entry(source_encoder,
|
||||
&dev->mode_config.encoder_list, base.head) {
|
||||
for_each_intel_encoder(dev, source_encoder) {
|
||||
if (encoders_cloneable(encoder, source_encoder))
|
||||
index_mask |= (1 << entry);
|
||||
|
||||
@ -12162,7 +12145,7 @@ static void intel_setup_outputs(struct drm_device *dev)
|
||||
|
||||
intel_edp_psr_init(dev);
|
||||
|
||||
list_for_each_entry(encoder, &dev->mode_config.encoder_list, base.head) {
|
||||
for_each_intel_encoder(dev, encoder) {
|
||||
encoder->base.possible_crtcs = encoder->crtc_mask;
|
||||
encoder->base.possible_clones =
|
||||
intel_encoder_clones(encoder);
|
||||
@ -13056,8 +13039,7 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
|
||||
intel_display_power_get(dev_priv, POWER_DOMAIN_PLLS);
|
||||
}
|
||||
|
||||
list_for_each_entry(encoder, &dev->mode_config.encoder_list,
|
||||
base.head) {
|
||||
for_each_intel_encoder(dev, encoder) {
|
||||
pipe = 0;
|
||||
|
||||
if (encoder->get_hw_state(encoder, &pipe)) {
|
||||
@ -13121,8 +13103,7 @@ void intel_modeset_setup_hw_state(struct drm_device *dev,
|
||||
}
|
||||
|
||||
/* HW state is read out, now we need to sanitize this mess. */
|
||||
list_for_each_entry(encoder, &dev->mode_config.encoder_list,
|
||||
base.head) {
|
||||
for_each_intel_encoder(dev, encoder) {
|
||||
intel_sanitize_encoder(encoder);
|
||||
}
|
||||
|
||||
|
@ -885,7 +885,7 @@ static bool hdmi_12bpc_possible(struct intel_crtc *crtc)
|
||||
if (HAS_GMCH_DISPLAY(dev))
|
||||
return false;
|
||||
|
||||
list_for_each_entry(encoder, &dev->mode_config.encoder_list, base.head) {
|
||||
for_each_intel_encoder(dev, encoder) {
|
||||
if (encoder->new_crtc != crtc)
|
||||
continue;
|
||||
|
||||
|
@ -823,8 +823,7 @@ bool intel_is_dual_link_lvds(struct drm_device *dev)
|
||||
struct intel_encoder *encoder;
|
||||
struct intel_lvds_encoder *lvds_encoder;
|
||||
|
||||
list_for_each_entry(encoder, &dev->mode_config.encoder_list,
|
||||
base.head) {
|
||||
for_each_intel_encoder(dev, encoder) {
|
||||
if (encoder->type == INTEL_OUTPUT_LVDS) {
|
||||
lvds_encoder = to_lvds_encoder(&encoder->base);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user