xserver: Branch 'master' - 14 commits

Keith Packard keithp at kemper.freedesktop.org
Mon Dec 9 10:29:33 PST 2013


 Xext/panoramiX.c                   |    5 
 Xext/panoramiXsrv.h                |    1 
 composite/compinit.c               |    7 
 composite/compoverlay.c            |    5 
 damageext/damageext.c              |  389 ++++++++++++++++++++++++++++++++-----
 damageext/damageextint.h           |    3 
 dix/dispatch.c                     |    5 
 dix/window.c                       |    6 
 dri3/dri3.c                        |    5 
 hw/xfree86/common/xf86AutoConfig.c |   17 -
 hw/xfree86/common/xf86Config.c     |    2 
 hw/xfree86/common/xf86Helper.c     |    7 
 hw/xfree86/dri2/dri2ext.c          |    5 
 present/present_screen.c           |    5 
 xfixes/region.c                    |   26 ++
 15 files changed, 419 insertions(+), 69 deletions(-)

New commits:
commit 576f3d36dd324bd0d16c9968f1ded5c5eead3569
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Dec 9 13:16:01 2013 -0500

    damageext: Die if we can't create the Xinerama resource type
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/damageext/damageext.c b/damageext/damageext.c
index d646923..5650953 100644
--- a/damageext/damageext.c
+++ b/damageext/damageext.c
@@ -725,6 +725,8 @@ void
 PanoramiXDamageInit(void)
 {
     XRT_DAMAGE = CreateNewResourceType(PanoramiXDamageDelete, "XineramaDamage");
+    if (!XRT_DAMAGE)
+        FatalError("Couldn't Xineramify Damage extension\n");
 
     PanoramiXSaveDamageCreate = ProcDamageVector[X_DamageCreate];
     ProcDamageVector[X_DamageCreate] = PanoramiXDamageCreate;
commit f10f36d91db1b21c2ce5a531b4fa5f96fcbdc2f0
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Sep 16 15:17:26 2013 -0400

    damageext: Xineramify (v7)
    
    v7: Don't bother making resources for the backing listeners. [keithp]
    
    This is now slightly unlike how other resources are xineramified.  We
    create N+1 internal damage listeners, one that's a real resource and
    reflects the protocol view, and then one per backend screen where the
    report function piles onto the protocol view.  The internal listeners
    are not stored in the resource database directly, they just hang off the
    xinerama resource. We don't wrap Subtract at the dispatch level, but we
    do extend it for the Xinerama case to clip to the root window geometry.
    
    As a result of the N+1 design here, the damage reports we generate are
    not quite minimal.  However they are indistinguishable from sequential
    rendering events happening before the client hears damage, and we don't
    need to add a post-dispatch callback just for this one extension.
    
    Add is probably (still) somewhat broken since it will only hit screen 0,
    but Add really only exists for DRI1's sake, and DRI1 disables itself
    with Xinerama enabled anyway.  In the absence of a use case, I'm leaving
    it unwrapped under Xinerama; if someone wants to define how it ought to
    work, be my guest.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index 15c38a9..ce0d072 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -54,6 +54,7 @@ Equipment Corporation.
 #include "resource.h"
 #include "picturestr.h"
 #include "xfixesint.h"
+#include "damageextint.h"
 #ifdef COMPOSITE
 #include "compint.h"
 #endif
@@ -582,6 +583,7 @@ PanoramiXExtensionInit(void)
 
     PanoramiXRenderInit();
     PanoramiXFixesInit();
+    PanoramiXDamageInit();
 #ifdef COMPOSITE
     PanoramiXCompositeInit();
 #endif
@@ -887,6 +889,7 @@ PanoramiXResetProc(ExtensionEntry * extEntry)
 
     PanoramiXRenderReset();
     PanoramiXFixesReset();
+    PanoramiXDamageReset();
 #ifdef COMPOSITE
     PanoramiXCompositeReset ();
 #endif
diff --git a/damageext/damageext.c b/damageext/damageext.c
index 9521c26..d646923 100644
--- a/damageext/damageext.c
+++ b/damageext/damageext.c
@@ -1,5 +1,6 @@
 /*
  * Copyright © 2002 Keith Packard
+ * Copyright 2013 Red Hat, Inc.
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -25,9 +26,24 @@
 #endif
 
 #include "damageextint.h"
+#include "damagestr.h"
 #include "protocol-versions.h"
 #include "extinit.h"
 
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+
+typedef struct {
+    DamageExtPtr ext;
+    DamagePtr damage[MAXSCREENS];
+} PanoramiXDamageRes;
+
+static RESTYPE XRT_DAMAGE;
+static int (*PanoramiXSaveDamageCreate) (ClientPtr);
+
+#endif
+
 static unsigned char DamageReqCode;
 static int DamageEventBase;
 static RESTYPE DamageExtType;
@@ -37,13 +53,49 @@ static DevPrivateKeyRec DamageClientPrivateKeyRec;
 #define DamageClientPrivateKey (&DamageClientPrivateKeyRec)
 
 static void
+DamageNoteCritical(ClientPtr pClient)
+{
+    DamageClientPtr pDamageClient = GetDamageClient(pClient);
+
+    /* Composite extension marks clients with manual Subwindows as critical */
+    if (pDamageClient->critical > 0) {
+        SetCriticalOutputPending();
+        pClient->smart_priority = SMART_MAX_PRIORITY;
+    }
+}
+
+static void
+damageGetGeometry(DrawablePtr draw, int *x, int *y, int *w, int *h)
+{
+#ifdef PANORAMIX
+    if (!noPanoramiXExtension && draw->type == DRAWABLE_WINDOW) {
+        WindowPtr win = (WindowPtr)draw;
+
+        if (!win->parent) {
+            *x = screenInfo.x;
+            *y = screenInfo.y;
+            *w = screenInfo.width;
+            *h = screenInfo.height;
+            return;
+        }
+    }
+#endif
+
+    *x = draw->x;
+    *y = draw->y;
+    *w = draw->width;
+    *h = draw->height;
+}
+
+static void
 DamageExtNotify(DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes)
 {
     ClientPtr pClient = pDamageExt->pClient;
-    DamageClientPtr pDamageClient = GetDamageClient(pClient);
     DrawablePtr pDrawable = pDamageExt->pDrawable;
     xDamageNotifyEvent ev;
-    int i;
+    int i, x, y, w, h;
+
+    damageGetGeometry(pDrawable, &x, &y, &w, &h);
 
     UpdateCurrentTimeIf();
     ev = (xDamageNotifyEvent) {
@@ -52,10 +104,10 @@ DamageExtNotify(DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes)
         .drawable = pDamageExt->drawable,
         .damage = pDamageExt->id,
         .timestamp = currentTime.milliseconds,
-        .geometry.x = pDrawable->x,
-        .geometry.y = pDrawable->y,
-        .geometry.width = pDrawable->width,
-        .geometry.height = pDrawable->height
+        .geometry.x = x,
+        .geometry.y = y,
+        .geometry.width = w,
+        .geometry.height = h
     };
     if (pBoxes) {
         for (i = 0; i < nBoxes; i++) {
@@ -72,15 +124,12 @@ DamageExtNotify(DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes)
     else {
         ev.area.x = 0;
         ev.area.y = 0;
-        ev.area.width = pDrawable->width;
-        ev.area.height = pDrawable->height;
+        ev.area.width = w;
+        ev.area.height = h;
         WriteEventsToClient(pClient, 1, (xEvent *) &ev);
     }
-    /* Composite extension marks clients with manual Subwindows as critical */
-    if (pDamageClient->critical > 0) {
-        SetCriticalOutputPending();
-        pClient->smart_priority = SMART_MAX_PRIORITY;
-    }
+
+    DamageNoteCritical(pClient);
 }
 
 static void
@@ -162,23 +211,62 @@ ProcDamageQueryVersion(ClientPtr client)
     return Success;
 }
 
-static int
-ProcDamageCreate(ClientPtr client)
+static void
+DamageExtRegister(DrawablePtr pDrawable, DamagePtr pDamage, Bool report)
+{
+    DamageSetReportAfterOp(pDamage, TRUE);
+    DamageRegister(pDrawable, pDamage);
+
+    if (report) {
+        RegionPtr pRegion = &((WindowPtr) pDrawable)->borderClip;
+        RegionTranslate(pRegion, -pDrawable->x, -pDrawable->y);
+        DamageReportDamage(pDamage, pRegion);
+        RegionTranslate(pRegion, pDrawable->x, pDrawable->y);
+    }
+}
+
+static DamageExtPtr
+DamageExtCreate(DrawablePtr pDrawable, DamageReportLevel level,
+                ClientPtr client, XID id, XID drawable)
+{
+    DamageExtPtr pDamageExt = malloc(sizeof(DamageExtRec));
+    if (!pDamageExt)
+        return NULL;
+
+    pDamageExt->id = id;
+    pDamageExt->drawable = drawable;
+    pDamageExt->pDrawable = pDrawable;
+    pDamageExt->level = level;
+    pDamageExt->pClient = client;
+    pDamageExt->pDamage = DamageCreate(DamageExtReport, DamageExtDestroy, level,
+                                       FALSE, pDrawable->pScreen, pDamageExt);
+    if (!pDamageExt->pDamage) {
+        free(pDamageExt);
+        return NULL;
+    }
+
+    if (!AddResource(id, DamageExtType, (pointer) pDamageExt))
+        return NULL;
+
+    DamageExtRegister(pDrawable, pDamageExt->pDamage,
+                      pDrawable->type == DRAWABLE_WINDOW);
+
+    return pDamageExt;
+}
+
+static DamageExtPtr
+doDamageCreate(ClientPtr client, int *rc)
 {
     DrawablePtr pDrawable;
     DamageExtPtr pDamageExt;
     DamageReportLevel level;
-    RegionPtr pRegion;
-    int rc;
 
     REQUEST(xDamageCreateReq);
 
-    REQUEST_SIZE_MATCH(xDamageCreateReq);
-    LEGAL_NEW_RESOURCE(stuff->damage, client);
-    rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
-                           DixGetAttrAccess | DixReadAccess);
-    if (rc != Success)
-        return rc;
+    *rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
+                            DixGetAttrAccess | DixReadAccess);
+    if (*rc != Success)
+        return NULL;
 
     switch (stuff->level) {
     case XDamageReportRawRectangles:
@@ -195,39 +283,27 @@ ProcDamageCreate(ClientPtr client)
         break;
     default:
         client->errorValue = stuff->level;
-        return BadValue;
+        *rc = BadValue;
+        return NULL;
     }
 
