NEWS                    |   21 ++++
 configure.ac            |    2 
 man/intel.man           |   10 ++
 src/i915_video.c        |    3 
 src/intel.h             |   33 ++++++-
 src/intel_batchbuffer.h |    6 -
 src/intel_display.c     |   14 +--
 src/intel_dri.c         |  209 ++++++++++++++++++++++++++++++++++--------------
 src/intel_driver.c      |   23 +++--
 src/intel_driver.h      |    2 
 src/intel_memory.c      |    4 
 src/intel_uxa.c         |    6 -
 12 files changed, 243 insertions(+), 90 deletions(-)

New commits:
commit a2c8442fcb29ef2d0df41518952a2d8df1671070
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Tue Mar 29 11:38:45 2011 +0100

    configure: version bump for 2.14.902 snapshot
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/configure.ac b/configure.ac
index e837738..b90e071 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.63])
 AC_INIT([xf86-video-intel],
-        [2.14.901],
+        [2.14.902],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-video-intel])
 AC_CONFIG_SRCDIR([Makefile.am])

commit 2f2680793952876c89796174bed53c824fe6d1cb
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Tue Mar 29 11:38:18 2011 +0100

    NEWS: Entry for 2.14.902 snapshot
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/NEWS b/NEWS
index c897bfd..d163097 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,24 @@
+Snapshot 2.14.902 (2011-03-29)
+==============================
+This is the second release candidate in preparation for the upcoming
+2.15.0 release. We will appreciate any feedback we can get from
+testing of this snapshot.
+
+As befits testing of release candidates, no major regression was found and
+a couple more bugs have been fixed.
+
+Bugs fixed in this snapshot (compared to 2.14.901)
+--------------------------------------------------
+
+* Clients disappearing with pending swaps
+
+* Incorrect clipping of Xv output on i915 across extended desktops
+  https://bugs.freedesktop.org/show_bug.cgi?id=35346
+
+* Introduction of a LinearFramebuffer option. (Defaults to tiled for
+  performance and power saving.)
+
+
 Snapshot 2.14.901 (2011-03-02)
 ==============================
 This is the first release candidate in preparation for the upcoming

commit 7ccbec801e9ee32fc110db730dfec674a94dea21
Author: Keith Packard <kei...@keithp.com>
Date:   Thu Mar 24 11:06:57 2011 -0700

    Recover from i830_dri2_add_frame_event out-of-memory condition
    
    If adding either the frame or client resources fails, we need to clean
    up afterwards properly.
    
    First, add_frame_event needs to internally clean up after itself by
    undoing any partial execution. Second, the callers need to look at the
    return value and free the swap/flip info structure when necessary.
    
    Signed-off-by: Keith Packard <kei...@keithp.com>
    Reviewed-by: Julien Cristau <jcris...@debian.org>

diff --git a/src/intel_dri.c b/src/intel_dri.c
index 3b80823..16e42f1 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -625,8 +625,10 @@ i830_dri2_add_frame_event(DRI2FrameEventPtr frame_event)
        if (!AddResource(frame_event->client_id, frame_event_client_type, 
frame_event))
                return FALSE;
 
-       if (!AddResource(frame_event->drawable_id, frame_event_drawable_type, 
frame_event))
+       if (!AddResource(frame_event->drawable_id, frame_event_drawable_type, 
frame_event)) {
+               FreeResourceByType(frame_event->client_id, 
frame_event_client_type, TRUE);
                return FALSE;
+       }
 
        return TRUE;
 }
