mirror of https://gitee.com/openkylin/linux.git
drm/i915: Iterate through the initialized DDIs to prepare their buffers
Not every DDIs is necessarily connected can be strapped off and, in the future, we'll have platforms with a different number of default DDI ports. So, let's only call intel_prepare_ddi_buffers() on DDI ports that are actually detected. We also use the opportunity to give a struct intel_digital_port to intel_prepare_ddi_buffers() as we'll need it in a following patch to query if the port supports HMDI or not. On my HSW machine this removes the initialization of a couple of (unused) DDIs. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Reviewed-by: Sivakumar Thulasimani <sivakumar.thulasimani@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
503604038b
commit
b403745c84
drivers/gpu/drm/i915
|
@ -251,6 +251,10 @@ enum hpd_pin {
|
||||||
&dev->mode_config.connector_list, \
|
&dev->mode_config.connector_list, \
|
||||||
base.head)
|
base.head)
|
||||||
|
|
||||||
|
#define for_each_digital_port(dev, digital_port) \
|
||||||
|
list_for_each_entry(digital_port, \
|
||||||
|
&dev->mode_config.encoder_list, \
|
||||||
|
base.base.head)
|
||||||
|
|
||||||
#define for_each_encoder_on_crtc(dev, __crtc, intel_encoder) \
|
#define for_each_encoder_on_crtc(dev, __crtc, intel_encoder) \
|
||||||
list_for_each_entry((intel_encoder), &(dev)->mode_config.encoder_list, base.head) \
|
list_for_each_entry((intel_encoder), &(dev)->mode_config.encoder_list, base.head) \
|
||||||
|
|
|
@ -198,10 +198,12 @@ enum port intel_ddi_get_encoder_port(struct intel_encoder *intel_encoder)
|
||||||
* in either FDI or DP modes only, as HDMI connections will work with both
|
* in either FDI or DP modes only, as HDMI connections will work with both
|
||||||
* of those
|
* of those
|
||||||
*/
|
*/
|
||||||
static void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port)
|
static void intel_prepare_ddi_buffers(struct drm_device *dev,
|
||||||
|
struct intel_digital_port *intel_dig_port)
|
||||||
{
|
{
|
||||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||||
u32 reg;
|
u32 reg;
|
||||||
|
int port = intel_dig_port->port;
|
||||||
int i, n_hdmi_entries, n_dp_entries, n_edp_entries, hdmi_default_entry,
|
int i, n_hdmi_entries, n_dp_entries, n_edp_entries, hdmi_default_entry,
|
||||||
size;
|
size;
|
||||||
int hdmi_level = dev_priv->vbt.ddi_port_info[port].hdmi_level_shift;
|
int hdmi_level = dev_priv->vbt.ddi_port_info[port].hdmi_level_shift;
|
||||||
|
@ -309,13 +311,19 @@ static void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port)
|
||||||
*/
|
*/
|
||||||
void intel_prepare_ddi(struct drm_device *dev)
|
void intel_prepare_ddi(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
int port;
|
struct intel_digital_port *intel_dig_port;
|
||||||
|
bool visited[I915_MAX_PORTS] = { 0, };
|
||||||
|
|
||||||
if (!HAS_DDI(dev))
|
if (!HAS_DDI(dev))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (port = PORT_A; port <= PORT_E; port++)
|
for_each_digital_port(dev, intel_dig_port) {
|
||||||
intel_prepare_ddi_buffers(dev, port);
|
if (visited[intel_dig_port->port])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
intel_prepare_ddi_buffers(dev, intel_dig_port);
|
||||||
|
visited[intel_dig_port->port] = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void intel_wait_ddi_buf_idle(struct drm_i915_private *dev_priv,
|
static void intel_wait_ddi_buf_idle(struct drm_i915_private *dev_priv,
|
||||||
|
|
Loading…
Reference in New Issue