-    pDamageExt = malloc(sizeof(DamageExtRec));
+    pDamageExt = DamageExtCreate(pDrawable, level, client, stuff->damage,
+                                 stuff->drawable);
     if (!pDamageExt)
-        return BadAlloc;
-    pDamageExt->id = stuff->damage;
-    pDamageExt->drawable = stuff->drawable;
-    pDamageExt->pDrawable = pDrawable;
-    pDamageExt->level = level;
-    pDamageExt->pClient = client;
-    pDamageExt->pDamage = DamageCreate(DamageExtReport,
-                                       DamageExtDestroy,
-                                       level,
-                                       FALSE, pDrawable->pScreen, pDamageExt);
-    if (!pDamageExt->pDamage) {
-        free(pDamageExt);
-        return BadAlloc;
-    }
-    if (!AddResource(stuff->damage, DamageExtType, (pointer) pDamageExt))
-        return BadAlloc;
-
-    DamageSetReportAfterOp(pDamageExt->pDamage, TRUE);
-    DamageRegister(pDamageExt->pDrawable, pDamageExt->pDamage);
+        *rc = BadAlloc;
 
-    if (pDrawable->type == DRAWABLE_WINDOW) {
-        pRegion = &((WindowPtr) pDrawable)->borderClip;
-        RegionTranslate(pRegion, -pDrawable->x, -pDrawable->y);
-        DamageReportDamage(pDamageExt->pDamage, pRegion);
-        RegionTranslate(pRegion, pDrawable->x, pDrawable->y);
-    }
+    return pDamageExt;
+}
 
