<div dir="ltr"><div>Should you have to bump the ABI version for this? It seems MoveWindowInStack is exported. Or will you bump it after the series is done, at release time?<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Tue, Aug 20, 2013 at 3:33 PM, Adam Jackson <span dir="ltr"><<a href="mailto:ajax@redhat.com" target="_blank">ajax@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This looks like it removes an optimisation, but this turns out not to be<br>
the case!  For 1024x768x32 Xvfb on a 1.7GHz Ivybridge:<br>
<br>
      before      after<br>
    --------  --------- --------   --------------------------<br>
    204437.1  1001917.1 (  4.90)   Circulate window (4 kids)<br>
    130656.5   971734.9 (  7.44)   Circulate window (16 kids)<br>
    127631.0   934420.7 (  7.32)   Circulate window (25 kids)<br>
    122622.6   843778.1 (  6.88)   Circulate window (50 kids)<br>
    116319.1   778275.1 (  6.69)   Circulate window (75 kids)<br>
    109929.4   723284.9 (  6.58)   Circulate window (100 kids)<br>
     83153.3   504731.3 (  6.07)   Circulate window (200 kids)<br>
<br>
So let's just tear that out, and in doing so, remove a #ifdef ROOTLESS<br>
from dix code.<br>
<br>
Signed-off-by: Adam Jackson <<a href="mailto:ajax@redhat.com">ajax@redhat.com</a>><br>
---<br>
 dix/window.c     | 82 ++++----------------------------------------------------<br>
 include/window.h |  4 +--<br>
 mi/mioverlay.c   |  8 +++---<br>
 mi/miwindow.c    |  8 +++---<br>
 4 files changed, 15 insertions(+), 87 deletions(-)<br>
<br>
diff --git a/dix/window.c b/dix/window.c<br>
index 8950f97..4e3da64 100644<br>
--- a/dix/window.c<br>
+++ b/dix/window.c<br>
@@ -1513,85 +1513,17 @@ GetWindowAttributes(WindowPtr pWin, ClientPtr client,<br>
     wa->visualID = wVisual(pWin);<br>
 }<br>
<br>
-WindowPtr<br>
+void<br>
 MoveWindowInStack(WindowPtr pWin, WindowPtr pNextSib)<br>
 {<br>
-    WindowPtr pParent = pWin->parent;<br>
-    WindowPtr pFirstChange = pWin;      /* highest window where list changes */<br>
-<br>
-    if (pWin->nextSib != pNextSib) {<br>
-        WindowPtr pOldNextSib = pWin->nextSib;<br>
-<br>
-        if (!pNextSib) {        /* move to bottom */<br>
-            if (pParent->firstChild == pWin)<br>
-                pParent->firstChild = pWin->nextSib;<br>
-            /* if (pWin->nextSib) *//* is always True: pNextSib == NULL<br>
-             * and pWin->nextSib != pNextSib<br>
-             * therefore pWin->nextSib != NULL */<br>
-            pFirstChange = pWin->nextSib;<br>
-            pWin->nextSib->prevSib = pWin->prevSib;<br>
-            if (pWin->prevSib)<br>
-                pWin->prevSib->nextSib = pWin->nextSib;<br>
-            pParent->lastChild->nextSib = pWin;<br>
-            pWin->prevSib = pParent->lastChild;<br>
-            pWin->nextSib = NullWindow;<br>
-            pParent->lastChild = pWin;<br>
-        }<br>
-        else if (pParent->firstChild == pNextSib) {     /* move to top */<br>
-            pFirstChange = pWin;<br>
-            if (pParent->lastChild == pWin)<br>
-                pParent->lastChild = pWin->prevSib;<br>
-            if (pWin->nextSib)<br>
-                pWin->nextSib->prevSib = pWin->prevSib;<br>
-            if (pWin->prevSib)<br>
-                pWin->prevSib->nextSib = pWin->nextSib;<br>
-            pWin->nextSib = pParent->firstChild;<br>
-            pWin->prevSib = (WindowPtr) NULL;<br>
-            pNextSib->prevSib = pWin;<br>
-            pParent->firstChild = pWin;<br>
-        }<br>
-        else {                  /* move in middle of list */<br>
-<br>
-            WindowPtr pOldNext = pWin->nextSib;<br>
-<br>
-            pFirstChange = NullWindow;<br>
-            if (pParent->firstChild == pWin)<br>
-                pFirstChange = pParent->firstChild = pWin->nextSib;<br>
-            if (pParent->lastChild == pWin) {<br>
-                pFirstChange = pWin;<br>
-                pParent->lastChild = pWin->prevSib;<br>
-            }<br>
-            if (pWin->nextSib)<br>
-                pWin->nextSib->prevSib = pWin->prevSib;<br>
-            if (pWin->prevSib)<br>
-                pWin->prevSib->nextSib = pWin->nextSib;<br>
-            pWin->nextSib = pNextSib;<br>
-            pWin->prevSib = pNextSib->prevSib;<br>
-            if (pNextSib->prevSib)<br>
-                pNextSib->prevSib->nextSib = pWin;<br>
-            pNextSib->prevSib = pWin;<br>
-            if (!pFirstChange) {        /* do we know it yet? */<br>
-                pFirstChange = pParent->firstChild;     /* no, search from top */<br>
-                while ((pFirstChange != pWin) && (pFirstChange != pOldNext))<br>
-                    pFirstChange = pFirstChange->nextSib;<br>
-            }<br>
-        }<br>
-        if (pWin->drawable.pScreen->RestackWindow)<br>
-            (*pWin->drawable.pScreen->RestackWindow) (pWin, pOldNextSib);<br>
-    }<br>
-<br>
-#ifdef ROOTLESS<br>
     /*<br>
      * In rootless mode we can't optimize away window restacks.<br>
      * There may be non-X windows around, so even if the window<br>
      * is in the correct position from X's point of view,<br>
      * the underlying window system may want to reorder it.<br>
      */<br>
-    else if (pWin->drawable.pScreen->RestackWindow)<br>
+    if (pWin->drawable.pScreen->RestackWindow)<br>
         (*pWin->drawable.pScreen->RestackWindow) (pWin, pWin->nextSib);<br>
-#endif<br>
-<br>
-    return pFirstChange;<br>
 }<br>
