diff options
-rw-r--r-- | linux-core/drm_crtc.c | 12 | ||||
-rw-r--r-- | linux-core/drm_crtc.h | 17 | ||||
-rw-r--r-- | linux-core/intel_crt.c | 18 | ||||
-rw-r--r-- | linux-core/intel_drv.h | 2 | ||||
-rw-r--r-- | linux-core/intel_sdvo.c | 4 | ||||
-rw-r--r-- | shared-core/drm.h | 8 |
6 files changed, 45 insertions, 16 deletions
diff --git a/linux-core/drm_crtc.c b/linux-core/drm_crtc.c index 400df98e..bb527413 100644 --- a/linux-core/drm_crtc.c +++ b/linux-core/drm_crtc.c @@ -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); } diff --git a/linux-core/drm_crtc.h b/linux-core/drm_crtc.h index 04e0d033..03c336e2 100644 --- a/linux-core/drm_crtc.h +++ b/linux-core/drm_crtc.h @@ -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); diff --git a/linux-core/intel_crt.c b/linux-core/intel_crt.c index 584dea21..44035783 100644 --- a/linux-core/intel_crt.c +++ b/linux-core/intel_crt.c @@ -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); } diff --git a/linux-core/intel_drv.h b/linux-core/intel_drv.h index 82d2d703..3f0c1664 100644 --- a/linux-core/intel_drv.h +++ b/linux-core/intel_drv.h @@ -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 */ diff --git a/linux-core/intel_sdvo.c b/linux-core/intel_sdvo.c index f4b1c6ef..2b232e9a 100644 --- a/linux-core/intel_sdvo.c +++ b/linux-core/intel_sdvo.c @@ -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) diff --git a/shared-core/drm.h b/shared-core/drm.h index 6cb68685..0005bb0b 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -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 |