NEWS                       |   23 
 configure.ac               |    6 
 src/intel.h                |    3 
 src/intel_dri.c            |   54 
 src/intel_module.c         |    6 
 src/sna/Makefile.am        |    1 
 src/sna/brw/brw_wm.c       |    4 
 src/sna/g4x_render.c       | 3695 +++++++++++++++++++++++++++++++++++++++++++++
 src/sna/gen2_render.c      |   10 
 src/sna/gen3_render.c      |    4 
 src/sna/gen4_render.c      |   69 
 src/sna/gen5_render.c      |   15 
 src/sna/gen6_render.c      |   13 
 src/sna/gen7_render.c      |   13 
 src/sna/kgem.c             |   10 
 src/sna/kgem.h             |   32 
 src/sna/sna.h              |    4 
 src/sna/sna_accel.c        |   43 
 src/sna/sna_blt.c          |   40 
 src/sna/sna_composite.c    |    1 
 src/sna/sna_display.c      |   11 
 src/sna/sna_dri.c          |  199 +-
 src/sna/sna_glyphs.c       |    3 
 src/sna/sna_io.c           |   44 
 src/sna/sna_render.c       |  169 +-
 src/sna/sna_render.h       |    4 
 src/sna/sna_video_sprite.c |   14 
 uxa/uxa-render.c           |    2 
 28 files changed, 4241 insertions(+), 251 deletions(-)

New commits:
commit 7a904ce839933d57176e013cdad147533c33ca2f
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Mon Nov 26 08:48:31 2012 +0000

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

diff --git a/NEWS b/NEWS
index 3d29cfe..8e48fbb 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,26 @@
+Release 2.20.14 (2012-11-26)
+============================
+The highlight of this release is gen4, from 965g to gm45. Quite an old
+bug surfaced in the shader assembly, sparking a chance to review a few
+design choices within that backend and experiment on fresh ways to
+workaround the remaining issues.
+
+ * Avoid using inplace XOR'ed uploads for very large buffers
+   https://bugs.freedesktop.org/show_bug.cgi?id=57031
+
+ * Fix the gen4/5 opacity shader
+   https://bugs.freedesktop.org/show_bug.cgi?id=57054
+
+ * Queue a pending vblank request after flip completion
+   https://bugs.freedesktop.org/show_bug.cgi?id=56423
+
+ * Avoid migrating an uninitialised pixmap for use as a render source
+   https://bugs.freedesktop.org/show_bug.cgi?id=47597
+
+ * Improve handing of texture fallbacks for 830/845.
+   https://bugs.freedesktop.org/show_bug.cgi?id=57392
+
+
 Release 2.20.13 (2012-11-11)
 ============================
 Nothing but bug fixes. Many thanks to everyone who took the time to
diff --git a/configure.ac b/configure.ac
index 92c77f5..9004ce5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-video-intel],
-        [2.20.13],
+        [2.20.14],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-video-intel])
 AC_CONFIG_SRCDIR([Makefile.am])

commit 1367e3f9ef5f606c8927cbde441a2ea41fa6d025
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Sun Nov 25 00:24:45 2012 +0000

    sna: Exploit the alpha-fixup of the BLT for texture format conversions
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/sna/g4x_render.c b/src/sna/g4x_render.c
index 9de8340..f92a33a 100644
--- a/src/sna/g4x_render.c
+++ b/src/sna/g4x_render.c
@@ -1927,7 +1927,8 @@ g4x_composite_picture(struct sna *sna,
        channel->card_format = g4x_get_card_format(picture->format);
        if (channel->card_format == -1)
                return sna_render_picture_convert(sna, picture, channel, pixmap,
-                                                 x, y, w, h, dst_x, dst_y);
+                                                 x, y, w, h, dst_x, dst_y,
+                                                 false);
 
        if (too_large(pixmap->drawable.width, pixmap->drawable.height))
                return sna_render_picture_extract(sna, picture, channel,
diff --git a/src/sna/gen2_render.c b/src/sna/gen2_render.c
index 9663dff..31074af 100644
--- a/src/sna/gen2_render.c
+++ b/src/sna/gen2_render.c
@@ -1304,7 +1304,8 @@ static bool
 gen2_check_card_format(struct sna *sna,
                       PicturePtr picture,
                       struct sna_composite_channel *channel,
-                      int x, int y, int w, int h)
+                      int x, int y, int w, int h,
+                      bool *fixup_alpha)
 {
        uint32_t format = picture->format;
        unsigned int i;
@@ -1324,10 +1325,12 @@ gen2_check_card_format(struct sna *sna,
                                return true;
                        }
 
+                       *fixup_alpha = true;
                        return false;
                }
        }
 
+       *fixup_alpha = false;
        return false;
 }
 
@@ -1343,6 +1346,7 @@ gen2_composite_picture(struct sna *sna,
        PixmapPtr pixmap;
        uint32_t color;
        int16_t dx, dy;
+       bool fixup_alpha;
 
        DBG(("%s: (%d, %d)x(%d, %d), dst=(%d, %d)\n",
             __FUNCTION__, x, y, w, h, dst_x, dst_y));
@@ -1417,9 +1421,9 @@ gen2_composite_picture(struct sna *sna,
        } else
                channel->transform = picture->transform;
 
-       if (!gen2_check_card_format(sna, picture, channel, x,  y, w ,h))
+       if (!gen2_check_card_format(sna, picture, channel, x,  y, w ,h, 
&fixup_alpha))
                return sna_render_picture_convert(sna, picture, channel, pixmap,
-                                                 x, y, w, h, dst_x, dst_y);
+                                                 x, y, w, h, dst_x, dst_y, 
fixup_alpha);
 
        channel->pict_format = picture->format;
        if (too_large(pixmap->drawable.width, pixmap->drawable.height))
diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c
index f0f0a48..9dcdfcd 100644
--- a/src/sna/gen3_render.c
+++ b/src/sna/gen3_render.c
@@ -2402,7 +2402,8 @@ gen3_composite_picture(struct sna *sna,
        if (!gen3_composite_channel_set_format(channel, picture->format) &&
            !gen3_composite_channel_set_xformat(picture, channel, x, y, w, h))
                return sna_render_picture_convert(sna, picture, channel, pixmap,
-                                                 x, y, w, h, dst_x, dst_y);
+                                                 x, y, w, h, dst_x, dst_y,
+                                                 false);
 
        if (too_large(pixmap->drawable.width, pixmap->drawable.height)) {
                DBG(("%s: pixmap too large (%dx%d), extracting (%d, 
%d)x(%d,%d)\n",
diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c
index 057192d..5134bb9 100644
--- a/src/sna/gen4_render.c
+++ b/src/sna/gen4_render.c
@@ -1918,7 +1918,8 @@ gen4_composite_picture(struct sna *sna,
        channel->card_format = gen4_get_card_format(picture->format);
        if (channel->card_format == -1)
                return sna_render_picture_convert(sna, picture, channel, pixmap,
-                                                 x, y, w, h, dst_x, dst_y);
+                                                 x, y, w, h, dst_x, dst_y,
+                                                 false);
 
        if (too_large(pixmap->drawable.width, pixmap->drawable.height))
                return sna_render_picture_extract(sna, picture, channel,
diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c
index b49b25e..31f6f21 100644
--- a/src/sna/gen5_render.c
+++ b/src/sna/gen5_render.c
@@ -1936,7 +1936,8 @@ gen5_composite_picture(struct sna *sna,
        channel->card_format = gen5_get_card_format(picture->format);
        if (channel->card_format == -1)
                return sna_render_picture_convert(sna, picture, channel, pixmap,
-                                                 x, y, w, h, dst_x, dst_y);
+                                                 x, y, w, h, dst_x, dst_y,
+                                                 false);
 
        if (too_large(pixmap->drawable.width, pixmap->drawable.height))
                return sna_render_picture_extract(sna, picture, channel,
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index fbe0951..6cc1a7d 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -2274,7 +2274,8 @@ gen6_composite_picture(struct sna *sna,
        channel->card_format = gen6_get_card_format(picture->format);
        if (channel->card_format == (unsigned)-1)
                return sna_render_picture_convert(sna, picture, channel, pixmap,
-                                                 x, y, w, h, dst_x, dst_y);
+                                                 x, y, w, h, dst_x, dst_y,
+                                                 false);
 
        if (too_large(pixmap->drawable.width, pixmap->drawable.height)) {
                DBG(("%s: extracting from pixmap %dx%d\n", __FUNCTION__,
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index 3bec5df..a106a18 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -2386,7 +2386,8 @@ gen7_composite_picture(struct sna *sna,
        channel->card_format = gen7_get_card_format(picture->format);
        if (channel->card_format == (unsigned)-1)
                return sna_render_picture_convert(sna, picture, channel, pixmap,
-                                                 x, y, w, h, dst_x, dst_y);
+                                                 x, y, w, h, dst_x, dst_y,
+                                                 false);
 
        if (too_large(pixmap->drawable.width, pixmap->drawable.height)) {
                DBG(("%s: extracting from pixmap %dx%d\n", __FUNCTION__,
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c
index c534f61..0a2856e 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -1637,11 +1637,10 @@ sna_render_picture_convert(struct sna *sna,
                           PixmapPtr pixmap,
                           int16_t x, int16_t y,
                           int16_t w, int16_t h,
-                          int16_t dst_x, int16_t dst_y)
+                          int16_t dst_x, int16_t dst_y,
+                          bool fixup_alpha)
 {
-       pixman_image_t *src, *dst;
        BoxRec box;
-       void *ptr;
 
 #if NO_CONVERT
        return -1;
@@ -1691,52 +1690,113 @@ sna_render_picture_convert(struct sna *sna,
                return 0;
        }
 
-       if (!sna_pixmap_move_to_cpu(pixmap, MOVE_READ))
-               return 0;
+       if (fixup_alpha && is_gpu(&pixmap->drawable)) {
+               ScreenPtr screen = pixmap->drawable.pScreen;
+               PixmapPtr tmp;
+               PicturePtr src, dst;
+               int error;
 
-       src = pixman_image_create_bits(picture->format,
-                                      pixmap->drawable.width,
-                                      pixmap->drawable.height,
-                                      pixmap->devPrivate.ptr,
-                                      pixmap->devKind);
-       if (!src)
-               return 0;
+               assert(PICT_FORMAT_BPP(picture->format) == 
pixmap->drawable.bitsPerPixel);
+               channel->pict_format = 
PICT_FORMAT(PICT_FORMAT_BPP(picture->format),
+                                                  
PICT_FORMAT_TYPE(picture->format),
+                                                  
PICT_FORMAT_BPP(picture->format) - PIXMAN_FORMAT_DEPTH(picture->format),
+                                                  
PICT_FORMAT_R(picture->format),
+                                                  
PICT_FORMAT_G(picture->format),
+                                                  
PICT_FORMAT_B(picture->format));
 
-       if (PICT_FORMAT_RGB(picture->format) == 0) {
-               channel->pict_format = PIXMAN_a8;
-               DBG(("%s: converting to a8 from %08x\n",
+               DBG(("%s: converting to %08x from %08x using composite 
alpha-fixup\n",
                     __FUNCTION__, picture->format));
+
+               tmp = screen->CreatePixmap(screen, w, h, 
pixmap->drawable.bitsPerPixel, 0);
+               if (tmp == NULL)
+                       return 0;
+
+               dst = CreatePicture(0, &tmp->drawable,
+                                   PictureMatchFormat(screen,
+                                                      
pixmap->drawable.bitsPerPixel,
+                                                      channel->pict_format),
+                                   0, NULL, serverClient, &error);
+               if (dst == NULL) {
+                       screen->DestroyPixmap(tmp);
+                       return 0;
+               }
+
+               src = CreatePicture(0, &pixmap->drawable,
+                                   PictureMatchFormat(screen,
+                                                      pixmap->drawable.depth,
+                                                      picture->format),
+                                   0, NULL, serverClient, &error);
+               if (dst == NULL) {
+                       FreePicture(dst, 0);
+                       screen->DestroyPixmap(tmp);
+                       return 0;
+               }
+
+               ValidatePicture(src);
+               ValidatePicture(dst);
+
+               sna_composite(PictOpSrc, src, NULL, dst,
+                             box.x1, box.y1,
+                             0, 0,
+                             0, 0,
+                             w, h);
+               FreePicture(dst, 0);
+               FreePicture(src, 0);
+
+               channel->bo = sna_pixmap_get_bo(tmp);
+               kgem_bo_reference(channel->bo);
+               screen->DestroyPixmap(tmp);
        } else {
-               channel->pict_format = PIXMAN_a8r8g8b8;
-               DBG(("%s: converting to a8r8g8b8 from %08x\n",
-                    __FUNCTION__, picture->format));
-       }
+               pixman_image_t *src, *dst;
+               void *ptr;
 
-       channel->bo = kgem_create_buffer_2d(&sna->kgem,
-                                           w, h, 
PIXMAN_FORMAT_BPP(channel->pict_format),
-                                           KGEM_BUFFER_WRITE_INPLACE,
-                                           &ptr);
-       if (!channel->bo) {
-               pixman_image_unref(src);
-               return 0;
-       }
+               if (!sna_pixmap_move_to_cpu(pixmap, MOVE_READ))
+                       return 0;
 
-       dst = pixman_image_create_bits(channel->pict_format,
-                                      w, h, ptr, channel->bo->pitch);
-       if (!dst) {
-               kgem_bo_destroy(&sna->kgem, channel->bo);
+               src = pixman_image_create_bits(picture->format,
+                                              pixmap->drawable.width,
+                                              pixmap->drawable.height,
+                                              pixmap->devPrivate.ptr,
+                                              pixmap->devKind);
+               if (!src)
+                       return 0;
+
+               if (PICT_FORMAT_RGB(picture->format) == 0) {
+                       channel->pict_format = PIXMAN_a8;
+                       DBG(("%s: converting to a8 from %08x\n",
+                            __FUNCTION__, picture->format));
+               } else {
+                       channel->pict_format = PIXMAN_a8r8g8b8;
+                       DBG(("%s: converting to a8r8g8b8 from %08x\n",
+                            __FUNCTION__, picture->format));
+               }
+
+               channel->bo = kgem_create_buffer_2d(&sna->kgem,
+                                                   w, h, 
PIXMAN_FORMAT_BPP(channel->pict_format),
+                                                   KGEM_BUFFER_WRITE_INPLACE,
+                                                   &ptr);
+               if (!channel->bo) {
+                       pixman_image_unref(src);
+                       return 0;
+               }
+
+               dst = pixman_image_create_bits(channel->pict_format,
+                                              w, h, ptr, channel->bo->pitch);
+               if (!dst) {
+                       kgem_bo_destroy(&sna->kgem, channel->bo);
+                       pixman_image_unref(src);
+                       return 0;
+               }
+
+               pixman_image_composite(PictOpSrc, src, NULL, dst,
+                                      box.x1, box.y1,
+                                      0, 0,
+                                      0, 0,
+                                      w, h);
+               pixman_image_unref(dst);
                pixman_image_unref(src);
-               return 0;
        }
 
-       pixman_image_composite(PictOpSrc, src, NULL, dst,
-                              box.x1, box.y1,
-                              0, 0,
-                              0, 0,
-                              w, h);
-       pixman_image_unref(dst);
-       pixman_image_unref(src);
-
        channel->width  = w;
        channel->height = h;
 
@@ -1745,11 +1805,10 @@ sna_render_picture_convert(struct sna *sna,
        channel->offset[0] = x - dst_x - box.x1;
        channel->offset[1] = y - dst_y - box.y1;
 
-       DBG(("%s: offset=(%d, %d), size=(%d, %d) ptr[0]=%08x\n",
+       DBG(("%s: offset=(%d, %d), size=(%d, %d)\n",
             __FUNCTION__,
             channel->offset[0], channel->offset[1],
-            channel->width, channel->height,
-            *(uint32_t*)ptr));
+            channel->width, channel->height));
        return 1;
 }
 
diff --git a/src/sna/sna_render.h b/src/sna/sna_render.h
index 97b9222..e9ec2ba 100644
--- a/src/sna/sna_render.h
+++ b/src/sna/sna_render.h
@@ -691,7 +691,8 @@ sna_render_picture_convert(struct sna *sna,
                           PixmapPtr pixmap,
                           int16_t x, int16_t y,
                           int16_t w, int16_t h,
-                          int16_t dst_x, int16_t dst_y);
+                          int16_t dst_x, int16_t dst_y,
+                          bool fixup_alpha);
 
 inline static void sna_render_composite_redirect_init(struct sna_composite_op 
*op)
 {

commit 6d6399f97cf7cb91dcf89e9a5cd1243f761e4314
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Sun Nov 25 00:05:44 2012 +0000

    sna: Transform a simple repeat pattern into range of the BLT
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c
index 9aa636c..ea11d00 100644
--- a/src/sna/sna_blt.c
+++ b/src/sna/sna_blt.c
@@ -1840,10 +1840,21 @@ clear:
        if (x < 0 || y < 0 ||
            x + width > src->pDrawable->width ||
            y + height > src->pDrawable->height) {
-               DBG(("%s: source extends outside (%d, %d), (%d, %d) of valid 
drawable %dx%d\n",
+               DBG(("%s: source extends outside (%d, %d), (%d, %d) of valid 
drawable %dx%d, repeat=%d\n",
                     __FUNCTION__,
-                    x, y, x+width, y+width, src->pDrawable->width, 
src->pDrawable->height));
-               return false;
+                    x, y, x+width, y+width, src->pDrawable->width, 
src->pDrawable->height, src->repeatType));
+               if (src->repeat && src->repeatType == RepeatNormal) {
+                       x = x % src->pDrawable->width;
+                       y = y % src->pDrawable->height;
+                       if (x < 0)
+                               x += src->pDrawable->width;
+                       if (y < 0)
+                               y += src->pDrawable->height;
+                       if (x + width  > src->pDrawable->width ||
+                           y + height > src->pDrawable->height)
+                               return false;
+               } else
+                       return false;
        }
 
        src_pixmap = get_drawable_pixmap(src->pDrawable);
@@ -2000,6 +2011,10 @@ sna_blt_composite__convert(struct sna *sna,
                return false;
        }
 
+       tmp->u.blt.src_pixmap = NULL;
+       tmp->u.blt.sx = tmp->src.offset[0];
+       tmp->u.blt.sy = tmp->src.offset[1];
+
        x += tmp->src.offset[0];
        y += tmp->src.offset[1];
        if (x < 0 || y < 0 ||
@@ -2008,7 +2023,21 @@ sna_blt_composite__convert(struct sna *sna,
                DBG(("%s: source extends outside (%d, %d), (%d, %d) of valid 
drawable %dx%d\n",
                     __FUNCTION__,
                     x, y, x+width, y+width, tmp->src.width, tmp->src.height));
-               return false;
+               if (tmp->src.repeat == RepeatNormal) {
+                       int xx = x % tmp->src.width;
+                       int yy = y % tmp->src.height;
+                       if (xx < 0)
+                               xx += tmp->src.width;
+                       if (yy < 0)
+                               yy += tmp->src.height;
+                       if (xx + width  > tmp->src.width ||
+                           yy + height > tmp->src.height)
+                               return false;
+
+                       tmp->u.blt.sx += xx - x;
+                       tmp->u.blt.sy += yy - y;
+               } else
+                       return false;
        }
 
        if (!kgem_check_many_bo_fenced(&sna->kgem, tmp->dst.bo, tmp->src.bo, 
NULL)) {
@@ -2021,9 +2050,6 @@ sna_blt_composite__convert(struct sna *sna,
                _kgem_set_mode(&sna->kgem, KGEM_BLT);
        }
 
-       tmp->u.blt.src_pixmap = NULL;
-       tmp->u.blt.sx = tmp->src.offset[0];
-       tmp->u.blt.sy = tmp->src.offset[1];
        DBG(("%s: blt dst offset (%d, %d), source offset (%d, %d), with alpha 
fixup? %x\n",
             __FUNCTION__,
             tmp->dst.x, tmp->dst.y, tmp->u.blt.sx, tmp->u.blt.sy, 
alpha_fixup));

commit 39f1e228b74e98d3d87157cf093fc56ca31e6b13
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Sat Nov 24 20:16:29 2012 +0000

    sna: Make GPU idle more consistent during wakeup
    
    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 1f9374f..2f49f12 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -14429,9 +14429,9 @@ void sna_accel_wakeup_handler(struct sna *sna)
 
        if (sna->kgem.need_retire)
                kgem_retire(&sna->kgem);
-       if (!sna->mode.shadow_active && !sna->kgem.need_retire) {
+       if (sna->kgem.nbatch && kgem_is_idle(&sna->kgem)) {
                DBG(("%s: GPU idle, flushing\n", __FUNCTION__));
-               kgem_submit(&sna->kgem);
+               _kgem_submit(&sna->kgem);
        }
        if (sna->kgem.need_purge)
                kgem_purge_cache(&sna->kgem);

commit 40b6121746c55153de444ccb753df80706ff3a69
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Fri Nov 23 18:21:41 2012 +0000

    sna/g4x: Refine the w/a for the broken sf shader
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/sna/g4x_render.c b/src/sna/g4x_render.c
index 41a02d3..9de8340 100644
--- a/src/sna/g4x_render.c
+++ b/src/sna/g4x_render.c
@@ -48,7 +48,6 @@
  * the BLT engine.
  */
 #define PREFER_BLT 1
-#define FLUSH_EVERY_VERTEX 1
 #define FORCE_SPANS 0
 
 #define NO_COMPOSITE 0
@@ -60,15 +59,6 @@
 #define NO_FILL_BOXES 0
 #define NO_VIDEO 0
 
-#if FLUSH_EVERY_VERTEX
-#define _FLUSH() do { \
-       g4x_vertex_flush(sna); \
-       OUT_BATCH(MI_FLUSH | MI_INHIBIT_RENDER_CACHE_FLUSH); \
-} while (0)
-#else
-#define _FLUSH()
-#endif
-
 #define GEN4_GRF_BLOCKS(nreg)    ((nreg + 15) / 16 - 1)
 
 /* Set up a default static partitioning of the URB, which is supposed to
@@ -695,23 +685,23 @@ g4x_emit_composite_primitive_solid(struct sna *sna,
        } dst;
 
        v = sna->render.vertices + sna->render.vertex_used;
-       sna->render.vertex_used += 15;
+       sna->render.vertex_used += 9;
 
        dst.p.x = r->dst.x + r->width;
        dst.p.y = r->dst.y + r->height;
        v[0] = dst.f;
-       v[3] = v[1] = 1.;
-       v[4] = v[2] = 1.;
+       v[1] = 1.;
+       v[2] = 1.;
 
        dst.p.x = r->dst.x;
-       v[5] = dst.f;
-       v[8] = v[6] = 0.;
-       v[9] = v[7] = 1.;
+       v[3] = dst.f;
+       v[4] = 0.;
+       v[5] = 1.;
 
        dst.p.y = r->dst.y;
-       v[10] = dst.f;
-       v[13] = v[11] = 0.;
-       v[14] = v[12] = 0.;
+       v[6] = dst.f;
+       v[7] = 0.;
+       v[8] = 0.;
 }
 
 fastcall static void
@@ -727,7 +717,7 @@ g4x_emit_composite_primitive_identity_source(struct sna 
*sna,
        } dst;
 
        v = sna->render.vertices + sna->render.vertex_used;
-       sna->render.vertex_used += 15;
+       sna->render.vertex_used += 9;
 
        sx = r->src.x + op->src.offset[0];
        sy = r->src.y + op->src.offset[1];
@@ -737,22 +727,16 @@ g4x_emit_composite_primitive_identity_source(struct sna 
*sna,
        v[0] = dst.f;
        v[1] = (sx + r->width) * sf[0];
        v[2] = (sy + r->height) * sf[1];
-       v[3] = 1.;
-       v[4] = 1.;
 
        dst.p.x = r->dst.x;
-       v[5] = dst.f;
-       v[6] = sx * sf[0];
-       v[7] = v[2];
-       v[8] = 0.;
-       v[9] = 1.;
+       v[3] = dst.f;
+       v[4] = sx * sf[0];
+       v[5] = v[2];
 
        dst.p.y = r->dst.y;
-       v[10] = dst.f;
-       v[11] = v[6];
-       v[12] = sy * sf[1];
-       v[13] = 0.;
-       v[14] = 0.;
+       v[6] = dst.f;
+       v[7] = v[4];
+       v[8] = sy * sf[1];
 }
 
 fastcall static void
@@ -767,7 +751,7 @@ g4x_emit_composite_primitive_affine_source(struct sna *sna,
        float *v;
 
        v = sna->render.vertices + sna->render.vertex_used;
-       sna->render.vertex_used += 15;
+       sna->render.vertex_used += 9;
 
        dst.p.x = r->dst.x + r->width;
        dst.p.y = r->dst.y + r->height;
@@ -778,30 +762,24 @@ g4x_emit_composite_primitive_affine_source(struct sna 
*sna,
                                         &v[1], &v[2]);
        v[1] *= op->src.scale[0];
        v[2] *= op->src.scale[1];
-       v[3] = 1.;
-       v[4] = 1.;
 
        dst.p.x = r->dst.x;
-       v[5] = dst.f;
+       v[3] = dst.f;
        _sna_get_transformed_coordinates(op->src.offset[0] + r->src.x,
                                         op->src.offset[1] + r->src.y + 
r->height,
                                         op->src.transform,
-                                        &v[6], &v[7]);
-       v[6] *= op->src.scale[0];
-       v[7] *= op->src.scale[1];
-       v[8] = 0.;
-       v[9] = 1.;
+                                        &v[4], &v[5]);
+       v[4] *= op->src.scale[0];
+       v[5] *= op->src.scale[1];
 
        dst.p.y = r->dst.y;
-       v[10] = dst.f;
+       v[6] = dst.f;
        _sna_get_transformed_coordinates(op->src.offset[0] + r->src.x,
                                         op->src.offset[1] + r->src.y,
                                         op->src.transform,
-                                        &v[11], &v[12]);
-       v[11] *= op->src.scale[0];
-       v[12] *= op->src.scale[1];
-       v[13] = 0.;
-       v[14] = 0.;
+                                        &v[7], &v[8]);
+       v[7] *= op->src.scale[0];
+       v[8] *= op->src.scale[1];
 }
 
 fastcall static void
@@ -1026,8 +1004,6 @@ static bool g4x_rectangle_begin(struct sna *sna,
 
        /* 7xpipelined pointers + 6xprimitive + 1xflush */
        ndwords = op->need_magic_ca_pass? 20 : 6;
-       if (FLUSH_EVERY_VERTEX)
-               ndwords += 1;
        if ((sna->render_state.gen4.vb_id & (1 << id)) == 0)
                ndwords += 5;
 
@@ -1045,7 +1021,7 @@ static bool g4x_rectangle_begin(struct sna *sna,
 static int g4x_get_rectangles__flush(struct sna *sna,
                                     const struct sna_composite_op *op)
 {
-       if (!kgem_check_batch(&sna->kgem, (FLUSH_EVERY_VERTEX || 
op->need_magic_ca_pass) ? 25 : 6))
+       if (!kgem_check_batch(&sna->kgem, op->need_magic_ca_pass ? 25 : 6))
                return 0;
        if (!kgem_check_reloc_and_exec(&sna->kgem, 1))
                return 0;
@@ -1273,7 +1249,7 @@ g4x_emit_pipelined_pointers(struct sna *sna,
        OUT_BATCH(sna->render_state.gen4.vs);
        OUT_BATCH(GEN4_GS_DISABLE); /* passthrough */
        OUT_BATCH(GEN4_CLIP_DISABLE); /* passthrough */
-       OUT_BATCH(sna->render_state.gen4.sf[!!(op->u.gen4.ve_id & 2)]);
+       OUT_BATCH(sna->render_state.gen4.sf[1]);
        OUT_BATCH(sna->render_state.gen4.wm + sp);
        OUT_BATCH(sna->render_state.gen4.cc + bp);
 
@@ -1315,9 +1291,9 @@ g4x_emit_vertex_elements(struct sna *sna,
         */
        struct gen4_render_state *render = &sna->render_state.gen4;
        int id = op->u.gen4.ve_id;
-       int selem, nelem;
        uint32_t w_component;
        uint32_t src_format;
+       int selem;
 
        if (render->ve_id == id)
                return;
@@ -1333,14 +1309,13 @@ g4x_emit_vertex_elements(struct sna *sna,
                w_component = GEN4_VFCOMPONENT_STORE_SRC;
                selem = 3;
        }
-       nelem = id & 2 ? 2 : 1;
 
        /* The VUE layout
         *    dword 0-3: position (x, y, 1.0, 1.0),
         *    dword 4-7: texture coordinate 0 (u0, v0, w0, 1.0)
         *    [optional] dword 8-11: texture coordinate 1 (u1, v1, w1, 1.0)
         */
-       OUT_BATCH(GEN4_3DSTATE_VERTEX_ELEMENTS | (2 * (1 + nelem) - 1));
+       OUT_BATCH(GEN4_3DSTATE_VERTEX_ELEMENTS | (2 * (1 + 2) - 1));
 
        /* x,y */
        OUT_BATCH(id << VE0_VERTEX_BUFFER_INDEX_SHIFT | VE0_VALID |
@@ -1363,15 +1338,21 @@ g4x_emit_vertex_elements(struct sna *sna,
                  (2*4) << VE1_DESTINATION_ELEMENT_OFFSET_SHIFT);       /* VUE 
offset in dwords */
 
        /* u1, v1, w1 */
+       OUT_BATCH(id << VE0_VERTEX_BUFFER_INDEX_SHIFT | VE0_VALID |
+                 src_format << VE0_FORMAT_SHIFT |
+                 ((1 + selem) * 4) << VE0_OFFSET_SHIFT); /* vb offset in bytes 
*/
        if (id & 2) {
-               OUT_BATCH(id << VE0_VERTEX_BUFFER_INDEX_SHIFT | VE0_VALID |
-                         src_format << VE0_FORMAT_SHIFT |
-                         ((1 + selem) * 4) << VE0_OFFSET_SHIFT); /* vb offset 
in bytes */
                OUT_BATCH(GEN4_VFCOMPONENT_STORE_SRC << VE1_VFCOMPONENT_0_SHIFT 
|
                          GEN4_VFCOMPONENT_STORE_SRC << VE1_VFCOMPONENT_1_SHIFT 
|
                          w_component << VE1_VFCOMPONENT_2_SHIFT |
                          GEN4_VFCOMPONENT_STORE_1_FLT << 
VE1_VFCOMPONENT_3_SHIFT |
                          (3*4) << VE1_DESTINATION_ELEMENT_OFFSET_SHIFT);       
/* VUE offset in dwords */
+       } else {
+               OUT_BATCH(GEN4_VFCOMPONENT_STORE_0 << VE1_VFCOMPONENT_0_SHIFT |
+                         GEN4_VFCOMPONENT_STORE_0 << VE1_VFCOMPONENT_1_SHIFT |
+                         GEN4_VFCOMPONENT_STORE_0 << VE1_VFCOMPONENT_2_SHIFT |
+                         GEN4_VFCOMPONENT_STORE_1_FLT << 
VE1_VFCOMPONENT_3_SHIFT |
+                         (3*4) << VE1_DESTINATION_ELEMENT_OFFSET_SHIFT);       
/* VUE offset in dwords */
        }
 }
 
@@ -1715,8 +1696,6 @@ g4x_render_video(struct sna *sna,
                OUT_VERTEX_F((box->x1 - dxo) * src_scale_x);
                OUT_VERTEX_F((box->y1 - dyo) * src_scale_y);
 
-               _FLUSH();
-
                if (!DAMAGE_IS_ALL(priv->gpu_damage)) {
                        sna_damage_add_box(&priv->gpu_damage, &r);
                        sna_damage_subtract_box(&priv->cpu_damage, &r);
@@ -2392,6 +2371,7 @@ g4x_render_composite(struct sna *sna,
                if (tmp->src.transform == NULL && tmp->mask.transform == NULL)
                        tmp->prim_emit = 
g4x_emit_composite_primitive_identity_source_mask;
 
+               tmp->floats_per_vertex = 5 + 2 * !tmp->is_affine;
        } else {
                if (tmp->src.is_solid)
                        tmp->prim_emit = g4x_emit_composite_primitive_solid;
@@ -2399,16 +2379,17 @@ g4x_render_composite(struct sna *sna,
                        tmp->prim_emit = 
g4x_emit_composite_primitive_identity_source;
                else if (tmp->src.is_affine)
                        tmp->prim_emit = 
g4x_emit_composite_primitive_affine_source;
+
+               tmp->floats_per_vertex = 3 + !tmp->is_affine;
        }
-       tmp->floats_per_vertex = 5 + 2 * !tmp->is_affine;
        tmp->floats_per_rect = 3*tmp->floats_per_vertex;
 
        tmp->u.gen4.wm_kernel =
                g4x_choose_composite_kernel(tmp->op,
-                                            mask != NULL,
-                                            tmp->has_component_alpha,
-                                            tmp->is_affine);
-       tmp->u.gen4.ve_id = 1 << 1 | tmp->is_affine;
+                                           tmp->mask.bo != NULL,
+                                           tmp->has_component_alpha,
+                                           tmp->is_affine);
+       tmp->u.gen4.ve_id = (tmp->mask.bo != NULL) << 1 | tmp->is_affine;
 
        tmp->blt   = g4x_render_composite_blt;
        tmp->box   = g4x_render_composite_box;
@@ -2796,8 +2777,6 @@ g4x_render_copy_one(struct sna *sna,
        OUT_VERTEX(dx, dy);
        OUT_VERTEX_F(sx*op->src.scale[0]);
        OUT_VERTEX_F(sy*op->src.scale[1]);
-
-       _FLUSH();
 }
 
 static inline bool prefer_blt_copy(struct sna *sna, unsigned flags)
@@ -3094,20 +3073,14 @@ g4x_render_fill_rectangle(struct sna *sna,
        OUT_VERTEX(x+w, y+h);
        OUT_VERTEX_F(1);
        OUT_VERTEX_F(1);
-       OUT_VERTEX_F(1);
-       OUT_VERTEX_F(1);
 
        OUT_VERTEX(x, y+h);
        OUT_VERTEX_F(0);
        OUT_VERTEX_F(1);
-       OUT_VERTEX_F(0);
-       OUT_VERTEX_F(1);
 
        OUT_VERTEX(x, y);
        OUT_VERTEX_F(0);
        OUT_VERTEX_F(0);
-       OUT_VERTEX_F(0);
-       OUT_VERTEX_F(0);
 }
 
 static bool
@@ -3184,10 +3157,10 @@ g4x_render_fill_boxes(struct sna *sna,
        g4x_composite_solid_init(sna, &tmp.src, pixel);
 
        tmp.is_affine = true;
-       tmp.floats_per_vertex = 5;
-       tmp.floats_per_rect = 15;
+       tmp.floats_per_vertex = 3;
+       tmp.floats_per_rect = 9;
        tmp.u.gen4.wm_kernel = WM_KERNEL;
-       tmp.u.gen4.ve_id = 1 | 1 << 1;
+       tmp.u.gen4.ve_id = 1;
 
        if (!kgem_check_bo(&sna->kgem, dst_bo, NULL)) {
                kgem_submit(&sna->kgem);
@@ -3289,10 +3262,10 @@ g4x_render_fill(struct sna *sna, uint8_t alu,
        op->base.mask.bo = NULL;
 
        op->base.is_affine = true;
-       op->base.floats_per_vertex = 5;
-       op->base.floats_per_rect = 15;
+       op->base.floats_per_vertex = 3;
+       op->base.floats_per_rect = 9;
        op->base.u.gen4.wm_kernel = WM_KERNEL;
-       op->base.u.gen4.ve_id = 1 | 1 << 1;
+       op->base.u.gen4.ve_id = 1;
 
        if (!kgem_check_bo(&sna->kgem, dst_bo, NULL)) {
                kgem_submit(&sna->kgem);
@@ -3365,13 +3338,13 @@ g4x_render_fill_one(struct sna *sna, PixmapPtr dst, 
struct kgem_bo *bo,
        tmp.mask.bo = NULL;
 
        tmp.is_affine = true;
-       tmp.floats_per_vertex = 5;
-       tmp.floats_per_rect = 15;
-       tmp.has_component_alpha = 0;
+       tmp.floats_per_vertex = 3;
+       tmp.floats_per_rect = 9;
+       tmp.has_component_alpha = false;
        tmp.need_magic_ca_pass = false;
 
        tmp.u.gen4.wm_kernel = WM_KERNEL;
-       tmp.u.gen4.ve_id = 1 | 1 << 1;
+       tmp.u.gen4.ve_id = 1;
 
        if (!kgem_check_bo(&sna->kgem, bo, NULL)) {
                _kgem_submit(&sna->kgem);

commit e0b906b09697b5fe7a5be2fdc52abd9b1c73f96d
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Fri Nov 23 18:01:25 2012 +0000

    sna/g4x: Use the render pipeline more often for composite operations
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/sna/g4x_render.c b/src/sna/g4x_render.c
index 5db4d84..41a02d3 100644
--- a/src/sna/g4x_render.c
+++ b/src/sna/g4x_render.c
@@ -2030,22 +2030,12 @@ picture_is_cpu(PicturePtr picture)
        return !is_gpu(picture->pDrawable);
 }
 
-static inline bool prefer_blt(struct sna *sna)
-{
-#if PREFER_BLT
-       return true;
-       (void)sna;
-#else
-       return sna->kgem.mode != KGEM_RENDER;
-#endif
-}
-
 static bool
 try_blt(struct sna *sna,
        PicturePtr dst, PicturePtr src,
        int width, int height)
 {
-       if (prefer_blt(sna)) {
+       if (sna->kgem.mode != KGEM_RENDER) {
                DBG(("%s: already performing BLT\n", __FUNCTION__));
                return true;
        }
@@ -2996,6 +2986,16 @@ g4x_render_copy_done(struct sna *sna, const struct 
sna_copy_op *op)
        g4x_vertex_flush(sna);
 }
 
+static inline bool prefer_blt_fill(struct sna *sna)
+{
+#if PREFER_BLT
+       return true;
+       (void)sna;
+#else
+       return sna->kgem.mode != KGEM_RENDER;
+#endif
+}
+
 static bool
 g4x_render_copy(struct sna *sna, uint8_t alu,
                PixmapPtr src, struct kgem_bo *src_bo,
@@ -3008,7 +3008,7 @@ g4x_render_copy(struct sna *sna, uint8_t alu,
             dst->drawable.serialNumber,
             alu));
 
-       if (prefer_blt(sna) &&
+       if (prefer_blt_fill(sna) &&
            sna_blt_compare_depth(&src->drawable, &dst->drawable) &&
            sna_blt_copy(sna, alu,
                         src_bo, dst_bo,
@@ -3128,7 +3128,7 @@ g4x_render_fill_boxes(struct sna *sna,
        }
 
        if (op <= PictOpSrc &&
-           (prefer_blt(sna) ||
+           (prefer_blt_fill(sna) ||
             too_large(dst->drawable.width, dst->drawable.height) ||
             !g4x_check_dst_format(format))) {
                uint8_t alu = GXinvalid;
@@ -3254,7 +3254,7 @@ g4x_render_fill(struct sna *sna, uint8_t alu,
                uint32_t color,
                struct sna_fill_op *op)
 {
-       if (prefer_blt(sna) &&
+       if (prefer_blt_fill(sna) &&
            sna_blt_fill(sna, alu,
                         dst_bo, dst->drawable.bitsPerPixel,
                         color,

commit 54d8968da5ae39bfbcad511322926931bce2bda3
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Fri Nov 23 17:47:49 2012 +0000

    sna/gen4: Revert changes to 965g[m]
    
    The changes tested on g45/gm45 prove to be highly unstable on 965gm,
    suggesting a radical difference in the nature of the bugs between the
    two generations. In theory, g4x has additional features that could be
    exploited over and above gen4 which may prove interesting in the future.
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/sna/Makefile.am b/src/sna/Makefile.am
index 306996b..9f3d579 100644
--- a/src/sna/Makefile.am
+++ b/src/sna/Makefile.am
@@ -72,6 +72,7 @@ libsna_la_SOURCES = \
        gen3_render.c \
        gen3_render.h \
        gen4_render.c \
+       g4x_render.c \
        gen4_render.h \
        gen5_render.c \
        gen5_render.h \
diff --git a/src/sna/g4x_render.c b/src/sna/g4x_render.c
new file mode 100644
index 0000000..5db4d84
--- /dev/null
+++ b/src/sna/g4x_render.c
@@ -0,0 +1,3721 @@
+/*
+ * Copyright © 2006,2008,2011 Intel Corporation
+ * Copyright © 2007 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the


-- 
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/e1te1dh-0007qc...@vasks.debian.org

Reply via email to