-    return Success;
+static int
+ProcDamageCreate(ClientPtr client)
+{
+    int rc;
+    REQUEST(xDamageCreateReq);
+    REQUEST_SIZE_MATCH(xDamageCreateReq);
+    LEGAL_NEW_RESOURCE(stuff->damage, client);
+    doDamageCreate(client, &rc);
+    return rc;
 }
 
 static int
@@ -242,6 +318,88 @@ ProcDamageDestroy(ClientPtr client)
     return Success;
 }
 
+#ifdef PANORAMIX
+static RegionPtr
+DamageExtSubtractWindowClip(DamageExtPtr pDamageExt)
+{
+    WindowPtr win = (WindowPtr)pDamageExt->pDrawable;
+    PanoramiXRes *res = NULL;
+    RegionPtr ret;
+    int i;
+
+    if (!win->parent)
+        return &PanoramiXScreenRegion;
+
+    dixLookupResourceByType((void **)&res, win->drawable.id, XRT_WINDOW,
+                            serverClient, DixReadAccess);
+    if (!res)
+        return NULL;
+
+    ret = RegionCreate(NULL, 0);
+    if (!ret)
+        return NULL;
+
+    FOR_NSCREENS_FORWARD(i) {
+        ScreenPtr screen;
+        if (Success != dixLookupWindow(&win, res->info[i].id, serverClient,
+                                       DixReadAccess))
+            goto out;
+
+        screen = win->drawable.pScreen;
+
+        RegionTranslate(ret, -screen->x, -screen->y);
+        if (!RegionUnion(ret, ret, &win->borderClip))
+            goto out;
+        RegionTranslate(ret, screen->x, screen->y);
+    }
+
+    return ret;
+
+out:
+    RegionDestroy(ret);
+    return NULL;
+}
+
+static void
+DamageExtFreeWindowClip(RegionPtr reg)
+{
+    if (reg != &PanoramiXScreenRegion)
+        RegionDestroy(reg);
+}
+#endif
+
+/*
+ * DamageSubtract intersects with borderClip, so we must reconstruct the
+ * protocol's perspective of same...
+ */
+static Bool
+DamageExtSubtract(DamageExtPtr pDamageExt, const RegionPtr pRegion)
+{
+    DamagePtr pDamage = pDamageExt->pDamage;
+
+#ifdef PANORAMIX
+    if (!noPanoramiXExtension) {
+        RegionPtr damage = DamageRegion(pDamage);
+        RegionSubtract(damage, damage, pRegion);
+
+        if (pDamageExt->pDrawable->type == DRAWABLE_WINDOW) {
+            DrawablePtr pDraw = pDamageExt->pDrawable;
+            RegionPtr clip = DamageExtSubtractWindowClip(pDamageExt);
+            if (clip) {
+                RegionTranslate(clip, -pDraw->x, -pDraw->y);
+                RegionIntersect(damage, damage, clip);
+                RegionTranslate(clip, pDraw->x, pDraw->y);
+                DamageExtFreeWindowClip(clip);
+            }
+        }
+
+        return RegionNotEmpty(damage);
+    }
+#endif
+
+    return DamageSubtract(pDamage, pRegion);
+}
+
 static int
 ProcDamageSubtract(ClientPtr client)
 {
@@ -261,7 +419,7 @@ ProcDamageSubtract(ClientPtr client)
         if (pRepair) {
             if (pParts)
                 RegionIntersect(pParts, DamageRegion(pDamage), pRepair);
-            if (DamageSubtract(pDamage, pRepair))
+            if (DamageExtSubtract(pDamageExt, pRepair))
                 DamageExtReport(pDamage, DamageRegion(pDamage),
                                 (void *) pDamageExt);
         }
@@ -271,6 +429,7 @@ ProcDamageSubtract(ClientPtr client)
             DamageEmpty(pDamage);
         }
     }
+
     return Success;
 }
 
@@ -460,6 +619,125 @@ SDamageNotifyEvent(xDamageNotifyEvent * from, xDamageNotifyEvent * to)
     cpswaps(from->geometry.height, to->geometry.height);
 }
 
+#ifdef PANORAMIX
+
+static void
+PanoramiXDamageReport(DamagePtr pDamage, RegionPtr pRegion, void *closure)
+{
+    PanoramiXDamageRes *res = closure;
+    DamageExtPtr pDamageExt = res->ext;
+    WindowPtr pWin = (WindowPtr)pDamage->pDrawable;
+    ScreenPtr pScreen = pDamage->pScreen;
+
+    /* happens on unmap? sigh xinerama */
+    if (RegionNil(pRegion))
+        return;
+
+    /* translate root windows if necessary */
+    if (!pWin->parent)
+        RegionTranslate(pRegion, pScreen->x, pScreen->y);
+
+    /* add our damage to the protocol view */
+    DamageReportDamage(pDamageExt->pDamage, pRegion);
+
+    /* empty our view */
+    DamageEmpty(pDamage);
+}
+
+static void
+PanoramiXDamageExtDestroy(DamagePtr pDamage, void *closure)
+{
+    PanoramiXDamageRes *damage = closure;
+    damage->damage[pDamage->pScreen->myNum] = NULL;
+}
+
+static int
+PanoramiXDamageCreate(ClientPtr client)
+{
+    PanoramiXDamageRes *damage;
+    PanoramiXRes *draw;
+    int i, rc;
+
+    REQUEST(xDamageCreateReq);
+
+    REQUEST_SIZE_MATCH(xDamageCreateReq);
+    LEGAL_NEW_RESOURCE(stuff->damage, client);
+    rc = dixLookupResourceByClass((void **)&draw, stuff->drawable, XRC_DRAWABLE,
+                                  client, DixGetAttrAccess | DixReadAccess);
+    if (rc != Success)
+        return rc;
+
+    if (!(damage = calloc(1, sizeof(PanoramiXDamageRes))))
+        return BadAlloc;
+
+    if (!AddResource(stuff->damage, XRT_DAMAGE, damage))
+        return BadAlloc;
+
+    damage->ext = doDamageCreate(client, &rc);
+    if (rc == Success && draw->type == XRT_WINDOW) {
+        FOR_NSCREENS_FORWARD(i) {
+            DrawablePtr pDrawable;
+            DamagePtr pDamage = DamageCreate(PanoramiXDamageReport,
+                                             PanoramiXDamageExtDestroy,
+                                             DamageReportRawRegion,
+                                             FALSE,
+                                             screenInfo.screens[i],
+                                             damage);
+            if (!pDamage) {
+                rc = BadAlloc;
+            } else {
+                damage->damage[i] = pDamage;
+                rc = dixLookupDrawable(&pDrawable, draw->info[i].id, client,
+                                       M_WINDOW,
+                                       DixGetAttrAccess | DixReadAccess);
+            }
+            if (rc != Success)
+                break;
+
+            DamageExtRegister(pDrawable, pDamage, i != 0);
+        }
+    }
+
+    if (rc != Success)
+        FreeResource(stuff->damage, RT_NONE);
+
+    return rc;
+}
+
+static int
+PanoramiXDamageDelete(void *res, XID id)
+{
+    int i;
+    PanoramiXDamageRes *damage = res;
+
+    FOR_NSCREENS_BACKWARD(i) {
+        if (damage->damage[i]) {
+            DamageDestroy(damage->damage[i]);
+            damage->damage[i] = NULL;
+        }
+    }
+
+    free(damage);
+    return 1;
+}
+
+void
+PanoramiXDamageInit(void)
+{
+    XRT_DAMAGE = CreateNewResourceType(PanoramiXDamageDelete, "XineramaDamage");
+
+    PanoramiXSaveDamageCreate = ProcDamageVector[X_DamageCreate];
+    ProcDamageVector[X_DamageCreate] = PanoramiXDamageCreate;
+}
+
+void
+PanoramiXDamageReset(void)
+{
+    ProcDamageVector[X_DamageCreate] = PanoramiXSaveDamageCreate;
+}
+
+#endif /* PANORAMIX */
+
 void
 DamageExtensionInit(void)
 {
@@ -490,5 +768,10 @@ DamageExtensionInit(void)
             (EventSwapPtr) SDamageNotifyEvent;
         SetResourceTypeErrorValue(DamageExtType,
                                   extEntry->errorBase + BadDamage);
+#ifdef PANORAMIX
+        if (XRT_DAMAGE)
+            SetResourceTypeErrorValue(XRT_DAMAGE,
+                                      extEntry->errorBase + BadDamage);
+#endif
     }
 }
diff --git a/damageext/damageextint.h b/damageext/damageextint.h
index 2723379..e501495 100644
--- a/damageext/damageextint.h
+++ b/damageext/damageextint.h
@@ -67,4 +67,7 @@ typedef struct _DamageExt {
 void
  DamageExtSetCritical(ClientPtr pClient, Bool critical);
 
+void PanoramiXDamageInit(void);
+void PanoramiXDamageReset(void);
+
 #endif                          /* _DAMAGEEXTINT_H_ */
commit 808303fe5232ba0320ae5a4310b1ed1322e85f1d
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Nov 4 17:49:34 2013 -0500

    fixes: Fix PanoramiXSetWindowShapeRegion for root windows (v2)
    
    Root windows in Xinerama are in the coordinate space of their root window
    pixmap, not in protocol space.
    
    v2: Only translate for root windows, sice the window shape is
    drawable-relative.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/xfixes/region.c b/xfixes/region.c
index f2ae851..14a02ba 100644
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -857,6 +857,7 @@ PanoramiXFixesSetWindowShapeRegion(ClientPtr client)
 {
     int result = Success, j;
     PanoramiXRes *win;
+    RegionPtr reg = NULL;
 
     REQUEST(xXFixesSetWindowShapeRegionReq);
 
@@ -869,10 +870,22 @@ PanoramiXFixesSetWindowShapeRegion(ClientPtr client)
         return result;
     }
 
+    if (win->u.win.root)
+        VERIFY_REGION_OR_NONE(reg, stuff->region, client, DixReadAccess);
+
     FOR_NSCREENS_FORWARD(j) {
+        ScreenPtr screen = screenInfo.screens[j];
         stuff->dest = win->info[j].id;
+
+        if (reg)
+            RegionTranslate(reg, -screen->x, -screen->y);
+
         result =
             (*PanoramiXSaveXFixesVector[X_XFixesSetWindowShapeRegion]) (client);
+
+        if (reg)
+            RegionTranslate(reg, screen->x, screen->y);
+
         if (result != Success)
             break;
     }
commit 5c10c7ea2129b70015e745523918d143cc29318d
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Nov 4 17:49:33 2013 -0500

    fixes: Fix PanoramiXSetPictureClipRegion for root windows (v2)
    
    Root windows in Xinerama are in the coordinate space of their root
    window pixmap, not in protocol space.  This fixes 'xcompmgr -n' when
    Xinerama is active.
    
    v2: Only translate for root windows, since the clip origin is
    drawable-relative.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/xfixes/region.c b/xfixes/region.c
index 0e9ca44..f2ae851 100644
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -886,6 +886,7 @@ PanoramiXFixesSetPictureClipRegion(ClientPtr client)
     REQUEST(xXFixesSetPictureClipRegionReq);
     int result = Success, j;
     PanoramiXRes *pict;
+    RegionPtr reg = NULL;
 
     REQUEST_SIZE_MATCH(xXFixesSetPictureClipRegionReq);
 
@@ -896,10 +897,22 @@ PanoramiXFixesSetPictureClipRegion(ClientPtr client)
         return result;
     }
 
