NEWS                            |   62 ++++++++++
 configure.ac                    |   26 +++-
 src/intel_display.c             |   57 +++++++++
 src/intel_dri.c                 |   25 ++--
 src/render_program/Makefile.am  |    8 -
 src/sna/fb/fbblt.c              |    4 
 src/sna/gen2_render.c           |  107 +++++++++++++-----
 src/sna/gen3_render.c           |    1 
 src/sna/gen5_render.c           |   17 ++
 src/sna/gen6_render.c           |    1 
 src/sna/gen7_render.c           |   23 ++-
 src/sna/kgem.c                  |   95 ++++++++++------
 src/sna/kgem.h                  |    8 +
 src/sna/sna_accel.c             |  231 +++++++++++++++++++---------------------
 src/sna/sna_blt.c               |   60 +++++++---
 src/sna/sna_damage.c            |    2 
 src/sna/sna_display.c           |   35 ++++++
 src/sna/sna_dri.c               |  220 ++++++++++++++++++++++++++------------
 src/sna/sna_driver.c            |   14 +-
 src/sna/sna_glyphs.c            |    8 +
 src/sna/sna_io.c                |    6 -
 src/sna/sna_render_inline.h     |    2 
 src/sna/sna_video_overlay.c     |   23 +++
 src/xvmc/shader/mc/Makefile.am  |    2 
 src/xvmc/shader/vld/Makefile.am |    2 
 uxa/uxa-glyphs.c                |    3 
 26 files changed, 718 insertions(+), 324 deletions(-)

New commits:
commit b42d81b63f5b6a571faffaadd42c74adce40128a
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Sun Oct 14 09:15:38 2012 +0100

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

diff --git a/NEWS b/NEWS
index 2cc2353..be10700 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,63 @@
+Release 2.20.10 (2012-10-14)
+============================
+The last couple of weeks have been fairly retrospective, a dive into
+prehistory tidying up the earlier generations which lay languishing as
+the core progressed and lead to a number of annoying core bugs being
+fixed.
+
+ * Release DRM master earlier during shutdown so switching between
+   multiple X servers works automatically.
+   https://bugs.freedesktop.org/show_bug.cgi?id=55446
+
+ * Suppress error propagation from DRI2GetMSC and behave as if the pipe
+   was simply off to avoid unexpected errors in the clients
+   https://bugs.freedesktop.org/show_bug.cgi?id=55395
+
+ * A few fixes to i8xx batch emission, ensuring that the GPU is always
+   in a valid state.
+   https://bugs.freedesktop.org/show_bug.cgi?id=55455
+
+ * Prevent a use-after-free during UXA shutdown due to inspecting
+   the glamor flags after the glamor interface had been freed.
+
+ * Prevent a crash combining TearFree and rotations.
+   https://bugs.freedesktop.org/show_bug.cgi?id=55527
+
+ * Correct a missing damage upload along PutImage after using the CPU bo
+   as a source for the GPU.
+   https://bugs.freedesktop.org/show_bug.cgi?id=55508
+
+ * Fix compilation for older glibc without O_CLOEXEC
+   https://bugs.freedesktop.org/show_bug.cgi?id=55577
+
+ * Fix out-of-tree builds failing to recompile the gen4 assemblies
+   https://bugs.freedesktop.org/show_bug.cgi?id=55645
+
+ * Fix non-standard build host configuration handling for intel-gen4asm
+   https://bugs.freedesktop.org/show_bug.cgi?id=55646
+
+ * Fix a potential batch buffer overflow when replacing the last BLT fill
+   operation with a copy
+   https://bugs.freedesktop.org/show_bug.cgi?id=55700
+
+ * Flush the render pipeline more frequently on Ironlake as not all
+   pipelined state changes are.
+   https://bugs.freedesktop.org/show_bug.cgi?id=51422
+
+ * Detect when we need to read the destination for the background raster
+   op during fallbacks.
+   https://bugs.freedesktop.org/show_bug.cgi?id=55810
+
+ * Avoid a potential deference of an invalid CPU mmap after doing an
+   inplace tiled upload.
+   https://bugs.freedesktop.org/show_bug.cgi?id=55812
+
+ * Prevent sign extension when packing the upload data for CopyPlane
+   https://bugs.freedesktop.org/show_bug.cgi?id=55823
+
+ * Fix some render corruption with a UDL slave output and pageflipping
+
+
 Release 2.20.9 (2012-09-29)
 ===========================
 And so it came to pass that a critical bug was uncovered in UXA. The
@@ -13,7 +73,7 @@ the issue.
 
 In other news:
 
-  * Prepare for xorg-1.4, the api is being tweaked again.
+  * Prepare for xorg-1.14, the api is being tweaked again.
 
   * Handle early FreeScreen in UXA.
     https://bugs.freedesktop.org/show_bug.cgi?id=55346
