xserver: Branch 'master'

Keith Packard keithp at kemper.freedesktop.org
Mon Oct 24 18:11:09 PDT 2011


 hw/xfree86/modes/xf86Crtc.c |   41 +++++++++++++++++++----------------------
 1 file changed, 19 insertions(+), 22 deletions(-)

New commits:
commit 17416e88dcfcc584fe5f87580d5d2b719b3521c3
Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Oct 20 14:43:01 2011 +0100

    xf86Crtc: handle no outputs with no modes harder.
    
    If you started an X server with no connected outputs, we pick a default
    1024x768 mode, however if you then ran an xvidmode using app against that
    server it would segfault the server due to not finding any valid modes.
    
    This was due to the no output mode set code, only adding the modes to the
    scrn->modes once, when something called randr 1.2 xf86SetScrnInfoModes would
    get called and remove all the modes and we'd end up with 0.
    
    This change fixes xf86SetScrnInfoModes to always report a scrn mode of at
    least 1024x768, and pushes the initial configuration to just call it instead
    of setting up the mode itself.
    
    Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=746926
    
    I've seen other bugs like this on other distros so it might also actually fix them.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 384d8b4..aac33d3 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1915,19 +1915,25 @@ xf86SetScrnInfoModes (ScrnInfoPtr scrn)
 		break;
     }
 
-    if (scrn->modes != NULL) {
-	/* For some reason, scrn->modes is circular, unlike the other mode
-	 * lists.  How great is that?
-	 */
-	for (last = scrn->modes; last && last->next; last = last->next)
-	    ;
-	last->next = scrn->modes;
-	scrn->modes->prev = last;
-	if (mode) {
-	    while (scrn->modes != mode)
-		scrn->modes = scrn->modes->next;
-	}
+    if (!scrn->modes) {
+	scrn->modes = xf86ModesAdd(scrn->modes,
+				   xf86CVTMode(scrn->display->virtualX,
+					       scrn->display->virtualY,
+					       60, 0, 0));
+    }
+
+    /* For some reason, scrn->modes is circular, unlike the other mode
+     * lists.  How great is that?
+     */
+    for (last = scrn->modes; last && last->next; last = last->next)
+	;
+    last->next = scrn->modes;
+    scrn->modes->prev = last;
+    if (mode) {
+	while (scrn->modes != mode)
+	    scrn->modes = scrn->modes->next;
     }
+
     scrn->currentMode = scrn->modes;
 #ifdef XFreeXDGA
     if (scrn->pScreen)
@@ -2529,16 +2535,7 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
 			      width, height);
     }
 
-    if (have_outputs) {
-	/* Mirror output modes to scrn mode list */
-	xf86SetScrnInfoModes (scrn);
-    } else {
-	/* Clear any existing modes from scrn->modes */
-	while (scrn->modes != NULL)
-	    xf86DeleteMode(&scrn->modes, scrn->modes);
-	scrn->modes = xf86ModesAdd(scrn->modes,
-				   xf86CVTMode(width, height, 60, 0, 0));
-    }
+    xf86SetScrnInfoModes (scrn);
 
     success = TRUE;
  bailout:


More information about the xorg-commit mailing list