+    if (pict->u.pict.root)
+        VERIFY_REGION_OR_NONE(reg, stuff->region, client, DixReadAccess);
+
     FOR_NSCREENS_BACKWARD(j) {
+        ScreenPtr screen = screenInfo.screens[j];
         stuff->picture = pict->info[j].id;
+
+        if (reg)
+            RegionTranslate(reg, -screen->x, -screen->y);
+
         result =
             (*PanoramiXSaveXFixesVector[X_XFixesSetPictureClipRegion]) (client);
+
+        if (reg)
+            RegionTranslate(reg, screen->x, screen->y);
+
         if (result != Success)
             break;
     }
commit 1dd839a425adc6e5a1dc377003ed86a374d81f0b
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Nov 7 13:59:30 2013 -0500

    composite: Fix COW creation for Xinerama (v2)
    
    Say you have two 800x600 screens left/right of each other.  A window
    that's 200x200 at +700+0 in protocol coordinate space will appear to be
    at -100+0 in the coordinate space of the right hand screen.  Put another
    way: windows are in the coordinate space of their root window pixmap.
    
    We weren't doing this translation for the COW, so when rendering came in
    to it you'd see the top-left chunk of the COW on all screens.  Cool
    effect and all, but wrong.
    
    v2: Only translate when Xinerama is active [keithp]
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/composite/compoverlay.c b/composite/compoverlay.c
index d3cfaf0..bf5434c 100644
--- a/composite/compoverlay.c
+++ b/composite/compoverlay.c
@@ -133,16 +133,19 @@ compCreateOverlayWindow(ScreenPtr pScreen)
     int result;
     int w = pScreen->width;
     int h = pScreen->height;
+    int x = 0, y = 0;
 
 #ifdef PANORAMIX
     if (!noPanoramiXExtension) {
+        x = -pScreen->x;
+        y = -pScreen->y;
         w = PanoramiXPixWidth;
         h = PanoramiXPixHeight;
     }
 #endif
 
     pWin = cs->pOverlayWin =
-        CreateWindow(cs->overlayWid, pRoot, 0, 0, w, h, 0,
+        CreateWindow(cs->overlayWid, pRoot, x, y, w, h, 0,
                      InputOutput, CWBackPixmap | CWOverrideRedirect, &attrs[0],
                      pRoot->drawable.depth,
                      serverClient, pScreen->rootVisual, &result);
commit 8dbe456abae1a32fb6c5c74fa456bc7301cccabe
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Oct 29 10:44:07 2013 -0400

    xinerama: Export the screen region
    
    damageext wants this so it can intersect subtract requests against the
    root window geometry.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index 2b3a570..15c38a9 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -73,7 +73,7 @@ int PanoramiXPixWidth = 0;
 int PanoramiXPixHeight = 0;
 int PanoramiXNumScreens = 0;
 
-static RegionRec PanoramiXScreenRegion = { {0, 0, 0, 0}, NULL };
+_X_EXPORT RegionRec PanoramiXScreenRegion = { {0, 0, 0, 0}, NULL };
 
 static int PanoramiXNumDepths;
 static DepthPtr PanoramiXDepths;
diff --git a/Xext/panoramiXsrv.h b/Xext/panoramiXsrv.h
index 7c605fe..0fcde4f 100644
--- a/Xext/panoramiXsrv.h
+++ b/Xext/panoramiXsrv.h
@@ -11,6 +11,7 @@
 extern _X_EXPORT int PanoramiXNumScreens;
 extern _X_EXPORT int PanoramiXPixWidth;
 extern _X_EXPORT int PanoramiXPixHeight;
+extern _X_EXPORT RegionRec PanoramiXScreenRegion;
 
 extern _X_EXPORT VisualID PanoramiXTranslateVisualID(int screen, VisualID orig);
 extern _X_EXPORT void PanoramiXConsolidate(void);
commit c6d4c2a24140feee4ceae48c4c74fedcae9b68b3
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Nov 15 15:13:31 2013 -0500

    xfree86: Prefer fbdev to vesa
    
    On UEFI machines you'd prefer fbdev to grab efifb instead of vesa trying
    to initialize and failing in a way we can't unwind from.  On BIOS
    machines this is harmless: either there is an fbdev driver and it'll
    probably be more capable, or there's not and vesa will kick in anyway.
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    Reviewed-by: Eric Anholt <eric at anholt.net>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
index 95d58fe..af2b7f8 100644
--- a/hw/xfree86/common/xf86AutoConfig.c
+++ b/hw/xfree86/common/xf86AutoConfig.c
@@ -267,14 +267,6 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
     if (i < (nmatches - 1))
         i = xf86PciMatchDriver(matches, nmatches);
 #endif
-    /* Fallback to platform default hardware */
-    if (i < (nmatches - 1)) {
-#if defined(__i386__) || defined(__amd64__) || defined(__hurd__)
-        matches[i++] = xnfstrdup("vesa");
-#elif defined(__sparc__) && !defined(sun)
-        matches[i++] = xnfstrdup("sunffb");
-#endif
-    }
 
 #if defined(__linux__)
     matches[i++] = xnfstrdup("modesetting");
@@ -290,6 +282,15 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
 #endif
     }
 #endif                          /* !sun */
