xserver: Branch 'xorg-server-1.5-apple' - 9 commits

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Fri May 23 02:33:09 PDT 2008


 Xext/panoramiX.c                      |    8 +--
 configure.ac                          |   18 --------
 hw/xfree86/modes/xf86Crtc.c           |    9 +++-
 hw/xfree86/modes/xf86Modes.c          |   22 ++++++++++
 hw/xfree86/modes/xf86Modes.h          |    3 +
 hw/xquartz/X11Application.m           |   11 -----
 hw/xquartz/mach-startup/bundle-main.c |   69 ++++++++++++++++++++--------------
 hw/xquartz/mach-startup/stub.c        |   15 +++----
 include/dix-config.h.in               |    3 -
 os/connection.c                       |   14 +++---
 10 files changed, 95 insertions(+), 77 deletions(-)

New commits:
commit f060c4184364ce88f8543c549e2ba952b0352892
Merge: 0f44d72... 9211a10...
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Fri May 23 02:31:25 2008 -0700

    Merge branch 'server-1.5-branch' into xorg-server-1.5-apple

commit 0f44d728735bbc5234a86643f8e1e5168fc540e1
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Fri May 23 02:27:58 2008 -0700

    XQuartz: A 2 second delay for launchd socket connections should be sufficient.
    (cherry picked from commit 2bb4251b3c6b30dbf1a556e1b51e6f03f02d2529)

diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index 73c0483..0068e02 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -437,8 +437,10 @@ int main(int argc, char **argv, char **envp) {
 }
 #else
 void *add_launchd_display_thread(void *data) {
-    /* TODO: Really fix this race */
-    sleep(5);
+    /* TODO: Really fix this race... we want xinitrc to finish before connections
+     *       are accepted on the launchd socket.
+     */
+    sleep(2);
     
     /* Start listening on the launchd fd */
     int launchd_fd = launchd_display_fd();
commit 605a1d10676aee5037e217b2af97ccc76e64d8fe
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Fri May 23 02:10:14 2008 -0700

    XQuartz: Add the launchd fd to AllSockets as well
    (cherry picked from commit 83f72529394be5871671d73b6ef4f8bc83708f8a)

diff --git a/os/connection.c b/os/connection.c
index 8eb66b0..b31a550 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -1327,15 +1327,17 @@ _X_EXPORT void ListenOnOpenFD(int fd) {
     ListenTransFds[ListenTransCount] = fd;
 
     FD_SET(fd, &WellKnownConnections);
+    FD_SET(fd, &AllSockets);
     
-    /* It is always local
-    if (!_XSERVTransIsLocal(ciptr)) {
-    //    DefineSelf (fd);
-    }
-    */
-
     /* Increment the count */
     ListenTransCount++;
+
+    /* This *might* be needed, but it seems to be working fine without it... */
+    //ResetAuthorization();
+    //ResetHosts(display);
+#ifdef XDMCP
+    //XdmcpReset();
+#endif
 }
 
 #endif
commit a6869b03f6ec7524625cbb0e65a3a3b78da6d8b9
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Fri May 23 02:30:59 2008 -0700

    XQuartz: Don't need launchd checking in configure.ac anymore since its functionality has been removed from libxtrans and into the mach startup code.
    (cherry picked from commit 1e1f4fb717d2f3a3227be2a034d28d6a4f29b5d1)

diff --git a/configure.ac b/configure.ac
index efd6786..887a1d1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -490,7 +490,6 @@ AC_ARG_WITH(apple-applications-dir,AS_HELP_STRING([--with-apple-applications-dir
 				[ APPLE_APPLICATIONS_DIR="${withval}" ],
 				[ APPLE_APPLICATIONS_DIR="/Applications/Utilities" ])
 AC_SUBST([APPLE_APPLICATIONS_DIR])
-AC_ARG_WITH(launchd,          AS_HELP_STRING([--with-launchd], [Build with support for Apple's launchd (default: auto)]), [LAUNCHD=$withval], [LAUNCHD=auto])
 AC_ARG_WITH(launchagents-dir,AS_HELP_STRING([--with-launchagents-dir=PATH], [Path to launchd's LaunchAgents directory (default: /Library/LaunchAgents)]),
 				[ launchagentsdir="${withval}" ],
 				[ launchagentsdir="/Library/LaunchAgents" ])
@@ -1781,21 +1780,6 @@ AM_CONDITIONAL(HAVE_XPLUGIN, [test "x$ac_cv_lib_Xplugin_xp_init" = xyes])
 AM_CONDITIONAL(HAVE_AGL_FRAMEWORK, [test "x$xorg_cv_AGL_framework" = xyes])
 AM_CONDITIONAL(XQUARTZ, [test "x$XQUARTZ" = xyes])
 
-if test "x$LAUNCHD" = "xauto"; then
-	if test "x$XQUARTZ" = "xyes" ; then
-		LAUNCHD=yes
-	else
-		unset LAUNCHD
-		AC_CHECK_PROG(LAUNCHD, [launchd], [yes], [no])
-	fi
-fi
-
-if test "x$LAUNCHD" = "xyes" ; then
-	AC_DEFINE(HAVE_LAUNCHD, 1, [launchd support available])
-fi
-AM_CONDITIONAL(LAUNCHD, [test "x$LAUNCHD" = "xyes"])
-
-
 dnl DMX DDX
 
 AC_MSG_CHECKING([whether to build Xdmx DDX])
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 94b5dd2..38639d6 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -148,9 +148,6 @@
 /* Define to 1 if you have version 2.2 (or newer) of the drm library */
 #undef HAVE_LIBDRM_2_2
 
-/* Define to 1 if launchd is available. */
-#undef HAVE_LAUNCHD
-
 /* Have Quartz */
 #undef XQUARTZ
 
commit b55226326caea0c3fa9be6145f83f02f56fbe46e
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Fri May 23 01:39:02 2008 -0700

    XQuartz: Move the launchd display grabbing into mach_startup
    (cherry picked from commit c3866c98d23020d2151977ee1177b6054d05832e)

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index d687c1f..c6c9c59 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -45,9 +45,6 @@
 #include "X11/extensions/applewm.h"
 #include "micmap.h"
 
-#include "os.h"
-#include "mach-startup/launchd_fd.h"
-
 #include <mach/mach.h>
 #include <unistd.h>
 
@@ -815,14 +812,6 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
     /* Tell the server thread that it can proceed */
     QuartzInitServer(argc, argv, envp);
     
-#ifndef NEW_LAUNCH_METHOD
-    /* Start listening on the launchd fd */
-    int launchd_fd = launchd_display_fd();
-    if(launchd_fd != -1) {
-        DarwinListenOnOpenFD(launchd_fd);
-    }
-#endif
-
     [NSApp run];
     /* not reached */
 }
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index 0fab990..73c0483 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -47,6 +47,10 @@
 #include "mach_startup.h"
 #include "mach_startupServer.h"
 
+#include "launchd_fd.h"
+void DarwinListenOnOpenFD(int fd);
+
+
 #define DEFAULT_CLIENT "/usr/X11/bin/xterm"
 #define DEFAULT_STARTX "/usr/X11/bin/startx"
 #define DEFAULT_SHELL  "/bin/sh"
@@ -60,8 +64,21 @@ int server_main(int argc, char **argv, char **envp);
 static int execute(const char *command);
 static char *command_from_prefs(const char *key, const char *default_value);
 
-#ifdef NEW_LAUNCH_METHOD
+/*** Pthread Magics ***/
+static pthread_t create_thread(void *func, void *arg) {
+    pthread_attr_t attr;
+    pthread_t tid;
+	
+    pthread_attr_init (&attr);
+    pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM);
+    pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
+    pthread_create (&tid, &attr, func, arg);
+    pthread_attr_destroy (&attr);
+	
+    return tid;
+}
 
+#ifdef NEW_LAUNCH_METHOD
 struct arg {
     int argc;
     char **argv;
@@ -106,20 +123,6 @@ static mach_port_t checkin_or_register(char *bname) {
     return mp;
 }
 
-/*** Pthread Magics ***/
-static pthread_t create_thread(void *func, void *arg) {
-    pthread_attr_t attr;
-    pthread_t tid;
-	
-    pthread_attr_init (&attr);
-    pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM);
-    pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
-    pthread_create (&tid, &attr, func, arg);
-    pthread_attr_destroy (&attr);
-	
-    return tid;
-}
-
 /*** $DISPLAY handoff ***/
 /* From darwinEvents.c ... but don't want to pull in all the server cruft */
 void DarwinListenOnOpenFD(int fd);
@@ -289,6 +292,8 @@ kern_return_t do_start_x11_server(mach_port_t port, string_array_t argv,
 
 int startup_trigger(int argc, char **argv, char **envp) {
 #else
+void *add_launchd_display_thread(void *data);
+    
 int main(int argc, char **argv, char **envp) {
 #endif
     Display *display;
@@ -345,6 +350,7 @@ int main(int argc, char **argv, char **envp) {
         }
         exit(EXIT_SUCCESS);
 #else
+        create_thread(add_launchd_display_thread, NULL);
         return server_main(argc, argv, envp);
 #endif
     }
@@ -356,14 +362,9 @@ int main(int argc, char **argv, char **envp) {
         /* Now, try to open a display, if so, run the launcher */
         display = XOpenDisplay(NULL);
         if(display) {
-            fprintf(stderr, "X11.app: Closing the display and sleeping for 2s to allow the X server to start up.\n");
             /* Could open the display, start the launcher */
             XCloseDisplay(display);
             
-            /* Give 2 seconds for the server to start... 
-             * TODO: *Really* fix this race condition
-             */
-            usleep(2000);
             return execute(command_from_prefs("app_to_run", DEFAULT_CLIENT));
         }
     }
@@ -434,6 +435,18 @@ int main(int argc, char **argv, char **envp) {
     
     return EXIT_SUCCESS;
 }
+#else
+void *add_launchd_display_thread(void *data) {
+    /* TODO: Really fix this race */
+    sleep(5);
+    
+    /* Start listening on the launchd fd */
+    int launchd_fd = launchd_display_fd();
+    if(launchd_fd != -1) {
+        DarwinListenOnOpenFD(launchd_fd);
+    }
+    return NULL;
+}
 #endif
     
 static int execute(const char *command) {
commit 517151d5f458aef6518197d84cec21e001b5f27b
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Mon May 19 03:13:09 2008 -0700

    XQuartz: Fixed a few issues with fd passing... still not working =(
    (cherry picked from commit 7dd351271522b475d8017e4bd1618f12817ee2fa)

diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index c975123..0fab990 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -163,10 +163,11 @@ static void accept_fd_handoff(int connected_fd) {
     
     launchd_fd = *((int*)CMSG_DATA(cmsg));
     
-    if(launchd_fd > 0)
-        DarwinListenOnOpenFD(launchd_fd);
-    else
+    if(launchd_fd == -1)
         fprintf(stderr, "Error receiving $DISPLAY file descriptor, no descriptor received? %d\n", launchd_fd);
+        
+    fprintf(stderr, "Received new DISPLAY fd: %d\n", launchd_fd);
+    DarwinListenOnOpenFD(launchd_fd);
 }
 
 typedef struct {
@@ -227,9 +228,6 @@ static void socket_handoff_thread(void *arg) {
     
     connected_fd = accept(handoff_fd, NULL, NULL);
     
-    /* We delete this temporary socket after we get the connection */
-    unlink(filename);
-
     if(connected_fd == -1) {
         fprintf(stderr, "Failed to accept incoming connection on socket: %s - %s\n", filename, strerror(errno));
         return;
@@ -237,8 +235,10 @@ static void socket_handoff_thread(void *arg) {
 
     /* Now actually get the passed file descriptor from this connection */
     accept_fd_handoff(connected_fd);
-    
+
+    close(connected_fd);
     close(handoff_fd);
+    unlink(filename);
 }
 
 kern_return_t do_prep_fd_handoff(mach_port_t port, string_t socket_filename) {
diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c
index 0a9ab66..854b71c 100644
--- a/hw/xquartz/mach-startup/stub.c
+++ b/hw/xquartz/mach-startup/stub.c
@@ -113,7 +113,7 @@ static void set_x11_path() {
     }
 }
 
-static void send_fd_handoff(int connected_fd, int launchd_fd) {
+static void send_fd_handoff(int handoff_fd, int launchd_fd) {
     char databuf[] = "display";
     struct iovec iov[1];
     
@@ -143,19 +143,19 @@ static void send_fd_handoff(int connected_fd, int launchd_fd) {
     
     *((int*)CMSG_DATA(cmsg)) = launchd_fd;
     
-    if (sendmsg(connected_fd, &msg, 0) < 0) {
+    if (sendmsg(handoff_fd, &msg, 0) < 0) {
         fprintf(stderr, "Error sending $DISPLAY file descriptor: %s\n", strerror(errno));
         return;
     }
 
-    fprintf(stderr, "send %d %d %d %s\n", connected_fd, launchd_fd, errno, strerror(errno));
+    fprintf(stderr, "send %d %d %d %s\n", handoff_fd, launchd_fd, errno, strerror(errno));
 }
 
 static void handoff_fd(const char *filename, int launchd_fd) {
     struct sockaddr_un servaddr_un;
     struct sockaddr *servaddr;
     socklen_t servaddr_len;
-    int handoff_fd, connected_fd;
+    int handoff_fd;
 
     /* Setup servaddr_un */
     memset (&servaddr_un, 0, sizeof (struct sockaddr_un));
@@ -171,15 +171,14 @@ static void handoff_fd(const char *filename, int launchd_fd) {
         return;
     }
 
-    connected_fd = connect(handoff_fd, servaddr, servaddr_len);
-
-    if(connected_fd == -1) {
+    if(connect(handoff_fd, servaddr, servaddr_len) < 0) {
         fprintf(stderr, "Failed to establish connection on socket: %s - %s\n", filename, strerror(errno));
         return;
     }
 
-    send_fd_handoff(connected_fd, launchd_fd);
+    fprintf(stderr, "Socket: %s\n", filename);
 
+    send_fd_handoff(handoff_fd, launchd_fd);
     close(handoff_fd);
 }
 
commit 9211a10b981008fb96f09d6933345e41a0872f2a
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed May 21 17:52:23 2008 -0400

    xserver 1.4.99.902

diff --git a/configure.ac b/configure.ac
index 4d841f6..07df3db 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,7 +26,7 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.57)
-AC_INIT([xorg-server], 1.4.99.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+AC_INIT([xorg-server], 1.4.99.902, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([dist-bzip2 foreign])
 AM_MAINTAINER_MODE
commit b69c74d14b7a777ae02aee0a8ff81efbff8cca6e
Author: Aaron Plattner <aplattner at nvidia.com>
Date:   Tue May 20 12:39:28 2008 -0700

    Short-circuit PanoramiXTranslateVisualID after verifying that the visual actually exists first.
    
    This allows using PanoramiXTranslateVisualID to test whether a given visual made
    it through PanoramiXVisualConsolidate.
    (cherry picked from commit 8b3d26f5b6caff1766669deb0e2100d2dee3f185)

diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index eb70689..2792dc7 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -850,10 +850,6 @@ PanoramiXTranslateVisualID(int screen, VisualID orig)
     VisualPtr pVisual = NULL;
     int i;
 
-    /* if screen is 0, orig is already the correct visual ID */
-    if (screen == 0)
-	return orig;
-
     for (i = 0; i < PanoramiXNumVisuals; i++) {
 	if (orig == PanoramiXVisuals[i].vid) {
 	    pVisual = &PanoramiXVisuals[i];
@@ -864,6 +860,10 @@ PanoramiXTranslateVisualID(int screen, VisualID orig)
     if (!pVisual)
 	return 0;
 
+    /* if screen is 0, orig is already the correct visual ID */
+    if (screen == 0)
+	return orig;
+
     /* found the original, now translate it relative to the backend screen */
     for (i = 0; i < pOtherScreen->numVisuals; i++) {
 	VisualPtr pOtherVisual = &pOtherScreen->visuals[i];
commit 5efe36f7afde8b5bf4e853dd1dde2a6a027d613b
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon May 19 11:22:19 2008 -0400

    Fix reduced-blanking mode filtering in RANDR 1.2.
    
    If the monitor isn't reduced-blanking (either through EDID logic, or
    config file setting), then remove RB modes from the default pool.  Any
    RB modes from the driver and config file pools will stick around though;
    you asked for them, you got them.
    (cherry picked from commit 0178b6a4abed0df3e90ba393709ed566105e7c2c)

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index e857b07..855d646 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1475,7 +1475,14 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
 	}
 	default_modes = xf86GetDefaultModes (output->interlaceAllowed,
 					     output->doubleScanAllowed);
-	
+
+	/*
+	 * If this is not an RB monitor, remove RB modes from the default
+	 * pool.  RB modes from the config or the monitor itself are fine.
+	 */
+	if (!mon_rec.reducedblanking)
+	    xf86ValidateModesReducedBlanking (scrn, default_modes);
+
 	if (sync_source == sync_config)
 	{
 	    /* 
diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c
index a07eba9..ea398ad 100644
--- a/hw/xfree86/modes/xf86Modes.c
+++ b/hw/xfree86/modes/xf86Modes.c
@@ -514,6 +514,28 @@ xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList,
 }
 
 /**
+ * Marks as bad any reduced-blanking modes.
+ *
+ * \param modeList doubly-linked list of modes.
+ */
+_X_EXPORT void
+xf86ValidateModesReducedBlanking(ScrnInfoPtr pScrn, DisplayModePtr modeList)
+{
+    Bool mode_is_reduced = FALSE;
+    DisplayModePtr mode;
+
+    for (mode = modeList; mode != NULL; mode = mode->next) {
+	/* gratuitous duplication from pre-randr validation code */
+	if ((((mode->HDisplay * 5 / 4) & ~0x07) > mode->HTotal) &&
+	    ((mode->HTotal - mode->HDisplay) == 160) &&
+	    ((mode->HSyncEnd - mode->HDisplay) == 80) &&
+	    ((mode->HSyncEnd - mode->HSyncStart) == 32) &&
+	    ((mode->VSyncStart - mode->VDisplay) == 3))
+	    mode->status = MODE_NO_REDUCED;
+    }
+}
+
+/**
  * Frees any modes from the list with a status other than MODE_OK.
  *
  * \param modeList pointer to a doubly-linked or circular list of modes.
diff --git a/hw/xfree86/modes/xf86Modes.h b/hw/xfree86/modes/xf86Modes.h
index 5d49c93..acdea65 100644
--- a/hw/xfree86/modes/xf86Modes.h
+++ b/hw/xfree86/modes/xf86Modes.h
@@ -85,6 +85,9 @@ xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList,
 			   unsigned int bandwidth, int depth);
 
 void
+xf86ValidateModesReducedBlanking(ScrnInfoPtr pScrn, DisplayModePtr modeList);
+
+void
 xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
 		      Bool verbose);
 


More information about the xorg-commit mailing list