提交 8f1a6086 编写于 作者: B Ben Skeggs

drm/nouveau: tidy connector/encoder creation a little

Create connectors before encoders to avoid having to do another loop across
encoder list whenever we create a new connector.  This allows us to pass
the connector to the encoder creation functions, and avoid using a
create_resources() callback since we can now call it directly.

This can also potentially modify the connector ordering on nv50.  On cards
where the DCB connector and encoder tables are in the same order, things
will be unchanged.  However, there's some cards where the ordering between
the tables differ, and in one case, leads us to naming the connectors
"wrongly".
Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
上级 3195c5f9
...@@ -81,6 +81,7 @@ struct dcb_connector_table_entry { ...@@ -81,6 +81,7 @@ struct dcb_connector_table_entry {
enum dcb_connector_type type; enum dcb_connector_type type;
uint8_t index2; uint8_t index2;
uint8_t gpio_tag; uint8_t gpio_tag;
void *drm;
}; };
struct dcb_connector_table { struct dcb_connector_table {
......
...@@ -729,66 +729,62 @@ nouveau_connector_funcs_lvds = { ...@@ -729,66 +729,62 @@ nouveau_connector_funcs_lvds = {
.force = nouveau_connector_force .force = nouveau_connector_force
}; };
int struct drm_connector *
nouveau_connector_create(struct drm_device *dev, nouveau_connector_create(struct drm_device *dev, int index)
struct dcb_connector_table_entry *dcb)
{ {
const struct drm_connector_funcs *funcs = &nouveau_connector_funcs; const struct drm_connector_funcs *funcs = &nouveau_connector_funcs;
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nouveau_connector *nv_connector = NULL; struct nouveau_connector *nv_connector = NULL;
struct dcb_connector_table_entry *dcb = NULL;
struct drm_connector *connector; struct drm_connector *connector;
struct drm_encoder *encoder;
int type, ret = 0; int type, ret = 0;
NV_DEBUG_KMS(dev, "\n"); NV_DEBUG_KMS(dev, "\n");
if (index >= dev_priv->vbios.dcb.connector.entries)
return ERR_PTR(-EINVAL);
dcb = &dev_priv->vbios.dcb.connector.entry[index];
if (dcb->drm)
return dcb->drm;
switch (dcb->type) { switch (dcb->type) {
case DCB_CONNECTOR_NONE:
return 0;
case DCB_CONNECTOR_VGA: case DCB_CONNECTOR_VGA:
NV_INFO(dev, "Detected a VGA connector\n");
type = DRM_MODE_CONNECTOR_VGA; type = DRM_MODE_CONNECTOR_VGA;
break; break;
case DCB_CONNECTOR_TV_0: case DCB_CONNECTOR_TV_0:
case DCB_CONNECTOR_TV_1: case DCB_CONNECTOR_TV_1:
case DCB_CONNECTOR_TV_3: case DCB_CONNECTOR_TV_3:
NV_INFO(dev, "Detected a TV connector\n");
type = DRM_MODE_CONNECTOR_TV; type = DRM_MODE_CONNECTOR_TV;
break; break;
case DCB_CONNECTOR_DVI_I: case DCB_CONNECTOR_DVI_I:
NV_INFO(dev, "Detected a DVI-I connector\n");
type = DRM_MODE_CONNECTOR_DVII; type = DRM_MODE_CONNECTOR_DVII;
break; break;
case DCB_CONNECTOR_DVI_D: case DCB_CONNECTOR_DVI_D:
NV_INFO(dev, "Detected a DVI-D connector\n");
type = DRM_MODE_CONNECTOR_DVID; type = DRM_MODE_CONNECTOR_DVID;
break; break;
case DCB_CONNECTOR_HDMI_0: case DCB_CONNECTOR_HDMI_0:
case DCB_CONNECTOR_HDMI_1: case DCB_CONNECTOR_HDMI_1:
NV_INFO(dev, "Detected a HDMI connector\n");
type = DRM_MODE_CONNECTOR_HDMIA; type = DRM_MODE_CONNECTOR_HDMIA;
break; break;
case DCB_CONNECTOR_LVDS: case DCB_CONNECTOR_LVDS:
NV_INFO(dev, "Detected a LVDS connector\n");
type = DRM_MODE_CONNECTOR_LVDS; type = DRM_MODE_CONNECTOR_LVDS;
funcs = &nouveau_connector_funcs_lvds; funcs = &nouveau_connector_funcs_lvds;
break; break;
case DCB_CONNECTOR_DP: case DCB_CONNECTOR_DP:
NV_INFO(dev, "Detected a DisplayPort connector\n");
type = DRM_MODE_CONNECTOR_DisplayPort; type = DRM_MODE_CONNECTOR_DisplayPort;
break; break;
case DCB_CONNECTOR_eDP: case DCB_CONNECTOR_eDP:
NV_INFO(dev, "Detected an eDP connector\n");
type = DRM_MODE_CONNECTOR_eDP; type = DRM_MODE_CONNECTOR_eDP;
break; break;
default: default:
NV_ERROR(dev, "unknown connector type: 0x%02x!!\n", dcb->type); NV_ERROR(dev, "unknown connector type: 0x%02x!!\n", dcb->type);
return -EINVAL; return ERR_PTR(-EINVAL);
} }
nv_connector = kzalloc(sizeof(*nv_connector), GFP_KERNEL); nv_connector = kzalloc(sizeof(*nv_connector), GFP_KERNEL);
if (!nv_connector) if (!nv_connector)
return -ENOMEM; return ERR_PTR(-ENOMEM);
nv_connector->dcb = dcb; nv_connector->dcb = dcb;
connector = &nv_connector->base; connector = &nv_connector->base;
...@@ -799,24 +795,6 @@ nouveau_connector_create(struct drm_device *dev, ...@@ -799,24 +795,6 @@ nouveau_connector_create(struct drm_device *dev,
drm_connector_init(dev, connector, funcs, type); drm_connector_init(dev, connector, funcs, type);
drm_connector_helper_add(connector, &nouveau_connector_helper_funcs); drm_connector_helper_add(connector, &nouveau_connector_helper_funcs);
/* attach encoders */
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
if (nv_encoder->dcb->connector != dcb->index)
continue;
if (get_slave_funcs(nv_encoder))
get_slave_funcs(nv_encoder)->create_resources(encoder, connector);
drm_mode_connector_attach_encoder(connector, encoder);
}
if (!connector->encoder_ids[0]) {
NV_WARN(dev, " no encoders, ignoring\n");
goto fail;
}
/* Check if we need dithering enabled */ /* Check if we need dithering enabled */
if (dcb->type == DCB_CONNECTOR_LVDS) { if (dcb->type == DCB_CONNECTOR_LVDS) {
bool dummy, is_24bit = false; bool dummy, is_24bit = false;
...@@ -877,11 +855,12 @@ nouveau_connector_create(struct drm_device *dev, ...@@ -877,11 +855,12 @@ nouveau_connector_create(struct drm_device *dev,
} }
drm_sysfs_connector_add(connector); drm_sysfs_connector_add(connector);
return 0; dcb->drm = connector;
return dcb->drm;
fail: fail:
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
kfree(connector); kfree(connector);
return ret; return ERR_PTR(ret);
} }
...@@ -49,7 +49,7 @@ static inline struct nouveau_connector *nouveau_connector( ...@@ -49,7 +49,7 @@ static inline struct nouveau_connector *nouveau_connector(
return container_of(con, struct nouveau_connector, base); return container_of(con, struct nouveau_connector, base);
} }
int nouveau_connector_create(struct drm_device *, struct drm_connector *
struct dcb_connector_table_entry *); nouveau_connector_create(struct drm_device *, int index);
#endif /* __NOUVEAU_CONNECTOR_H__ */ #endif /* __NOUVEAU_CONNECTOR_H__ */
...@@ -1072,13 +1072,13 @@ extern long nouveau_compat_ioctl(struct file *file, unsigned int cmd, ...@@ -1072,13 +1072,13 @@ extern long nouveau_compat_ioctl(struct file *file, unsigned int cmd,
unsigned long arg); unsigned long arg);
/* nv04_dac.c */ /* nv04_dac.c */
extern int nv04_dac_create(struct drm_device *dev, struct dcb_entry *entry); extern int nv04_dac_create(struct drm_connector *, struct dcb_entry *);
extern uint32_t nv17_dac_sample_load(struct drm_encoder *encoder); extern uint32_t nv17_dac_sample_load(struct drm_encoder *encoder);
extern int nv04_dac_output_offset(struct drm_encoder *encoder); extern int nv04_dac_output_offset(struct drm_encoder *encoder);
extern void nv04_dac_update_dacclk(struct drm_encoder *encoder, bool enable); extern void nv04_dac_update_dacclk(struct drm_encoder *encoder, bool enable);
/* nv04_dfp.c */ /* nv04_dfp.c */
extern int nv04_dfp_create(struct drm_device *dev, struct dcb_entry *entry); extern int nv04_dfp_create(struct drm_connector *, struct dcb_entry *);
extern int nv04_dfp_get_bound_head(struct drm_device *dev, struct dcb_entry *dcbent); extern int nv04_dfp_get_bound_head(struct drm_device *dev, struct dcb_entry *dcbent);
extern void nv04_dfp_bind_head(struct drm_device *dev, struct dcb_entry *dcbent, extern void nv04_dfp_bind_head(struct drm_device *dev, struct dcb_entry *dcbent,
int head, bool dl); int head, bool dl);
...@@ -1087,10 +1087,10 @@ extern void nv04_dfp_update_fp_control(struct drm_encoder *encoder, int mode); ...@@ -1087,10 +1087,10 @@ extern void nv04_dfp_update_fp_control(struct drm_encoder *encoder, int mode);
/* nv04_tv.c */ /* nv04_tv.c */
extern int nv04_tv_identify(struct drm_device *dev, int i2c_index); extern int nv04_tv_identify(struct drm_device *dev, int i2c_index);
extern int nv04_tv_create(struct drm_device *dev, struct dcb_entry *entry); extern int nv04_tv_create(struct drm_connector *, struct dcb_entry *);
/* nv17_tv.c */ /* nv17_tv.c */
extern int nv17_tv_create(struct drm_device *dev, struct dcb_entry *entry); extern int nv17_tv_create(struct drm_connector *, struct dcb_entry *);
/* nv04_display.c */ /* nv04_display.c */
extern int nv04_display_create(struct drm_device *); extern int nv04_display_create(struct drm_device *);
......
...@@ -71,8 +71,8 @@ static inline struct drm_encoder *to_drm_encoder(struct nouveau_encoder *enc) ...@@ -71,8 +71,8 @@ static inline struct drm_encoder *to_drm_encoder(struct nouveau_encoder *enc)
struct nouveau_connector * struct nouveau_connector *
nouveau_encoder_connector_get(struct nouveau_encoder *encoder); nouveau_encoder_connector_get(struct nouveau_encoder *encoder);
int nv50_sor_create(struct drm_device *dev, struct dcb_entry *entry); int nv50_sor_create(struct drm_connector *, struct dcb_entry *);
int nv50_dac_create(struct drm_device *dev, struct dcb_entry *entry); int nv50_dac_create(struct drm_connector *, struct dcb_entry *);
struct bit_displayport_encoder_table { struct bit_displayport_encoder_table {
uint32_t match; uint32_t match;
......
...@@ -501,11 +501,13 @@ static const struct drm_encoder_funcs nv04_dac_funcs = { ...@@ -501,11 +501,13 @@ static const struct drm_encoder_funcs nv04_dac_funcs = {
.destroy = nv04_dac_destroy, .destroy = nv04_dac_destroy,
}; };
int nv04_dac_create(struct drm_device *dev, struct dcb_entry *entry) int
nv04_dac_create(struct drm_connector *connector, struct dcb_entry *entry)
{ {
const struct drm_encoder_helper_funcs *helper; const struct drm_encoder_helper_funcs *helper;
struct drm_encoder *encoder;
struct nouveau_encoder *nv_encoder = NULL; struct nouveau_encoder *nv_encoder = NULL;
struct drm_device *dev = connector->dev;
struct drm_encoder *encoder;
nv_encoder = kzalloc(sizeof(*nv_encoder), GFP_KERNEL); nv_encoder = kzalloc(sizeof(*nv_encoder), GFP_KERNEL);
if (!nv_encoder) if (!nv_encoder)
...@@ -527,5 +529,6 @@ int nv04_dac_create(struct drm_device *dev, struct dcb_entry *entry) ...@@ -527,5 +529,6 @@ int nv04_dac_create(struct drm_device *dev, struct dcb_entry *entry)
encoder->possible_crtcs = entry->heads; encoder->possible_crtcs = entry->heads;
encoder->possible_clones = 0; encoder->possible_clones = 0;
drm_mode_connector_attach_encoder(connector, encoder);
return 0; return 0;
} }
...@@ -584,11 +584,12 @@ static const struct drm_encoder_funcs nv04_dfp_funcs = { ...@@ -584,11 +584,12 @@ static const struct drm_encoder_funcs nv04_dfp_funcs = {
.destroy = nv04_dfp_destroy, .destroy = nv04_dfp_destroy,
}; };
int nv04_dfp_create(struct drm_device *dev, struct dcb_entry *entry) int
nv04_dfp_create(struct drm_connector *connector, struct dcb_entry *entry)
{ {
const struct drm_encoder_helper_funcs *helper; const struct drm_encoder_helper_funcs *helper;
struct drm_encoder *encoder;
struct nouveau_encoder *nv_encoder = NULL; struct nouveau_encoder *nv_encoder = NULL;
struct drm_encoder *encoder;
int type; int type;
switch (entry->type) { switch (entry->type) {
...@@ -613,11 +614,12 @@ int nv04_dfp_create(struct drm_device *dev, struct dcb_entry *entry) ...@@ -613,11 +614,12 @@ int nv04_dfp_create(struct drm_device *dev, struct dcb_entry *entry)
nv_encoder->dcb = entry; nv_encoder->dcb = entry;
nv_encoder->or = ffs(entry->or) - 1; nv_encoder->or = ffs(entry->or) - 1;
drm_encoder_init(dev, encoder, &nv04_dfp_funcs, type); drm_encoder_init(connector->dev, encoder, &nv04_dfp_funcs, type);
drm_encoder_helper_add(encoder, helper); drm_encoder_helper_add(encoder, helper);
encoder->possible_crtcs = entry->heads; encoder->possible_crtcs = entry->heads;
encoder->possible_clones = 0; encoder->possible_clones = 0;
drm_mode_connector_attach_encoder(connector, encoder);
return 0; return 0;
} }
...@@ -94,6 +94,7 @@ nv04_display_create(struct drm_device *dev) ...@@ -94,6 +94,7 @@ nv04_display_create(struct drm_device *dev)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct dcb_table *dcb = &dev_priv->vbios.dcb; struct dcb_table *dcb = &dev_priv->vbios.dcb;
struct drm_connector *connector, *ct;
struct drm_encoder *encoder; struct drm_encoder *encoder;
struct drm_crtc *crtc; struct drm_crtc *crtc;
int i, ret; int i, ret;
...@@ -132,19 +133,23 @@ nv04_display_create(struct drm_device *dev) ...@@ -132,19 +133,23 @@ nv04_display_create(struct drm_device *dev)
for (i = 0; i < dcb->entries; i++) { for (i = 0; i < dcb->entries; i++) {
struct dcb_entry *dcbent = &dcb->entry[i]; struct dcb_entry *dcbent = &dcb->entry[i];
connector = nouveau_connector_create(dev, dcbent->connector);
if (IS_ERR(connector))
continue;
switch (dcbent->type) { switch (dcbent->type) {
case OUTPUT_ANALOG: case OUTPUT_ANALOG:
ret = nv04_dac_create(dev, dcbent); ret = nv04_dac_create(connector, dcbent);
break; break;
case OUTPUT_LVDS: case OUTPUT_LVDS:
case OUTPUT_TMDS: case OUTPUT_TMDS:
ret = nv04_dfp_create(dev, dcbent); ret = nv04_dfp_create(connector, dcbent);
break; break;
case OUTPUT_TV: case OUTPUT_TV:
if (dcbent->location == DCB_LOC_ON_CHIP) if (dcbent->location == DCB_LOC_ON_CHIP)
ret = nv17_tv_create(dev, dcbent); ret = nv17_tv_create(connector, dcbent);
else else
ret = nv04_tv_create(dev, dcbent); ret = nv04_tv_create(connector, dcbent);
break; break;
default: default:
NV_WARN(dev, "DCB type %d not known\n", dcbent->type); NV_WARN(dev, "DCB type %d not known\n", dcbent->type);
...@@ -155,8 +160,14 @@ nv04_display_create(struct drm_device *dev) ...@@ -155,8 +160,14 @@ nv04_display_create(struct drm_device *dev)
continue; continue;
} }
for (i = 0; i < dcb->connector.entries; i++) list_for_each_entry_safe(connector, ct,
nouveau_connector_create(dev, &dcb->connector.entry[i]); &dev->mode_config.connector_list, head) {
if (!connector->encoder_ids[0]) {
NV_WARN(dev, "%s has no encoders, removing\n",
drm_get_connector_name(connector));
connector->funcs->destroy(connector);
}
}
/* Save previous state */ /* Save previous state */
NVLockVgaCrtcs(dev, false); NVLockVgaCrtcs(dev, false);
......
...@@ -223,10 +223,12 @@ static void nv04_tv_destroy(struct drm_encoder *encoder) ...@@ -223,10 +223,12 @@ static void nv04_tv_destroy(struct drm_encoder *encoder)
kfree(nv_encoder); kfree(nv_encoder);
} }
int nv04_tv_create(struct drm_device *dev, struct dcb_entry *entry) int
nv04_tv_create(struct drm_connector *connector, struct dcb_entry *entry)
{ {
struct nouveau_encoder *nv_encoder; struct nouveau_encoder *nv_encoder;
struct drm_encoder *encoder; struct drm_encoder *encoder;
struct drm_device *dev = connector->dev;
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct i2c_adapter *adap; struct i2c_adapter *adap;
struct drm_encoder_funcs *funcs = NULL; struct drm_encoder_funcs *funcs = NULL;
...@@ -266,7 +268,7 @@ int nv04_tv_create(struct drm_device *dev, struct dcb_entry *entry) ...@@ -266,7 +268,7 @@ int nv04_tv_create(struct drm_device *dev, struct dcb_entry *entry)
was_locked = NVLockVgaCrtcs(dev, false); was_locked = NVLockVgaCrtcs(dev, false);
ret = drm_i2c_encoder_init(encoder->dev, to_encoder_slave(encoder), adap, ret = drm_i2c_encoder_init(dev, to_encoder_slave(encoder), adap,
&nv04_tv_encoder_info[type].board_info); &nv04_tv_encoder_info[type].board_info);
NVLockVgaCrtcs(dev, was_locked); NVLockVgaCrtcs(dev, was_locked);
...@@ -294,7 +296,9 @@ int nv04_tv_create(struct drm_device *dev, struct dcb_entry *entry) ...@@ -294,7 +296,9 @@ int nv04_tv_create(struct drm_device *dev, struct dcb_entry *entry)
/* Set the slave encoder configuration */ /* Set the slave encoder configuration */
sfuncs->set_config(encoder, nv04_tv_encoder_info[type].params); sfuncs->set_config(encoder, nv04_tv_encoder_info[type].params);
sfuncs->create_resources(encoder, connector);
drm_mode_connector_attach_encoder(connector, encoder);
return 0; return 0;
fail: fail:
......
...@@ -744,8 +744,10 @@ static struct drm_encoder_funcs nv17_tv_funcs = { ...@@ -744,8 +744,10 @@ static struct drm_encoder_funcs nv17_tv_funcs = {
.destroy = nv17_tv_destroy, .destroy = nv17_tv_destroy,
}; };
int nv17_tv_create(struct drm_device *dev, struct dcb_entry *entry) int
nv17_tv_create(struct drm_connector *connector, struct dcb_entry *entry)
{ {
struct drm_device *dev = connector->dev;
struct drm_encoder *encoder; struct drm_encoder *encoder;
struct nv17_tv_encoder *tv_enc = NULL; struct nv17_tv_encoder *tv_enc = NULL;
...@@ -774,5 +776,7 @@ int nv17_tv_create(struct drm_device *dev, struct dcb_entry *entry) ...@@ -774,5 +776,7 @@ int nv17_tv_create(struct drm_device *dev, struct dcb_entry *entry)
encoder->possible_crtcs = entry->heads; encoder->possible_crtcs = entry->heads;
encoder->possible_clones = 0; encoder->possible_clones = 0;
nv17_tv_create_resources(encoder, connector);
drm_mode_connector_attach_encoder(connector, encoder);
return 0; return 0;
} }
...@@ -275,14 +275,11 @@ static const struct drm_encoder_funcs nv50_dac_encoder_funcs = { ...@@ -275,14 +275,11 @@ static const struct drm_encoder_funcs nv50_dac_encoder_funcs = {
}; };
int int
nv50_dac_create(struct drm_device *dev, struct dcb_entry *entry) nv50_dac_create(struct drm_connector *connector, struct dcb_entry *entry)
{ {
struct nouveau_encoder *nv_encoder; struct nouveau_encoder *nv_encoder;
struct drm_encoder *encoder; struct drm_encoder *encoder;
NV_DEBUG_KMS(dev, "\n");
NV_INFO(dev, "Detected a DAC output\n");
nv_encoder = kzalloc(sizeof(*nv_encoder), GFP_KERNEL); nv_encoder = kzalloc(sizeof(*nv_encoder), GFP_KERNEL);
if (!nv_encoder) if (!nv_encoder)
return -ENOMEM; return -ENOMEM;
...@@ -293,12 +290,14 @@ nv50_dac_create(struct drm_device *dev, struct dcb_entry *entry) ...@@ -293,12 +290,14 @@ nv50_dac_create(struct drm_device *dev, struct dcb_entry *entry)
nv_encoder->disconnect = nv50_dac_disconnect; nv_encoder->disconnect = nv50_dac_disconnect;
drm_encoder_init(dev, encoder, &nv50_dac_encoder_funcs, drm_encoder_init(connector->dev, encoder, &nv50_dac_encoder_funcs,
DRM_MODE_ENCODER_DAC); DRM_MODE_ENCODER_DAC);
drm_encoder_helper_add(encoder, &nv50_dac_helper_funcs); drm_encoder_helper_add(encoder, &nv50_dac_helper_funcs);
encoder->possible_crtcs = entry->heads; encoder->possible_crtcs = entry->heads;
encoder->possible_clones = 0; encoder->possible_clones = 0;
drm_mode_connector_attach_encoder(connector, encoder);
return 0; return 0;
} }
...@@ -465,6 +465,7 @@ int nv50_display_create(struct drm_device *dev) ...@@ -465,6 +465,7 @@ int nv50_display_create(struct drm_device *dev)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct dcb_table *dcb = &dev_priv->vbios.dcb; struct dcb_table *dcb = &dev_priv->vbios.dcb;
struct drm_connector *connector, *ct;
int ret, i; int ret, i;
NV_DEBUG_KMS(dev, "\n"); NV_DEBUG_KMS(dev, "\n");
...@@ -507,14 +508,18 @@ int nv50_display_create(struct drm_device *dev) ...@@ -507,14 +508,18 @@ int nv50_display_create(struct drm_device *dev)
continue; continue;
} }
connector = nouveau_connector_create(dev, entry->connector);
if (IS_ERR(connector))
continue;
switch (entry->type) { switch (entry->type) {
case OUTPUT_TMDS: case OUTPUT_TMDS:
case OUTPUT_LVDS: case OUTPUT_LVDS:
case OUTPUT_DP: case OUTPUT_DP:
nv50_sor_create(dev, entry); nv50_sor_create(connector, entry);
break; break;
case OUTPUT_ANALOG: case OUTPUT_ANALOG:
nv50_dac_create(dev, entry); nv50_dac_create(connector, entry);
break; break;
default: default:
NV_WARN(dev, "DCB encoder %d unknown\n", entry->type); NV_WARN(dev, "DCB encoder %d unknown\n", entry->type);
...@@ -522,11 +527,13 @@ int nv50_display_create(struct drm_device *dev) ...@@ -522,11 +527,13 @@ int nv50_display_create(struct drm_device *dev)
} }
} }
for (i = 0 ; i < dcb->connector.entries; i++) { list_for_each_entry_safe(connector, ct,
if (i != 0 && dcb->connector.entry[i].index2 == &dev->mode_config.connector_list, head) {
dcb->connector.entry[i - 1].index2) if (!connector->encoder_ids[0]) {
continue; NV_WARN(dev, "%s has no encoders, removing\n",
nouveau_connector_create(dev, &dcb->connector.entry[i]); drm_get_connector_name(connector));
connector->funcs->destroy(connector);
}
} }
ret = nv50_display_init(dev); ret = nv50_display_init(dev);
......
...@@ -272,32 +272,22 @@ static const struct drm_encoder_funcs nv50_sor_encoder_funcs = { ...@@ -272,32 +272,22 @@ static const struct drm_encoder_funcs nv50_sor_encoder_funcs = {
}; };
int int
nv50_sor_create(struct drm_device *dev, struct dcb_entry *entry) nv50_sor_create(struct drm_connector *connector, struct dcb_entry *entry)
{ {
struct nouveau_encoder *nv_encoder = NULL; struct nouveau_encoder *nv_encoder = NULL;
struct drm_device *dev = connector->dev;
struct drm_encoder *encoder; struct drm_encoder *encoder;
bool dum;
int type; int type;
NV_DEBUG_KMS(dev, "\n"); NV_DEBUG_KMS(dev, "\n");
switch (entry->type) { switch (entry->type) {
case OUTPUT_TMDS: case OUTPUT_TMDS:
NV_INFO(dev, "Detected a TMDS output\n"); case OUTPUT_DP:
type = DRM_MODE_ENCODER_TMDS; type = DRM_MODE_ENCODER_TMDS;
break; break;
case OUTPUT_LVDS: case OUTPUT_LVDS:
NV_INFO(dev, "Detected a LVDS output\n");
type = DRM_MODE_ENCODER_LVDS; type = DRM_MODE_ENCODER_LVDS;
if (nouveau_bios_parse_lvds_table(dev, 0, &dum, &dum)) {
NV_ERROR(dev, "Failed parsing LVDS table\n");
return -EINVAL;
}
break;
case OUTPUT_DP:
NV_INFO(dev, "Detected a DP output\n");
type = DRM_MODE_ENCODER_TMDS;
break; break;
default: default:
return -EINVAL; return -EINVAL;
...@@ -342,5 +332,6 @@ nv50_sor_create(struct drm_device *dev, struct dcb_entry *entry) ...@@ -342,5 +332,6 @@ nv50_sor_create(struct drm_device *dev, struct dcb_entry *entry)
nv_encoder->dp.mc_unknown = 5; nv_encoder->dp.mc_unknown = 5;
} }
drm_mode_connector_attach_encoder(connector, encoder);
return 0; return 0;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册