Module Name:    src
Committed By:   riastradh
Date:           Fri Apr 25 19:07:55 UTC 2014

Modified Files:
        src/sys/external/bsd/drm2/dist/drm: drm_fb_helper.c

Log Message:
Fix hot-plug with small patch from upstream before a full update.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c:1.3 src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c:1.4
--- src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c:1.3	Tue Mar 18 21:36:52 2014
+++ src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c	Fri Apr 25 19:07:55 2014
@@ -40,6 +40,7 @@
 #include <linux/notifier.h>
 #include <linux/printk.h>
 #include <linux/sysrq.h>
+#include <asm/bug.h>
 #include <drm/drmP.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_fb_helper.h>
@@ -1331,6 +1332,7 @@ static void drm_setup_crtcs(struct drm_f
 	for (i = 0; i < fb_helper->crtc_count; i++) {
 		modeset = &fb_helper->crtc_info[i].mode_set;
 		modeset->num_connectors = 0;
+		modeset->fb = NULL;
 	}
 
 	for (i = 0; i < fb_helper->connector_count; i++) {
@@ -1350,6 +1352,18 @@ static void drm_setup_crtcs(struct drm_f
 		}
 	}
 
+	/* Clear out any old modes if there are no more connected outputs. */
+	for (i = 0; i < fb_helper->crtc_count; i++) {
+		modeset = &fb_helper->crtc_info[i].mode_set;
+		if (modeset->num_connectors == 0) {
+			BUG_ON(modeset->fb);
+			BUG_ON(modeset->num_connectors);
+			if (modeset->mode)
+				drm_mode_destroy(dev, modeset->mode);
+			modeset->mode = NULL;
+			fb_helper->crtc_info[i].desired_mode = NULL;
+		}
+	}
 out:
 	kfree(crtcs);
 	kfree(modes);

Reply via email to