NEWS                       |   30 ++
 configure.ac               |    2 
 man/intel.man              |    5 
 src/intel.h                |   14 -
 src/intel_display.c        |   64 ++++
 src/intel_dri.c            |    7 
 src/intel_driver.c         |   97 ++++++-
 src/intel_glamor.c         |    2 
 src/intel_module.c         |   62 ++++
 src/intel_uxa.c            |   86 ++++++
 src/intel_video.c          |    5 
 src/sna/fb/fb.h            |   18 -
 src/sna/fb/fbblt.c         |   15 -
 src/sna/fb/fbpoint.c       |   60 ++--
 src/sna/fb/fbpointbits.h   |   58 +++-
 src/sna/gen6_render.c      |   68 +++-
 src/sna/gen7_render.c      |   78 +++--
 src/sna/kgem.c             |  162 ++++++++++-
 src/sna/kgem.h             |   10 
 src/sna/sna.h              |   21 +
 src/sna/sna_accel.c        |  614 ++++++++++++++++++++++++++++++++++++++-------
 src/sna/sna_composite.c    |   19 -
 src/sna/sna_damage.c       |   20 +
 src/sna/sna_display.c      |  218 ++++++++++++---
 src/sna/sna_dri.c          |   27 +
 src/sna/sna_driver.c       |   80 +++--
 src/sna/sna_glyphs.c       |    6 
 src/sna/sna_tiling.c       |    1 
 src/sna/sna_video.c        |    5 
 src/sna/sna_video_sprite.c |   13 
 30 files changed, 1501 insertions(+), 366 deletions(-)

New commits:
commit 0659711dfa9c9fc52adeaba766049887d5b6f040
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Sat Sep 8 20:01:32 2012 +0100

    2.20.7 release
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/NEWS b/NEWS
index 1291b51..82cf4a4 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,29 @@
+Release 2.20.7 (2012-09-08)
+===========================
+Continuing the flurry of releases, this week saw the release of
+xorg-1.13 bringing with it the first steps towards hotpluggable gpu
+support and the ability to offload DRI rendering onto other GPUs. In
+light of that advance, this release includes the support code by Dave
+Airlie to integrate PRIME into xf86-video-intel and make those new
+features available.
+
+Aside from landing PRIME, a few other bugs were fixed since 2.20.5:
+
+ * Fix framebuffer leak on server regeneration
+
+ * Fix texture cache flushing on IvyBridge and Kwin with plastique
+   https://bugs.freedesktop.org/show_bug.cgi?id=54488
+
+ * Redirect large solid fills on SandyBridge+. By large I mean greater
+   than 8192 or 16384 pixels on SandyBridge and IvyBridge respectively.
+   https://bugs.freedesktop.org/show_bug.cgi?id=54134
+
+ * Fix up backlight option handling in the manpage and uxa.
+   https://bugs.freedesktop.org/show_bug.cgi?id=54397
+
+ * Unbreak ZaphodHeads.
+   https://bugs.freedesktop.org/show_bug.cgi?id=52438
+
 Release 2.20.6 (2012-09-02)
 ===========================
 A serious bug that caused a crash on SandyBridge and IvyBridge when
diff --git a/configure.ac b/configure.ac
index c401a61..f94f140 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-video-intel],
-        [2.20.6],
+        [2.20.7],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-video-intel])
 AC_CONFIG_SRCDIR([Makefile.am])

commit 2c8e48f8149499040342836491333402fd05b762
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Fri Sep 7 23:00:47 2012 +0100

    sna: Remember that LineDoubleDash involves updating the GC between segments
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 9881050..7574847 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -5088,6 +5088,13 @@ struct sna_fill_spans {
 };
 
 static void