diff --git a/configure.ac b/configure.ac
index 79bba83..972d918 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-video-intel],
-        [2.20.9],
+        [2.20.10],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-video-intel])
 AC_CONFIG_SRCDIR([Makefile.am])

commit 877e9c57c788cb3d4db1e96e519b26ca5d542465
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Fri Oct 12 17:57:28 2012 +0100

    sna/overlay: Trim suggested BestSize to fit within the overlay constraints
    
    As the maximum reported image sizes are for the source image, we should
    be careful not to recommend the application use an output Window larger
    than can be handled by the overlay hardware. So shrink it to fit, whilst
    preserving the aspect ratio.
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/sna/sna_video_overlay.c b/src/sna/sna_video_overlay.c
index babdfc6..b73e9dd 100644
--- a/src/sna/sna_video_overlay.c
+++ b/src/sna/sna_video_overlay.c
@@ -285,12 +285,29 @@ sna_video_overlay_query_best_size(ScrnInfoPtr scrn,
                                  Bool motion,
                                  short vid_w, short vid_h,
                                  short drw_w, short drw_h,
-                                 unsigned int *p_w, unsigned int *p_h, pointer 
data)
+                                 unsigned int *p_w, unsigned int *p_h,
+                                 pointer data)
 {
-       if (vid_w > (drw_w << 1))
+       struct sna *sna = to_sna(scrn);
+       short max_w, max_h;
+
+       if (vid_w > (drw_w << 1) || vid_h > (drw_h << 1)){
                drw_w = vid_w >> 1;
-       if (vid_h > (drw_h << 1))
                drw_h = vid_h >> 1;
+       }
+
+       if (sna->kgem.gen < 21) {
+               max_w = IMAGE_MAX_WIDTH_LEGACY;
+               max_h = IMAGE_MAX_HEIGHT_LEGACY;
+       } else {
+               max_w = IMAGE_MAX_WIDTH;
+               max_h = IMAGE_MAX_HEIGHT;
+       }
+
+       while (drw_w > max_w || drw_h > max_h) {
+               drw_w >>= 1;
+               drw_h >>= 1;
+       }
 
        *p_w = drw_w;
        *p_h = drw_h;

commit 1ec41590c9d142a77a2fdcfcd9a762aca99d9d86
Author: Paulo Zanoni <paulo.r.zan...@intel.com>
Date:   Thu Oct 11 18:10:17 2012 -0300

    Fix possible_clones computation for shared encoders between outputs
    
    Libdrm's possible_clones is a mask of encoders. Xorg's possible_clones
    is a mask of outputs, so we just can't do the following:
    
      output->possible_clones = kencoder->possible_clones;
    
    This is a problem on Haswell because, at least with the current
    patches floating on the mailing list, there is more than one connector
    per encoder.
    
    This patch writes the code to properly translate libdrm's encoder mask
    into Xorg's output mask.
    
    Signed-off-by: Paulo Zanoni <paulo.r.zan...@intel.com>
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/intel_display.c b/src/intel_display.c
index b2a5904..d58e6e0 100644
--- a/src/intel_display.c
+++ b/src/intel_display.c
@@ -1435,7 +1435,6 @@ intel_output_init(ScrnInfoPtr scrn, struct intel_mode 
*mode, int num)
                intel_output_backlight_init(output);
 
        output->possible_crtcs = kencoder->possible_crtcs;
-       output->possible_clones = kencoder->possible_clones;
        output->interlaceAllowed = TRUE;
 
        intel_output->output = output;
@@ -1680,6 +1679,60 @@ drm_wakeup_handler(pointer data, int err, pointer p)
                drmHandleEvent(mode->fd, &mode->event_context);
 }
 