@@ -705,7 +707,10 @@ I830DRI2ScheduleFlip(struct intel_screen_private *intel,
        flip_info->event_data = data;
        flip_info->frame = target_msc;
 
-       i830_dri2_add_frame_event(flip_info);
+       if (!i830_dri2_add_frame_event(flip_info)) {
+           free(flip_info);
+           return FALSE;
+       }
 
        /* Page flip the full screen buffer */
        back_priv = back->driverPrivate;
@@ -955,11 +960,16 @@ I830DRI2ScheduleSwap(ClientPtr client, DrawablePtr draw, 
DRI2BufferPtr front,
        swap_info->event_data = data;
        swap_info->front = front;
        swap_info->back = back;
+
+       if (!i830_dri2_add_frame_event(swap_info)) {
+           free(swap_info);
+           swap_info = NULL;
+           goto blit_fallback;
+       }
+
        I830DRI2ReferenceBuffer(front);
        I830DRI2ReferenceBuffer(back);
 
-       i830_dri2_add_frame_event(swap_info);
-
        /* Get current count */
        vbl.request.type = DRM_VBLANK_RELATIVE;
        if (pipe > 0)

commit ec133abc4bd8caba15ed54e18621b816afb06981
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Thu Mar 24 15:32:50 2011 +0000

    Use the per-generation batch context switch for atomic sequences
    
    A modest boost to throughput and reduction in CPU overhead from
    not flushing the batch on every transition from BLT to RENDER.
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/intel_batchbuffer.h b/src/intel_batchbuffer.h
index 3f783b0..0d6c3f7 100644
--- a/src/intel_batchbuffer.h
+++ b/src/intel_batchbuffer.h
@@ -63,8 +63,10 @@ static inline void intel_batch_start_atomic(ScrnInfoPtr 
scrn, unsigned int sz)
 
        assert(!intel->in_batch_atomic);
 
-       if (intel->current_batch != RENDER_BATCH)
-               intel_batch_submit(scrn, FALSE);
+       if (intel->current_batch != RENDER_BATCH) {
+               if (intel->current_batch && intel->context_switch)
+                       intel->context_switch(intel, RENDER_BATCH);
+       }
 
        intel_batch_require_space(scrn, intel, sz * 4);
        intel->current_batch = RENDER_BATCH;

commit 86f23f21ab57fcbc031bcd2b8f432a08ff4cc320
Author: Keith Packard <kei...@keithp.com>
Date:   Wed Mar 23 17:07:49 2011 -0700

    Skip client and drawable resource delete calls when deleting frame event
    
    As the frame_event is about to be freed, there's no point in cleaning
    up references to the drawable and client.
    
    Signed-off-by: Keith Packard <kei...@keithp.com>

diff --git a/src/intel_dri.c b/src/intel_dri.c
index f039e9d..3b80823 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -635,9 +635,9 @@ static void
 i830_dri2_del_frame_event(DRI2FrameEventPtr frame_event)
 {
        if (frame_event->client_id)
-               FreeResourceByType(frame_event->client_id, 
frame_event_client_type, FALSE);
+               FreeResourceByType(frame_event->client_id, 
frame_event_client_type, TRUE);
        if (frame_event->drawable_id)
-               FreeResourceByType(frame_event->drawable_id, 
frame_event_drawable_type, FALSE);
+               FreeResourceByType(frame_event->drawable_id, 
frame_event_drawable_type, TRUE);
 }
 
 static void

commit e1ff5182304e00c0d392092069422cae7626cf8d
Author: Keith Packard <kei...@keithp.com>
Date:   Wed Mar 9 17:00:41 2011 -0800

    Handle drawable/client destruction in pending swaps/flips
    
    A pending swap or flip holds references to drawables and clients which
    become invalid when destroyed. Add suitable resources to the database
    to track those lifetimes and clean up the pending data structure then.
    
    Later, when the pending swap or flip occurs, handle a missing drawable
    by just discarding the flip or swap. Handle a missing client by not
    sending an event or reply.
    
    Signed-off-by: Keith Packard <kei...@keithp.com>

diff --git a/src/intel.h b/src/intel.h
index 711449a..4179989 100644
--- a/src/intel.h
+++ b/src/intel.h
@@ -472,6 +472,7 @@ enum DRI2FrameEventType {
 
 typedef struct _DRI2FrameEvent {
        XID drawable_id;
+       XID client_id;  /* fake client ID to track client destruction */
        ClientPtr client;
        enum DRI2FrameEventType type;
        int frame;
diff --git a/src/intel_display.c b/src/intel_display.c
index eb07cf5..4734844 100644
--- a/src/intel_display.c
+++ b/src/intel_display.c
@@ -1512,7 +1512,7 @@ static const xf86CrtcConfigFuncsRec 
intel_xf86crtc_config_funcs = {
 
 static void
 intel_vblank_handler(int fd, unsigned int frame, unsigned int tv_sec,
-                      unsigned int tv_usec, DRI2FrameEventPtr event)
+                      unsigned int tv_usec, void *event)
 {
        I830DRI2FrameEventHandler(frame, tv_sec, tv_usec, event);
 }
diff --git a/src/intel_dri.c b/src/intel_dri.c
index 9e8c370..f039e9d 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -577,6 +577,69 @@ I830DRI2DrawablePipe(DrawablePtr pDraw)
        return pipe;
 }
 
+static RESTYPE frame_event_client_type, frame_event_drawable_type;
+
+static int
+i830_dri2_frame_event_client_gone(void *data, XID id)
+{
+       DRI2FrameEventPtr       frame_event = data;
+
+       frame_event->client = NULL;
+       frame_event->client_id = None;
+       return Success;
+}
+
+static int
+i830_dri2_frame_event_drawable_gone(void *data, XID id)
+{
+       DRI2FrameEventPtr       frame_event = data;
+
+       frame_event->drawable_id = None;
+       return Success;
+}
+
+static Bool
+i830_dri2_register_frame_event_resource_types(void)
+{
+       frame_event_client_type = 
CreateNewResourceType(i830_dri2_frame_event_client_gone, "Frame Event Client");
+       if (!frame_event_client_type)
+               return FALSE;
+
+       frame_event_drawable_type = 
CreateNewResourceType(i830_dri2_frame_event_drawable_gone, "Frame Event 
Drawable");
+       if (!frame_event_drawable_type)
+               return FALSE;
+
+       return TRUE;
+}
+
+/*
+ * Hook this frame event into the server resource
+ * database so we can clean it up if the drawable or
+ * client exits while the swap is pending
+ */
+static Bool
+i830_dri2_add_frame_event(DRI2FrameEventPtr frame_event)
+{
+       frame_event->client_id = FakeClientID(frame_event->client->index);
+
+       if (!AddResource(frame_event->client_id, frame_event_client_type, 
frame_event))
+               return FALSE;
+
+       if (!AddResource(frame_event->drawable_id, frame_event_drawable_type, 
frame_event))
+               return FALSE;
+
+       return TRUE;
+}
+
+static void
+i830_dri2_del_frame_event(DRI2FrameEventPtr frame_event)
+{
+       if (frame_event->client_id)
+               FreeResourceByType(frame_event->client_id, 
frame_event_client_type, FALSE);
+       if (frame_event->drawable_id)
+               FreeResourceByType(frame_event->drawable_id, 
frame_event_drawable_type, FALSE);
+}
+
 static void
 I830DRI2ExchangeBuffers(DrawablePtr draw, DRI2BufferPtr front,
                        DRI2BufferPtr back)
@@ -642,11 +705,18 @@ I830DRI2ScheduleFlip(struct intel_screen_private *intel,
        flip_info->event_data = data;
        flip_info->frame = target_msc;
 
+       i830_dri2_add_frame_event(flip_info);
+
        /* Page flip the full screen buffer */
        back_priv = back->driverPrivate;
-       return intel_do_pageflip(intel,
-                                intel_get_pixmap_bo(back_priv->pixmap),
-                                flip_info, ref_crtc_hw_id);
+       if (intel_do_pageflip(intel,
+                             intel_get_pixmap_bo(back_priv->pixmap),
+                             flip_info, ref_crtc_hw_id))
+               return TRUE;
+
+       i830_dri2_del_frame_event(flip_info);
+       free(flip_info);
+       return FALSE;
 }
 
 static Bool
@@ -682,7 +752,7 @@ can_exchange(DRI2BufferPtr front, DRI2BufferPtr back)
 }
 
 void I830DRI2FrameEventHandler(unsigned int frame, unsigned int tv_sec,
-                              unsigned int tv_usec, DRI2FrameEventPtr event)
+                              unsigned int tv_usec, DRI2FrameEventPtr 
swap_info)
 {
        DrawablePtr drawable;
        ScreenPtr screen;
@@ -690,12 +760,16 @@ void I830DRI2FrameEventHandler(unsigned int frame, 
unsigned int tv_sec,
        intel_screen_private *intel;
        int status;
 
-       status = dixLookupDrawable(&drawable, event->drawable_id, serverClient,
-                                  M_ANY, DixWriteAccess);
+       if (!swap_info->drawable_id)
+               status = BadDrawable;
+       else
+               status = dixLookupDrawable(&drawable, swap_info->drawable_id, 
serverClient,
+                                          M_ANY, DixWriteAccess);
        if (status != Success) {
-               I830DRI2DestroyBuffer(NULL, event->front);
-               I830DRI2DestroyBuffer(NULL, event->back);
-               free(event);
+               i830_dri2_del_frame_event(swap_info);
+               I830DRI2DestroyBuffer(NULL, swap_info->front);
+               I830DRI2DestroyBuffer(NULL, swap_info->back);
+               free(swap_info);
                return;
        }
 
@@ -703,28 +777,28 @@ void I830DRI2FrameEventHandler(unsigned int frame, 
unsigned int tv_sec,
        scrn = xf86Screens[screen->myNum];
        intel = intel_get_screen_private(scrn);
 
-       switch (event->type) {
+       switch (swap_info->type) {
        case DRI2_FLIP:
                /* If we can still flip... */
                if (DRI2CanFlip(drawable) && !intel->shadow_present &&
                    intel->use_pageflipping &&
-                   can_exchange(event->front, event->back) &&
+                   can_exchange(swap_info->front, swap_info->back) &&
                    I830DRI2ScheduleFlip(intel,
-                                        event->client, drawable, event->front,
-                                        event->back, event->event_complete,
-                                        event->event_data, event->frame)) {
+                                        swap_info->client, drawable, 
swap_info->front,
+                                        swap_info->back, 
swap_info->event_complete,
+                                        swap_info->event_data, 
swap_info->frame)) {
                        I830DRI2ExchangeBuffers(drawable,
-                                               event->front, event->back);
+                                               swap_info->front, 
swap_info->back);
                        break;
                }
                /* else fall through to exchange/blit */
        case DRI2_SWAP: {
                int swap_type;
 
-               if (DRI2CanExchange(drawable) && can_exchange(event->front,
-                                                             event->back)) {
+               if (DRI2CanExchange(drawable) && can_exchange(swap_info->front,
+                                                             swap_info->back)) 
{
                        I830DRI2ExchangeBuffers(drawable,
-                                               event->front, event->back);
+                                               swap_info->front, 
swap_info->back);
                        swap_type = DRI2_EXCHANGE_COMPLETE;
                } else {
                        BoxRec      box;
@@ -737,17 +811,19 @@ void I830DRI2FrameEventHandler(unsigned int frame, 
unsigned int tv_sec,
                        REGION_INIT(pScreen, &region, &box, 0);
 
                        I830DRI2CopyRegion(drawable,
-                                          &region, event->front, event->back);
+                                          &region, swap_info->front, 
swap_info->back);
                        swap_type = DRI2_BLIT_COMPLETE;
                }
-               DRI2SwapComplete(event->client, drawable, frame, tv_sec, 
tv_usec,
+               DRI2SwapComplete(swap_info->client, drawable, frame, tv_sec, 
tv_usec,
                                 swap_type,
-                                event->event_complete, event->event_data);
+                                swap_info->client ? swap_info->event_complete 
: NULL,
+                                swap_info->event_data);
                break;
        }
        case DRI2_WAITMSC:
-               DRI2WaitMSCComplete(event->client, drawable,
-                                   frame, tv_sec, tv_usec);
+               if (swap_info->client)
+                       DRI2WaitMSCComplete(swap_info->client, drawable,
+                                           frame, tv_sec, tv_usec);
                break;
        default:
                xf86DrvMsg(scrn->scrnIndex, X_WARNING,
@@ -756,23 +832,28 @@ void I830DRI2FrameEventHandler(unsigned int frame, 
unsigned int tv_sec,
                break;
        }
 
-       I830DRI2DestroyBuffer(drawable, event->front);
-       I830DRI2DestroyBuffer(drawable, event->back);
-       free(event);
+       i830_dri2_del_frame_event(swap_info);
+       I830DRI2DestroyBuffer(drawable, swap_info->front);
+       I830DRI2DestroyBuffer(drawable, swap_info->back);
+       free(swap_info);
 }
 
 void I830DRI2FlipEventHandler(unsigned int frame, unsigned int tv_sec,
-                             unsigned int tv_usec, DRI2FrameEventPtr flip)
+                             unsigned int tv_usec, DRI2FrameEventPtr flip_info)
 {
        DrawablePtr drawable;
        ScreenPtr screen;
        ScrnInfoPtr scrn;
        int status;
 
-       status = dixLookupDrawable(&drawable, flip->drawable_id, serverClient,
-                                    M_ANY, DixWriteAccess);
+       if (!flip_info->drawable_id)
+               status = BadDrawable;
+       else
+               status = dixLookupDrawable(&drawable, flip_info->drawable_id, 
serverClient,
+                                          M_ANY, DixWriteAccess);
        if (status != Success) {
-               free(flip);
+               i830_dri2_del_frame_event(flip_info);
+               free(flip_info);
                return;
        }
 
@@ -780,13 +861,13 @@ void I830DRI2FlipEventHandler(unsigned int frame, 
unsigned int tv_sec,
        scrn = xf86Screens[screen->myNum];
 
        /* We assume our flips arrive in order, so we don't check the frame */
-       switch (flip->type) {
+       switch (flip_info->type) {
        case DRI2_SWAP:
                /* Check for too small vblank count of pageflip completion, 
taking wraparound
                 * into account. This usually means some defective kms pageflip 
completion,
                 * causing wrong (msc, ust) return values and possible visual 
corruption.
                 */
-               if ((frame < flip->frame) && (flip->frame - frame < 5)) {
+               if ((frame < flip_info->frame) && (flip_info->frame - frame < 
5)) {
                        static int limit = 5;
 
                        /* XXX we are currently hitting this path with older
@@ -795,7 +876,7 @@ void I830DRI2FlipEventHandler(unsigned int frame, unsigned 
int tv_sec,
                        if (limit) {
                                xf86DrvMsg(scrn->scrnIndex, X_WARNING,
                                           "%s: Pageflip completion has 
impossible msc %d < target_msc %d\n",
-                                          __func__, frame, flip->frame);
+                                          __func__, frame, flip_info->frame);
                                limit--;
                        }
 
@@ -803,9 +884,9 @@ void I830DRI2FlipEventHandler(unsigned int frame, unsigned 
int tv_sec,
                        frame = tv_sec = tv_usec = 0;
                }
 
-               DRI2SwapComplete(flip->client, drawable, frame, tv_sec, tv_usec,
-                                DRI2_FLIP_COMPLETE, flip->event_complete,
-                                flip->event_data);
+               DRI2SwapComplete(flip_info->client, drawable, frame, tv_sec, 
tv_usec,
+                                DRI2_FLIP_COMPLETE, flip_info->client ? 
flip_info->event_complete : NULL,
+                                flip_info->event_data);
        break;
        default:
                xf86DrvMsg(scrn->scrnIndex, X_WARNING,
@@ -814,7 +895,8 @@ void I830DRI2FlipEventHandler(unsigned int frame, unsigned 
int tv_sec,
                break;
        }
 
-       free(flip);
+       i830_dri2_del_frame_event(flip_info);
+       free(flip_info);
 }
 
 /*
@@ -876,6 +958,8 @@ I830DRI2ScheduleSwap(ClientPtr client, DrawablePtr draw, 
DRI2BufferPtr front,
        I830DRI2ReferenceBuffer(front);
        I830DRI2ReferenceBuffer(back);
 
+       i830_dri2_add_frame_event(swap_info);
+
        /* Get current count */
        vbl.request.type = DRM_VBLANK_RELATIVE;
        if (pipe > 0)
@@ -1008,6 +1092,7 @@ blit_fallback:
 
        DRI2SwapComplete(client, draw, 0, 0, 0, DRI2_BLIT_COMPLETE, func, data);
        if (swap_info) {
+           i830_dri2_del_frame_event(swap_info);
            I830DRI2DestroyBuffer(draw, swap_info->front);
            I830DRI2DestroyBuffer(draw, swap_info->back);
            free(swap_info);
@@ -1198,6 +1283,8 @@ out_complete:
 }
 #endif
 
+static int dri2_server_generation;
+
 Bool I830DRI2ScreenInit(ScreenPtr screen)
 {
        ScrnInfoPtr scrn = xf86Screens[screen->myNum];
@@ -1224,6 +1311,14 @@ Bool I830DRI2ScreenInit(ScreenPtr screen)
                return FALSE;
        }
 
+       if (serverGeneration != dri2_server_generation) {
+           dri2_server_generation = serverGeneration;
+           if (!i830_dri2_register_frame_event_resource_types()) {
+               xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+                          "Cannot register DRI2 frame event resources\n");
+               return FALSE;
+           }
+       }
        intel->deviceName = drmGetDeviceNameFromFd(intel->drmSubFD);
        memset(&info, '\0', sizeof(info));
        info.fd = intel->drmSubFD;

commit aa0328f342177e33f9c863531712eaa4577b5f2b
Author: Keith Packard <kei...@keithp.com>
Date:   Wed Mar 9 16:23:22 2011 -0800

    dri2: Make DRI2FrameEvent public and use instead of void *
    
    Instead of using void * for all of the flip_info and swap_info
    pointers, just make the underlying structure a public data type and
    use that.
    
    Signed-off-by: Keith Packard <kei...@keithp.com>

diff --git a/src/intel.h b/src/intel.h
index d2a553f..711449a 100644
--- a/src/intel.h
+++ b/src/intel.h
@@ -464,9 +464,28 @@ extern int intel_get_pipe_from_crtc_id(drm_intel_bufmgr 
*bufmgr, xf86CrtcPtr crt
 extern int intel_crtc_id(xf86CrtcPtr crtc);
 extern int intel_output_dpms_status(xf86OutputPtr output);
 
+enum DRI2FrameEventType {
+       DRI2_SWAP,
+       DRI2_FLIP,
+       DRI2_WAITMSC,
+};
+
+typedef struct _DRI2FrameEvent {
+       XID drawable_id;
+       ClientPtr client;
+       enum DRI2FrameEventType type;
+       int frame;
+
+       /* for swaps & flips only */
+       DRI2SwapEventPtr event_complete;
+       void *event_data;
+       DRI2BufferPtr front;
+       DRI2BufferPtr back;
+} DRI2FrameEventRec, *DRI2FrameEventPtr;
+
 extern Bool intel_do_pageflip(intel_screen_private *intel,
                              dri_bo *new_front,
-                             void *data, int ref_crtc_hw_id);
+                             DRI2FrameEventPtr flip_info, int ref_crtc_hw_id);
 
 static inline intel_screen_private *
 intel_get_screen_private(ScrnInfoPtr scrn)
@@ -500,9 +519,9 @@ extern xf86CrtcPtr intel_covering_crtc(ScrnInfoPtr scrn, 
BoxPtr box,
 Bool I830DRI2ScreenInit(ScreenPtr pScreen);
 void I830DRI2CloseScreen(ScreenPtr pScreen);
 void I830DRI2FrameEventHandler(unsigned int frame, unsigned int tv_sec,
-                              unsigned int tv_usec, void *user_data);
+                              unsigned int tv_usec, DRI2FrameEventPtr 
flip_info);
 void I830DRI2FlipEventHandler(unsigned int frame, unsigned int tv_sec,
-                             unsigned int tv_usec, void *user_data);
+                             unsigned int tv_usec, DRI2FrameEventPtr 
flip_info);
 
 extern Bool intel_crtc_on(xf86CrtcPtr crtc);
 int intel_crtc_to_pipe(xf86CrtcPtr crtc);
diff --git a/src/intel_display.c b/src/intel_display.c
index f487a6e..eb07cf5 100644
--- a/src/intel_display.c
+++ b/src/intel_display.c
@@ -50,7 +50,7 @@ struct intel_mode {
        int cpp;
 
        drmEventContext event_context;
-       void *event_data;
+       DRI2FrameEventPtr flip_info;
        int old_fb_id;
        int flip_count;
        unsigned int fe_frame;
@@ -1428,7 +1428,7 @@ fail:
 Bool
 intel_do_pageflip(intel_screen_private *intel,
                  dri_bo *new_front,
-                 void *data, int ref_crtc_hw_id)
+                 DRI2FrameEventPtr flip_info, int ref_crtc_hw_id)
 {
        ScrnInfoPtr scrn = intel->scrn;
        xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
@@ -1464,7 +1464,7 @@ intel_do_pageflip(intel_screen_private *intel,
                if (!config->crtc[i]->enabled)
                        continue;
 
-               mode->event_data = data;
+               mode->flip_info = flip_info;
                mode->flip_count++;
 
                crtc = config->crtc[i]->driver_private;
@@ -1512,9 +1512,9 @@ static const xf86CrtcConfigFuncsRec 
intel_xf86crtc_config_funcs = {
 
 static void
 intel_vblank_handler(int fd, unsigned int frame, unsigned int tv_sec,
-                      unsigned int tv_usec, void *event_data)
+                      unsigned int tv_usec, DRI2FrameEventPtr event)
 {
-       I830DRI2FrameEventHandler(frame, tv_sec, tv_usec, event_data);
+       I830DRI2FrameEventHandler(frame, tv_sec, tv_usec, event);
 }
 
 static void
@@ -1541,12 +1541,12 @@ intel_page_flip_handler(int fd, unsigned int frame, 
unsigned int tv_sec,
        /* Release framebuffer */
        drmModeRmFB(mode->fd, mode->old_fb_id);
 
-       if (mode->event_data == NULL)
+       if (mode->flip_info == NULL)
                return;
 
        /* Deliver cached msc, ust from reference crtc to flip event handler */
        I830DRI2FlipEventHandler(mode->fe_frame, mode->fe_tv_sec,
-                                mode->fe_tv_usec, mode->event_data);
+                                mode->fe_tv_usec, mode->flip_info);
 }
 
 static void
diff --git a/src/intel_dri.c b/src/intel_dri.c
index 7449232..9e8c370 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -553,24 +553,6 @@ I830DRI2CopyRegion(DrawablePtr drawable, RegionPtr pRegion,
 
 #if DRI2INFOREC_VERSION >= 4
 
-enum DRI2FrameEventType {
-       DRI2_SWAP,
-       DRI2_FLIP,
-       DRI2_WAITMSC,
-};
-
-typedef struct _DRI2FrameEvent {
-       XID drawable_id;
-       ClientPtr client;
-       enum DRI2FrameEventType type;
-       int frame;
-
-       /* for swaps & flips only */
-       DRI2SwapEventPtr event_complete;
-       void *event_data;
-       DRI2BufferPtr front;
-       DRI2BufferPtr back;
-} DRI2FrameEventRec, *DRI2FrameEventPtr;
 
 static int
 I830DRI2DrawablePipe(DrawablePtr pDraw)
@@ -700,9 +682,8 @@ can_exchange(DRI2BufferPtr front, DRI2BufferPtr back)
 }
 
 void I830DRI2FrameEventHandler(unsigned int frame, unsigned int tv_sec,
-                              unsigned int tv_usec, void *event_data)
+                              unsigned int tv_usec, DRI2FrameEventPtr event)
 {
-       DRI2FrameEventPtr event = event_data;
        DrawablePtr drawable;
        ScreenPtr screen;
        ScrnInfoPtr scrn;
@@ -781,9 +762,8 @@ void I830DRI2FrameEventHandler(unsigned int frame, unsigned 
int tv_sec,
 }
 
 void I830DRI2FlipEventHandler(unsigned int frame, unsigned int tv_sec,
-                             unsigned int tv_usec, void *event_data)
+                             unsigned int tv_usec, DRI2FrameEventPtr flip)
 {
-       DRI2FrameEventPtr flip = event_data;
        DrawablePtr drawable;
        ScreenPtr screen;
        ScrnInfoPtr scrn;

commit ee740778f5d5355c04f6fc4564f598993b106d62
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Wed Mar 16 08:37:24 2011 +0000

    i915/video: Clip indirect Xv output
    
    In the case of a singular clip box and rendering onto the front buffer
    larger than 2048, the clip extents were being ignored.  Here we can
    simply reduce the size of the indirect pixmap to the clip extents.
    
    Reported-by: Michael Chang <mch...@novell.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=35346
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/i915_video.c b/src/i915_video.c
index 861bea6..d46c6d1 100644
--- a/src/i915_video.c
+++ b/src/i915_video.c
@@ -69,7 +69,8 @@ I915DisplayVideoTextured(ScrnInfoPtr scrn,
                ScreenPtr screen = pixmap->drawable.pScreen;
 
                target = screen->CreatePixmap(screen,
-                                             drw_w, drw_h,
+                                             dstRegion->extents.x2 - dxo,
+                                             dstRegion->extents.y2 - dyo,
                                              pixmap->drawable.depth,
                                              CREATE_PIXMAP_USAGE_SCRATCH);
 

commit 014fc7abb7b2cc2110e3ab9a0bd6f7cff2c64c05
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Wed Mar 9 17:10:50 2011 +0000

    dri: Disable page-flip between a tiled buffer and a linear scanout
    
    Keith Packard pointed out a loophole that could cause the DDX to end up
    with a tiled scanout even if the user required a linear framebuffer;
    that is by using page-flipping we could replace the scanout pixmap with
    another of our choosing, and not necessarily tiled.
    
    Close that loophole by only allowing an exchange of buffers between
    identical tiling modes. For the common case, this is fine since they
    will indeed be allocated with the same tiling. For the linear
    framebuffer case with mesa using a tiled pixmap, we force it to blit
    onto the scanout instead.
    
    Reported-by: Keith Packard <keith.pack...@intel.com>
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/intel_dri.c b/src/intel_dri.c
index 3901aae..7449232 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -674,6 +674,8 @@ can_exchange(DRI2BufferPtr front, DRI2BufferPtr back)
        I830DRI2BufferPrivatePtr back_priv = back->driverPrivate;
        PixmapPtr front_pixmap = front_priv->pixmap;
        PixmapPtr back_pixmap = back_priv->pixmap;
+       struct intel_pixmap *front_intel = 
intel_get_pixmap_private(front_pixmap);
+       struct intel_pixmap *back_intel = intel_get_pixmap_private(back_pixmap);
 
        if (front_pixmap->drawable.width != back_pixmap->drawable.width)
                return FALSE;
@@ -690,6 +692,10 @@ can_exchange(DRI2BufferPtr front, DRI2BufferPtr back)
                return FALSE;
 #endif
 
+       /* prevent an implicit tiling mode change */
+       if (front_intel->tiling != back_intel->tiling)
+               return FALSE;
+
        return TRUE;
 }
 

commit 049ce4397ddf7fd088ce364cbb53cacf5133176f
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Wed Mar 9 08:27:02 2011 +0000

    Give each user of tiling separate xorg.conf options
    
    So that you can indeed allocate a linear framebuffer if you so desire
    without breaking mesa.
    
    Adds:
    
    Section "Driver"
      Option "LinearFramebuffer" "False|True" # default false
    EndSection
    
    to xorg.conf
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/man/intel.man b/man/intel.man
index db4c145..4fd0ce7 100644
--- a/man/intel.man
+++ b/man/intel.man
@@ -181,12 +181,20 @@ the framerate of applications that render frames at less 
than refresh rate.
 Default: enabled.
 .TP
 .BI "Option \*qTiling\*q \*q" boolean \*q
-This option controls whether memory buffers are allocated in tiled mode.  In
+This option controls whether memory buffers for Pixmaps are allocated in tiled 
mode.  In
 most cases (especially for complex rendering), tiling dramatically improves
 performance.
 .IP
 Default: enabled.
 .TP
+.BI "Option \*qLinearFramebuffer\*q \*q" boolean \*q
+This option controls whether the memory for the scanout (also known as the
+front or frame buffer) is allocated in linear memory. A tiled framebuffer is
+required for power conservation features, but for certain system configurations
+you may wish to override this and force a linear layout.
+.IP
+Default: disabled
+.TP
 .BI "Option \*qXvMC\*q \*q" boolean \*q
 Enable XvMC driver. Current support MPEG2 MC on 915/945 and G33 series.
 User should provide absolute path to libIntelXvMC.so in XvMCConfig file.
diff --git a/src/intel.h b/src/intel.h
index 4c755fc..d2a553f 100644
--- a/src/intel.h
+++ b/src/intel.h
@@ -297,7 +297,12 @@ typedef struct intel_screen_private {
 
        Bool need_mi_flush;
 
-       Bool tiling;
+       unsigned int tiling;
+#define INTEL_TILING_FB                0x1
+#define INTEL_TILING_2D                0x2
+#define INTEL_TILING_3D                0x4
+#define INTEL_TILING_ALL (~0)
+
        Bool swapbuffers_wait;
        Bool has_relaxed_fencing;
 
diff --git a/src/intel_dri.c b/src/intel_dri.c
index 88d49bd..3901aae 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -219,7 +219,7 @@ I830DRI2CreateBuffers(DrawablePtr drawable, unsigned int 
*attachments,
                if (pixmap == NULL) {
                        unsigned int hint = INTEL_CREATE_PIXMAP_DRI2;
 
-                       if (intel->tiling) {
+                       if (intel->tiling & INTEL_TILING_3D) {
                                switch (attachments[i]) {
                                case DRI2BufferDepth:
                                        if (SUPPORTS_YTILING(intel))
@@ -328,7 +328,7 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int 
attachment,
        if (pixmap == NULL) {
                unsigned int hint = INTEL_CREATE_PIXMAP_DRI2;
 
-               if (intel->tiling) {
+               if (intel->tiling & INTEL_TILING_3D) {
                        switch (attachment) {
                        case DRI2BufferDepth:
                        case DRI2BufferDepthStencil:
diff --git a/src/intel_driver.c b/src/intel_driver.c
index ebed258..6b610b8 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -89,7 +89,8 @@ typedef enum {
    OPTION_VIDEO_KEY,
    OPTION_COLOR_KEY,
    OPTION_FALLBACKDEBUG,
-   OPTION_TILING,
+   OPTION_TILING_FB,
+   OPTION_TILING_2D,
    OPTION_SHADOW,
    OPTION_SWAPBUFFERS_WAIT,
 #ifdef INTEL_XVMC
@@ -108,7 +109,8 @@ static OptionInfoRec I830Options[] = {
    {OPTION_COLOR_KEY,  "ColorKey",     OPTV_INTEGER,   {0},    FALSE},
    {OPTION_VIDEO_KEY,  "VideoKey",     OPTV_INTEGER,   {0},    FALSE},
    {OPTION_FALLBACKDEBUG, "FallbackDebug", OPTV_BOOLEAN, {0},  FALSE},
-   {OPTION_TILING,     "Tiling",       OPTV_BOOLEAN,   {0},    TRUE},
+   {OPTION_TILING_2D,  "Tiling",       OPTV_BOOLEAN,   {0},    TRUE},
+   {OPTION_TILING_FB,  "LinearFramebuffer",    OPTV_BOOLEAN,   {0},    FALSE},
    {OPTION_SHADOW,     "Shadow",       OPTV_BOOLEAN,   {0},    FALSE},
    {OPTION_SWAPBUFFERS_WAIT, "SwapbuffersWait", OPTV_BOOLEAN,  {0},    TRUE},
 #ifdef INTEL_XVMC
@@ -586,12 +588,13 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags)
                drmCommandNone(intel->drmSubFD, DRM_I915_GEM_THROTTLE) != 0;
 
        /* Enable tiling by default */
-       intel->tiling = TRUE;
+       intel->tiling = INTEL_TILING_ALL;
 
        /* Allow user override if they set a value */
-       if (!ALWAYS_TILING(intel))
-               intel->tiling = xf86ReturnOptValBool(intel->Options,
-                                                    OPTION_TILING, TRUE);
+       if (!xf86ReturnOptValBool(intel->Options, OPTION_TILING_2D, TRUE))
+               intel->tiling &= ~INTEL_TILING_2D;
+       if (xf86ReturnOptValBool(intel->Options, OPTION_TILING_FB, FALSE))
+               intel->tiling &= ~INTEL_TILING_FB;
 
        intel->can_blt = can_accelerate_blt(intel);
        intel->use_shadow = !intel->can_blt;
@@ -616,8 +619,12 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags)
        if (IS_GEN6(intel))
                intel->swapbuffers_wait = FALSE;
 
-       xf86DrvMsg(scrn->scrnIndex, X_CONFIG, "Tiling %sabled\n",
-                  intel->tiling ? "en" : "dis");
+       xf86DrvMsg(scrn->scrnIndex, X_CONFIG, "Framebuffer %s\n",
+                  intel->tiling & INTEL_TILING_FB ? "tiled" : "linear");
+       xf86DrvMsg(scrn->scrnIndex, X_CONFIG, "Pixmaps %s\n",
+                  intel->tiling & INTEL_TILING_2D ? "tiled" : "linear");
+       xf86DrvMsg(scrn->scrnIndex, X_CONFIG, "3D buffers %s\n",
+                  intel->tiling & INTEL_TILING_3D ? "tiled" : "linear");
        xf86DrvMsg(scrn->scrnIndex, X_CONFIG, "SwapBuffers wait %sabled\n",
                   intel->swapbuffers_wait ? "en" : "dis");
 
diff --git a/src/intel_driver.h b/src/intel_driver.h
index d7f5dfa..2e72177 100644
--- a/src/intel_driver.h
+++ b/src/intel_driver.h
@@ -223,8 +223,6 @@
 /* supports Y tiled surfaces (pre-965 Mesa isn't ready yet) */
 #define SUPPORTS_YTILING(pI810) (INTEL_INFO(intel)->gen >= 40)
 
-#define ALWAYS_TILING(intel) IS_GEN6(intel)
-
 extern SymTabRec *intel_chipsets;
 
 struct intel_chipset {
diff --git a/src/intel_memory.c b/src/intel_memory.c
index e9ea58d..64dfd8e 100644
--- a/src/intel_memory.c
+++ b/src/intel_memory.c
@@ -185,7 +185,7 @@ drm_intel_bo *intel_allocate_framebuffer(ScrnInfoPtr scrn,
        uint32_t tiling_mode;
        unsigned long pitch;
 
-       if (intel->tiling)
+       if (intel->tiling & INTEL_TILING_FB)
                tiling_mode = I915_TILING_X;
        else
                tiling_mode = I915_TILING_NONE;
@@ -231,7 +231,7 @@ retry:
                return NULL;
        }
 
-       if (intel->tiling && tiling_mode != I915_TILING_X) {
+       if ((intel->tiling & INTEL_TILING_FB) && tiling_mode != I915_TILING_X) {
                xf86DrvMsg(scrn->scrnIndex, X_WARNING,
                           "Failed to set tiling on frontbuffer.\n");
        }

commit 0bb1a5f19e09dc553761ddd90bf6319eab94a597
Author: Chris Wilson <ch...@chris-wilson.co.uk>
Date:   Wed Mar 9 08:26:44 2011 +0000

    Update priv->stride after bo reallocation
    
    Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

diff --git a/src/intel_uxa.c b/src/intel_uxa.c
index 754bb4e..13d8cf9 100644
--- a/src/intel_uxa.c
+++ b/src/intel_uxa.c
@@ -668,9 +668,7 @@ void intel_set_pixmap_bo(PixmapPtr pixmap, dri_bo * bo)
                priv->bo = bo;
                priv->stride = intel_pixmap_pitch(pixmap);
 
-               ret = drm_intel_bo_get_tiling(bo,
-                                             &tiling,
-                                             &swizzle_mode);
+               ret = drm_intel_bo_get_tiling(bo, &tiling, &swizzle_mode);
                if (ret != 0) {
                        FatalError("Couldn't get tiling on bo %p: %s\n",
                                   bo, strerror(-ret));
@@ -796,6 +794,8 @@ static Bool intel_uxa_put_image(PixmapPtr pixmap,
 
                        if (tiling != I915_TILING_NONE)
                                drm_intel_bo_set_tiling(bo, &tiling, stride);


-- 
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/e1q581w-0005h6...@alioth.debian.org

Reply via email to