diff options
Diffstat (limited to 'linux-core')
-rw-r--r-- | linux-core/drm_crtc.c | 6 | ||||
-rw-r--r-- | linux-core/drm_crtc.h | 8 | ||||
-rw-r--r-- | linux-core/drm_crtc_helper.c | 15 | ||||
-rw-r--r-- | linux-core/intel_display.c | 12 | ||||
-rw-r--r-- | linux-core/intel_tv.c | 17 |
5 files changed, 42 insertions, 16 deletions
diff --git a/linux-core/drm_crtc.c b/linux-core/drm_crtc.c index c60476a4..bf6afd6a 100644 --- a/linux-core/drm_crtc.c +++ b/linux-core/drm_crtc.c @@ -1148,9 +1148,6 @@ int drm_mode_getconnector(struct drm_device *dev, else out_resp->crtc = 0; - out_resp->crtcs = connector->possible_crtcs; - out_resp->clones = connector->possible_clones; - if ((out_resp->count_modes >= mode_count) && mode_count) { copied = 0; mode_ptr = (struct drm_mode_modeinfo *)(unsigned long)out_resp->modes_ptr; @@ -2201,6 +2198,9 @@ int drm_mode_connector_attach_encoder(struct drm_connector *connector, for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) { if (connector->encoder_ids[i] == 0) { connector->encoder_ids[i] = encoder->id; + /* pick the first added encoder as the current */ + if (i == 0) + connector->current_encoder_id = encoder->id; return 0; } } diff --git a/linux-core/drm_crtc.h b/linux-core/drm_crtc.h index 568b6b31..09886c15 100644 --- a/linux-core/drm_crtc.h +++ b/linux-core/drm_crtc.h @@ -423,8 +423,6 @@ struct drm_encoder { /** * drm_connector - central DRM connector control structure * @crtc: CRTC this connector is currently connected to, NULL if none - * @possible_crtcs: bitmap of CRTCS this connector could be attached to - * @possible_clones: bitmap of possible connectors this connector could clone * @interlace_allowed: can this connector handle interlaced modes? * @doublescan_allowed: can this connector handle doublescan? * @available_modes: modes available on this connector (from get_modes() + user) @@ -448,8 +446,6 @@ struct drm_connector { int connector_type; int connector_type_id; - unsigned long possible_crtcs; - unsigned long possible_clones; bool interlace_allowed; bool doublescan_allowed; struct list_head modes; /* list of modes on this connector */ @@ -470,7 +466,9 @@ struct drm_connector { void *helper_private; - u32 encoder_ids[DRM_CONNECTOR_MAX_ENCODER]; + uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER]; + uint32_t force_encoder_id; + uint32_t current_encoder_id; }; /** diff --git a/linux-core/drm_crtc_helper.c b/linux-core/drm_crtc_helper.c index 98b112ed..e5774ccc 100644 --- a/linux-core/drm_crtc_helper.c +++ b/linux-core/drm_crtc_helper.c @@ -46,6 +46,7 @@ static void drm_pick_crtcs (struct drm_device *dev) { int c, o, assigned; struct drm_connector *connector, *connector_equal; + struct drm_encoder *encoder, *encoder_equal; struct drm_crtc *crtc; struct drm_display_mode *des_mode = NULL, *modes, *modes_equal; int found; @@ -89,12 +90,16 @@ static void drm_pick_crtcs (struct drm_device *dev) } } + list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) + if (encoder->id == connector->current_encoder_id) + break; + c = -1; list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { assigned = 0; c++; - if ((connector->possible_crtcs & (1 << c)) == 0) + if ((encoder->possible_crtcs & (1 << c)) == 0) continue; list_for_each_entry(connector_equal, &dev->mode_config.connector_list, head) { @@ -117,11 +122,15 @@ static void drm_pick_crtcs (struct drm_device *dev) if (connector->id == connector_equal->id) continue; + list_for_each_entry(encoder_equal, &dev->mode_config.encoder_list, head) + if (encoder_equal->id == connector_equal->current_encoder_id) + break; + list_for_each_entry(modes, &connector->modes, head) { list_for_each_entry(modes_equal, &connector_equal->modes, head) { if (drm_mode_equal (modes, modes_equal)) { - if ((connector->possible_clones & connector_equal->possible_clones) && (connector_equal->crtc == crtc)) { - printk("Cloning %s (0x%lx) to %s (0x%lx)\n",drm_get_connector_name(connector),connector->possible_clones,drm_get_connector_name(connector_equal),connector_equal->possible_clones); + if ((encoder->possible_clones & encoder_equal->possible_clones) && (connector_equal->crtc == crtc)) { + printk("Cloning %s (0x%lx) to %s (0x%lx)\n",drm_get_connector_name(connector),encoder->possible_clones,drm_get_connector_name(connector_equal),encoder_equal->possible_clones); des_mode = modes; assigned = 0; goto clone; diff --git a/linux-core/intel_display.c b/linux-core/intel_display.c index 7fb1ea5f..f0cbc385 100644 --- a/linux-core/intel_display.c +++ b/linux-core/intel_display.c @@ -1091,6 +1091,7 @@ struct drm_crtc *intel_get_load_detect_pipe(struct drm_connector *connector, struct intel_crtc *intel_crtc; struct drm_crtc *possible_crtc; struct drm_crtc *supported_crtc =NULL; + struct drm_encoder *encoder = NULL; struct drm_crtc *crtc = NULL; struct drm_connector_helper_funcs *connector_funcs; int i = -1; @@ -1118,10 +1119,14 @@ struct drm_crtc *intel_get_load_detect_pipe(struct drm_connector *connector, return crtc; } + list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) + if (encoder->id == connector->current_encoder_id) + break; + /* Find an unused one (if possible) */ list_for_each_entry(possible_crtc, &dev->mode_config.crtc_list, head) { i++; - if (!(connector->possible_crtcs & (1 << i))) + if (!(encoder->possible_crtcs & (1 << i))) continue; if (!possible_crtc->enabled) { crtc = possible_crtc; @@ -1395,6 +1400,7 @@ static void intel_setup_outputs(struct drm_device *dev) list_for_each_entry(connector, &dev->mode_config.connector_list, head) { struct intel_output *intel_output = to_intel_output(connector); + struct drm_encoder *encoder = &intel_output->enc; int crtc_mask = 0, clone_mask = 0; /* valid crtcs */ @@ -1424,8 +1430,8 @@ static void intel_setup_outputs(struct drm_device *dev) clone_mask = (1 << INTEL_OUTPUT_TVOUT); break; } - connector->possible_crtcs = crtc_mask; - connector->possible_clones = intel_connector_clones(dev, clone_mask); + encoder->possible_crtcs = crtc_mask; + encoder->possible_clones = intel_connector_clones(dev, clone_mask); } } diff --git a/linux-core/intel_tv.c b/linux-core/intel_tv.c index 330c204a..c2658f13 100644 --- a/linux-core/intel_tv.c +++ b/linux-core/intel_tv.c @@ -1614,6 +1614,16 @@ static const struct drm_connector_funcs intel_tv_connector_funcs = { .set_property = intel_tv_set_property, }; +void intel_tv_enc_destroy(struct drm_encoder *encoder) +{ + drm_encoder_cleanup(encoder); +} + +static const struct drm_encoder_funcs intel_tv_enc_funcs = { + .destroy = intel_tv_enc_destroy, +}; + + void intel_tv_init(struct drm_device *dev) { @@ -1665,10 +1675,13 @@ intel_tv_init(struct drm_device *dev) drm_connector_init(dev, connector, &intel_tv_connector_funcs, DRM_MODE_CONNECTOR_Unknown); + drm_encoder_init(dev, &intel_output->enc, &intel_tv_enc_funcs, + DRM_MODE_ENCODER_TVDAC); + tv_priv = (struct intel_tv_priv *)(intel_output + 1); intel_output->type = INTEL_OUTPUT_TVOUT; - connector->possible_crtcs = ((1 << 0) | (1 << 1)); - connector->possible_clones = (1 << INTEL_OUTPUT_TVOUT); + intel_output->enc.possible_crtcs = ((1 << 0) | (1 << 1)); + intel_output->enc.possible_clones = (1 << INTEL_OUTPUT_TVOUT); intel_output->dev_priv = tv_priv; tv_priv->type = DRM_MODE_CONNECTOR_Unknown; |