+static drmModeEncoderPtr
+intel_get_kencoder(struct intel_mode *mode, int num)
+{
+       struct intel_output *iterator;
+       int id = mode->mode_res->encoders[num];
+
+       list_for_each_entry(iterator, &mode->outputs, link)
+               if (iterator->mode_encoder->encoder_id == id)
+                       return iterator->mode_encoder;
+
+       return NULL;
+}
+
+/*
+ * Libdrm's possible_clones is a mask of encoders, Xorg's possible_clones is a
+ * mask of outputs. This function sets Xorg's possible_clones based on the
+ * values read from libdrm.
+ */
+static void
+intel_compute_possible_clones(ScrnInfoPtr scrn, struct intel_mode *mode)
+{
+       xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+       struct intel_output *intel_output, *clone;
+       drmModeEncoderPtr cloned_encoder;
+       uint32_t mask;
+       int i, j, k;
+       CARD32 possible_clones;
+
+       for (i = 0; i < config->num_output; i++) {
+               possible_clones = 0;
+               intel_output = config->output[i]->driver_private;
+
+               mask = intel_output->mode_encoder->possible_clones;
+               for (j = 0; mask != 0; j++, mask >>= 1) {
+
+                       if ((mask & 1) == 0)
+                               continue;
+
+                       cloned_encoder = intel_get_kencoder(mode, j);
+                       if (!cloned_encoder)
+                               continue;
+
+                       for (k = 0; k < config->num_output; k++) {
+                               clone = config->output[k]->driver_private;
+                               if (clone->mode_encoder->encoder_id ==
+                                   cloned_encoder->encoder_id)
+                                       possible_clones |= (1 << k);
+                       }
+               }
+
+               config->output[i]->possible_clones = possible_clones;
+       }
+}
+
 Bool intel_mode_pre_init(ScrnInfoPtr scrn, int fd, int cpp)
 {
        intel_screen_private *intel = intel_get_screen_private(scrn);
@@ -1716,6 +1769,8 @@ Bool intel_mode_pre_init(ScrnInfoPtr scrn, int fd, int 
cpp)
        for (i = 0; i < mode->mode_res->count_connectors; i++)
                intel_output_init(scrn, mode, i);
 
+       intel_compute_possible_clones(scrn, mode);
+
 #ifdef INTEL_PIXMAP_SHARING
        xf86ProviderSetup(scrn, NULL, "Intel");
 #endif
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index fc5cbfc..ed32375 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -2291,6 +2291,35 @@ cleanup_connector:
        drmModeFreeConnector(koutput);
 }
 
+/* The kernel reports possible encoder clones, whereas X uses a list of
+ * possible connector clones. This is works when we have a 1:1 mapping
+ * between encoders and connectors, but breaks for Haswell which has a pair
+ * of DP/HDMI connectors hanging off a single encoder.
+ */
+static void
+sna_mode_compute_possible_clones(ScrnInfoPtr scrn)
+{
+       xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+       unsigned clones[32] = { 0 };
+       int i, j;
+
+       assert(config->num_output <= 32);
+
+       /* Convert from encoder numbering to output numbering */
+       for (i = 0; i < config->num_output; i++) {
+               unsigned mask = config->output[i]->possible_clones;
+               for (j = 0; mask != 0; j++, mask >>= 1) {
+                       if ((mask & 1) == 0)
+                               continue;
+
+                       clones[j] |= 1 << i;
+               }
+       }
+
+       for (i = 0; i < config->num_output; i++)
+               config->output[i]->possible_clones = clones[i];
+}
+
 struct sna_visit_set_pixmap_window {
        PixmapPtr old, new;
 };
@@ -2574,6 +2603,9 @@ bool sna_mode_pre_init(ScrnInfoPtr scrn, struct sna *sna)
        for (i = 0; i < mode->kmode->count_connectors; i++)
                sna_output_init(scrn, mode, i);
 
+       if (!xf86IsEntityShared(scrn->entityList[0]))
+               sna_mode_compute_possible_clones(scrn);
+
 #if HAS_PIXMAP_SHARING
        xf86ProviderSetup(scrn, NULL, "Intel");
 #endif

commit 0b92a5a3062d73666279e17ac2d711314bcd8dfe
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Thu Oct 11 12:16:03 2012 +0100

    sna: Correct a bogus assertion after inplace PutImage
    
    If we are forced to use the GPU bo as the target because the CPU bo is
    busy, the priv->cpu flag is likely to remain set, so we need to clear it
    rather than fail the assertion that is false.
    
    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 4d6c798..a8a0c93 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -3553,7 +3553,6 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, 