+
+    /* Fallback to platform default hardware */
+    if (i < (nmatches - 1)) {
+#if defined(__i386__) || defined(__amd64__) || defined(__hurd__)
+        matches[i++] = xnfstrdup("vesa");
+#elif defined(__sparc__) && !defined(sun)
+        matches[i++] = xnfstrdup("sunffb");
+#endif
+    }
 }
 
 /* copy a screen section and enter the desired driver
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 74d5ed3..b5efc02 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -507,7 +507,7 @@ xf86InputDriverlistFromConfig(void)
 static void
 fixup_video_driver_list(char **drivers)
 {
-    static const char *fallback[4] = { "vesa", "fbdev", "wsfb", NULL };
+    static const char *fallback[4] = { "fbdev", "vesa", "wsfb", NULL };
     char **end, **drv;
     char *x;
     int i;
commit 7b5d4f147fdef9edfeaa9c6565375111079efd11
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Nov 5 10:12:28 2013 -0500

    composite: Don't double-redirect if someone asks for backing store twice
    
    v2: Belt-and-suspenders the unredirection path [vsyrjala]
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/composite/compinit.c b/composite/compinit.c
index 6431464..3c91091 100644
--- a/composite/compinit.c
+++ b/composite/compinit.c
@@ -117,11 +117,11 @@ compChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
 
     if (ret && (mask & CWBackingStore) &&
         pScreen->backingStoreSupport != NotUseful) {
-        if (pWin->backingStore != NotUseful) {
+        if (pWin->backingStore != NotUseful && !pWin->backStorage) {
             compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic);
             pWin->backStorage = (pointer) (intptr_t) 1;
         }
-        else {
+        else if (pWin->backingStore == NotUseful && pWin->backStorage) {
             compUnredirectWindow(serverClient, pWin,
                                  CompositeRedirectAutomatic);
             pWin->backStorage = NULL;
commit a2b2c271e0ca87d3188ba2741b6db9bbbdc599f5
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Nov 5 10:08:17 2013 -0500

    composite: Automatically enable backing store support on the screen
    
    ... unless you explicitly disabled it with -bs on the command line, or
    with the corresponding thing in xorg.conf.
    
    v2: Drop a bogus hunk from compChangeWindowAttributes [vsyrjala]
    v3: s/TRUE/WhenMapped/ [jcristau]
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/composite/compinit.c b/composite/compinit.c
index bc1130e..6431464 100644
--- a/composite/compinit.c
+++ b/composite/compinit.c
@@ -355,6 +355,9 @@ compScreenInit(ScreenPtr pScreen)
         return FALSE;
     }
 
+    if (!disableBackingStore)
+        pScreen->backingStoreSupport = WhenMapped;
+
     cs->PositionWindow = pScreen->PositionWindow;
     pScreen->PositionWindow = compPositionWindow;
 
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index 4f1f3d4..f1e6783 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -1638,6 +1638,11 @@ xf86SetBackingStore(ScreenPtr pScreen)
     else {
         if (xf86GetOptValBool(options, OPTION_BACKING_STORE, &useBS))
             from = X_CONFIG;
+#ifdef COMPOSITE
+        if (from != X_CONFIG)
+            useBS = xf86ReturnOptValBool(options, OPTION_BACKING_STORE,
+                                         !noCompositeExtension);
+#endif
     }
     free(options);
     pScreen->backingStoreSupport = useBS ? WhenMapped : NotUseful;
commit e0cac005608a2e5618c7be59701318d684e0bb93
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Nov 5 09:58:17 2013 -0500

    bs: Set the screen's bs support level to WhenMapped
    
    Since we're using RedirectAutomatic to do this, we don't actually
    preserve contents when unmapped.
    
    v2: Don't say WhenMapped if Composite didn't initialize [vsyrjala]
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/dix/window.c b/dix/window.c
index 92df1eb..0e9109e 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -530,7 +530,11 @@ CreateRootWindow(ScreenPtr pScreen)
     if (disableBackingStore)
         pScreen->backingStoreSupport = NotUseful;
     if (enableBackingStore)
-        pScreen->backingStoreSupport = Always;
+        pScreen->backingStoreSupport = WhenMapped;
+#ifdef COMPOSITE
+    if (noCompositeExtension)
+        pScreen->backingStoreSupport = NotUseful;
+#endif
 
     pScreen->saveUnderSupport = NotUseful;
 
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index 721159d..4f1f3d4 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -1640,7 +1640,7 @@ xf86SetBackingStore(ScreenPtr pScreen)
             from = X_CONFIG;
     }
     free(options);
-    pScreen->backingStoreSupport = useBS ? Always : NotUseful;
+    pScreen->backingStoreSupport = useBS ? WhenMapped : NotUseful;
     if (serverGeneration == 1)
         xf86DrvMsg(pScreen->myNum, from, "Backing store %s\n",
                    useBS ? "enabled" : "disabled");
commit b61ccd5d9d368f3fbbae27ce14ac02a3db1884c4
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Nov 5 10:20:04 2013 -0500

    smartsched: Tweak the default scheduler intervals
    
    A default timeslice of 20ms means a pathological client can ruin up to
    two frames per scheduler tick.  And a fifth of a second is just insane.
    
    Pick two different numbers out of the hat.  A 5ms slice means you can
    probably keep up with two or three abusive clients, and letting it burst
    to 15ms should give you about all the timeslice you need for a
    fullscreen game (that's doing server-side rendering for some reason).
    
    If you're running on a system with a 10ms granularity on SIGALRM, then
    this effectively changes the intervals to 10ms and 30ms.  Which is still
    better, just not as better.
    
    I suspect this is about as good as we can do without actually going
    preemptive, which is an entire other nightmare.
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/dix/dispatch.c b/dix/dispatch.c
index 4fecfea..8dcd9cb 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -220,8 +220,9 @@ UpdateCurrentTimeIf(void)
 
 #undef SMART_DEBUG
 
-#define SMART_SCHEDULE_DEFAULT_INTERVAL	20      /* ms */
-#define SMART_SCHEDULE_MAX_SLICE	200     /* ms */
+/* in milliseconds */
+#define SMART_SCHEDULE_DEFAULT_INTERVAL	5
+#define SMART_SCHEDULE_MAX_SLICE	15
 
 #if defined(WIN32) && !defined(__CYGWIN__)
 Bool SmartScheduleDisable = TRUE;