+sna_poly_point__cpu(DrawablePtr drawable, GCPtr gc,
+                   int mode, int n, DDXPointPtr pt)
+{
+       fbPolyPoint(drawable, gc, mode, n, pt, -1);
+}
+
+static void
 sna_poly_point__fill(DrawablePtr drawable, GCPtr gc,
                     int mode, int n, DDXPointPtr pt)
 {
@@ -5123,6 +5130,52 @@ sna_poly_point__fill(DrawablePtr drawable, GCPtr gc,
 }
 
 static void
+sna_poly_point__gpu(DrawablePtr drawable, GCPtr gc,
+                    int mode, int n, DDXPointPtr pt)
+{
+       struct sna_fill_spans *data = sna_gc(gc)->priv;
+       struct sna_fill_op fill;
+       BoxRec box[512];
+       DDXPointRec last;
+
+       if (!sna_fill_init_blt(&fill,
+                              data->sna, data->pixmap,
+                              data->bo, gc->alu, gc->fgPixel))
+               return;
+
+       DBG(("%s: count=%d\n", __FUNCTION__, n));
+
+       last.x = drawable->x;
+       last.y = drawable->y;
+       while (n) {
+               BoxRec *b = box;
+               unsigned nbox = n;
+               if (nbox > ARRAY_SIZE(box))
+                       nbox = ARRAY_SIZE(box);
+               n -= nbox;
+               do {
+                       *(DDXPointRec *)b = *pt++;
+
+                       b->x1 += last.x;
+                       b->y1 += last.y;
+                       if (mode == CoordModePrevious)
+                               last = *(DDXPointRec *)b;
+
+                       if (RegionContainsPoint(&data->region,
+                                               b->x1, b->y1, NULL)) {
+                               b->x1 += data->dx;
+                               b->y1 += data->dy;
+                               b->x2 = b->x1 + 1;
+                               b->y2 = b->y1 + 1;
+                               b++;
+                       }
+               } while (--nbox);
+               fill.boxes(data->sna, &fill, box, b - box);
+       }
+       fill.done(data->sna, &fill);
+}
+
+static void
 sna_poly_point__fill_clip_extents(DrawablePtr drawable, GCPtr gc,
                                  int mode, int n, DDXPointPtr pt)
 {
@@ -9275,45 +9328,64 @@ sna_poly_arc(DrawablePtr drawable, GCPtr gc, int n, 
xArc *arc)
                get_drawable_deltas(drawable, data.pixmap, &data.dx, &data.dy);
 
                if (gc_is_solid(gc, &color)) {
-                       struct sna_fill_op fill;
+                       sna_gc(gc)->priv = &data;
 
-                       if (!sna_fill_init_blt(&fill,
-                                              data.sna, data.pixmap,
-                                              data.bo, gc->alu, color))
-                               goto fallback;
+                       assert(gc->miTranslate);
+                       if (gc->lineStyle == LineSolid) {
+                               struct sna_fill_op fill;
 
-                       data.op = &fill;
-                       sna_gc(gc)->priv = &data;
+                               if (!sna_fill_init_blt(&fill,
+                                                      data.sna, data.pixmap,
+                                                      data.bo, gc->alu, color))
+                                       goto fallback;
 
-                       if ((data.flags & 2) == 0) {
-                               if (data.dx | data.dy)
-                                       sna_gc_ops__tmp.FillSpans = 
sna_fill_spans__fill_offset;
+                               if ((data.flags & 2) == 0) {
+                                       if (data.dx | data.dy)
+                                               sna_gc_ops__tmp.FillSpans = 
sna_fill_spans__fill_offset;
+                                       else
+                                               sna_gc_ops__tmp.FillSpans = 
sna_fill_spans__fill;
+                                       sna_gc_ops__tmp.PolyPoint = 
sna_poly_point__fill;
+                               } else {
+                                       region_maybe_clip(&data.region,
+                                                         gc->pCompositeClip);
+                                       if (!RegionNotEmpty(&data.region))
+                                               return;
+
+                                       if (region_is_singular(&data.region)) {
+                                               sna_gc_ops__tmp.FillSpans = 
sna_fill_spans__fill_clip_extents;
+                                               sna_gc_ops__tmp.PolyPoint = 
sna_poly_point__fill_clip_extents;
+                                       } else {
+                                               sna_gc_ops__tmp.FillSpans = 
sna_fill_spans__fill_clip_boxes;
+                                               sna_gc_ops__tmp.PolyPoint = 
sna_poly_point__fill_clip_boxes;
+                                       }
+                               }
+
+                               data.op = &fill;
+                               gc->ops = &sna_gc_ops__tmp;
+                               if (gc->lineWidth == 0)
+                                       miZeroPolyArc(drawable, gc, n, arc);
                                else
-                                       sna_gc_ops__tmp.FillSpans = 
sna_fill_spans__fill;
-                               sna_gc_ops__tmp.PolyPoint = 
sna_poly_point__fill;
+                                       miPolyArc(drawable, gc, n, arc);
+                               gc->ops = (GCOps *)&sna_gc_ops;
+
+                               fill.done(data.sna, &fill);
                        } else {
                                region_maybe_clip(&data.region,
                                                  gc->pCompositeClip);
                                if (!RegionNotEmpty(&data.region))
                                        return;
 
-                               if (region_is_singular(&data.region)) {
-                                       sna_gc_ops__tmp.FillSpans = 
sna_fill_spans__fill_clip_extents;
-                                       sna_gc_ops__tmp.PolyPoint = 
sna_poly_point__fill_clip_extents;
-                               } else {
-                                       sna_gc_ops__tmp.FillSpans = 
sna_fill_spans__fill_clip_boxes;
-                                       sna_gc_ops__tmp.PolyPoint = 
sna_poly_point__fill_clip_boxes;
-                               }
+                               sna_gc_ops__tmp.FillSpans = sna_fill_spans__gpu;
+                               sna_gc_ops__tmp.PolyPoint = sna_poly_point__gpu;
+
+                               gc->ops = &sna_gc_ops__tmp;
+                               if (gc->lineWidth == 0)
+                                       miZeroPolyArc(drawable, gc, n, arc);
+                               else
+                                       miPolyArc(drawable, gc, n, arc);
+                               gc->ops = (GCOps *)&sna_gc_ops;
                        }
-                       assert(gc->miTranslate);
-                       gc->ops = &sna_gc_ops__tmp;
-                       if (gc->lineWidth == 0)
-                               miZeroPolyArc(drawable, gc, n, arc);
-                       else
-                               miPolyArc(drawable, gc, n, arc);
-                       gc->ops = (GCOps *)&sna_gc_ops;
 
-                       fill.done(data.sna, &fill);
                        if (data.damage) {
                                if (data.dx | data.dy)
                                        pixman_region_translate(&data.region, 
data.dx, data.dy);
@@ -13431,7 +13503,7 @@ static const GCOps sna_gc_ops__cpu = {
        fbPutImage,
        fbCopyArea,
        fbCopyPlane,
-       fbPolyPoint,
+       sna_poly_point__cpu,
        fbPolyLine,
        fbPolySegment,
        miPolyRectangle,

commit ed7b8db24921dc0bb6ea59dacf35ea41a61d59bf
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Fri Sep 7 22:12:17 2012 +0100

    sna: Pass the hints down to the PolyPoint fallback
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/sna/fb/fb.h b/src/sna/fb/fb.h
index 215aec9..adefaa1 100644
--- a/src/sna/fb/fb.h
+++ b/src/sna/fb/fb.h
@@ -515,7 +515,9 @@ extern RegionPtr
 fbBitmapToRegion(PixmapPtr pixmap);
 
 extern void
-fbPolyPoint(DrawablePtr drawable, GCPtr gc, int mode, int n, xPoint *pt);
+fbPolyPoint(DrawablePtr drawable, GCPtr gc,
+           int mode, int n, xPoint *pt,
+           unsigned flags);
 
 extern void
 fbPushImage(DrawablePtr drawable, GCPtr gc,
diff --git a/src/sna/fb/fbpoint.c b/src/sna/fb/fbpoint.c
index e3974fc..3df79a2 100644
--- a/src/sna/fb/fbpoint.c
+++ b/src/sna/fb/fbpoint.c
@@ -25,21 +25,27 @@
 #include <micoord.h>
 
 #define DOTS       fbDots8
+#define DOTS__SIMPLE fbDots8__simple
 #define BITS       BYTE
 #include "fbpointbits.h"
 #undef BITS
+#undef DOTS__SIMPLE
 #undef DOTS
 
 #define DOTS       fbDots16
+#define DOTS__SIMPLE fbDots16__simple
 #define BITS       CARD16
 #include "fbpointbits.h"
 #undef BITS
+#undef DOTS__SIMPLE
 #undef DOTS
 
 #define DOTS       fbDots32
+#define DOTS__SIMPLE fbDots32__simple
 #define BITS       CARD32
 #include "fbpointbits.h"
 #undef BITS
+#undef DOTS__SIMPLE
 #undef DOTS
 
 static void
@@ -74,7 +80,7 @@ fbDots(FbBits *dstOrig, FbStride dstStride, int dstBpp,
 
 void
 fbPolyPoint(DrawablePtr drawable, GCPtr gc,
-           int mode, int n, xPoint *pt)
+           int mode, int n, xPoint *pt, unsigned flags)
 {
        FbBits *dst;
        FbStride dstStride;
@@ -97,16 +103,30 @@ fbPolyPoint(DrawablePtr drawable, GCPtr gc,
 
        fbGetDrawable(drawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
        dots = fbDots;
-       switch (dstBpp) {
-       case 8:
-               dots = fbDots8;
-               break;
-       case 16:
-               dots = fbDots16;
-               break;
-       case 32:
-               dots = fbDots32;
-               break;
+       if ((flags & 2) == 0 && fb_gc(gc)->and == 0) {
+               switch (dstBpp) {
+               case 8:
+                       dots = fbDots8__simple;
+                       break;
+               case 16:
+                       dots = fbDots16__simple;
+                       break;
+               case 32:
+                       dots = fbDots32__simple;
+                       break;
+               }
+       } else {
+               switch (dstBpp) {
+               case 8:
+                       dots = fbDots8;
+                       break;
+               case 16:
+                       dots = fbDots16;
+                       break;
+               case 32:
+                       dots = fbDots32;
+                       break;
+               }
        }
        dots(dst, dstStride, dstBpp, gc->pCompositeClip, pt, n,
             drawable->x, drawable->y, dstXoff, dstYoff,
diff --git a/src/sna/fb/fbpointbits.h b/src/sna/fb/fbpointbits.h
index 2d71c1d..60bf488 100644
--- a/src/sna/fb/fbpointbits.h
+++ b/src/sna/fb/fbpointbits.h
@@ -106,5 +106,43 @@ DOTS(FbBits * dst,
        }
 }
 
+static void
+DOTS__SIMPLE(FbBits * dst,
+            FbStride dstStride,
+            int dstBpp,
+            RegionPtr region,
+            xPoint * ptsOrig,
+            int npt, int xorg, int yorg, int xoff, int yoff,
+            FbBits and, FbBits xor)
+{
+       uint32_t *pts = (uint32_t *) ptsOrig;
+       BITS *bits = (BITS *) dst, *p;
+       BITS bxor = (BITS) xor;
+       FbStride bitsStride = dstStride * (sizeof(FbBits) / sizeof(BITS));
+
+       bits += bitsStride * (yorg + yoff) + (xorg + xoff);
+       while (npt >= 2) {
+               union {
+                       uint32_t pt32[2];
+                       uint64_t pt64;
+               } pt;
+               pt.pt64 = *(uint64_t *)pts;
+
+               p = bits + intToY(pt.pt32[0]) * bitsStride + intToX(pt.pt32[0]);
+               WRITE(p, bxor);
+
+               p = bits + intToY(pt.pt32[1]) * bitsStride + intToX(pt.pt32[1]);
+               WRITE(p, bxor);
+
+               pts += 2;
+               npt -= 2;
+       }
+       if (npt) {
+               uint32_t pt = *pts;
+               p = bits + intToY(pt) * bitsStride + intToX(pt);
+               WRITE(p, bxor);
+       }
+}
+
 #undef RROP
 #undef isClipped
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 792d007..9881050 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -6696,7 +6696,7 @@ fallback:
                goto out_gc;
 
        DBG(("%s: fbPolyPoint\n", __FUNCTION__));
-       fbPolyPoint(drawable, gc, mode, n, pt);
+       fbPolyPoint(drawable, gc, mode, n, pt, flags);
        FALLBACK_FLUSH(drawable);
 out_gc:
        sna_gc_move_to_gpu(gc);

commit 6c9df48fa8f1ac93103ce771ae28f47faa321619
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Fri Sep 7 22:05:19 2012 +0100

    sna: Fix PolyPoint fallback through a complex clip
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/sna/fb/fbpoint.c b/src/sna/fb/fbpoint.c
index d3f796e..e3974fc 100644
--- a/src/sna/fb/fbpoint.c
+++ b/src/sna/fb/fbpoint.c
@@ -26,26 +26,19 @@
 
 #define DOTS       fbDots8
 #define BITS       BYTE
-#define BITS2      CARD16
-#define BITS4      CARD32
 #include "fbpointbits.h"
 #undef BITS
-#undef BITS2
-#undef BITS4
 #undef DOTS
 
 #define DOTS       fbDots16
 #define BITS       CARD16
-#define BITS2      CARD32
 #include "fbpointbits.h"
 #undef BITS
-#undef BITS2
 #undef DOTS
 
 #define DOTS       fbDots32
 #define BITS       CARD32
 #include "fbpointbits.h"
-#undef ARC
 #undef BITS
 #undef DOTS
 
@@ -93,16 +86,16 @@ fbPolyPoint(DrawablePtr drawable, GCPtr gc,
                     int xorg, int yorg,
                     int xoff, int yoff,
                     FbBits and, FbBits xor);
-       FbBits and, xor;
 
-       DBG(("%s x %d\n", __FUNCTION__, n));
+       DBG(("%s x %d, clip=[(%d, %d), (%d, %d)]x%d\n", __FUNCTION__, n,
+            gc->pCompositeClip->extents.x1, gc->pCompositeClip->extents.y1,
+            gc->pCompositeClip->extents.x2, gc->pCompositeClip->extents.y2,
+            RegionNumRects(gc->pCompositeClip)));
 
        if (mode == CoordModePrevious)
                fbFixCoordModePrevious(n, pt);
 
        fbGetDrawable(drawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
-       and = fb_gc(gc)->and;
-       xor = fb_gc(gc)->xor;
        dots = fbDots;
        switch (dstBpp) {
        case 8:
@@ -116,5 +109,6 @@ fbPolyPoint(DrawablePtr drawable, GCPtr gc,
                break;
        }
        dots(dst, dstStride, dstBpp, gc->pCompositeClip, pt, n,
-            drawable->x, drawable->y, dstXoff, dstYoff, and, xor);
+            drawable->x, drawable->y, dstXoff, dstYoff,
+            fb_gc(gc)->and, fb_gc(gc)->xor);
 }
diff --git a/src/sna/fb/fbpointbits.h b/src/sna/fb/fbpointbits.h
index 40a25c6..2d71c1d 100644
--- a/src/sna/fb/fbpointbits.h
+++ b/src/sna/fb/fbpointbits.h
@@ -38,14 +38,13 @@ DOTS(FbBits * dst,
        BITS band = (BITS) and;
        FbStride bitsStride = dstStride * (sizeof(FbBits) / sizeof(BITS));
 
-       bits += bitsStride * (yorg + yoff) + (xorg + xoff);
-
        if (region->data == NULL) {
                INT32 ul = coordToInt(region->extents.x1 - xorg,
                                      region->extents.y1 - yorg);
                INT32 lr = coordToInt(region->extents.x2 - xorg - 1,
                                      region->extents.y2 - yorg - 1);
 
+               bits += bitsStride * (yorg + yoff) + (xorg + xoff);
                if (and == 0) {
                        while (npt >= 2) {
                                union {
@@ -82,23 +81,24 @@ DOTS(FbBits * dst,
                        }
                }
        } else {
+               bits += bitsStride * yoff + xoff;
                if (and == 0) {
                        while (npt--) {
                                uint32_t pt = *pts++;
-                               if (RegionContainsPoint(region,
-                                                       intToX(pt), intToY(pt),
-                                                       NULL)) {
-                                       BITS *point = bits + intToY(pt) * 
bitsStride + intToX(pt);
+                               int x = intToX(pt) + xorg;
+                               int y = intToY(pt) + yorg;
+                               if (RegionContainsPoint(region, x, y, NULL)) {
+                                       BITS *point = bits + y * bitsStride + x;
                                        WRITE(point, bxor);
                                }
                        }
                } else {
                        while (npt--) {
                                uint32_t pt = *pts++;
-                               if (RegionContainsPoint(region,
-                                                       intToX(pt), intToY(pt),
-                                                       NULL)) {
-                                       BITS *point = bits + intToY(pt) * 
bitsStride + intToX(pt);
+                               int x = intToX(pt) + xorg;
+                               int y = intToY(pt) + yorg;
+                               if (RegionContainsPoint(region, x, y, NULL)) {
+                                       BITS *point = bits + y * bitsStride + x;
                                        RROP(point, band, bxor);
                                }
                        }

commit 7d76eb155ed78343abfa15b7c8af87fc3d4211e4
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Fri Sep 7 18:06:25 2012 +0100

    sna: First scan for a backlight associated with the device
    
    The goal is to find the right interface in a multi-GPU system.
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index beafb3b..be5d983 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -318,8 +318,84 @@ has_user_backlight_override(xf86OutputPtr output)
        return str;
 }
 
-static void
-sna_output_backlight_init(xf86OutputPtr output)
+static char *
+has_device_backlight(xf86OutputPtr output, int *best_type)
+{
+       struct sna_output *sna_output = output->driver_private;
+       struct sna *sna = to_sna(output->scrn);
+       struct pci_device *pci = sna->PciInfo;
+       char path[1024];
+       char *best_iface = NULL;
+       DIR *dir;
+       struct dirent *de;
+
+       snprintf(path, sizeof(path),
+                "/sys/bus/pci/devices/%04x:%02x:%02x.%d/backlight",
+                pci->domain, pci->bus, pci->dev, pci->func);
+
+       DBG(("%s: scanning %s\n", __FUNCTION__, path));
+       dir = opendir(path);
+       if (dir == NULL)
+               return NULL;
+
+       while ((de = readdir(dir))) {
+               char buf[100];
+               int fd, v;
+
+               if (*de->d_name == '.')
+                       continue;
+
+               DBG(("%s: %s\n", __FUNCTION__, de->d_name));
+               snprintf(path, sizeof(path), "%s/%s/type",
+                        BACKLIGHT_CLASS, de->d_name);
+
+               v = -1;
+               fd = open(path, O_RDONLY);
+               if (fd >= 0) {
+                       v = read(fd, buf, sizeof(buf)-1);
+                       close(fd);
+               }
+               if (v > 0) {
+                       while (v > 0 && isspace(buf[v-1]))
+                               v--;
+                       buf[v] = '\0';
+
+                       if (strcmp(buf, "raw") == 0)
+                               v = RAW;
+                       else if (strcmp(buf, "platform") == 0)
+                               v = PLATFORM;
+                       else if (strcmp(buf, "firmware") == 0)
+                               v = FIRMWARE;
+                       else
+                               v = INT_MAX;
+               } else
+                       v = INT_MAX;
+
+               if (v < *best_type) {
+                       char *copy;
+                       int max;
+
+                       sna_output->backlight_iface = de->d_name;
+                       max = sna_output_backlight_get_max(output);
+                       sna_output->backlight_iface = NULL;
+                       if (max <= 0)
+                               continue;
+
+                       copy = strdup(de->d_name);
+                       if (copy) {
+                               free(best_iface);
+                               best_iface = copy;
+                               *best_type = v;
+                       }
+               }
+       }
+       closedir(dir);
+
+       return best_iface;
+}
+
+static char *
+has_backlight(xf86OutputPtr output, int *best_type)
 {
        static const char *known_interfaces[] = {
                "gmux_backlight",
@@ -335,21 +411,14 @@ sna_output_backlight_init(xf86OutputPtr output)
                "acpi_video0",
                "intel_backlight",
        };
-       MessageType from = X_PROBED;
        struct sna_output *sna_output = output->driver_private;
-       char *best_iface;
-       int best_type;
+       char *best_iface = NULL;
        DIR *dir;
        struct dirent *de;
 
-       best_type = INT_MAX;
-       best_iface = has_user_backlight_override(output);
-       if (best_iface)
-               goto skip;
-
        dir = opendir(BACKLIGHT_CLASS);
        if (dir == NULL)
-               return;
+               return NULL;
 
        while ((de = readdir(dir))) {
                char path[1024];
@@ -394,7 +463,7 @@ sna_output_backlight_init(xf86OutputPtr output)
                        v += i;
                }
 
-               if (v < best_type) {
+               if (v < *best_type) {
                        char *copy;
                        int max;
 
@@ -410,16 +479,39 @@ sna_output_backlight_init(xf86OutputPtr output)
                        if (copy) {
                                free(best_iface);
                                best_iface = copy;
-                               best_type = v;
+                               *best_type = v;
                        }
                }
        }
        closedir(dir);
 
-       if (!best_iface)
-               return;
+       return best_iface;
+}
+
+static void
+sna_output_backlight_init(xf86OutputPtr output)
+{
+       struct sna_output *sna_output = output->driver_private;
+       MessageType from = X_PROBED;
+       char *best_iface;
+       int best_type;
 
-skip:
+       best_type = INT_MAX;
+       best_iface = has_user_backlight_override(output);
+       if (best_iface)
+               goto done;
+
+       best_iface = has_device_backlight(output, &best_type);
+       if (best_iface)
+               goto done;
+
+       best_iface = has_backlight(output, &best_type);
+       if (best_iface)
+               goto done;
+
+       return;
+
+done:
        sna_output->backlight_iface = best_iface;
        sna_output->backlight_max = sna_output_backlight_get_max(output);
        sna_output->backlight_active_level = sna_output_backlight_get(output);
@@ -435,7 +527,6 @@ skip:
                   sna_output->backlight_iface, best_iface);
 }
 
-
 static void
 mode_from_kmode(ScrnInfoPtr scrn,
                drmModeModeInfoPtr kmode,

commit 2de7d2d8150d648815feb74a3ae2239b908b971e
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Fri Sep 7 16:56:33 2012 +0100

    sna/prime: Fixup attaching the randr14 scanout pixmap
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 6baa37c..792d007 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1020,7 +1020,11 @@ sna_set_shared_pixmap_backing(PixmapPtr pixmap, void 
*fd_handle)
        struct sna_pixmap *priv;
        struct kgem_bo *bo;
 
-       DBG(("%s: pixmap=%ld\n", __FUNCTION__, pixmap->drawable.serialNumber));
+       DBG(("%s: pixmap=%ld, size=%dx%d, depth=%d/%d, stride=%d\n",
+            __FUNCTION__, pixmap->drawable.serialNumber,
+            pixmap->drawable.width, pixmap->drawable.height,
+            pixmap->drawable.depth, pixmap->drawable.bitsPerPixel,
+            pixmap->devKind));
 
        priv = sna_pixmap(pixmap);
        if (priv == NULL)
@@ -13691,6 +13695,9 @@ static struct sna_pixmap *sna_accel_scanout(struct sna 
*sna)
        if (sna->vblank_interval == 0)
                return NULL;
 
+       if (sna->front == NULL)
+               return NULL;
+
        priv = sna_pixmap(sna->front);
        return priv && priv->gpu_bo ? priv : NULL;
 }
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index ff24ed3..beafb3b 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -569,7 +569,6 @@ sna_crtc_apply(xf86CrtcPtr crtc)
        arg.crtc_id = sna_crtc->id;
        arg.fb_id = fb_id(sna_crtc->bo);
        if (sna_crtc->transform) {
-               assert(sna_crtc->shadow);
                arg.x = 0;
                arg.y = 0;
        } else {
@@ -714,6 +713,9 @@ static void update_flush_interval(struct sna *sna)
                        continue;
                }
 
+               DBG(("%s: CRTC:%d (pipe %d) vrefresh=%d\n",
+                    __FUNCTION__,i, to_sna_crtc(crtc)->pipe,
+                    xf86ModeVRefresh(&crtc->mode)));
                max_vrefresh = max(max_vrefresh, xf86ModeVRefresh(&crtc->mode));
        }
 
@@ -942,7 +944,21 @@ static struct kgem_bo *sna_crtc_attach(xf86CrtcPtr crtc)
        struct kgem_bo *bo;
 
        sna_crtc->transform = false;
-       if (use_shadow(sna, crtc)) {
+       if (sna_crtc->scanout_pixmap) {
+               DBG(("%s: attaching to scanout pixmap\n", __FUNCTION__));
+
+               bo = sna_pixmap_pin(sna_crtc->scanout_pixmap, PIN_SCANOUT);
+               if (bo == NULL)
+                       return NULL;
+
+               if (!get_fb(sna, bo,
+                           sna_crtc->scanout_pixmap->drawable.width,
+                           sna_crtc->scanout_pixmap->drawable.height))
+                       return NULL;
+
+               sna_crtc->transform = true;
+               return kgem_bo_reference(bo);
+       } else if (use_shadow(sna, crtc)) {
                if (!sna_crtc_enable_shadow(sna, sna_crtc))
                        return NULL;
 
@@ -963,22 +979,6 @@ static struct kgem_bo *sna_crtc_attach(xf86CrtcPtr crtc)
 
                sna_crtc->transform = true;
                return bo;
-       } else if (sna_crtc->scanout_pixmap) {
-               DBG(("%s: attaching to scanout pixmap\n", __FUNCTION__));
-               if (!sna_crtc_enable_shadow(sna, sna_crtc))
-                       return NULL;
-
-               bo = sna_pixmap_pin(sna_crtc->scanout_pixmap, PIN_SCANOUT);
-               if (bo == NULL)
-                       return NULL;
-
-               if (!get_fb(sna, bo,
-                           sna_crtc->scanout_pixmap->drawable.width,
-                           sna_crtc->scanout_pixmap->drawable.height))
-                       return NULL;
-
-               sna_crtc->transform = true;
-               return kgem_bo_reference(bo);
        } else if (sna->flags & SNA_TEAR_FREE) {
                DBG(("%s: tear-free updates requested\n", __FUNCTION__));
 

commit 448808d8a4e78afa7fe90e318d6d7afdbff66190
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Fri Sep 7 14:31:52 2012 +0100

    prime: Allocate a GPU_SCREEN when not primary to fulfil the output sink role
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/intel_module.c b/src/intel_module.c
index a5d071b..b4f0ad2 100644
--- a/src/intel_module.c
+++ b/src/intel_module.c
@@ -538,14 +538,22 @@ intel_platform_probe(DriverPtr driver,
 {
        ScrnInfoPtr scrn = NULL;
        char *path = xf86_get_platform_device_attrib(dev, ODEV_ATTRIB_PATH);
+       unsigned scrn_flags = 0;
 
        if (!dev->pdev)
                return FALSE;
+
+       /* Allow ourselves to act as a slaved output if not primary */
+       if (flags & PLATFORM_PROBE_GPU_SCREEN) {
+               flags &= ~PLATFORM_PROBE_GPU_SCREEN;
+               scrn_flags |= XF86_ALLOCATE_GPU_SCREEN;
+       }
+
        /* if we get any flags we don't understand fail to probe for now */
        if (flags)
                return FALSE;
 
-       scrn = xf86AllocateScreen(driver, 0);
+       scrn = xf86AllocateScreen(driver, scrn_flags);
        if (scrn == NULL)
                return FALSE;
 

commit 3dce661ef3df5558fe9c9d85324ab3395a37b7ea
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Fri Sep 7 13:48:12 2012 +0100

    sna: And remember to update the ScreenPixmap after resize
    
    Fixes the regression from the previous commit
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index f69ca97..ff24ed3 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -2178,19 +2178,6 @@ sna_visit_set_window_pixmap(WindowPtr window, pointer 
data)
     return WT_DONTWALKCHILDREN;
 }
 
-static void
-sna_redirect_screen_pixmap(ScrnInfoPtr scrn, PixmapPtr old, PixmapPtr new)
-{
-       ScreenPtr screen = scrn->pScreen;
-       struct sna_visit_set_pixmap_window visit;
-
-       visit.old = old;
-       visit.new = new;
-       TraverseTree(screen->root, sna_visit_set_window_pixmap, &visit);
-
-       screen->SetScreenPixmap(new);
-}
-
 static void copy_front(struct sna *sna, PixmapPtr old, PixmapPtr new)
 {
        struct sna_pixmap *old_priv, *new_priv;
@@ -2263,6 +2250,7 @@ sna_crtc_resize(ScrnInfoPtr scrn, int width, int height)
 {
        xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
        struct sna *sna = to_sna(scrn);
+       ScreenPtr screen = scrn->pScreen;
        PixmapPtr old_front, new_front;
        int i;
 
@@ -2274,16 +2262,15 @@ sna_crtc_resize(ScrnInfoPtr scrn, int width, int height)
                return TRUE;
 
        assert(sna->front);
-       assert(scrn->pScreen->GetScreenPixmap(scrn->pScreen) == sna->front);
+       assert(screen->GetScreenPixmap(screen) == sna->front);
 
        DBG(("%s: creating new framebuffer %dx%d\n",
             __FUNCTION__, width, height));
 
        old_front = sna->front;
-       new_front = scrn->pScreen->CreatePixmap(scrn->pScreen,
-                                               width, height,
-                                               scrn->depth,
-                                               SNA_CREATE_FB);
+       new_front = screen->CreatePixmap(screen,
+                                        width, height, scrn->depth,
+                                        SNA_CREATE_FB);
        if (!new_front)
                return FALSE;
 
@@ -2312,13 +2299,18 @@ sna_crtc_resize(ScrnInfoPtr scrn, int width, int height)
                        sna_crtc_disable(crtc);
        }
 
-       if (scrn->pScreen->root) {
-               sna_redirect_screen_pixmap(scrn, old_front, sna->front);
-               assert(scrn->pScreen->GetScreenPixmap(scrn->pScreen) == 
sna->front);
-               assert(scrn->pScreen->GetWindowPixmap(scrn->pScreen->root) == 
sna->front);
+       if (screen->root) {
+               struct sna_visit_set_pixmap_window visit;
+
+               visit.old = old_front;
+               visit.new = sna->front;
+               TraverseTree(screen->root, sna_visit_set_window_pixmap, &visit);
+               assert(screen->GetWindowPixmap(screen->root) == sna->front);
        }
+       screen->SetScreenPixmap(sna->front);
+       assert(screen->GetScreenPixmap(screen) == sna->front);
 
-       scrn->pScreen->DestroyPixmap(old_front);
+       screen->DestroyPixmap(old_front);
 
        return TRUE;
 }

commit 0c39c363d7235d03f27337c731c0ffe3369bf713
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Fri Sep 7 13:07:52 2012 +0100

    sna: Protect sna_crtc_resize() against early invocation with no RootWindow
    
    If the outputs are resized very early on, in CreateScreenResources, then
    we will not yet have created a RootWindow and so trying to change its
    pixmap is a futile effort.
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index bde296d..f69ca97 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -2266,24 +2266,24 @@ sna_crtc_resize(ScrnInfoPtr scrn, int width, int height)
        PixmapPtr old_front, new_front;
        int i;
 
-       DBG(("%s (%d, %d) -> (%d, %d)\n",
-            __FUNCTION__,
+       DBG(("%s (%d, %d) -> (%d, %d)\n", __FUNCTION__,
             scrn->virtualX, scrn->virtualY,
             width, height));


-- 
To UNSUBSCRIBE, email to debian-x-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/e1tbkxj-0005n3...@vasks.debian.org

Reply via email to