RegionPtr region,
        if (upload_inplace(sna, pixmap, priv, region) &&
            sna_put_image_upload_blt(drawable, gc, region,
                                     x, y, w, h, bits, stride)) {
-               assert(priv->cpu == false);
                if (!DAMAGE_IS_ALL(priv->gpu_damage)) {
                        DBG(("%s: marking damage\n", __FUNCTION__));
                        if (region_subsumes_drawable(region, &pixmap->drawable))
@@ -3582,6 +3581,7 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, 
RegionPtr region,
 
                assert_pixmap_damage(pixmap);
                priv->clear = false;
+               priv->cpu = false;
                return true;
        }
 

commit c51aaa731e5cffc892e59730194ad7c98789b02b
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Thu Oct 11 11:36:00 2012 +0100

    sna/gen7: Replace bogus state tracking assertion
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index 37d0359..4d94c80 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -189,7 +189,8 @@ static const struct blendinfo {
 #define GEN7_BLEND_STATE_PADDED_SIZE   ALIGN(sizeof(struct gen7_blend_state), 
64)
 
 #define BLEND_OFFSET(s, d) \
-       (((s) * GEN7_BLENDFACTOR_COUNT + (d)) * GEN7_BLEND_STATE_PADDED_SIZE)
+       ((d != GEN7_BLENDFACTOR_ZERO) << 15 | \
+        (((s) * GEN7_BLENDFACTOR_COUNT + (d)) * GEN7_BLEND_STATE_PADDED_SIZE))
 
 #define NO_BLEND BLEND_OFFSET(GEN7_BLENDFACTOR_ONE, GEN7_BLENDFACTOR_ZERO)
 #define CLEAR BLEND_OFFSET(GEN7_BLENDFACTOR_ZERO, GEN7_BLENDFACTOR_ZERO)
@@ -213,7 +214,8 @@ static const struct blendinfo {
                       SAMPLER_FILTER_NEAREST, SAMPLER_EXTEND_NONE)
 
 #define GEN7_SAMPLER(f) (((f) >> 16) & 0xfff0)
-#define GEN7_BLEND(f) (((f) >> 0) & 0xfff0)
+#define GEN7_BLEND(f) (((f) >> 0) & 0x7ff0)
+#define GEN7_READS_DST(f) (((f) >> 15) & 1)
 #define GEN7_KERNEL(f) (((f) >> 16) & 0xf)
 #define GEN7_VERTEX(f) (((f) >> 0) & 0xf)
 #define GEN7_SET_FLAGS(S, B, K, V)  (((S) | (K)) << 16 | ((B) | (V)))
@@ -1059,8 +1061,7 @@ gen7_emit_state(struct sna *sna,
        if (need_stall)
                gen7_emit_pipe_stall(sna);
 
-       sna->render_state.gen7.emit_flush =
-               GEN7_BLEND(op->u.gen7.flags) != NO_BLEND;
+       sna->render_state.gen7.emit_flush = GEN7_READS_DST(op->u.gen7.flags);
 }
 
 static void gen7_magic_ca_pass(struct sna *sna,
@@ -3327,7 +3328,7 @@ gen7_emit_copy_state(struct sna *sna,
                offset = sna->render_state.gen7.surface_table;
        }
 
-       assert(GEN7_BLEND(op->u.gen7.flags) == NO_BLEND);
+       assert(!GEN7_READS_DST(op->u.gen7.flags));
        gen7_emit_state(sna, op, offset);
 }
 

commit a56fa2fb4aad172be905c3abeefd987804553809
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Thu Oct 11 10:55:34 2012 +0100

    sna: Rearrange switch to suppress a compiler warning in sna_copy_plane_blt()
    
    Hide the impossible default case so that static analyzers are not
    confused.
    
    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 4f204f1..4d6c798 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -6381,6 +6381,8 @@ sna_copy_plane_blt(DrawablePtr source, DrawablePtr 
drawable, GCPtr gc,
                                } while (--bh);
                                break;
                        }
+               default:
+                       assert(0);
                case 8:
                        {
                                uint8_t *src = src_pixmap->devPrivate.ptr;
@@ -6414,9 +6416,6 @@ sna_copy_plane_blt(DrawablePtr source, DrawablePtr 
drawable, GCPtr gc,
                                } while (--bh);
                                break;
                        }
-               default:
-                       assert(0);
-                       return;
                }
 
                b = sna->kgem.batch + sna->kgem.nbatch;

commit 94a98d1c472ce0fc7601421a2bcfbd0524d2bc93
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Thu Oct 11 08:42:21 2012 +0100

    sna: Limit available space for gen2
    
    Since pre-g33 chipsets impose massive alignment restrictions on objects
    within the aperture we need to further restrict the amount of available
    space to be sure we have sufficient room to accommodate the alignment.
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 8382a0b..46c898f 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -888,6 +888,11 @@ void kgem_init(struct kgem *kgem, int fd, struct 
pci_device *dev, int gen)
        kgem->aperture_total = aperture.aper_size;
        kgem->aperture_high = aperture.aper_size * 3/4;
        kgem->aperture_low = aperture.aper_size * 1/3;
+       if (gen < 33) {
+               /* Severe alignment penalties */
+               kgem->aperture_high /= 2;
+               kgem->aperture_low /= 2;
+       }
        DBG(("%s: aperture low=%d [%d], high=%d [%d]\n", __FUNCTION__,
             kgem->aperture_low, kgem->aperture_low / (1024*1024),
             kgem->aperture_high, kgem->aperture_high / (1024*1024)));

commit d3ae85dd01952ecff7b780e30a43571146aa61ea
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Wed Oct 10 17:27:38 2012 +0100

    sna: Use high/low watermarks for fenced aperture counting
    
    This helps with fitting larger operations into the small apertures of
    gen2, which due to the lax accounting could trigger ENOSPC.
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 4b29dcb..8382a0b 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -3688,27 +3688,36 @@ bool kgem_check_bo_fenced(struct kgem *kgem, struct 
kgem_bo *bo)
 
                        size = kgem->aperture_fenced;
                        size += kgem_bo_fenced_size(kgem, bo);
-                       if (size > kgem->aperture_mappable)
+                       if (4*size > 3*kgem->aperture_mappable)
                                return false;
                }
 
                return true;
        }
 
-       if (kgem->aperture > kgem->aperture_low)
+       if (kgem->nexec >= KGEM_EXEC_SIZE(kgem) - 1)
                return false;
 
-       if (kgem->nexec >= KGEM_EXEC_SIZE(kgem) - 1)
+       if (kgem->aperture > kgem->aperture_low)
                return false;
 
-       if (kgem->gen < 40 &&
-           bo->tiling != I915_TILING_NONE &&
-           kgem->nfence >= kgem->fence_max)
+       if (kgem->aperture + num_pages(bo) > kgem->aperture_high)
                return false;
 
-       size = kgem->aperture;
-       size += num_pages(bo);
-       return size <= kgem->aperture_high;
+       if (kgem->gen < 40 && bo->tiling != I915_TILING_NONE) {
+               if (kgem->nfence >= kgem->fence_max)
+                       return false;
+
+               if (2*kgem->aperture_fenced > kgem->aperture_mappable)
+                       return false;
+
+               size = kgem->aperture_fenced;
+               size += kgem_bo_fenced_size(kgem, bo);
+               if (4*size > 3*kgem->aperture_mappable)
+                       return false;
+       }
+
+       return true;
 }
 
 bool kgem_check_many_bo_fenced(struct kgem *kgem, ...)
@@ -3748,23 +3757,27 @@ bool kgem_check_many_bo_fenced(struct kgem *kgem, ...)
        }
        va_end(ap);
 
-       if (fenced_size + kgem->aperture_fenced > kgem->aperture_mappable)
-               return false;
+       if (num_fence) {
+               if (kgem->nfence + num_fence > kgem->fence_max)
+                       return false;
 
-       if (kgem->nfence + num_fence > kgem->fence_max)
-               return false;
+               if (2*kgem->aperture_fenced > kgem->aperture_mappable)
+                       return false;
 
-       if (!num_pages)
-               return true;
+               if (4*(fenced_size + kgem->aperture_fenced) > 
3*kgem->aperture_mappable)
+                       return false;
+       }
 
-       if (kgem->aperture > kgem->aperture_low)
-               return false;
+       if (num_pages) {
+               if (kgem->aperture > kgem->aperture_low)
+                       return false;
 
-       if (num_pages + kgem->aperture > kgem->aperture_high)
-               return false;
+               if (num_pages + kgem->aperture > kgem->aperture_high)
+                       return false;
 
-       if (kgem->nexec + num_exec >= KGEM_EXEC_SIZE(kgem))
-               return false;
+               if (kgem->nexec + num_exec >= KGEM_EXEC_SIZE(kgem))
+                       return false;
+       }
 
        return true;
 }

commit dadffd0061e2b14db397608e3cedfe9c76e546c8
Author: Dave Airlie <airl...@redhat.com>
Date:   Thu Oct 11 14:30:29 2012 +1000

    intel: fix fullscreen damage posting on pageflip
    
    While playing with MPX and sw cursor I noticed page flips won't
    end up misrendering some bits, so the sw cursor was replacing the
    bits on the wrong pixmap.
    
    Fix the damage handling to be correct and append damage before swapping
    the pointers and process damage after.
    
    This fixes misrendering with MPX cursors under a fullscreen compositor,
    that pageflips.
    
    Signed-off-by: Dave Airlie <airl...@redhat.com>
    [ickle: The secret is that damage is sometimes reported before the
    rendering in DamageRegionAppend, and sometimes afterwards in
    DamageRegionProcessPending. For instance, the software cursor operates
    prior to being rendered over.]
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/intel_dri.c b/src/intel_dri.c
index 64cb567..867a465 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -725,6 +725,17 @@ static struct intel_pixmap *
 intel_exchange_pixmap_buffers(struct intel_screen_private *intel, PixmapPtr 
front, PixmapPtr back)
 {
        struct intel_pixmap *new_front, *new_back;
+       RegionRec region;
+
+       /* Post damage on the front buffer so that listeners, such
+        * as DisplayLink know take a copy and shove it over the USB.
+        * also for sw cursors.
+        */
+       region.extents.x1 = region.extents.y1 = 0;
+       region.extents.x2 = front->drawable.width;
+       region.extents.y2 = front->drawable.height;
+       region.data = NULL;
+       DamageRegionAppend(&front->drawable, &region);
 
        new_front = intel_get_pixmap_private(back);
        new_back = intel_get_pixmap_private(front);
@@ -735,19 +746,7 @@ intel_exchange_pixmap_buffers(struct intel_screen_private 
*intel, PixmapPtr fron
 
        intel_glamor_exchange_buffers(intel, front, back);
 
-       /* Post damage on the new front buffer so that listeners, such
-        * as DisplayLink know take a copy and shove it over the USB.
-        */
-       {
-               RegionRec region;
-
-               region.extents.x1 = region.extents.y1 = 0;
-               region.extents.x2 = front->drawable.width;
-               region.extents.y2 = front->drawable.height;
-               region.data = NULL;
-               DamageRegionAppend(&front->drawable, &region);
-               DamageRegionProcessPending(&front->drawable);
-       }
+       DamageRegionProcessPending(&front->drawable);
 
        return new_front;
 }
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index 2fc3af2..15ac46a 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -430,6 +430,16 @@ static void set_bo(PixmapPtr pixmap, struct kgem_bo *bo)
        struct sna_pixmap *priv = sna_pixmap(pixmap);
        RegionRec region;
 
+       /* Post damage on the new front buffer so that listeners, such
+        * as DisplayLink know take a copy and shove it over the USB,
+        * also for software cursors and the like.
+        */
+       region.extents.x1 = region.extents.y1 = 0;
+       region.extents.x2 = pixmap->drawable.width;
+       region.extents.y2 = pixmap->drawable.height;
+       region.data = NULL;
+       DamageRegionAppend(&pixmap->drawable, &region);
+
        sna_damage_all(&priv->gpu_damage,
                       pixmap->drawable.width,
                       pixmap->drawable.height);
@@ -446,14 +456,6 @@ static void set_bo(PixmapPtr pixmap, struct kgem_bo *bo)
        if (bo->domain != DOMAIN_GPU)
                bo->domain = DOMAIN_NONE;
 
-       /* Post damage on the new front buffer so that listeners, such
-        * as DisplayLink know take a copy and shove it over the USB.
-        */
-       region.extents.x1 = region.extents.y1 = 0;
-       region.extents.x2 = pixmap->drawable.width;
-       region.extents.y2 = pixmap->drawable.height;
-       region.data = NULL;
-       DamageRegionAppend(&pixmap->drawable, &region);
        DamageRegionProcessPending(&pixmap->drawable);
 }
 
@@ -618,15 +620,17 @@ sna_dri_copy_to_front(struct sna *sna, DrawablePtr draw, 
RegionPtr region,
                boxes = &clip.extents;
                n = 1;
        }
+       pixman_region_translate(region, dx, dy);
+       DamageRegionAppend(&pixmap->drawable, region);
        if (wedged(sna)) {
                sna_dri_copy_fallback(sna, draw->bitsPerPixel,
-                                     src_bo, -draw->x, -draw->y,
-                                     dst_bo, dx, dy,
+                                     src_bo, -draw->x-dx, -draw->y-dy,
+                                     dst_bo, 0, 0,
                                      boxes, n);
        } else {
                sna->render.copy_boxes(sna, GXcopy,
-                                      (PixmapPtr)draw, src_bo, -draw->x, 
-draw->y,
-                                      pixmap, dst_bo, dx, dy,
+                                      (PixmapPtr)draw, src_bo, -draw->x-dx, 
-draw->y-dy,
+                                      pixmap, dst_bo, 0, 0,
                                       boxes, n, COPY_LAST);
 
                DBG(("%s: flushing? %d\n", __FUNCTION__, flush));
@@ -637,8 +641,6 @@ sna_dri_copy_to_front(struct sna *sna, DrawablePtr draw, 
RegionPtr region,
                }
        }
 
-       pixman_region_translate(region, dx, dy);
-       DamageRegionAppend(&pixmap->drawable, region);
        DamageRegionProcessPending(&pixmap->drawable);
 
        if (clip.data)

