xserver: Branch 'master' - 2 commits

Peter Hutterer whot at kemper.freedesktop.org
Tue Nov 25 16:54:49 PST 2008


 dix/devices.c   |   14 ++++++++------
 include/input.h |    2 +-
 2 files changed, 9 insertions(+), 7 deletions(-)

New commits:
commit ec1d08442f69353cb0e73ac4eaf0346ebb975594
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Nov 21 15:13:00 2008 +1000

    dix: Enable core devices in InitCoreDevices already.
    
    Updated patch, see
    http://lists.freedesktop.org/archives/xorg/2008-November/040540.html
    
    Signed-off-by: Peter Hutterer <peter.hutterer at redhat.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/dix/devices.c b/dix/devices.c
index afc78d8..f85e875 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -595,8 +595,6 @@ CorePointerProc(DeviceIntPtr pDev, int what)
  * Both devices are not tied to physical devices, but guarantee that there is
  * always a keyboard and a pointer present and keep the protocol semantics.
  *
- * The devices are activated but not enabled.
- *
  * Note that the server MUST have two core devices at all times, even if there
  * is no physical device connected.
  */
@@ -607,6 +605,12 @@ InitCoreDevices(void)
                           &inputInfo.pointer,
                           &inputInfo.keyboard) != Success)
         FatalError("Failed to allocate core devices");
+
+    ActivateDevice(inputInfo.pointer);
+    ActivateDevice(inputInfo.keyboard);
+    EnableDevice(inputInfo.pointer);
+    EnableDevice(inputInfo.keyboard);
+
 }
 
 /**
@@ -632,21 +636,6 @@ InitAndStartDevices()
             ActivateDevice(dev);
     }
 
-    if (!inputInfo.keyboard) { /* In theory, this cannot happen */
-	ErrorF("[dix] No core keyboard\n");
-	return BadImplementation;
-    }
-    if (!inputInfo.pointer) { /* In theory, this cannot happen */
-	ErrorF("[dix] No core pointer\n");
-	return BadImplementation;
-    }
-
-    /* Now enable all devices */
-    if (inputInfo.pointer->inited && inputInfo.pointer->startup)
-        EnableDevice(inputInfo.pointer);
-    if (inputInfo.keyboard->inited && inputInfo.keyboard->startup)
-        EnableDevice(inputInfo.keyboard);
-
     /* enable real devices */
     for (dev = inputInfo.off_devices; dev; dev = next)
     {
diff --git a/dix/main.c b/dix/main.c
index 7bd91e0..ee2e10d 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -361,8 +361,7 @@ int main(int argc, char *argv[], char *envp[])
 
         InitCoreDevices();
 	InitInput(argc, argv);
-	if (InitAndStartDevices() != Success)
-	    FatalError("failed to initialize core devices");
+	InitAndStartDevices();
 
 	dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
 
commit 2b45602e828a07a0817691b2838cd34ffee531bd
Author: Peter Hutterer <peter.hutterer at redhat.com>
Date:   Wed Nov 26 10:42:52 2008 +1000

    Revert "dix: Enable core devices in InitCoreDevices already."
    
    I merged the wrong patch. See correct patch at:
    http://lists.freedesktop.org/archives/xorg/2008-November/040540.html
    
    Not activating the device before attempting to enable it would leave the
    sprite unset, crashing the server when enabling the real devices.
    
    This reverts commit e078901a4eca02bd3e7a80d9462dafbca939a187.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at redhat.com>

diff --git a/dix/devices.c b/dix/devices.c
index 583ecc0..afc78d8 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -595,6 +595,8 @@ CorePointerProc(DeviceIntPtr pDev, int what)
  * Both devices are not tied to physical devices, but guarantee that there is
  * always a keyboard and a pointer present and keep the protocol semantics.
  *
+ * The devices are activated but not enabled.
+ *
  * Note that the server MUST have two core devices at all times, even if there
  * is no physical device connected.
  */
@@ -605,12 +607,6 @@ InitCoreDevices(void)
                           &inputInfo.pointer,
                           &inputInfo.keyboard) != Success)
         FatalError("Failed to allocate core devices");
-
-    if (inputInfo.pointer->inited && inputInfo.pointer->startup)
-        EnableDevice(inputInfo.pointer);
-    if (inputInfo.keyboard->inited && inputInfo.keyboard->startup)
-        EnableDevice(inputInfo.keyboard);
-
 }
 
 /**
@@ -625,7 +621,7 @@ InitCoreDevices(void)
  *
  * @return Success or error code on failure.
  */
-void
+int
 InitAndStartDevices()
 {
     DeviceIntPtr dev, next;
@@ -636,14 +632,31 @@ InitAndStartDevices()
             ActivateDevice(dev);
     }
 
+    if (!inputInfo.keyboard) { /* In theory, this cannot happen */
+	ErrorF("[dix] No core keyboard\n");
+	return BadImplementation;
+    }
+    if (!inputInfo.pointer) { /* In theory, this cannot happen */
+	ErrorF("[dix] No core pointer\n");
+	return BadImplementation;
+    }
+
+    /* Now enable all devices */
+    if (inputInfo.pointer->inited && inputInfo.pointer->startup)
+        EnableDevice(inputInfo.pointer);
+    if (inputInfo.keyboard->inited && inputInfo.keyboard->startup)
+        EnableDevice(inputInfo.keyboard);
+
     /* enable real devices */
     for (dev = inputInfo.off_devices; dev; dev = next)
     {
         DebugF("(dix) enabling device %d\n", dev->id);
 	next = dev->next;
 	if (dev->inited && dev->startup)
-	    EnableDevice(dev);
+	    (void)EnableDevice(dev);
     }
+
+    return Success;
 }
 
 /**
diff --git a/dix/main.c b/dix/main.c
index ee2e10d..7bd91e0 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -361,7 +361,8 @@ int main(int argc, char *argv[], char *envp[])
 
         InitCoreDevices();
 	InitInput(argc, argv);
-	InitAndStartDevices();
+	if (InitAndStartDevices() != Success)
+	    FatalError("failed to initialize core devices");
 
 	dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
 
diff --git a/include/input.h b/include/input.h
index 62f5449..c78f0b7 100644
--- a/include/input.h
+++ b/include/input.h
@@ -233,7 +233,7 @@ extern Bool ActivateDevice(
 extern Bool DisableDevice(
     DeviceIntPtr /*device*/);
 
-extern void InitAndStartDevices(void);
+extern int InitAndStartDevices(void);
 
 extern void CloseDownDevices(void);
 


More information about the xorg-commit mailing list