Message ID | 1472023380-29923-2-git-send-email-dhinakaran.pandiyan@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
IRC acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> On Wed, 2016-08-24 at 00:22 -0700, Dhinakaran Pandiyan wrote: > Storing the port enum in intel_encoder makes it convenient to know the > port attached to an encoder. Moving the port information up from > intel_digital_port to intel_encoder avoids unecessary intel_digital_port > access and handles MST encoders cleanly without requiring conditional > checks for them (thanks danvet). > > v2: > Renamed the port enum member from 'attached_port' to 'port' (danvet) > Fixed missing initialization of port in intel_sdvo.c (danvet) > > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> > --- > drivers/gpu/drm/i915/i915_drv.h | 1 + > drivers/gpu/drm/i915/intel_ddi.c | 1 + > drivers/gpu/drm/i915/intel_dp.c | 1 + > drivers/gpu/drm/i915/intel_dp_mst.c | 1 + > drivers/gpu/drm/i915/intel_drv.h | 1 + > drivers/gpu/drm/i915/intel_dsi.c | 1 + > drivers/gpu/drm/i915/intel_dvo.c | 2 ++ > drivers/gpu/drm/i915/intel_hdmi.c | 1 + > drivers/gpu/drm/i915/intel_lvds.c | 3 ++- > drivers/gpu/drm/i915/intel_sdvo.c | 1 + > drivers/gpu/drm/i915/intel_tv.c | 2 ++ > 11 files changed, 14 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h > index 9cd102c..60e282d5 100644 > --- a/drivers/gpu/drm/i915/i915_drv.h > +++ b/drivers/gpu/drm/i915/i915_drv.h > @@ -185,6 +185,7 @@ enum plane { > #define sprite_name(p, s) ((p) * INTEL_INFO(dev)->num_sprites[(p)] + (s) + 'A') > > enum port { > + PORT_NONE = -1, > PORT_A = 0, > PORT_B, > PORT_C, > diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c > index c2df4e4..402755d 100644 > --- a/drivers/gpu/drm/i915/intel_ddi.c > +++ b/drivers/gpu/drm/i915/intel_ddi.c > @@ -2426,6 +2426,7 @@ void intel_ddi_init(struct drm_device *dev, enum port port) > intel_dig_port->max_lanes = max_lanes; > > intel_encoder->type = INTEL_OUTPUT_UNKNOWN; > + intel_encoder->port = port; > intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); > intel_encoder->cloneable = 0; > > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c > index 364db90..cfe2f4a 100644 > --- a/drivers/gpu/drm/i915/intel_dp.c > +++ b/drivers/gpu/drm/i915/intel_dp.c > @@ -5726,6 +5726,7 @@ bool intel_dp_init(struct drm_device *dev, > intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); > } > intel_encoder->cloneable = 0; > + intel_encoder->port = port; > > intel_dig_port->hpd_pulse = intel_dp_hpd_pulse; > dev_priv->hotplug.irq_port[port] = intel_dig_port; > diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c > index 629337d..d1d7e91 100644 > --- a/drivers/gpu/drm/i915/intel_dp_mst.c > +++ b/drivers/gpu/drm/i915/intel_dp_mst.c > @@ -540,6 +540,7 @@ intel_dp_create_fake_mst_encoder(struct intel_digital_port *intel_dig_port, enum > DRM_MODE_ENCODER_DPMST, "DP-MST %c", pipe_name(pipe)); > > intel_encoder->type = INTEL_OUTPUT_DP_MST; > + intel_encoder->port = intel_dig_port->port; > intel_encoder->crtc_mask = 0x7; > intel_encoder->cloneable = 0; > > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h > index 1c700b0..68bf134 100644 > --- a/drivers/gpu/drm/i915/intel_drv.h > +++ b/drivers/gpu/drm/i915/intel_drv.h > @@ -202,6 +202,7 @@ struct intel_encoder { > struct drm_encoder base; > > enum intel_output_type type; > + enum port port; > unsigned int cloneable; > void (*hot_plug)(struct intel_encoder *); > bool (*compute_config)(struct intel_encoder *, > diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c > index de8e9fb..eb5cc0b 100644 > --- a/drivers/gpu/drm/i915/intel_dsi.c > +++ b/drivers/gpu/drm/i915/intel_dsi.c > @@ -1478,6 +1478,7 @@ void intel_dsi_init(struct drm_device *dev) > > intel_connector->get_hw_state = intel_connector_get_hw_state; > > + intel_encoder->port = port; > /* > * On BYT/CHV, pipe A maps to MIPI DSI port A, pipe B maps to MIPI DSI > * port C. BXT isn't limited like this. > diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c > index 47bdf9d..6dc2791 100644 > --- a/drivers/gpu/drm/i915/intel_dvo.c > +++ b/drivers/gpu/drm/i915/intel_dvo.c > @@ -511,7 +511,9 @@ void intel_dvo_init(struct drm_device *dev) > "DVO %c", intel_dvo_port_name(dvo->dvo_reg)); > > intel_encoder->type = INTEL_OUTPUT_DVO; > + intel_encoder->port = PORT_NONE; > intel_encoder->crtc_mask = (1 << 0) | (1 << 1); > + > switch (dvo->type) { > case INTEL_DVO_CHIP_TMDS: > intel_encoder->cloneable = (1 << INTEL_OUTPUT_ANALOG) | > diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c > index 4df9f38..25eeac3 100644 > --- a/drivers/gpu/drm/i915/intel_hdmi.c > +++ b/drivers/gpu/drm/i915/intel_hdmi.c > @@ -1962,6 +1962,7 @@ void intel_hdmi_init(struct drm_device *dev, > } > > intel_encoder->type = INTEL_OUTPUT_HDMI; > + intel_encoder->port = port; > if (IS_CHERRYVIEW(dev)) { > if (port == PORT_D) > intel_encoder->crtc_mask = 1 << 2; > diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c > index 668eabb..b756248 100644 > --- a/drivers/gpu/drm/i915/intel_lvds.c > +++ b/drivers/gpu/drm/i915/intel_lvds.c > @@ -1052,8 +1052,9 @@ void intel_lvds_init(struct drm_device *dev) > intel_connector->get_hw_state = intel_connector_get_hw_state; > > intel_connector_attach_encoder(intel_connector, intel_encoder); > - intel_encoder->type = INTEL_OUTPUT_LVDS; > > + intel_encoder->type = INTEL_OUTPUT_LVDS; > + intel_encoder->port = PORT_NONE; > intel_encoder->cloneable = 0; > if (HAS_PCH_SPLIT(dev)) > intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); > diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c > index e378f35..c5e04e8 100644 > --- a/drivers/gpu/drm/i915/intel_sdvo.c > +++ b/drivers/gpu/drm/i915/intel_sdvo.c > @@ -2973,6 +2973,7 @@ bool intel_sdvo_init(struct drm_device *dev, > /* encoder type will be decided later */ > intel_encoder = &intel_sdvo->base; > intel_encoder->type = INTEL_OUTPUT_SDVO; > + intel_encoder->port = port; > drm_encoder_init(dev, &intel_encoder->base, &intel_sdvo_enc_funcs, 0, > "SDVO %c", port_name(port)); > > diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c > index 49136ad..dba365c 100644 > --- a/drivers/gpu/drm/i915/intel_tv.c > +++ b/drivers/gpu/drm/i915/intel_tv.c > @@ -1603,7 +1603,9 @@ intel_tv_init(struct drm_device *dev) > intel_connector->get_hw_state = intel_connector_get_hw_state; > > intel_connector_attach_encoder(intel_connector, intel_encoder); > + > intel_encoder->type = INTEL_OUTPUT_TVOUT; > + intel_encoder->port = PORT_NONE; > intel_encoder->crtc_mask = (1 << 0) | (1 << 1); > intel_encoder->cloneable = 0; > intel_encoder->base.possible_crtcs = ((1 << 0) | (1 << 1));
Reviewed-by: Lyude <cpaul@redhat.com> On Wed, 2016-08-24 at 00:22 -0700, Dhinakaran Pandiyan wrote: > Storing the port enum in intel_encoder makes it convenient to know the > port attached to an encoder. Moving the port information up from > intel_digital_port to intel_encoder avoids unecessary intel_digital_port > access and handles MST encoders cleanly without requiring conditional > checks for them (thanks danvet). > > v2: > Renamed the port enum member from 'attached_port' to 'port' (danvet) > Fixed missing initialization of port in intel_sdvo.c (danvet) > > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> > --- > drivers/gpu/drm/i915/i915_drv.h | 1 + > drivers/gpu/drm/i915/intel_ddi.c | 1 + > drivers/gpu/drm/i915/intel_dp.c | 1 + > drivers/gpu/drm/i915/intel_dp_mst.c | 1 + > drivers/gpu/drm/i915/intel_drv.h | 1 + > drivers/gpu/drm/i915/intel_dsi.c | 1 + > drivers/gpu/drm/i915/intel_dvo.c | 2 ++ > drivers/gpu/drm/i915/intel_hdmi.c | 1 + > drivers/gpu/drm/i915/intel_lvds.c | 3 ++- > drivers/gpu/drm/i915/intel_sdvo.c | 1 + > drivers/gpu/drm/i915/intel_tv.c | 2 ++ > 11 files changed, 14 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h > index 9cd102c..60e282d5 100644 > --- a/drivers/gpu/drm/i915/i915_drv.h > +++ b/drivers/gpu/drm/i915/i915_drv.h > @@ -185,6 +185,7 @@ enum plane { > #define sprite_name(p, s) ((p) * INTEL_INFO(dev)->num_sprites[(p)] + (s) + > 'A') > > enum port { > + PORT_NONE = -1, > PORT_A = 0, > PORT_B, > PORT_C, > diff --git a/drivers/gpu/drm/i915/intel_ddi.c > b/drivers/gpu/drm/i915/intel_ddi.c > index c2df4e4..402755d 100644 > --- a/drivers/gpu/drm/i915/intel_ddi.c > +++ b/drivers/gpu/drm/i915/intel_ddi.c > @@ -2426,6 +2426,7 @@ void intel_ddi_init(struct drm_device *dev, enum port > port) > intel_dig_port->max_lanes = max_lanes; > > intel_encoder->type = INTEL_OUTPUT_UNKNOWN; > + intel_encoder->port = port; > intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); > intel_encoder->cloneable = 0; > > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c > index 364db90..cfe2f4a 100644 > --- a/drivers/gpu/drm/i915/intel_dp.c > +++ b/drivers/gpu/drm/i915/intel_dp.c > @@ -5726,6 +5726,7 @@ bool intel_dp_init(struct drm_device *dev, > intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); > } > intel_encoder->cloneable = 0; > + intel_encoder->port = port; > > intel_dig_port->hpd_pulse = intel_dp_hpd_pulse; > dev_priv->hotplug.irq_port[port] = intel_dig_port; > diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c > b/drivers/gpu/drm/i915/intel_dp_mst.c > index 629337d..d1d7e91 100644 > --- a/drivers/gpu/drm/i915/intel_dp_mst.c > +++ b/drivers/gpu/drm/i915/intel_dp_mst.c > @@ -540,6 +540,7 @@ intel_dp_create_fake_mst_encoder(struct intel_digital_port > *intel_dig_port, enum > DRM_MODE_ENCODER_DPMST, "DP-MST %c", > pipe_name(pipe)); > > intel_encoder->type = INTEL_OUTPUT_DP_MST; > + intel_encoder->port = intel_dig_port->port; > intel_encoder->crtc_mask = 0x7; > intel_encoder->cloneable = 0; > > diff --git a/drivers/gpu/drm/i915/intel_drv.h > b/drivers/gpu/drm/i915/intel_drv.h > index 1c700b0..68bf134 100644 > --- a/drivers/gpu/drm/i915/intel_drv.h > +++ b/drivers/gpu/drm/i915/intel_drv.h > @@ -202,6 +202,7 @@ struct intel_encoder { > struct drm_encoder base; > > enum intel_output_type type; > + enum port port; > unsigned int cloneable; > void (*hot_plug)(struct intel_encoder *); > bool (*compute_config)(struct intel_encoder *, > diff --git a/drivers/gpu/drm/i915/intel_dsi.c > b/drivers/gpu/drm/i915/intel_dsi.c > index de8e9fb..eb5cc0b 100644 > --- a/drivers/gpu/drm/i915/intel_dsi.c > +++ b/drivers/gpu/drm/i915/intel_dsi.c > @@ -1478,6 +1478,7 @@ void intel_dsi_init(struct drm_device *dev) > > intel_connector->get_hw_state = intel_connector_get_hw_state; > > + intel_encoder->port = port; > /* > * On BYT/CHV, pipe A maps to MIPI DSI port A, pipe B maps to MIPI > DSI > * port C. BXT isn't limited like this. > diff --git a/drivers/gpu/drm/i915/intel_dvo.c > b/drivers/gpu/drm/i915/intel_dvo.c > index 47bdf9d..6dc2791 100644 > --- a/drivers/gpu/drm/i915/intel_dvo.c > +++ b/drivers/gpu/drm/i915/intel_dvo.c > @@ -511,7 +511,9 @@ void intel_dvo_init(struct drm_device *dev) > "DVO %c", intel_dvo_port_name(dvo- > >dvo_reg)); > > intel_encoder->type = INTEL_OUTPUT_DVO; > + intel_encoder->port = PORT_NONE; > intel_encoder->crtc_mask = (1 << 0) | (1 << 1); > + > switch (dvo->type) { > case INTEL_DVO_CHIP_TMDS: > intel_encoder->cloneable = (1 << INTEL_OUTPUT_ANALOG) > | > diff --git a/drivers/gpu/drm/i915/intel_hdmi.c > b/drivers/gpu/drm/i915/intel_hdmi.c > index 4df9f38..25eeac3 100644 > --- a/drivers/gpu/drm/i915/intel_hdmi.c > +++ b/drivers/gpu/drm/i915/intel_hdmi.c > @@ -1962,6 +1962,7 @@ void intel_hdmi_init(struct drm_device *dev, > } > > intel_encoder->type = INTEL_OUTPUT_HDMI; > + intel_encoder->port = port; > if (IS_CHERRYVIEW(dev)) { > if (port == PORT_D) > intel_encoder->crtc_mask = 1 << 2; > diff --git a/drivers/gpu/drm/i915/intel_lvds.c > b/drivers/gpu/drm/i915/intel_lvds.c > index 668eabb..b756248 100644 > --- a/drivers/gpu/drm/i915/intel_lvds.c > +++ b/drivers/gpu/drm/i915/intel_lvds.c > @@ -1052,8 +1052,9 @@ void intel_lvds_init(struct drm_device *dev) > intel_connector->get_hw_state = intel_connector_get_hw_state; > > intel_connector_attach_encoder(intel_connector, intel_encoder); > - intel_encoder->type = INTEL_OUTPUT_LVDS; > > + intel_encoder->type = INTEL_OUTPUT_LVDS; > + intel_encoder->port = PORT_NONE; > intel_encoder->cloneable = 0; > if (HAS_PCH_SPLIT(dev)) > intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); > diff --git a/drivers/gpu/drm/i915/intel_sdvo.c > b/drivers/gpu/drm/i915/intel_sdvo.c > index e378f35..c5e04e8 100644 > --- a/drivers/gpu/drm/i915/intel_sdvo.c > +++ b/drivers/gpu/drm/i915/intel_sdvo.c > @@ -2973,6 +2973,7 @@ bool intel_sdvo_init(struct drm_device *dev, > /* encoder type will be decided later */ > intel_encoder = &intel_sdvo->base; > intel_encoder->type = INTEL_OUTPUT_SDVO; > + intel_encoder->port = port; > drm_encoder_init(dev, &intel_encoder->base, &intel_sdvo_enc_funcs, 0, > "SDVO %c", port_name(port)); > > diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c > index 49136ad..dba365c 100644 > --- a/drivers/gpu/drm/i915/intel_tv.c > +++ b/drivers/gpu/drm/i915/intel_tv.c > @@ -1603,7 +1603,9 @@ intel_tv_init(struct drm_device *dev) > intel_connector->get_hw_state = intel_connector_get_hw_state; > > intel_connector_attach_encoder(intel_connector, intel_encoder); > + > intel_encoder->type = INTEL_OUTPUT_TVOUT; > + intel_encoder->port = PORT_NONE; > intel_encoder->crtc_mask = (1 << 0) | (1 << 1); > intel_encoder->cloneable = 0; > intel_encoder->base.possible_crtcs = ((1 << 0) | (1 << 1));
On Wed, Aug 24, 2016 at 12:22:57AM -0700, Dhinakaran Pandiyan wrote: > Storing the port enum in intel_encoder makes it convenient to know the > port attached to an encoder. Moving the port information up from > intel_digital_port to intel_encoder avoids unecessary intel_digital_port > access and handles MST encoders cleanly without requiring conditional > checks for them (thanks danvet). > > v2: > Renamed the port enum member from 'attached_port' to 'port' (danvet) > Fixed missing initialization of port in intel_sdvo.c (danvet) > > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> > --- > drivers/gpu/drm/i915/i915_drv.h | 1 + > drivers/gpu/drm/i915/intel_ddi.c | 1 + > drivers/gpu/drm/i915/intel_dp.c | 1 + > drivers/gpu/drm/i915/intel_dp_mst.c | 1 + > drivers/gpu/drm/i915/intel_drv.h | 1 + > drivers/gpu/drm/i915/intel_dsi.c | 1 + > drivers/gpu/drm/i915/intel_dvo.c | 2 ++ > drivers/gpu/drm/i915/intel_hdmi.c | 1 + > drivers/gpu/drm/i915/intel_lvds.c | 3 ++- > drivers/gpu/drm/i915/intel_sdvo.c | 1 + > drivers/gpu/drm/i915/intel_tv.c | 2 ++ Missing intel_crt.c at least. Also we're going to want a patch to kill off the, now duplicated, information from intel_dig_port. > 11 files changed, 14 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h > index 9cd102c..60e282d5 100644 > --- a/drivers/gpu/drm/i915/i915_drv.h > +++ b/drivers/gpu/drm/i915/i915_drv.h > @@ -185,6 +185,7 @@ enum plane { > #define sprite_name(p, s) ((p) * INTEL_INFO(dev)->num_sprites[(p)] + (s) + 'A') > > enum port { > + PORT_NONE = -1, > PORT_A = 0, > PORT_B, > PORT_C, > diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c > index c2df4e4..402755d 100644 > --- a/drivers/gpu/drm/i915/intel_ddi.c > +++ b/drivers/gpu/drm/i915/intel_ddi.c > @@ -2426,6 +2426,7 @@ void intel_ddi_init(struct drm_device *dev, enum port port) > intel_dig_port->max_lanes = max_lanes; > > intel_encoder->type = INTEL_OUTPUT_UNKNOWN; > + intel_encoder->port = port; > intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); > intel_encoder->cloneable = 0; > > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c > index 364db90..cfe2f4a 100644 > --- a/drivers/gpu/drm/i915/intel_dp.c > +++ b/drivers/gpu/drm/i915/intel_dp.c > @@ -5726,6 +5726,7 @@ bool intel_dp_init(struct drm_device *dev, > intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); > } > intel_encoder->cloneable = 0; > + intel_encoder->port = port; > > intel_dig_port->hpd_pulse = intel_dp_hpd_pulse; > dev_priv->hotplug.irq_port[port] = intel_dig_port; > diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c > index 629337d..d1d7e91 100644 > --- a/drivers/gpu/drm/i915/intel_dp_mst.c > +++ b/drivers/gpu/drm/i915/intel_dp_mst.c > @@ -540,6 +540,7 @@ intel_dp_create_fake_mst_encoder(struct intel_digital_port *intel_dig_port, enum > DRM_MODE_ENCODER_DPMST, "DP-MST %c", pipe_name(pipe)); > > intel_encoder->type = INTEL_OUTPUT_DP_MST; > + intel_encoder->port = intel_dig_port->port; > intel_encoder->crtc_mask = 0x7; > intel_encoder->cloneable = 0; > > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h > index 1c700b0..68bf134 100644 > --- a/drivers/gpu/drm/i915/intel_drv.h > +++ b/drivers/gpu/drm/i915/intel_drv.h > @@ -202,6 +202,7 @@ struct intel_encoder { > struct drm_encoder base; > > enum intel_output_type type; > + enum port port; > unsigned int cloneable; > void (*hot_plug)(struct intel_encoder *); > bool (*compute_config)(struct intel_encoder *, > diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c > index de8e9fb..eb5cc0b 100644 > --- a/drivers/gpu/drm/i915/intel_dsi.c > +++ b/drivers/gpu/drm/i915/intel_dsi.c > @@ -1478,6 +1478,7 @@ void intel_dsi_init(struct drm_device *dev) > > intel_connector->get_hw_state = intel_connector_get_hw_state; > > + intel_encoder->port = port; > /* > * On BYT/CHV, pipe A maps to MIPI DSI port A, pipe B maps to MIPI DSI > * port C. BXT isn't limited like this. > diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c > index 47bdf9d..6dc2791 100644 > --- a/drivers/gpu/drm/i915/intel_dvo.c > +++ b/drivers/gpu/drm/i915/intel_dvo.c > @@ -511,7 +511,9 @@ void intel_dvo_init(struct drm_device *dev) > "DVO %c", intel_dvo_port_name(dvo->dvo_reg)); > > intel_encoder->type = INTEL_OUTPUT_DVO; > + intel_encoder->port = PORT_NONE; > intel_encoder->crtc_mask = (1 << 0) | (1 << 1); > + > switch (dvo->type) { > case INTEL_DVO_CHIP_TMDS: > intel_encoder->cloneable = (1 << INTEL_OUTPUT_ANALOG) | > diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c > index 4df9f38..25eeac3 100644 > --- a/drivers/gpu/drm/i915/intel_hdmi.c > +++ b/drivers/gpu/drm/i915/intel_hdmi.c > @@ -1962,6 +1962,7 @@ void intel_hdmi_init(struct drm_device *dev, > } > > intel_encoder->type = INTEL_OUTPUT_HDMI; > + intel_encoder->port = port; > if (IS_CHERRYVIEW(dev)) { > if (port == PORT_D) > intel_encoder->crtc_mask = 1 << 2; > diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c > index 668eabb..b756248 100644 > --- a/drivers/gpu/drm/i915/intel_lvds.c > +++ b/drivers/gpu/drm/i915/intel_lvds.c > @@ -1052,8 +1052,9 @@ void intel_lvds_init(struct drm_device *dev) > intel_connector->get_hw_state = intel_connector_get_hw_state; > > intel_connector_attach_encoder(intel_connector, intel_encoder); > - intel_encoder->type = INTEL_OUTPUT_LVDS; > > + intel_encoder->type = INTEL_OUTPUT_LVDS; > + intel_encoder->port = PORT_NONE; > intel_encoder->cloneable = 0; > if (HAS_PCH_SPLIT(dev)) > intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); > diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c > index e378f35..c5e04e8 100644 > --- a/drivers/gpu/drm/i915/intel_sdvo.c > +++ b/drivers/gpu/drm/i915/intel_sdvo.c > @@ -2973,6 +2973,7 @@ bool intel_sdvo_init(struct drm_device *dev, > /* encoder type will be decided later */ > intel_encoder = &intel_sdvo->base; > intel_encoder->type = INTEL_OUTPUT_SDVO; > + intel_encoder->port = port; > drm_encoder_init(dev, &intel_encoder->base, &intel_sdvo_enc_funcs, 0, > "SDVO %c", port_name(port)); > > diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c > index 49136ad..dba365c 100644 > --- a/drivers/gpu/drm/i915/intel_tv.c > +++ b/drivers/gpu/drm/i915/intel_tv.c > @@ -1603,7 +1603,9 @@ intel_tv_init(struct drm_device *dev) > intel_connector->get_hw_state = intel_connector_get_hw_state; > > intel_connector_attach_encoder(intel_connector, intel_encoder); > + > intel_encoder->type = INTEL_OUTPUT_TVOUT; > + intel_encoder->port = PORT_NONE; > intel_encoder->crtc_mask = (1 << 0) | (1 << 1); > intel_encoder->cloneable = 0; > intel_encoder->base.possible_crtcs = ((1 << 0) | (1 << 1)); > -- > 2.5.0
On Tue, 2016-09-06 at 15:07 +0300, Ville Syrjälä wrote: > On Wed, Aug 24, 2016 at 12:22:57AM -0700, Dhinakaran Pandiyan wrote: > > Storing the port enum in intel_encoder makes it convenient to know the > > port attached to an encoder. Moving the port information up from > > intel_digital_port to intel_encoder avoids unecessary intel_digital_port > > access and handles MST encoders cleanly without requiring conditional > > checks for them (thanks danvet). > > > > v2: > > Renamed the port enum member from 'attached_port' to 'port' (danvet) > > Fixed missing initialization of port in intel_sdvo.c (danvet) > > > > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> > > Cc: Daniel Vetter <daniel.vetter@ffwll.ch> > > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> > > --- > > drivers/gpu/drm/i915/i915_drv.h | 1 + > > drivers/gpu/drm/i915/intel_ddi.c | 1 + > > drivers/gpu/drm/i915/intel_dp.c | 1 + > > drivers/gpu/drm/i915/intel_dp_mst.c | 1 + > > drivers/gpu/drm/i915/intel_drv.h | 1 + > > drivers/gpu/drm/i915/intel_dsi.c | 1 + > > drivers/gpu/drm/i915/intel_dvo.c | 2 ++ > > drivers/gpu/drm/i915/intel_hdmi.c | 1 + > > drivers/gpu/drm/i915/intel_lvds.c | 3 ++- > > drivers/gpu/drm/i915/intel_sdvo.c | 1 + > > drivers/gpu/drm/i915/intel_tv.c | 2 ++ > > Missing intel_crt.c at least. > My grep search string was inadequate, will fix this. Thanks for the review. Can you also look at the the API change patch that you had R-B'd earlier? I removed your R-B as the patch changed. > Also we're going to want a patch to kill off the, now duplicated, > information from intel_dig_port. > Makes sense, I will work on it. > > 11 files changed, 14 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h > > index 9cd102c..60e282d5 100644 > > --- a/drivers/gpu/drm/i915/i915_drv.h > > +++ b/drivers/gpu/drm/i915/i915_drv.h > > @@ -185,6 +185,7 @@ enum plane { > > #define sprite_name(p, s) ((p) * INTEL_INFO(dev)->num_sprites[(p)] + (s) + 'A') > > > > enum port { > > + PORT_NONE = -1, > > PORT_A = 0, > > PORT_B, > > PORT_C, > > diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c > > index c2df4e4..402755d 100644 > > --- a/drivers/gpu/drm/i915/intel_ddi.c > > +++ b/drivers/gpu/drm/i915/intel_ddi.c > > @@ -2426,6 +2426,7 @@ void intel_ddi_init(struct drm_device *dev, enum port port) > > intel_dig_port->max_lanes = max_lanes; > > > > intel_encoder->type = INTEL_OUTPUT_UNKNOWN; > > + intel_encoder->port = port; > > intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); > > intel_encoder->cloneable = 0; > > > > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c > > index 364db90..cfe2f4a 100644 > > --- a/drivers/gpu/drm/i915/intel_dp.c > > +++ b/drivers/gpu/drm/i915/intel_dp.c > > @@ -5726,6 +5726,7 @@ bool intel_dp_init(struct drm_device *dev, > > intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); > > } > > intel_encoder->cloneable = 0; > > + intel_encoder->port = port; > > > > intel_dig_port->hpd_pulse = intel_dp_hpd_pulse; > > dev_priv->hotplug.irq_port[port] = intel_dig_port; > > diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c > > index 629337d..d1d7e91 100644 > > --- a/drivers/gpu/drm/i915/intel_dp_mst.c > > +++ b/drivers/gpu/drm/i915/intel_dp_mst.c > > @@ -540,6 +540,7 @@ intel_dp_create_fake_mst_encoder(struct intel_digital_port *intel_dig_port, enum > > DRM_MODE_ENCODER_DPMST, "DP-MST %c", pipe_name(pipe)); > > > > intel_encoder->type = INTEL_OUTPUT_DP_MST; > > + intel_encoder->port = intel_dig_port->port; > > intel_encoder->crtc_mask = 0x7; > > intel_encoder->cloneable = 0; > > > > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h > > index 1c700b0..68bf134 100644 > > --- a/drivers/gpu/drm/i915/intel_drv.h > > +++ b/drivers/gpu/drm/i915/intel_drv.h > > @@ -202,6 +202,7 @@ struct intel_encoder { > > struct drm_encoder base; > > > > enum intel_output_type type; > > + enum port port; > > unsigned int cloneable; > > void (*hot_plug)(struct intel_encoder *); > > bool (*compute_config)(struct intel_encoder *, > > diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c > > index de8e9fb..eb5cc0b 100644 > > --- a/drivers/gpu/drm/i915/intel_dsi.c > > +++ b/drivers/gpu/drm/i915/intel_dsi.c > > @@ -1478,6 +1478,7 @@ void intel_dsi_init(struct drm_device *dev) > > > > intel_connector->get_hw_state = intel_connector_get_hw_state; > > > > + intel_encoder->port = port; > > /* > > * On BYT/CHV, pipe A maps to MIPI DSI port A, pipe B maps to MIPI DSI > > * port C. BXT isn't limited like this. > > diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c > > index 47bdf9d..6dc2791 100644 > > --- a/drivers/gpu/drm/i915/intel_dvo.c > > +++ b/drivers/gpu/drm/i915/intel_dvo.c > > @@ -511,7 +511,9 @@ void intel_dvo_init(struct drm_device *dev) > > "DVO %c", intel_dvo_port_name(dvo->dvo_reg)); > > > > intel_encoder->type = INTEL_OUTPUT_DVO; > > + intel_encoder->port = PORT_NONE; > > intel_encoder->crtc_mask = (1 << 0) | (1 << 1); > > + > > switch (dvo->type) { > > case INTEL_DVO_CHIP_TMDS: > > intel_encoder->cloneable = (1 << INTEL_OUTPUT_ANALOG) | > > diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c > > index 4df9f38..25eeac3 100644 > > --- a/drivers/gpu/drm/i915/intel_hdmi.c > > +++ b/drivers/gpu/drm/i915/intel_hdmi.c > > @@ -1962,6 +1962,7 @@ void intel_hdmi_init(struct drm_device *dev, > > } > > > > intel_encoder->type = INTEL_OUTPUT_HDMI; > > + intel_encoder->port = port; > > if (IS_CHERRYVIEW(dev)) { > > if (port == PORT_D) > > intel_encoder->crtc_mask = 1 << 2; > > diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c > > index 668eabb..b756248 100644 > > --- a/drivers/gpu/drm/i915/intel_lvds.c > > +++ b/drivers/gpu/drm/i915/intel_lvds.c > > @@ -1052,8 +1052,9 @@ void intel_lvds_init(struct drm_device *dev) > > intel_connector->get_hw_state = intel_connector_get_hw_state; > > > > intel_connector_attach_encoder(intel_connector, intel_encoder); > > - intel_encoder->type = INTEL_OUTPUT_LVDS; > > > > + intel_encoder->type = INTEL_OUTPUT_LVDS; > > + intel_encoder->port = PORT_NONE; > > intel_encoder->cloneable = 0; > > if (HAS_PCH_SPLIT(dev)) > > intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); > > diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c > > index e378f35..c5e04e8 100644 > > --- a/drivers/gpu/drm/i915/intel_sdvo.c > > +++ b/drivers/gpu/drm/i915/intel_sdvo.c > > @@ -2973,6 +2973,7 @@ bool intel_sdvo_init(struct drm_device *dev, > > /* encoder type will be decided later */ > > intel_encoder = &intel_sdvo->base; > > intel_encoder->type = INTEL_OUTPUT_SDVO; > > + intel_encoder->port = port; > > drm_encoder_init(dev, &intel_encoder->base, &intel_sdvo_enc_funcs, 0, > > "SDVO %c", port_name(port)); > > > > diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c > > index 49136ad..dba365c 100644 > > --- a/drivers/gpu/drm/i915/intel_tv.c > > +++ b/drivers/gpu/drm/i915/intel_tv.c > > @@ -1603,7 +1603,9 @@ intel_tv_init(struct drm_device *dev) > > intel_connector->get_hw_state = intel_connector_get_hw_state; > > > > intel_connector_attach_encoder(intel_connector, intel_encoder); > > + > > intel_encoder->type = INTEL_OUTPUT_TVOUT; > > + intel_encoder->port = PORT_NONE; > > intel_encoder->crtc_mask = (1 << 0) | (1 << 1); > > intel_encoder->cloneable = 0; > > intel_encoder->base.possible_crtcs = ((1 << 0) | (1 << 1)); > > -- > > 2.5.0 >
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 9cd102c..60e282d5 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -185,6 +185,7 @@ enum plane { #define sprite_name(p, s) ((p) * INTEL_INFO(dev)->num_sprites[(p)] + (s) + 'A') enum port { + PORT_NONE = -1, PORT_A = 0, PORT_B, PORT_C, diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index c2df4e4..402755d 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c @@ -2426,6 +2426,7 @@ void intel_ddi_init(struct drm_device *dev, enum port port) intel_dig_port->max_lanes = max_lanes; intel_encoder->type = INTEL_OUTPUT_UNKNOWN; + intel_encoder->port = port; intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); intel_encoder->cloneable = 0; diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 364db90..cfe2f4a 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -5726,6 +5726,7 @@ bool intel_dp_init(struct drm_device *dev, intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); } intel_encoder->cloneable = 0; + intel_encoder->port = port; intel_dig_port->hpd_pulse = intel_dp_hpd_pulse; dev_priv->hotplug.irq_port[port] = intel_dig_port; diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c index 629337d..d1d7e91 100644 --- a/drivers/gpu/drm/i915/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/intel_dp_mst.c @@ -540,6 +540,7 @@ intel_dp_create_fake_mst_encoder(struct intel_digital_port *intel_dig_port, enum DRM_MODE_ENCODER_DPMST, "DP-MST %c", pipe_name(pipe)); intel_encoder->type = INTEL_OUTPUT_DP_MST; + intel_encoder->port = intel_dig_port->port; intel_encoder->crtc_mask = 0x7; intel_encoder->cloneable = 0; diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 1c700b0..68bf134 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -202,6 +202,7 @@ struct intel_encoder { struct drm_encoder base; enum intel_output_type type; + enum port port; unsigned int cloneable; void (*hot_plug)(struct intel_encoder *); bool (*compute_config)(struct intel_encoder *, diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c index de8e9fb..eb5cc0b 100644 --- a/drivers/gpu/drm/i915/intel_dsi.c +++ b/drivers/gpu/drm/i915/intel_dsi.c @@ -1478,6 +1478,7 @@ void intel_dsi_init(struct drm_device *dev) intel_connector->get_hw_state = intel_connector_get_hw_state; + intel_encoder->port = port; /* * On BYT/CHV, pipe A maps to MIPI DSI port A, pipe B maps to MIPI DSI * port C. BXT isn't limited like this. diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c index 47bdf9d..6dc2791 100644 --- a/drivers/gpu/drm/i915/intel_dvo.c +++ b/drivers/gpu/drm/i915/intel_dvo.c @@ -511,7 +511,9 @@ void intel_dvo_init(struct drm_device *dev) "DVO %c", intel_dvo_port_name(dvo->dvo_reg)); intel_encoder->type = INTEL_OUTPUT_DVO; + intel_encoder->port = PORT_NONE; intel_encoder->crtc_mask = (1 << 0) | (1 << 1); + switch (dvo->type) { case INTEL_DVO_CHIP_TMDS: intel_encoder->cloneable = (1 << INTEL_OUTPUT_ANALOG) | diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 4df9f38..25eeac3 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -1962,6 +1962,7 @@ void intel_hdmi_init(struct drm_device *dev, } intel_encoder->type = INTEL_OUTPUT_HDMI; + intel_encoder->port = port; if (IS_CHERRYVIEW(dev)) { if (port == PORT_D) intel_encoder->crtc_mask = 1 << 2; diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 668eabb..b756248 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c @@ -1052,8 +1052,9 @@ void intel_lvds_init(struct drm_device *dev) intel_connector->get_hw_state = intel_connector_get_hw_state; intel_connector_attach_encoder(intel_connector, intel_encoder); - intel_encoder->type = INTEL_OUTPUT_LVDS; + intel_encoder->type = INTEL_OUTPUT_LVDS; + intel_encoder->port = PORT_NONE; intel_encoder->cloneable = 0; if (HAS_PCH_SPLIT(dev)) intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index e378f35..c5e04e8 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c @@ -2973,6 +2973,7 @@ bool intel_sdvo_init(struct drm_device *dev, /* encoder type will be decided later */ intel_encoder = &intel_sdvo->base; intel_encoder->type = INTEL_OUTPUT_SDVO; + intel_encoder->port = port; drm_encoder_init(dev, &intel_encoder->base, &intel_sdvo_enc_funcs, 0, "SDVO %c", port_name(port)); diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c index 49136ad..dba365c 100644 --- a/drivers/gpu/drm/i915/intel_tv.c +++ b/drivers/gpu/drm/i915/intel_tv.c @@ -1603,7 +1603,9 @@ intel_tv_init(struct drm_device *dev) intel_connector->get_hw_state = intel_connector_get_hw_state; intel_connector_attach_encoder(intel_connector, intel_encoder); + intel_encoder->type = INTEL_OUTPUT_TVOUT; + intel_encoder->port = PORT_NONE; intel_encoder->crtc_mask = (1 << 0) | (1 << 1); intel_encoder->cloneable = 0; intel_encoder->base.possible_crtcs = ((1 << 0) | (1 << 1));
Storing the port enum in intel_encoder makes it convenient to know the port attached to an encoder. Moving the port information up from intel_digital_port to intel_encoder avoids unecessary intel_digital_port access and handles MST encoders cleanly without requiring conditional checks for them (thanks danvet). v2: Renamed the port enum member from 'attached_port' to 'port' (danvet) Fixed missing initialization of port in intel_sdvo.c (danvet) Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> --- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/intel_ddi.c | 1 + drivers/gpu/drm/i915/intel_dp.c | 1 + drivers/gpu/drm/i915/intel_dp_mst.c | 1 + drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_dsi.c | 1 + drivers/gpu/drm/i915/intel_dvo.c | 2 ++ drivers/gpu/drm/i915/intel_hdmi.c | 1 + drivers/gpu/drm/i915/intel_lvds.c | 3 ++- drivers/gpu/drm/i915/intel_sdvo.c | 1 + drivers/gpu/drm/i915/intel_tv.c | 2 ++ 11 files changed, 14 insertions(+), 1 deletion(-)