commit 66310ea2893811614b3c3aade8992624a95a6ee7
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Nov 8 09:22:37 2013 -0500

    dri3: Disable when Xinerama is active
    
    Pretty sure this can't work.
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/dri3/dri3.c b/dri3/dri3.c
index 2bca7ae..76e07b4 100644
--- a/dri3/dri3.c
+++ b/dri3/dri3.c
@@ -68,6 +68,11 @@ dri3_extension_init(void)
     ExtensionEntry *extension;
     int i;
 
+#ifdef PANORAMIX
+    if (!noPanoramiXExtension)
+        return;
+#endif
+
     extension = AddExtension(DRI3_NAME, DRI3NumberEvents, DRI3NumberErrors,
                              proc_dri3_dispatch, sproc_dri3_dispatch,
                              NULL, StandardMinorOpcode);
commit 793fd5eefb0e417614d77fe1522c6548587fbd4e
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Nov 8 09:20:29 2013 -0500

    dri2: Disable when Xinerama is active
    
    Would only work on ScreenRec 0, which means it's broken.
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index e1decec..ffd66fa 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -672,6 +672,11 @@ DRI2ExtensionInit(void)
 {
     ExtensionEntry *dri2Extension;
 
+#ifdef PANORAMIX
+    if (!noPanoramiXExtension)
+        return;
+#endif
+
     dri2Extension = AddExtension(DRI2_NAME,
                                  DRI2NumberEvents,
                                  DRI2NumberErrors,
commit 2bf92108294805c5c6fef249c2f7de6ecf4975d8
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Nov 8 09:06:59 2013 -0500

    present: Disable when Xinerama is active
    
    Among much else Present depends on RANDR types, and RANDR isn't properly
    Xinerama-aware yet anyway.
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/present/present_screen.c b/present/present_screen.c
index 2702cd6..25ef681 100644
--- a/present/present_screen.c
+++ b/present/present_screen.c
@@ -206,6 +206,11 @@ present_extension_init(void)
     ExtensionEntry *extension;
     int i;
 
+#ifdef PANORAMIX
+    if (!noPanoramiXExtension)
+        return;
+#endif
+
     extension = AddExtension(PRESENT_NAME, PresentNumberEvents, PresentNumberErrors,
                              proc_present_dispatch, sproc_present_dispatch,
                              NULL, StandardMinorOpcode);


More information about the xorg-commit mailing list