drm: attach an encoder.

Time to do some renaming on the connectors I think
main
Dave Airlie 2008-05-30 13:57:27 +10:00
parent 1c4b25a2b1
commit 6aeef92c0c
6 changed files with 45 additions and 16 deletions

View File

@ -77,7 +77,7 @@ static struct drm_prop_enum_list drm_conn_enum_list[] =
};
static struct drm_prop_enum_list drm_output_enum_list[] =
{ { DRM_MODE_OUTPUT_NONE, "None" },
{ DRM_MODE_OUTPUT_DAC, "DAC" },
{ DRM_MODE_OUTPUT_VGA, "VGA" },
{ DRM_MODE_OUTPUT_TMDS, "TMDS" },
{ DRM_MODE_OUTPUT_LVDS, "LVDS" },
{ DRM_MODE_OUTPUT_TVDAC, "TV" },
@ -541,11 +541,13 @@ EXPORT_SYMBOL(drm_output_cleanup);
void drm_encoder_init(struct drm_device *dev,
struct drm_encoder *encoder,
const struct drm_encoder_funcs *funcs,
int encoder_type)
{
encoder->dev = dev;
encoder->id = drm_idr_get(dev, encoder);
encoder->encoder_type = encoder_type;
encoder->funcs = funcs;
mutex_lock(&dev->mode_config.mutex);
list_add_tail(&encoder->head, &dev->mode_config.encoder_list);
@ -791,6 +793,10 @@ void drm_mode_config_cleanup(struct drm_device *dev)
struct drm_framebuffer *fb, *fbt;
struct drm_property *property, *pt;
list_for_each_entry_safe(encoder, enct, &dev->mode_config.encoder_list, head) {
encoder->funcs->destroy(encoder);
}
list_for_each_entry_safe(output, ot, &dev->mode_config.output_list, head) {
drm_sysfs_output_remove(output);
output->funcs->destroy(output);
@ -808,10 +814,6 @@ void drm_mode_config_cleanup(struct drm_device *dev)
dev->driver->fb_remove(dev, fb);
}
list_for_each_entry_safe(encoder, enct, &dev->mode_config.encoder_list, head) {
encoder->funcs->destroy(encoder);
}
list_for_each_entry_safe(crtc, ct, &dev->mode_config.crtc_list, head) {
crtc->funcs->destroy(crtc);
}

View File

@ -556,12 +556,19 @@ extern void drm_crtc_init(struct drm_device *dev,
const struct drm_crtc_funcs *funcs);
extern void drm_crtc_cleanup(struct drm_crtc *crtc);
void drm_output_init(struct drm_device *dev,
struct drm_output *output,
const struct drm_output_funcs *funcs,
int output_type);
extern void drm_output_init(struct drm_device *dev,
struct drm_output *output,
const struct drm_output_funcs *funcs,
int output_type);
void drm_output_cleanup(struct drm_output *output);
extern void drm_output_cleanup(struct drm_output *output);
extern void drm_encoder_init(struct drm_device *dev,
struct drm_encoder *encoder,
const struct drm_encoder_funcs *funcs,
int encoder_type);
extern void drm_encoder_cleanup(struct drm_encoder *encoder);
extern char *drm_get_output_name(struct drm_output *output);
extern char *drm_get_dpms_name(int val);

View File

@ -242,6 +242,15 @@ static const struct drm_output_funcs intel_crt_output_funcs = {
};
void intel_crt_enc_destroy(struct drm_encoder *encoder)
{
drm_encoder_cleanup(encoder);
}
static const struct drm_encoder_funcs intel_crt_enc_funcs = {
.destroy = intel_crt_enc_destroy,
};
void intel_crt_init(struct drm_device *dev)
{
struct drm_output *output;
@ -252,7 +261,11 @@ void intel_crt_init(struct drm_device *dev)
return;
output = &intel_output->base;
drm_output_init(dev, &intel_output->base, &intel_crt_output_funcs, DRM_MODE_OUTPUT_DAC);
drm_output_init(dev, &intel_output->base, &intel_crt_output_funcs, DRM_MODE_OUTPUT_VGA);
drm_encoder_init(dev, &intel_output->enc, &intel_crt_enc_funcs, DRM_MODE_ENCODER_DAC);
drm_mode_output_attach_encoder(&intel_output->base, &intel_output->enc);
/* Set up the DDC bus. */
intel_output->ddc_bus = intel_i2c_create(dev, GPIOA, "CRTDDC_A");
@ -268,7 +281,6 @@ void intel_crt_init(struct drm_device *dev)
output->doublescan_allowed = 0;
drm_output_helper_add(output, &intel_crt_helper_funcs);
drm_sysfs_output_add(output);
drm_output_attach_property(output, dev->mode_config.connector_type_property, ConnectorVGA);
drm_sysfs_output_add(output);
}

View File

@ -48,6 +48,8 @@ struct intel_i2c_chan {
struct intel_output {
struct drm_output base;
struct drm_encoder enc;
int type;
struct intel_i2c_chan *i2c_bus; /* for control functions */
struct intel_i2c_chan *ddc_bus; /* for DDC only stuff */

View File

@ -1059,14 +1059,14 @@ void intel_sdvo_init(struct drm_device *dev, int output_device)
{
sdvo_priv->active_outputs = SDVO_OUTPUT_RGB0;
output->display_info.subpixel_order = SubPixelHorizontalRGB;
output_type = DRM_MODE_OUTPUT_DAC;
output_type = DRM_MODE_OUTPUT_VGA;
connector_type = ConnectorVGA;
}
else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_RGB1)
{
sdvo_priv->active_outputs = SDVO_OUTPUT_RGB1;
output->display_info.subpixel_order = SubPixelHorizontalRGB;
output_type = DRM_MODE_OUTPUT_DAC;
output_type = DRM_MODE_OUTPUT_VGA;
connector_type = ConnectorVGA;
}
else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_TMDS0)

View File

@ -1062,8 +1062,14 @@ struct drm_mode_get_encoder {
uint32_t clones;
};
#define DRM_MODE_ENCODER_NONE 0
#define DRM_MODE_ENCODER_DAC 1
#define DRM_MODE_ENCODER_TMDS 2
#define DRM_MODE_ENCODER_LVDS 3
#define DRM_MODE_ENCODER_TVDAC 4
#define DRM_MODE_OUTPUT_NONE 0
#define DRM_MODE_OUTPUT_DAC 1
#define DRM_MODE_OUTPUT_VGA 1
#define DRM_MODE_OUTPUT_TMDS 2
#define DRM_MODE_OUTPUT_LVDS 3
#define DRM_MODE_OUTPUT_TVDAC 4