conn.connector = connector_id;
conn.connector_type_id = 0;
conn.connector_type = 0;
- conn.count_crtcs = 0;
- conn.crtcs = 0;
- conn.count_clones = 0;
- conn.clones = 0;
conn.count_modes = 0;
conn.modes_ptr = 0;
conn.count_props = 0;
r->mmWidth = conn.mm_width;
r->mmHeight = conn.mm_height;
r->subpixel = conn.subpixel;
- r->count_crtcs = conn.count_crtcs;
- r->count_clones = conn.count_clones;
r->count_modes = conn.count_modes;
/* TODO we should test if these alloc & cpy fails. */
- r->crtcs = conn.crtcs;
- r->clones = conn.clones;
r->count_props = conn.count_props;
r->props = drmAllocCpy(U642VOID(conn.props_ptr), conn.count_props, sizeof(uint32_t));
r->prop_values = drmAllocCpy(U642VOID(conn.prop_values_ptr), conn.count_props, sizeof(uint64_t));
uint32_t mmWidth, mmHeight; /**< HxW in millimeters */
drmModeSubPixel subpixel;
- int count_crtcs;
- uint32_t crtcs; /**< Possible crtc to connect to */
-
- int count_clones;
- uint32_t clones; /**< Mask of clones */
-
int count_modes;
struct drm_mode_modeinfo *modes;
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;
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;
}
}
/**
* 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)
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 */
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;
};
/**
{
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;
}
}
+ 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) {
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;
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;
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;
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 */
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);
}
}
.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)
{
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;
unsigned int connection;
unsigned int mm_width, mm_height; /**< HxW in millimeters */
unsigned int subpixel;
- int count_crtcs;
- int count_clones;
- unsigned int crtcs; /**< possible crtc to connect to */
- unsigned int clones; /**< list of clones */
};
#define DRM_MODE_PROP_PENDING (1<<0)