- Instead of touching the fragile recovery system when modesetting fails, the
encoder is now defined as active when it has a
connector.
- Previously bad things happened with the same crtc, same connector, but
different encoder, because encoder->crtc != NULL.
- Also put a function in the header, which already had an exported symbol.
---
drivers/gpu/drm/drm_crtc_helper.c | 23 +++++++++++++++++------
include/drm/drm_crtc_helper.h | 1 +
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/drm_crtc_helper.c
b/drivers/gpu/drm/drm_crtc_helper.c
index 9cd8451..86992e1 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -265,8 +265,11 @@ void drm_helper_disable_unused_functions(struct drm_device
*dev)
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
encoder_funcs = encoder->helper_private;
- if (!drm_helper_encoder_in_use(encoder))
+ if (!drm_helper_encoder_in_use(encoder)) {
+ /* With encoder swapping the crtc can still be
non-NULL. */
+ encoder->crtc = NULL;
(*encoder_funcs->dpms)(encoder, DRM_MODE_DPMS_OFF);
+ }
}
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
@@ -549,7 +552,7 @@ drm_crtc_prepare_encoders(struct drm_device *dev)
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
encoder_funcs = encoder->helper_private;
/* Disable unused encoders */
- if (encoder->crtc == NULL)
+ if (!(drm_helper_encoder_in_use(encoder)))
(*encoder_funcs->dpms)(encoder, DRM_MODE_DPMS_OFF);
/* Disable encoders whose CRTC is about to change */
if (encoder_funcs->get_crtc &&
@@ -611,7 +614,9 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
*/
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
- if (encoder->crtc != crtc)
+ /* For the sake of reversability encoder->crtc is NULL'ed later.
+ * Check to make sure the encoder is actually connected. */
+ if (encoder->crtc != crtc ||
!drm_helper_encoder_in_use(encoder))
continue;
encoder_funcs = encoder->helper_private;
if (!(ret = encoder_funcs->mode_fixup(encoder, mode,
@@ -627,7 +632,9 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
/* Prepare the encoders and CRTCs before setting the mode. */
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
- if (encoder->crtc != crtc)
+ /* For the sake of reversability encoder->crtc is NULL'ed later.
+ * Check to make sure the encoder is actually connected. */
+ if (encoder->crtc != crtc ||
!drm_helper_encoder_in_use(encoder))
continue;
encoder_funcs = encoder->helper_private;
/* Disable the encoders as the first thing we do. */
@@ -647,7 +654,9 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
- if (encoder->crtc != crtc)
+ /* For the sake of reversability encoder->crtc is NULL'ed later.
+ * Check to make sure the encoder is actually connected. */
+ if (encoder->crtc != crtc ||
!drm_helper_encoder_in_use(encoder))
continue;
DRM_INFO("%s: set mode %s %x\n", drm_get_encoder_name(encoder),
@@ -661,7 +670,9 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
- if (encoder->crtc != crtc)
+ /* For the sake of reversability encoder->crtc is NULL'ed later.
+ * Check to make sure the encoder is actually connected. */
+ if (encoder->crtc != crtc ||
!drm_helper_encoder_in_use(encoder))
continue;
encoder_funcs = encoder->helper_private;
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index 6769ff6..e44a4f8 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -98,6 +98,7 @@ extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
int x, int y,
struct drm_framebuffer *old_fb);
extern bool drm_helper_crtc_in_use(struct drm_crtc *crtc);
+extern bool drm_helper_encoder_in_use(struct drm_encoder *encoder);
extern void drm_helper_connector_dpms(struct drm_connector *connector, int
mode);
--
1.6.4
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel