NEWS                          |   28 +++++++
 configure.ac                  |   16 +++-
 src/compat-api.h              |    1 
 src/intel.h                   |    7 -
 src/intel_display.c           |   30 ++++---
 src/intel_dri.c               |   13 ++-
 src/intel_driver.c            |    5 -
 src/intel_module.c            |   18 ++++
 src/intel_options.h           |    3 
 src/legacy/i810/i810_driver.c |    2 
 src/sna/blt.c                 |  117 +++++++++++++++++++++++++++++
 src/sna/fb/fb.h               |    1 
 src/sna/fb/fbgc.c             |    6 +
 src/sna/gen3_render.c         |    8 --
 src/sna/gen5_render.c         |   12 +--
 src/sna/gen6_render.c         |    8 --
 src/sna/gen7_render.c         |   13 +--
 src/sna/kgem.c                |   67 ++++++++++++++++
 src/sna/kgem.h                |   11 ++
 src/sna/sna.h                 |    8 ++
 src/sna/sna_accel.c           |  148 ++++++++++++-------------------------
 src/sna/sna_blt.c             |   29 ++++---
 src/sna/sna_composite.c       |    6 +
 src/sna/sna_display.c         |   42 ++++++++--
 src/sna/sna_dri.c             |  167 +++++++++++++++++++++---------------------
 src/sna/sna_driver.c          |    5 -
 src/sna/sna_io.c              |   98 +++++++++++++++++++++++-
 src/sna/sna_render_inline.h   |   19 ++++
 src/sna/sna_video.c           |   33 ++++----
 uxa/uxa-priv.h                |    1 
 30 files changed, 632 insertions(+), 290 deletions(-)

New commits:
commit a192f8cbc238d84e058b01b7682abe7ef09d3508
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Sat Sep 29 10:51:00 2012 +0100

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

diff --git a/NEWS b/NEWS
index 62ec266..2cc2353 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,31 @@
+Release 2.20.9 (2012-09-29)
+===========================
+And so it came to pass that a critical bug was uncovered in UXA. The
+kernel does not like to pageflip when the pipe is off, yet due to the
+delayed nature of a pageflip and the relaxed checking performed by UXA,
+we could request a pageflip after turning off the display (DPMS). The
+kernel rejected that pageflip and the error handling path failed to
+restore sanity, and when the screen came back it was stuck on the image
+seen before it went to sleep. (Note that there are also some related
+kernel bugs, but this update should prevent the most conspicious of the
+freezes.) Many thanks to Timo Aaltonen for his efforts in tracking down
+the issue.
+
+In other news:
+
+  * Prepare for xorg-1.4, the api is being tweaked again.
+
+  * Handle early FreeScreen in UXA.
+    https://bugs.freedesktop.org/show_bug.cgi?id=55346
+
+  * Reenable XvMC support
+
+  * Do not replace the GPU bo when uploading into the shadow/CPU copy
+    https://bugs.freedesktop.org/show_bug.cgi?id=54978
+
+  * Fix use of an uninitialised GC when drawing glyphs to a depth=1 pixmap
+
+
 Release 2.20.8 (2012-09-16)
 ===========================
 Another new small feature, another new release. And a few more bugs
diff --git a/configure.ac b/configure.ac
index 1cd5a92..c961d85 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-video-intel],
-        [2.20.8],
+        [2.20.9],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-video-intel])
 AC_CONFIG_SRCDIR([Makefile.am])

commit 16860d448f11ba405050bd1ff02dc63a4b26280c
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Sat Sep 29 10:40:51 2012 +0100

    uxa: Only destroy the bufmgr if it exists
    
    Be wary in case the Screen is destroy before we initialise bufmgr.
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/intel_driver.c b/src/intel_driver.c
index f338a36..65a5008 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -328,6 +328,9 @@ static int intel_init_bufmgr(intel_screen_private *intel)
 
 static void intel_bufmgr_fini(intel_screen_private *intel)
 {
+       if (intel->bufmgr == NULL)
+               return;
+
        drm_intel_bo_unreference(intel->wa_scratch_bo);
        drm_intel_bufmgr_destroy(intel->bufmgr);
 }

commit 13f7a9e267fbefd3326569e89b840bef31d77996
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Fri Sep 28 09:25:12 2012 +0100

    sna: Restore LLC cache level after using a buffer for scanout (uncached)
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 0ea14f0..7826aad 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1354,6 +1354,10 @@ static void kgem_bo_clear_scanout(struct kgem *kgem, 
struct kgem_bo *bo)
        bo->needs_flush = true;
        bo->flush = false;
        bo->reusable = true;
+
+       if (kgem->has_llc &&
+           gem_set_cacheing(kgem->fd, bo->handle, SNOOPED))
+               bo->reusable = false;
 }
 
 static void _kgem_bo_delete_buffer(struct kgem *kgem, struct kgem_bo *bo)

commit 8bfd31e9bb13bcb7f12e4147bec0da87b8e87dde
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Thu Sep 27 18:12:11 2012 +0100

    sna/dri: Improve handling of flipping with no outputs
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index 88dec3a..676636a 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -87,7 +87,7 @@ struct sna_dri_frame_event {
        unsigned int fe_tv_sec;
        unsigned int fe_tv_usec;
 
-       struct {
+       struct dri_bo {
                struct kgem_bo *bo;
                uint32_t name;
        } old_front, next_front, cache;
@@ -956,7 +956,7 @@ sna_dri_frame_event_info_free(struct sna *sna,
        free(info);
 }
 
-static bool
+static void
 sna_dri_page_flip(struct sna *sna, struct sna_dri_frame_event *info)
 {
        struct kgem_bo *bo = get_private(info->back)->bo;
@@ -964,10 +964,9 @@ sna_dri_page_flip(struct sna *sna, struct 
sna_dri_frame_event *info)
        DBG(("%s()\n", __FUNCTION__));
 
        assert(sna_pixmap_get_buffer(sna->front) == info->front);
+       assert(get_drawable_pixmap(info->draw)->drawable.height * bo->pitch <= 
kgem_bo_size(bo));
 
        info->count = sna_page_flip(sna, bo, info, info->pipe);
-       if (info->count == 0)
-               return false;
 
        info->old_front.name = info->front->name;
        info->old_front.bo = get_private(info->front)->bo;
@@ -976,7 +975,6 @@ sna_dri_page_flip(struct sna *sna, struct 
sna_dri_frame_event *info)
 
        info->front->name = info->back->name;
        get_private(info->front)->bo = bo;
-       return true;
 }
 
 static bool
@@ -1261,8 +1259,8 @@ void sna_dri_vblank_handler(struct sna *sna, struct 
drm_event_vblank *event)
        switch (info->type) {
        case DRI2_FLIP:
                /* If we can still flip... */
-               if (can_flip(sna, draw, info->front, info->back) &&
-                   sna_dri_page_flip(sna, info)) {
+               if (can_flip(sna, draw, info->front, info->back)) {
+                       sna_dri_page_flip(sna, info);
                        info->back->name = info->old_front.name;
                        get_private(info->back)->bo = info->old_front.bo;
                        info->old_front.bo = NULL;
@@ -1321,40 +1319,23 @@ done:
        sna_dri_frame_event_info_free(sna, draw, info);
 }
 
-static int
+static void
 sna_dri_flip_continue(struct sna *sna, struct sna_dri_frame_event *info)
 {
-       struct kgem_bo *bo;
-       int name;
+       struct dri_bo tmp;
 
        DBG(("%s()\n", __FUNCTION__));
 
        assert(sna_pixmap_get_buffer(get_drawable_pixmap(info->draw)) == 
info->front);
 
-       name = info->back->name;
-       bo = get_private(info->back)->bo;
-       assert(get_drawable_pixmap(info->draw)->drawable.height * bo->pitch <= 
kgem_bo_size(bo));
+       tmp = info->old_front;
 
-       info->count = sna_page_flip(sna, bo, info, info->pipe);
-       if (info->count == 0)
-               return false;
+       sna_dri_page_flip(sna, info);
 
-       set_bo(sna->front, bo);
-
-       get_private(info->back)->bo = info->old_front.bo;
-       info->back->name = info->old_front.name;
-
-       info->old_front.name = info->front->name;
-       info->old_front.bo = get_private(info->front)->bo;
-
-       info->front->name = name;
-       get_private(info->front)->bo = bo;
+       get_private(info->back)->bo = tmp.bo;
+       info->back->name = tmp.name;
 
        info->next_front.name = 0;
-
-       sna->dri.flip_pending = info;
-
-       return true;
 }
 
 static void sna_dri_flip_event(struct sna *sna,
@@ -1392,13 +1373,17 @@ static void sna_dri_flip_event(struct sna *sna,
                        DBG(("%s: flip chain complete\n", __FUNCTION__));
                        sna_dri_frame_event_info_free(sna, flip->draw, flip);
                } else if (flip->draw &&
-                          can_flip(sna, flip->draw, flip->front, flip->back) &&
-                          sna_dri_flip_continue(sna, flip)) {
+                          can_flip(sna, flip->draw, flip->front, flip->back)) {
+                       sna_dri_flip_continue(sna, flip);
                        DRI2SwapComplete(flip->client, flip->draw,
                                         0, 0, 0,
                                         DRI2_FLIP_COMPLETE,
                                         flip->client ? flip->event_complete : 
NULL,
                                         flip->event_data);
+                       if (flip->count)
+                               sna->dri.flip_pending = flip;
+                       else
+                               sna_dri_frame_event_info_free(sna, flip->draw, 
flip);
                } else {
                        DBG(("%s: no longer able to flip\n", __FUNCTION__));
 
@@ -1513,8 +1498,16 @@ sna_dri_schedule_flip(ClientPtr client, DrawablePtr 
draw, DRI2BufferPtr front,
        VG_CLEAR(vbl);
 
        pipe = sna_dri_get_pipe(draw);
-       if (pipe == -1)
-               return false;
+       if (pipe == -1) {
+               /* XXX WARN_ON(sna->dri.flip_pending) ? */
+               if (sna->dri.flip_pending == NULL) {
+                       sna_dri_exchange_buffers(draw, front, back);
+                       DRI2SwapComplete(client, draw, 0, 0, 0,
+                                       DRI2_EXCHANGE_COMPLETE, func, data);
+                       return true;
+               } else
+                       return false;
+       }
 
        /* Truncate to match kernel interfaces; means occasional overflow
         * misses, but that's generally not a big deal */
@@ -1560,13 +1553,19 @@ sna_dri_schedule_flip(ClientPtr client, DrawablePtr 
draw, DRI2BufferPtr front,
                sna_dri_reference_buffer(front);
                sna_dri_reference_buffer(back);
 
-               if (!sna_dri_page_flip(sna, info)) {
-                       DBG(("%s: failed to queue page flip\n", __FUNCTION__));
-                       sna_dri_frame_event_info_free(sna, draw, info);
-                       return false;
-               }
+               sna_dri_page_flip(sna, info);
+
+               if (info->count == 0) {
+                       info->back->name = info->old_front.name;
+                       get_private(info->back)->bo = info->old_front.bo;
+                       info->old_front.bo = NULL;
 
-               if (type != DRI2_FLIP) {
+                       DRI2SwapComplete(info->client, draw, 0, 0, 0,
+                                        DRI2_EXCHANGE_COMPLETE,
+                                        info->event_complete,
+                                        info->event_data);
+                       sna_dri_frame_event_info_free(sna, draw, info);
+               } else if (type != DRI2_FLIP) {
                        get_private(info->back)->bo =
                                kgem_create_2d(&sna->kgem,
                                               draw->width,
@@ -2011,10 +2010,7 @@ blit:
                sna_dri_reference_buffer(front);
                sna_dri_reference_buffer(back);
 
-               if (!sna_dri_page_flip(sna, info)) {
-                       sna_dri_frame_event_info_free(sna, draw, info);
-                       goto blit;
-               }
+               sna_dri_page_flip(sna, info);
 
                info->next_front.name = info->front->name;
                info->next_front.bo = get_private(info->front)->bo;

commit dddb6e4e63d5cc8b2a1f2ae3ff287922d30460b9
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Thu Sep 27 17:17:30 2012 +0100

    sna: Attempt to restore the current mode if pipe is disabled on DPMS on
    
    If we attempt to power up the pipe through a DPMS request, but it was
    previously disabled due to an error, first try re-enabling.
    
    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 3c41a2a..61d1a9f 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -787,6 +787,8 @@ sna_crtc_disable(xf86CrtcPtr crtc)
                kgem_bo_destroy(&sna->kgem, sna_crtc->bo);
                sna_crtc->bo = NULL;
        }
+
+       sna_crtc->dpms_mode = DPMSModeOff;
 }
 
 static void update_flush_interval(struct sna *sna)
@@ -824,15 +826,6 @@ static void update_flush_interval(struct sna *sna)
               max_vrefresh, sna->vblank_interval));
 }
 
-static void
-sna_crtc_dpms(xf86CrtcPtr crtc, int mode)
-{
-       DBG(("%s(pipe %d, dpms mode -> %d):= active=%d\n",
-            __FUNCTION__, to_sna_crtc(crtc)->pipe, mode, mode == DPMSModeOn));
-       to_sna_crtc(crtc)->dpms_mode = mode;
-       update_flush_interval(to_sna(crtc->scrn));
-}
-
 void sna_mode_disable_unused(struct sna *sna)
 {
        xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(sna->scrn);
@@ -1289,6 +1282,28 @@ retry: /* Attach per-crtc pixmap or direct */
        return TRUE;
 }
 
+static void
+sna_crtc_dpms(xf86CrtcPtr crtc, int mode)
+{
+       struct sna_crtc *priv = to_sna_crtc(crtc);
+
+       DBG(("%s(pipe %d, dpms mode -> %d):= active=%d\n",
+            __FUNCTION__, priv->pipe, mode, mode == DPMSModeOn));
+       if (mode == DPMSModeOn) {
+               if (priv->bo == NULL &&
+                   !sna_crtc_set_mode_major(crtc,
+                                            &crtc->mode, crtc->rotation,
+                                            crtc->x, crtc->y))
+                       sna_crtc_disable(crtc);
+       } else
+               sna_crtc_disable(crtc);
+
+       if (priv->bo != NULL) {
+               priv->dpms_mode = mode;
+               update_flush_interval(to_sna(crtc->scrn));
+       }
+}
+
 void sna_mode_adjust_frame(struct sna *sna, int x, int y)
 {
        xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(sna->scrn);
@@ -1497,6 +1512,7 @@ sna_crtc_init(ScrnInfoPtr scrn, struct sna_mode *mode, 
int num)
                return;
 
        sna_crtc->id = mode->kmode->crtcs[num];
+       sna_crtc->dpms_mode = DPMSModeOff;
 
        VG_CLEAR(get_pipe);
        get_pipe.pipe = 0;

commit 88cfd23379950d1fe4e682519c48ef6e3091c2f3
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Thu Sep 27 16:16:39 2012 +0100

    uxa: Update mode->fb_id after completing pageflips
    
    As intel_crtc_on() depends upon the current value for determining if the
    pipe is active, we can only change the value afterwards.
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/intel_display.c b/src/intel_display.c
index ab73e24..b2a5904 100644
--- a/src/intel_display.c
+++ b/src/intel_display.c
@@ -705,7 +705,6 @@ intel_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
        ScrnInfoPtr scrn = crtc->scrn;
        intel_screen_private *intel = intel_get_screen_private(scrn);
        dri_bo *bo;
-       int ret;
 
        if (ppix == intel_crtc->scanout_pixmap)
                return TRUE;
@@ -725,11 +724,10 @@ intel_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
        }
 
        intel_crtc->scanout_pixmap = ppix;
-       ret = drmModeAddFB(intel->drmSubFD, ppix->drawable.width,
+       return drmModeAddFB(intel->drmSubFD, ppix->drawable.width,
                           ppix->drawable.height, ppix->drawable.depth,
                           ppix->drawable.bitsPerPixel, ppix->devKind,
-                          bo->handle, &intel_crtc->scanout_fb_id);
-       return TRUE;
+                          bo->handle, &intel_crtc->scanout_fb_id) == 0;
 }
 #endif
 
@@ -1547,15 +1545,15 @@ intel_do_pageflip(intel_screen_private *intel,
        struct intel_mode *mode = crtc->mode;
        unsigned int pitch = scrn->displayWidth * intel->cpp;
        struct intel_pageflip *flip;
-       int i, old_fb_id;
+       uint32_t new_fb_id;
+       int i;
 
        /*
         * Create a new handle for the back buffer
         */
-       old_fb_id = mode->fb_id;
        if (drmModeAddFB(mode->fd, scrn->virtualX, scrn->virtualY,
                         scrn->depth, scrn->bitsPerPixel, pitch,
-                        new_front->handle, &mode->fb_id))
+                        new_front->handle, &new_fb_id))
                goto error_out;
 
        intel_glamor_flush(intel);
@@ -1598,7 +1596,7 @@ intel_do_pageflip(intel_screen_private *intel,
 
                if (drmModePageFlip(mode->fd,
                                    crtc_id(crtc),
-                                   mode->fb_id,
+                                   new_fb_id,
                                    DRM_MODE_PAGE_FLIP_EVENT, flip)) {
                        xf86DrvMsg(scrn->scrnIndex, X_WARNING,
                                   "flip queue failed: %s\n", strerror(errno));
@@ -1607,12 +1605,16 @@ intel_do_pageflip(intel_screen_private *intel,
                }
        }
 
-       mode->old_fb_id = old_fb_id;
+       mode->old_fb_id = mode->fb_id;
+       mode->fb_id = new_fb_id;
        return TRUE;
 
 error_undo:
-       drmModeRmFB(mode->fd, mode->fb_id);
-       mode->fb_id = old_fb_id;
+       drmModeRmFB(mode->fd, new_fb_id);
+       for (i = 0; i < config->num_crtc; i++) {
+               if (config->crtc[i]->enabled)
+                       intel_crtc_apply(config->crtc[i]);
+       }
 
 error_out:
        xf86DrvMsg(scrn->scrnIndex, X_WARNING, "Page flip failed: %s\n",

commit 83990c649cbd3cb563d08f04e1c02232c44997aa
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Thu Sep 27 14:58:26 2012 +0100

    Remove the last couple of references to mibstore
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/legacy/i810/i810_driver.c b/src/legacy/i810/i810_driver.c
index fc6369e..9f684d2 100644
--- a/src/legacy/i810/i810_driver.c
+++ b/src/legacy/i810/i810_driver.c
@@ -58,7 +58,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "xf86cmap.h"
 
 #include "compiler.h"
-#include "mibstore.h"
 #include "vgaHW.h"
 #include "mipointer.h"
 #include "micmap.h"
@@ -1675,7 +1674,6 @@ I810ScreenInit(SCREEN_INIT_ARGS_DECL)
       I810EmitFlush(scrn);
    }
 
-   miInitializeBackingStore(screen);
    xf86SetBackingStore(screen);
    xf86SetSilkenMouse(screen);
 
diff --git a/uxa/uxa-priv.h b/uxa/uxa-priv.h
index 91ef4e0..3f639e7 100644
--- a/uxa/uxa-priv.h
+++ b/uxa/uxa-priv.h
@@ -44,7 +44,6 @@
 #include "pixmapstr.h"
 #include "windowstr.h"
 #include "servermd.h"
-#include "mibstore.h"
 #include "colormapst.h"
 #include "gcstruct.h"
 #include "input.h"

commit cb0b72c4fbb7b1bc941522d8679fef856f2f8936
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Thu Sep 27 14:53:46 2012 +0100

    uxa: Fixup the last couple of commits after realising I didn't have uxa 
enabled
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/intel_dri.c b/src/intel_dri.c
index b0e4830..64cb567 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -924,7 +924,8 @@ I830DRI2ScheduleFlip(struct intel_screen_private *intel,
 static Bool
 can_exchange(DrawablePtr drawable, DRI2BufferPtr front, DRI2BufferPtr back)
 {
-       struct intel_screen_private *intel = 
intel_get_screen_private(xf86ScreenToScrn(drawable->pScreen));
+       ScrnInfoPtr pScrn = xf86ScreenToScrn(drawable->pScreen);
+       struct intel_screen_private *intel = intel_get_screen_private(pScrn);
        I830DRI2BufferPrivatePtr front_priv = front->driverPrivate;
        I830DRI2BufferPrivatePtr back_priv = back->driverPrivate;
        PixmapPtr front_pixmap = front_priv->pixmap;
@@ -935,7 +936,7 @@ can_exchange(DrawablePtr drawable, DRI2BufferPtr front, 
DRI2BufferPtr back)
        if (!pScrn->vtSema)
                return FALSE;
 
-       if (I830DRI2DrawablePipe(draw) < 0)
+       if (I830DRI2DrawablePipe(drawable) < 0)
                return FALSE;
 
        if (!DRI2CanFlip(drawable))

commit feef53005b57d6b4489a15f8d0db8245dcb0cfaa
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Thu Sep 27 13:36:55 2012 +0100

    uxa: Do not attempt to pageflip whilst not master
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/intel_dri.c b/src/intel_dri.c
index ccb10d1..b0e4830 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -932,6 +932,9 @@ can_exchange(DrawablePtr drawable, DRI2BufferPtr front, 
DRI2BufferPtr back)
        struct intel_pixmap *front_intel = 
intel_get_pixmap_private(front_pixmap);
        struct intel_pixmap *back_intel = intel_get_pixmap_private(back_pixmap);
 
+       if (!pScrn->vtSema)
+               return FALSE;
+
        if (I830DRI2DrawablePipe(draw) < 0)
                return FALSE;
 

commit 5a45cbacb777e478d8fbda9223b0fb5c705d7249
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Thu Sep 27 13:31:27 2012 +0100

    uxa: Confirm the pipe is alive before flipping
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/intel_display.c b/src/intel_display.c
index 60af415..ab73e24 100644
--- a/src/intel_display.c
+++ b/src/intel_display.c
@@ -1575,7 +1575,7 @@ intel_do_pageflip(intel_screen_private *intel,
        mode->fe_tv_usec = 0;
 
        for (i = 0; i < config->num_crtc; i++) {
-               if (!config->crtc[i]->enabled)
+               if (!intel_crtc_on(config->crtc[i]))
                        continue;
 
                mode->flip_info = flip_info;

commit edc5b7f741a4bb8e9a58b5eb2201fa9304f94ef7
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Thu Sep 27 13:27:20 2012 +0100

    uxa/dri: Confirm Drawable is still attached to an active pipe before 
flipping
    
    If we schedule a flip to happen on a far distant vblank, it is possible
    for us to disable the pipes with a modeset, whilst maintaining the fb
    size, or with a DPMS command. If the pipe is disabled and we still try
    to flip, then we trigger an EINVAL error from the kernel.
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/intel_dri.c b/src/intel_dri.c
index 8cab73f..ccb10d1 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -455,7 +455,7 @@ I830DRI2CopyRegion(DrawablePtr drawable, RegionPtr pRegion,
                BoxPtr box;
                BoxRec crtcbox;
                int y1, y2;
-               int pipe = -1, event, load_scan_lines_pipe;
+               int event, load_scan_lines_pipe;
                xf86CrtcPtr crtc;
                Bool full_height = FALSE;
 
@@ -467,7 +467,7 @@ I830DRI2CopyRegion(DrawablePtr drawable, RegionPtr pRegion,
                 * buffer
                 */
                if (crtc != NULL && !crtc->rotatedData) {
-                       pipe = intel_crtc_to_pipe(crtc);
+                       int pipe = intel_crtc_to_pipe(crtc);
 
                        /*
                         * Make sure we don't wait for a scanline that will
@@ -932,6 +932,9 @@ can_exchange(DrawablePtr drawable, DRI2BufferPtr front, 
DRI2BufferPtr back)
        struct intel_pixmap *front_intel = 
intel_get_pixmap_private(front_pixmap);
        struct intel_pixmap *back_intel = intel_get_pixmap_private(back_pixmap);
 
+       if (I830DRI2DrawablePipe(draw) < 0)
+               return FALSE;
+
        if (!DRI2CanFlip(drawable))
                return FALSE;
 

commit eb667378543f97d7c7e7767daddbd9b39e07c1f8
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Wed Sep 26 15:12:57 2012 +0100

    sna: Typo in DBG
    
    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 5e3280e..7f64741 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2571,7 +2571,7 @@ sna_drawable_use_bo(DrawablePtr drawable, unsigned flags, 
const BoxRec *box,
        int16_t dx, dy;
        int ret;
 
-       DBG(("%s pixmap=%ld, box=((%d, %d), (%d, %d)), flagss=%x...\n",
+       DBG(("%s pixmap=%ld, box=((%d, %d), (%d, %d)), flags=%x...\n",
             __FUNCTION__,
             pixmap->drawable.serialNumber,
             box->x1, box->y1, box->x2, box->y2,
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index a59580b..88dec3a 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -1373,8 +1373,8 @@ static void sna_dri_flip_event(struct sna *sna,
        /* We assume our flips arrive in order, so we don't check the frame */
        switch (flip->type) {
        case DRI2_FLIP:
-               DBG(("%s: flip complete (drawable gone? %d)\n"
-                    , __FUNCTION__, flp->draw == NULL));
+               DBG(("%s: flip complete (drawable gone? %d)\n",
+                    __FUNCTION__, flip->draw == NULL));
                if (flip->draw)
                        DRI2SwapComplete(flip->client, flip->draw,
                                         flip->fe_frame,

commit 557ad78d02dfff3db9e7fc21f05230a8fe482f7c
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Wed Sep 26 15:02:17 2012 +0100

    Kill mibstore pretend backwards compatibility
    
    Adam Jackson was kind enough to point out that mibstore had been a no-op
    since xorg-1.4 and the earliest we claim to support is xorg-1.6.
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/compat-api.h b/src/compat-api.h
index 9ca2ab3..6b76572 100644
--- a/src/compat-api.h
+++ b/src/compat-api.h
@@ -103,10 +103,4 @@
 
 #endif
 
-#if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(13, 0)
-#define miInitializeBackingStore(x) do {} while (0)
-#else
-#include "mibstore.h"
-#endif
-
 #endif
diff --git a/src/intel_driver.c b/src/intel_driver.c
index ec887aa..f338a36 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -960,7 +960,6 @@ I830ScreenInit(SCREEN_INIT_ARGS_DECL)
                return FALSE;
        }
 
-       miInitializeBackingStore(screen);
        xf86SetBackingStore(screen);
        xf86SetSilkenMouse(screen);
        miDCInitialize(screen, xf86GetPointerScreenFuncs());
diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index 223387d..462d9ac 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -884,7 +884,6 @@ sna_screen_init(SCREEN_INIT_ARGS_DECL)
 
        xf86SetBlackWhitePixels(screen);
 
-       miInitializeBackingStore(screen);
        xf86SetBackingStore(screen);
        xf86SetSilkenMouse(screen);
        if (!miDCInitialize(screen, xf86GetPointerScreenFuncs()))

commit 367f57faf2c422da026a25c099426dc750cf3759
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Wed Sep 26 14:06:18 2012 +0100

    sna/video: Force integer promotion to avoid u16 overflow for frame size
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/sna/sna_video.c b/src/sna/sna_video.c
index e7b335a..7bf20e9 100644
--- a/src/sna/sna_video.c
+++ b/src/sna/sna_video.c
@@ -225,31 +225,31 @@ sna_video_frame_init(struct sna *sna,
                if (video->rotation & (RR_Rotate_90 | RR_Rotate_270)) {
                        frame->pitch[0] = ALIGN((height / 2), align);
                        frame->pitch[1] = ALIGN(height, align);
-                       frame->size = frame->pitch[0] * width * 3;
+                       frame->size = 3U * frame->pitch[0] * width;
                } else {
                        frame->pitch[0] = ALIGN((width / 2), align);
                        frame->pitch[1] = ALIGN(width, align);
-                       frame->size = frame->pitch[0] * height * 3;
+                       frame->size = 3U * frame->pitch[0] * height;
                }
        } else {
                if (video->rotation & (RR_Rotate_90 | RR_Rotate_270)) {
                        frame->pitch[0] = ALIGN((height << 1), align);
-                       frame->size = frame->pitch[0] * width;
+                       frame->size = (int)frame->pitch[0] * width;
                } else {
                        frame->pitch[0] = ALIGN((width << 1), align);
-                       frame->size = frame->pitch[0] * height;
+                       frame->size = (int)frame->pitch[0] * height;
                }
                frame->pitch[1] = 0;
        }
 
        if (video->rotation & (RR_Rotate_90 | RR_Rotate_270)) {
-               frame->UBufOffset = frame->pitch[1] * width;
+               frame->UBufOffset = (int)frame->pitch[1] * width;
                frame->VBufOffset =
-                       frame->UBufOffset + frame->pitch[0] * width / 2;
+                       frame->UBufOffset + (int)frame->pitch[0] * width / 2;
        } else {
-               frame->UBufOffset = frame->pitch[1] * height;
+               frame->UBufOffset = (int)frame->pitch[1] * height;
                frame->VBufOffset =
-                       frame->UBufOffset + frame->pitch[0] * height / 2;
+                       frame->UBufOffset + (int)frame->pitch[0] * height / 2;
        }
 }
 
@@ -450,11 +450,12 @@ sna_video_copy_data(struct sna *sna,
                        if (pitch[0] == frame->pitch[0] &&
                            pitch[1] == frame->pitch[1] &&
                            frame->top == 0 && frame->left == 0) {
+                               uint32_t len =
+                                       (uint32_t)pitch[1]*frame->height +
+                                       (uint32_t)pitch[0]*frame->height;
                                if (frame->bo) {
                                        kgem_bo_write(&sna->kgem, frame->bo,
-                                                     buf,
-                                                     pitch[1]*frame->height +
-                                                     pitch[0]*frame->height);
+                                                     buf, len);
                                } else {
                                        frame->bo = 
kgem_create_buffer(&sna->kgem, frame->size,
                                                                       
KGEM_BUFFER_WRITE | KGEM_BUFFER_WRITE_INPLACE,
@@ -462,9 +463,7 @@ sna_video_copy_data(struct sna *sna,
                                        if (frame->bo == NULL)
                                                return false;
 
-                                       memcpy(dst, buf,
-                                              pitch[1]*frame->height +
-                                              pitch[0]*frame->height);
+                                       memcpy(dst, buf, len);
                                }
                                if (frame->id != FOURCC_I420) {
                                        uint32_t tmp;
@@ -478,8 +477,8 @@ sna_video_copy_data(struct sna *sna,
                        if (frame->width*2 == frame->pitch[0]) {
                                if (frame->bo) {
                                        kgem_bo_write(&sna->kgem, frame->bo,
-                                                     buf + (frame->top * 
frame->width*2) + (frame->left << 1),
-                                                     
frame->nlines*frame->width*2);
+                                                     buf + (2U*frame->top * 
frame->width) + (frame->left << 1),
+                                                     
2U*frame->nlines*frame->width);
                                } else {
                                        frame->bo = 
kgem_create_buffer(&sna->kgem, frame->size,
                                                                       
KGEM_BUFFER_WRITE | KGEM_BUFFER_WRITE_INPLACE,
@@ -489,7 +488,7 @@ sna_video_copy_data(struct sna *sna,
 
                                        memcpy(dst,
                                               buf + (frame->top * 
frame->width*2) + (frame->left << 1),
-                                              frame->nlines*frame->width*2);
+                                              2U*frame->nlines*frame->width);
                                }
                                return true;
                        }

commit 34772cb0e724a880a8c6db936c0bb5dd129398f2
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Wed Sep 26 12:09:39 2012 +0100

    sna/dri: Handle pending flips when drawable disappears.
    
    The async case needs special handling as the current front buffer may be
    pending a flip onto the scanout which needs to be completed even if the
    Drawable is destroyed.
    
    Fixes regression from commit ad877abdc70b842afd202b2f97892d97a0b8d151
    Author: Chris Wilson <ch...@chris-wilson.co.uk>
    Date:   Sat Jul 7 17:48:52 2012 +0100
    
        sna/dri: Attach the chain of frame events to the Window, not pixmap
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index 14c718d..a59580b 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -1322,20 +1322,18 @@ done:
 }
 
 static int
-sna_dri_flip_continue(struct sna *sna,
-                     DrawablePtr draw,
-                     struct sna_dri_frame_event *info)
+sna_dri_flip_continue(struct sna *sna, struct sna_dri_frame_event *info)
 {
        struct kgem_bo *bo;
        int name;
 
        DBG(("%s()\n", __FUNCTION__));
 
-       assert(sna_pixmap_get_buffer(get_drawable_pixmap(draw)) == info->front);
+       assert(sna_pixmap_get_buffer(get_drawable_pixmap(info->draw)) == 
info->front);
 
        name = info->back->name;
        bo = get_private(info->back)->bo;
-       assert(get_drawable_pixmap(draw)->drawable.height * bo->pitch <= 
kgem_bo_size(bo));
+       assert(get_drawable_pixmap(info->draw)->drawable.height * bo->pitch <= 
kgem_bo_size(bo));
 
        info->count = sna_page_flip(sna, bo, info, info->pipe);
        if (info->count == 0)
@@ -1362,8 +1360,6 @@ sna_dri_flip_continue(struct sna *sna,
 static void sna_dri_flip_event(struct sna *sna,
                               struct sna_dri_frame_event *flip)
 {
-       DrawablePtr draw;
-
        DBG(("%s(frame=%d, tv=%d.%06d, type=%d)\n",
             __FUNCTION__,
             flip->fe_frame,
@@ -1374,35 +1370,31 @@ static void sna_dri_flip_event(struct sna *sna,
        if (sna->dri.flip_pending == flip)
                sna->dri.flip_pending = NULL;
 
-       draw = flip->draw;
-       if (draw == NULL) {
-               DBG(("%s: drawable already gone\n", __FUNCTION__));
-               sna_dri_frame_event_info_free(sna, draw, flip);
-               return;
-       }
-
        /* We assume our flips arrive in order, so we don't check the frame */
        switch (flip->type) {
        case DRI2_FLIP:
-               DBG(("%s: flip complete\n", __FUNCTION__));
-               DRI2SwapComplete(flip->client, draw,
-                                flip->fe_frame,
-                                flip->fe_tv_sec,
-                                flip->fe_tv_usec,
-                                DRI2_FLIP_COMPLETE,
-                                flip->client ? flip->event_complete : NULL,
-                                flip->event_data);
-
-               sna_dri_frame_event_info_free(sna, draw, flip);
+               DBG(("%s: flip complete (drawable gone? %d)\n"
+                    , __FUNCTION__, flp->draw == NULL));
+               if (flip->draw)
+                       DRI2SwapComplete(flip->client, flip->draw,
+                                        flip->fe_frame,
+                                        flip->fe_tv_sec,
+                                        flip->fe_tv_usec,
+                                        DRI2_FLIP_COMPLETE,
+                                        flip->client ? flip->event_complete : 
NULL,
+                                        flip->event_data);
+
+               sna_dri_frame_event_info_free(sna, flip->draw, flip);
                break;
 
        case DRI2_FLIP_THROTTLE:
                if (!flip->next_front.name) {
                        DBG(("%s: flip chain complete\n", __FUNCTION__));
-                       sna_dri_frame_event_info_free(sna, draw, flip);
-               } else if (can_flip(sna, draw, flip->front, flip->back) &&
-                          sna_dri_flip_continue(sna, draw, flip)) {
-                       DRI2SwapComplete(flip->client, draw,
+                       sna_dri_frame_event_info_free(sna, flip->draw, flip);
+               } else if (flip->draw &&
+                          can_flip(sna, flip->draw, flip->front, flip->back) &&
+                          sna_dri_flip_continue(sna, flip)) {
+                       DRI2SwapComplete(flip->client, flip->draw,
                                         0, 0, 0,
                                         DRI2_FLIP_COMPLETE,
                                         flip->client ? flip->event_complete : 
NULL,
@@ -1410,17 +1402,19 @@ static void sna_dri_flip_event(struct sna *sna,
                } else {
                        DBG(("%s: no longer able to flip\n", __FUNCTION__));
 
-                       flip->bo = sna_dri_copy_to_front(sna, draw, NULL,
-                                                        
get_private(flip->front)->bo,
-                                                        
get_private(flip->back)->bo,
-                                                        false);
-                       DRI2SwapComplete(flip->client, draw,
-                                        0, 0, 0,
-                                        DRI2_BLIT_COMPLETE,
-                                        flip->client ? flip->event_complete : 
NULL,
-                                        flip->event_data);
+                       if (flip->draw) {
+                               flip->bo = sna_dri_copy_to_front(sna, 
flip->draw, NULL,
+                                                                
get_private(flip->front)->bo,
+                                                                
get_private(flip->back)->bo,
+                                                                false);
+                               DRI2SwapComplete(flip->client, flip->draw,
+                                                0, 0, 0,
+                                                DRI2_BLIT_COMPLETE,
+                                                flip->client ? 
flip->event_complete : NULL,
+                                                flip->event_data);
+                       }
 
-                       sna_dri_frame_event_info_free(sna, draw, flip);
+                       sna_dri_frame_event_info_free(sna, flip->draw, flip);
                }
                break;
 
@@ -1451,7 +1445,7 @@ static void sna_dri_flip_event(struct sna *sna,
                        flip->off_delay = 5;
 
                        sna->dri.flip_pending = flip;
-               } else if (--flip->off_delay) {
+               } else if (flip->draw && --flip->off_delay) {
                        DBG(("%s: queuing no-flip [delay=%d]\n",
                             __FUNCTION__, flip->off_delay));
                        /* Just queue a no-op flip to trigger another event */
@@ -1465,7 +1459,7 @@ static void sna_dri_flip_event(struct sna *sna,
                } else {
 finish_async_flip:
                        DBG(("%s: async flip completed\n", __FUNCTION__));
-                       sna_dri_frame_event_info_free(sna, draw, flip);
+                       sna_dri_frame_event_info_free(sna, flip->draw, flip);
                }
                break;
 #endif

commit addfa653cf51fa45c7eae49be1fd722aaadf97d6


-- 
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/e1ti2kr-0008w4...@vasks.debian.org

Reply via email to