commit a1ea19a3edaac6e1e5d240b75b7c5fdcfea0e0a8
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Wed Oct 10 23:20:13 2012 +0100

    sna: Prevent sign-extension when manipulating strides
    
    Reported-by: Prit Laes <pl...@plaes.org>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55823
    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 3973c9d..4f204f1 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -6318,7 +6318,7 @@ sna_copy_plane_blt(DrawablePtr source, DrawablePtr 
drawable, GCPtr gc,
                case 32:
                        {
                                uint32_t *src = src_pixmap->devPrivate.ptr;
-                               uint32_t src_stride = 
src_pixmap->devKind/sizeof(uint32_t);
+                               int src_stride = 
src_pixmap->devKind/sizeof(uint32_t);
                                uint8_t *dst = ptr;
 
                                src += (box->y1 + sy) * src_stride;
@@ -6351,7 +6351,7 @@ sna_copy_plane_blt(DrawablePtr source, DrawablePtr 
drawable, GCPtr gc,
                case 16:
                        {
                                uint16_t *src = src_pixmap->devPrivate.ptr;
-                               uint16_t src_stride = 
src_pixmap->devKind/sizeof(uint16_t);
+                               int src_stride = 
src_pixmap->devKind/sizeof(uint16_t);
                                uint8_t *dst = ptr;
 
                                src += (box->y1 + sy) * src_stride;
@@ -6384,7 +6384,7 @@ sna_copy_plane_blt(DrawablePtr source, DrawablePtr 
drawable, GCPtr gc,
                case 8:
                        {
                                uint8_t *src = src_pixmap->devPrivate.ptr;
-                               uint8_t src_stride = 
src_pixmap->devKind/sizeof(uint8_t);
+                               int src_stride = 
src_pixmap->devKind/sizeof(uint8_t);
                                uint8_t *dst = ptr;
 
                                src += (box->y1 + sy) * src_stride;

commit d73f5b5bb1a81421f1fdc3ac3b460a8ad90be0ad
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Tue Oct 9 19:41:10 2012 +0100

    sna/gen6+: Initialize the damage for fill-boxes
    
    In case we need to redirect the rendering for a large render target, we
    need to initialize the damage pointer.
    
    Reported-by: Clemens Eisserer <linuxhi...@gmail.com>
    Bugzilla: ttps://bugs.freedesktop.org/show_bug.cgi?id=55812
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c
index 4c4271e..7c303f4 100644
--- a/src/sna/gen3_render.c
+++ b/src/sna/gen3_render.c
@@ -4397,6 +4397,7 @@ gen3_render_fill_boxes(struct sna *sna,
        tmp.dst.height = dst->drawable.height;
        tmp.dst.format = format;
        tmp.dst.bo = dst_bo;
+       tmp.damage = NULL;
        tmp.floats_per_vertex = 2;
        tmp.floats_per_rect = 6;
        tmp.rb_reversed = 0;
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index 4990062..fd7f295 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -3713,6 +3713,7 @@ gen6_render_fill_boxes(struct sna *sna,
        tmp.dst.format = format;
        tmp.dst.bo = dst_bo;
        tmp.dst.x = tmp.dst.y = 0;
+       tmp.damage = NULL;
 
        sna_render_composite_redirect_init(&tmp);
        if (too_large(dst->drawable.width, dst->drawable.height)) {
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index 376556a..37d0359 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -3797,6 +3797,7 @@ gen7_render_fill_boxes(struct sna *sna,
        tmp.dst.format = format;
        tmp.dst.bo = dst_bo;
        tmp.dst.x = tmp.dst.y = 0;
+       tmp.damage = NULL;
 
        sna_render_composite_redirect_init(&tmp);
        if (too_large(dst->drawable.width, dst->drawable.height)) {

commit ae6ae91baa0574a7a23ab76afac5e2d827c49c20
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Tue Oct 9 18:36:59 2012 +0100

    sna: Check the map exists before trying to release it
    
    Reported-by: Clemens Eisserer <linuxhi...@gmail.com>
    Bugzilla: ttps://bugs.freedesktop.org/show_bug.cgi?id=55812
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 6f33ed5..4b29dcb 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -4118,7 +4118,7 @@ retry:
        }
 
        VG(VALGRIND_MAKE_MEM_DEFINED(mmap_arg.addr_ptr, bytes(bo)));
-       if (bo->domain == DOMAIN_CPU) {
+       if (bo->map && bo->domain == DOMAIN_CPU) {
                DBG(("%s: discarding GTT vma for %d\n", __FUNCTION__, 
bo->handle));
                kgem_bo_release_map(kgem, bo);
        }

commit 8bbfa88a8691f6c1b2903090c3cd3159126ef563
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Tue Oct 9 17:26:39 2012 +0100

    sna: Also check the bg rrop for reads when deciding upon fallback placement
    
    Reported-and-tested-by: chr....@gmx.net
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55810
    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 3d8392f..3973c9d 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2338,7 +2338,7 @@ drawable_gc_flags(DrawablePtr draw, GCPtr gc, bool 
partial)
                return MOVE_READ | MOVE_WRITE;
        }
 
-       if (fb_gc(gc)->and) {
+       if (fb_gc(gc)->and | fb_gc(gc)->bgand) {
                DBG(("%s: read due to rrop %d:%x\n",
                     __FUNCTION__, gc->alu, (unsigned)fb_gc(gc)->and));
                return MOVE_READ | MOVE_WRITE;

commit f8a005d1f984382272ad10cabd88c0422d4e76e8
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Tue Oct 9 00:23:24 2012 +0100

    sna: Pass the region, not its pointer, when moving the GC to the CPU
    
    Fortunately, the sgc->region was not used along that particular fallback
    path.
    
    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 862b296..3d8392f 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -5011,7 +5011,7 @@ sna_fallback_copy_boxes(DrawablePtr src, DrawablePtr dst, 
GCPtr gc,
             region->extents.x2, region->extents.y2,
             dx, dy, gc->alu));
 
-       if (!sna_gc_move_to_cpu(gc, dst, &region))
+       if (!sna_gc_move_to_cpu(gc, dst, region))
                return;
 
        if (src == dst ||

commit fb5205a86da09b344dbc20598655e917c263125c
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Mon Oct 8 09:12:33 2012 +0100

    sna/gen5: Flush pipelined ops when changing state
    
    When is a pipelined operation, not pipelined? That is the mystery posed
    by our hardware!
    
    Reported-by: Clemens Eisserer <linuxhi...@gmail.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51422
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c
index afd729e..5d55937 100644
--- a/src/sna/gen5_render.c
+++ b/src/sna/gen5_render.c
@@ -1215,12 +1215,12 @@ gen5_align_vertex(struct sna *sna, const struct 
sna_composite_op *op)
        }
 }
 
-static void
+static bool
 gen5_emit_binding_table(struct sna *sna, uint16_t offset)
 {
        if (!DBG_NO_STATE_CACHE &&
            sna->render_state.gen5.surface_table == offset)
-               return;
+               return false;
 
        sna->render_state.gen5.surface_table = offset;
 
@@ -1232,6 +1232,8 @@ gen5_emit_binding_table(struct sna *sna, uint16_t offset)
        OUT_BATCH(0);           /* sf */
        /* Only the PS uses the binding table */
        OUT_BATCH(offset*4);
+
+       return true;
 }
 
 static bool
@@ -1281,6 +1283,7 @@ gen5_emit_drawing_rectangle(struct sna *sna, const struct 
sna_composite_op *op)
            sna->render_state.gen5.drawrect_limit == limit &&
            sna->render_state.gen5.drawrect_offset == offset)
                return;
+
        sna->render_state.gen5.drawrect_offset = offset;
        sna->render_state.gen5.drawrect_limit = limit;
 
@@ -1377,15 +1380,19 @@ gen5_emit_state(struct sna *sna,
                const struct sna_composite_op *op,
                uint16_t offset)
 {
+       bool flush;
+
        /* drawrect must be first for Ironlake BLT workaround */
        gen5_emit_drawing_rectangle(sna, op);
 
-       gen5_emit_binding_table(sna, offset);
-       if (gen5_emit_pipelined_pointers(sna, op, op->op, op->u.gen5.wm_kernel))
+       flush = gen5_emit_binding_table(sna, offset);
+       if (gen5_emit_pipelined_pointers(sna, op, op->op, 
op->u.gen5.wm_kernel)) {
                gen5_emit_urb(sna);
+               flush = true;
+       }
        gen5_emit_vertex_elements(sna, op);
 
-       if (kgem_bo_is_dirty(op->src.bo) || kgem_bo_is_dirty(op->mask.bo)) {
+       if (flush || kgem_bo_is_dirty(op->src.bo) || 
kgem_bo_is_dirty(op->mask.bo)) {
                OUT_BATCH(MI_FLUSH);
                kgem_clear_dirty(&sna->kgem);
                kgem_bo_mark_dirty(op->dst.bo);

commit bed64c998df538046d77eeea90598f48077dab5f
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Mon Oct 8 00:13:03 2012 +0100

    sna: Fix check_reloc_and_exec typo
    
    Garbage xorg includes hiding genuine compiler warnings ftl once again.
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/sna/sna_io.c b/src/sna/sna_io.c
index 367bfde..69d920c 100644
--- a/src/sna/sna_io.c
+++ b/src/sna/sna_io.c
@@ -379,7 +379,7 @@ fallback:
        }
 
        kgem_set_mode(kgem, KGEM_BLT);
-       if (!kgem_check_exec_and_reloc(kgem, 2) ||
+       if (!kgem_check_reloc_and_exec(kgem, 2) ||
            !kgem_check_batch(kgem, 8) ||
            !kgem_check_many_bo_fenced(kgem, dst_bo, src_bo, NULL)) {
                _kgem_submit(kgem);
@@ -1172,7 +1172,7 @@ tile:
        }
 
        kgem_set_mode(kgem, KGEM_BLT);
-       if (!kgem_check_exec_and_reloc(kgem, 2) ||
+       if (!kgem_check_reloc_and_exec(kgem, 2) ||
            !kgem_check_batch(kgem, 8) ||
            !kgem_check_bo_fenced(kgem, dst_bo)) {
                _kgem_submit(kgem);

commit 2ac3776be85d857a57ce7b742e52cd6091d2befb
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Sun Oct 7 22:41:25 2012 +0100

    sna: Check that we have sufficient space for a copy when replacing a fill
    
    Reported-by: Timo Kamph <t...@kamph.org>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55700
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c


-- 
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/e1to6ot-0005lk...@vasks.debian.org

Reply via email to