<br>
 void<br>
@@ -2039,7 +1971,7 @@ ReflectStackChange(WindowPtr pWin, WindowPtr pSib, VTKind kind)<br>
<br>
     Bool WasViewable = (Bool) pWin->viewable;<br>
     Bool anyMarked;<br>
-    WindowPtr pFirstChange;<br>
+    WindowPtr pFirstChange = pWin;<br>
     WindowPtr pLayerWin;<br>
     ScreenPtr pScreen = pWin->drawable.pScreen;<br>
<br>
@@ -2047,7 +1979,7 @@ ReflectStackChange(WindowPtr pWin, WindowPtr pSib, VTKind kind)<br>
     if (!pWin->parent)<br>
         return;<br>
<br>
-    pFirstChange = MoveWindowInStack(pWin, pSib);<br>
+    MoveWindowInStack(pWin, pSib);<br>
<br>
     if (WasViewable) {<br>
         anyMarked = (*pScreen->MarkOverlappedWindows) (pWin, pFirstChange,<br>
@@ -2236,11 +2168,7 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client)<br>
     if ((mask & CWBorderWidth) && (bw != wBorderWidth(pWin)))<br>
         goto ActuallyDoSomething;<br>
     if (mask & CWStackMode) {<br>
-#ifndef ROOTLESS<br>
-        /* See above for why we always reorder in rootless mode. */<br>
-        if (pWin->nextSib != pSib)<br>
-#endif<br>
-            goto ActuallyDoSomething;<br>
+        goto ActuallyDoSomething;<br>
     }<br>
     return Success;<br>
<br>
diff --git a/include/window.h b/include/window.h<br>
index b6d61c3..df06b75 100644<br>
--- a/include/window.h<br>
+++ b/include/window.h<br>
@@ -201,8 +201,8 @@ extern _X_EXPORT void CheckWindowOptionalNeed(WindowPtr /*w */ );<br>
<br>
 extern _X_EXPORT Bool MakeWindowOptional(WindowPtr /*pWin */ );<br>
<br>
-extern _X_EXPORT WindowPtr MoveWindowInStack(WindowPtr /*pWin */ ,<br>
-                                             WindowPtr /*pNextSib */ );<br>
+extern _X_EXPORT void MoveWindowInStack(WindowPtr /*pWin */ ,<br>
+                                        WindowPtr /*pNextSib */ );<br>
<br>
 extern _X_EXPORT void SetWinSize(WindowPtr /*pWin */ );<br>
<br>
diff --git a/mi/mioverlay.c b/mi/mioverlay.c<br>
index 2bfd5e4..b014d3d 100644<br>
--- a/mi/mioverlay.c<br>
+++ b/mi/mioverlay.c<br>
@@ -911,7 +911,7 @@ miOverlayMoveWindow(WindowPtr pWin,<br>
 {<br>
     ScreenPtr pScreen = pWin->drawable.pScreen;<br>
     miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);<br>
-    WindowPtr pParent, windowToValidate;<br>
+    WindowPtr pParent, windowToValidate = pWin;<br>
     Bool WasViewable = (Bool) (pWin->viewable);<br>
     short bw;<br>
     RegionRec overReg, underReg;<br>
@@ -946,7 +946,7 @@ miOverlayMoveWindow(WindowPtr pWin,<br>
<br>
     (*pScreen->PositionWindow) (pWin, x, y);<br>
<br>
-    windowToValidate = MoveWindowInStack(pWin, pNextSib);<br>
+    MoveWindowInStack(pWin, pNextSib);<br>
<br>
     ResizeChildrenWinSize(pWin, x - oldpt.x, y - oldpt.y, 0, 0);<br>
<br>
@@ -1101,7 +1101,7 @@ miOverlayResizeWindow(WindowPtr pWin,<br>
     short dw, dh;<br>
     DDXPointRec oldpt;<br>
     RegionPtr oldRegion = NULL, oldRegion2 = NULL;<br>
-    WindowPtr pFirstChange;<br>
+    WindowPtr pFirstChange = pWin;<br>
     WindowPtr pChild;<br>
     RegionPtr gravitate[StaticGravity + 1];<br>
     RegionPtr gravitate2[StaticGravity + 1];<br>
@@ -1225,7 +1225,7 @@ miOverlayResizeWindow(WindowPtr pWin,<br>
     /* let the hardware adjust background and border pixmaps, if any */<br>
     (*pScreen->PositionWindow) (pWin, x, y);<br>
<br>
-    pFirstChange = MoveWindowInStack(pWin, pSib);<br>
+    MoveWindowInStack(pWin, pSib);<br>
<br>
     if (WasViewable) {<br>
         pRegion = RegionCreate(NullBox, 1);<br>
diff --git a/mi/miwindow.c b/mi/miwindow.c<br>
index 8dd99db..8adafdc 100644<br>
--- a/mi/miwindow.c<br>
+++ b/mi/miwindow.c<br>
@@ -247,7 +247,7 @@ miMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pNextSib, VTKind kind)<br>
     DDXPointRec oldpt;<br>
     Bool anyMarked = FALSE;<br>
     ScreenPtr pScreen;<br>
-    WindowPtr windowToValidate;<br>
+    WindowPtr windowToValidate = pWin;<br>
     WindowPtr pLayerWin;<br>
<br>
     /* if this is a root window, can't be moved */<br>
@@ -273,7 +273,7 @@ miMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pNextSib, VTKind kind)<br>
<br>
     (*pScreen->PositionWindow) (pWin, x, y);<br>
<br>
-    windowToValidate = MoveWindowInStack(pWin, pNextSib);<br>
+    MoveWindowInStack(pWin, pNextSib);<br>
<br>
     ResizeChildrenWinSize(pWin, x - oldpt.x, y - oldpt.y, 0, 0);<br>
<br>
@@ -350,7 +350,7 @@ miSlideAndSizeWindow(WindowPtr pWin,<br>
     RegionPtr oldRegion = NULL;<br>
     Bool anyMarked = FALSE;<br>
     ScreenPtr pScreen;<br>
-    WindowPtr pFirstChange;<br>
+    WindowPtr pFirstChange = pWin;<br>
     WindowPtr pChild;<br>
     RegionPtr gravitate[StaticGravity + 1];<br>
     unsigned g;<br>
@@ -444,7 +444,7 @@ miSlideAndSizeWindow(WindowPtr pWin,<br>
     /* let the hardware adjust background and border pixmaps, if any */<br>
     (*pScreen->PositionWindow) (pWin, x, y);<br>
<br>
-    pFirstChange = MoveWindowInStack(pWin, pSib);<br>
+    MoveWindowInStack(pWin, pSib);<br>
<br>
     if (WasViewable) {<br>
         pRegion = RegionCreate(NullBox, 1);<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.3.1<br>
<br>
_______________________________________________<br>
<a href="mailto:xorg-devel@lists.x.org">xorg-devel@lists.x.org</a>: X.Org development<br>
Archives: <a href="http://lists.x.org/archives/xorg-devel" target="_blank">http://lists.x.org/archives/xorg-devel</a><br>
Info: <a href="http://lists.x.org/mailman/listinfo/xorg-devel" target="_blank">http://lists.x.org/mailman/listinfo/xorg-devel</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br>  Jasper<br>
</div>