From 8ae82f3a2feb8b8fe56214c4c9e806bf1f87cbf8 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 30 May 2008 12:03:36 +1000 Subject: drm: add encoder / get encoder to the modesetting resources interface --- linux-core/drm_crtc_helper.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'linux-core/drm_crtc_helper.h') diff --git a/linux-core/drm_crtc_helper.h b/linux-core/drm_crtc_helper.h index f56b97c6..9e16861d 100644 --- a/linux-core/drm_crtc_helper.h +++ b/linux-core/drm_crtc_helper.h @@ -47,6 +47,15 @@ struct drm_output_helper_funcs { struct drm_display_mode *adjusted_mode); }; +struct drm_encoder_helper_funcs { + void (*prepare)(struct drm_output *output); + void (*commit)(struct drm_output *output); + void (*mode_set)(struct drm_output *output, + struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode); +}; + + extern int drm_helper_hotplug_stage_two(struct drm_device *dev, struct drm_output *output, bool connected); extern bool drm_helper_initial_config(struct drm_device *dev, bool can_grow); -- cgit v1.2.3 From 9d38448ed33aaff324cc4bbe1e0878593e97d07d Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 30 May 2008 15:03:12 +1000 Subject: modesetting: the great renaming. Okay we have crtc, encoder and connectors. No more outputs exposed beyond driver internals I've broken intel tv connector stuff. Really for TV we should have one TV connector, with a sub property for the type of signal been driven over it --- linux-core/drm_crtc_helper.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'linux-core/drm_crtc_helper.h') diff --git a/linux-core/drm_crtc_helper.h b/linux-core/drm_crtc_helper.h index 9e16861d..10420065 100644 --- a/linux-core/drm_crtc_helper.h +++ b/linux-core/drm_crtc_helper.h @@ -36,27 +36,27 @@ struct drm_crtc_helper_funcs { void (*mode_set_base)(struct drm_crtc *crtc, int x, int y); }; -struct drm_output_helper_funcs { - bool (*mode_fixup)(struct drm_output *output, +struct drm_connector_helper_funcs { + bool (*mode_fixup)(struct drm_connector *connector, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode); - void (*prepare)(struct drm_output *output); - void (*commit)(struct drm_output *output); - void (*mode_set)(struct drm_output *output, + void (*prepare)(struct drm_connector *connector); + void (*commit)(struct drm_connector *connector); + void (*mode_set)(struct drm_connector *connector, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode); }; struct drm_encoder_helper_funcs { - void (*prepare)(struct drm_output *output); - void (*commit)(struct drm_output *output); - void (*mode_set)(struct drm_output *output, + void (*prepare)(struct drm_connector *connector); + void (*commit)(struct drm_connector *connector); + void (*mode_set)(struct drm_connector *connector, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode); }; -extern int drm_helper_hotplug_stage_two(struct drm_device *dev, struct drm_output *output, +extern int drm_helper_hotplug_stage_two(struct drm_device *dev, struct drm_connector *connector, bool connected); extern bool drm_helper_initial_config(struct drm_device *dev, bool can_grow); extern int drm_crtc_helper_set_config(struct drm_mode_set *set); @@ -68,9 +68,9 @@ static inline void drm_crtc_helper_add(struct drm_crtc *crtc, const struct drm_c crtc->helper_private = (void *)funcs; } -static inline void drm_output_helper_add(struct drm_output *output, const struct drm_output_helper_funcs *funcs) +static inline void drm_connector_helper_add(struct drm_connector *connector, const struct drm_connector_helper_funcs *funcs) { - output->helper_private = (void *)funcs; + connector->helper_private = (void *)funcs; } -- cgit v1.2.3 From e439e74776b215d70d8e34e8aa9cea22179dcbc6 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 2 Jun 2008 10:05:54 +1000 Subject: drm/modesetting: another re-org of some internals. Move dpms into the helper functions. Move crtc into the encoder. Move disable unused functions into the helper. --- linux-core/drm_crtc_helper.h | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'linux-core/drm_crtc_helper.h') diff --git a/linux-core/drm_crtc_helper.h b/linux-core/drm_crtc_helper.h index 10420065..063d1f7a 100644 --- a/linux-core/drm_crtc_helper.h +++ b/linux-core/drm_crtc_helper.h @@ -21,6 +21,11 @@ #include struct drm_crtc_helper_funcs { + /* + * Control power levels on the CRTC. If the mode passed in is + * unsupported, the provider must use the next lowest power level. + */ + void (*dpms)(struct drm_crtc *crtc, int mode); void (*prepare)(struct drm_crtc *crtc); void (*commit)(struct drm_crtc *crtc); @@ -36,26 +41,23 @@ struct drm_crtc_helper_funcs { void (*mode_set_base)(struct drm_crtc *crtc, int x, int y); }; -struct drm_connector_helper_funcs { - bool (*mode_fixup)(struct drm_connector *connector, +struct drm_encoder_helper_funcs { + void (*dpms)(struct drm_encoder *encoder, int mode); + void (*save)(struct drm_encoder *encoder); + void (*restore)(struct drm_encoder *encoder); + + bool (*mode_fixup)(struct drm_encoder *encoder, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode); - void (*prepare)(struct drm_connector *connector); - void (*commit)(struct drm_connector *connector); - void (*mode_set)(struct drm_connector *connector, - struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode); -}; - -struct drm_encoder_helper_funcs { - void (*prepare)(struct drm_connector *connector); - void (*commit)(struct drm_connector *connector); - void (*mode_set)(struct drm_connector *connector, + void (*prepare)(struct drm_encoder *encoder); + void (*commit)(struct drm_encoder *encoder); + void (*mode_set)(struct drm_encoder *encoder, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode); }; +extern void drm_helper_disable_unused_functions(struct drm_device *dev); extern int drm_helper_hotplug_stage_two(struct drm_device *dev, struct drm_connector *connector, bool connected); extern bool drm_helper_initial_config(struct drm_device *dev, bool can_grow); @@ -68,9 +70,9 @@ static inline void drm_crtc_helper_add(struct drm_crtc *crtc, const struct drm_c crtc->helper_private = (void *)funcs; } -static inline void drm_connector_helper_add(struct drm_connector *connector, const struct drm_connector_helper_funcs *funcs) +static inline void drm_encoder_helper_add(struct drm_encoder *encoder, const struct drm_encoder_helper_funcs *funcs) { - connector->helper_private = (void *)funcs; + encoder->helper_private = (void *)funcs; } -- cgit v1.2.3 From 0dd000b578adec6ff101c957bce7dc9a32b76713 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 2 Jun 2008 11:12:28 +1000 Subject: drm/modesetting: move some connector functions to helper. Migrated the output mode collection into the helper. --- linux-core/drm_crtc_helper.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'linux-core/drm_crtc_helper.h') diff --git a/linux-core/drm_crtc_helper.h b/linux-core/drm_crtc_helper.h index 063d1f7a..80cb4b49 100644 --- a/linux-core/drm_crtc_helper.h +++ b/linux-core/drm_crtc_helper.h @@ -55,8 +55,14 @@ struct drm_encoder_helper_funcs { struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode); }; - +struct drm_connector_helper_funcs { + int (*get_modes)(struct drm_connector *connector); + int (*mode_valid)(struct drm_connector *connector, + struct drm_display_mode *mode); +}; + +extern void drm_helper_probe_single_connector_modes(struct drm_connector *connector, uint32_t maxX, uint32_t maxY); extern void drm_helper_disable_unused_functions(struct drm_device *dev); extern int drm_helper_hotplug_stage_two(struct drm_device *dev, struct drm_connector *connector, bool connected); @@ -64,7 +70,7 @@ extern bool drm_helper_initial_config(struct drm_device *dev, bool can_grow); extern int drm_crtc_helper_set_config(struct drm_mode_set *set); extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, struct drm_display_mode *mode, int x, int y); - +extern bool drm_helper_crtc_in_use(struct drm_crtc *crtc); static inline void drm_crtc_helper_add(struct drm_crtc *crtc, const struct drm_crtc_helper_funcs *funcs) { crtc->helper_private = (void *)funcs; @@ -75,6 +81,11 @@ static inline void drm_encoder_helper_add(struct drm_encoder *encoder, const str encoder->helper_private = (void *)funcs; } +static inline void drm_connector_helper_add(struct drm_connector *connector, const struct drm_connector_helper_funcs *funcs) +{ + connector->helper_private = (void *)funcs; +} + #endif -- cgit v1.2.3 From 46c78a2223802b9105a87b7125fd4872ab69c4ca Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 2 Jun 2008 11:44:35 +1000 Subject: drm/modesetting: add best encoder finding for modesetting This asks the driver to suggest the best encoder for the connector during the pick crtcs stage. Need to also do this during mode setting stages --- linux-core/drm_crtc_helper.h | 1 + 1 file changed, 1 insertion(+) (limited to 'linux-core/drm_crtc_helper.h') diff --git a/linux-core/drm_crtc_helper.h b/linux-core/drm_crtc_helper.h index 80cb4b49..3a3a4d4f 100644 --- a/linux-core/drm_crtc_helper.h +++ b/linux-core/drm_crtc_helper.h @@ -60,6 +60,7 @@ struct drm_connector_helper_funcs { int (*get_modes)(struct drm_connector *connector); int (*mode_valid)(struct drm_connector *connector, struct drm_display_mode *mode); + struct drm_encoder *(*best_encoder)(struct drm_connector *connector); }; extern void drm_helper_probe_single_connector_modes(struct drm_connector *connector, uint32_t maxX, uint32_t maxY); -- cgit v1.2.3