[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xserver-xorg-video-intel: Changes to 'upstream-experimental'



 NEWS                    |   50 ++
 configure.ac            |   15 
 src/i830_render.c       |   24 -
 src/i915_render.c       |    4 
 src/i965_render.c       |  966 +++++++++++++++++++++++-------------------------
 src/intel.h             |   46 +-
 src/intel_batchbuffer.c |   85 +---
 src/intel_batchbuffer.h |   11 
 src/intel_display.c     |   83 +++-
 src/intel_dri.c         |   79 +++
 src/intel_driver.c      |   48 +-
 src/intel_module.c      |    2 
 src/intel_shadow.c      |    4 
 src/intel_uxa.c         |  109 +++--
 src/intel_video.c       |    2 
 uxa/uxa-render.c        |   12 
 16 files changed, 885 insertions(+), 655 deletions(-)

New commits:
commit a7c7a9108f76aa312f3d5efa466052b914c81484
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Jan 4 10:53:30 2011 +0000

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

diff --git a/configure.ac b/configure.ac
index ddb37a4..8fcbce3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-video-intel],
-        [2.13.902],
+        [2.13.903],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-video-intel])
 AC_CONFIG_SRCDIR([Makefile.am])

commit 3fbecf34630c3588618900afdfbd9a4266856178
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Jan 4 10:52:44 2011 +0000

    NEWS: Add entry for 2.13.903
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/NEWS b/NEWS
index df0107e..298ce66 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,26 @@
+Snapshot 2.13.903 (2010-01-04)
+==============================
+This is the second release candidate in preparation for the upcoming
+2.14.0 release, and if no showstoppers turn up in wider testing will
+become the next release. Besides the usual bug fixes, we've included
+patches by Mario Kleiner to improve vblank handing which both improve the
+timing accuracy and remove a few potential races -- provided you also
+have the corresponding fixes in the kernel.
+
+Bug fixes
+---------
+
+ * Crash on hot-unpluging with an active fullscreen GL application, e.g. a
+   compositing WM or video player
+   https://bugs.freedesktop.org/show_bug.cgi?id=32770
+
+ * Freeze upon maximising client-side software renderers, e.g. flash.
+   https://bugs.freedesktop.org/show_bug.cgi?id=31367
+
+ * Fix confusion over G35 generation
+   https://bugs.freedesktop.org/show_bug.cgi?id=32478
+
+
 Snapshot 2.13.902 (2010-12-10)
 ==============================
 This is the first release candidate in preparation for the upcoming

commit 90538ecfff9c324d61419f451d41d26ab026f232
Author: U. Artie Eoff <ullysses.a.eoff@intel.com>
Date:   Tue Dec 21 17:42:38 2010 -0700

    configure: suggest upstream to find macros in case they're missing.
    
    added upstream suggestion to error message in case xorg macros or
    xserver macros are missing. removed package manager references in
    suggestion since these are 'user' and/or 'distribution' preferences.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/configure.ac b/configure.ac
index e6517e6..ddb37a4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,14 +37,17 @@ AM_MAINTAINER_MODE
 # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
 m4_ifndef([XORG_MACROS_VERSION],
           [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen.
-  Try "apt-get install xutils-dev" or "yum install xorg-x11-util-macros"])])
+  Hint: either install from source, git://anongit.freedesktop.org/xorg/util/macros or,
+  depending on you distribution, try package 'xutils-dev' or 'xorg-x11-util-macros'])])
+
 XORG_MACROS_VERSION(1.8)
 XORG_DEFAULT_OPTIONS
 
 # Require X.Org server macros (i.e. XORG_DRIVER_CHECK_EXT) to check for required modules 
 m4_ifndef([XORG_DRIVER_CHECK_EXT],
           [m4_fatal([must install xorg-server macros before running autoconf/autogen.
-  Try "apt-get install xserver-xorg-dev" or "yum install xorg-x11-server-devel"])])
+  Hint: either install from source, git://anongit.freedesktop.org/xorg/xserver or,
+  depending on your distribution, try package 'xserver-xorg-dev' or 'xorg-x11-server-devel'])])
 
 # Initialize libtool
 AC_DISABLE_STATIC

commit 6d50f5a140dbefdf86eb25d18d08473aa7e42acc
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Jan 3 23:06:14 2011 +0000

    If the crtc is not enabled, then it can't be on
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/intel_driver.c b/src/intel_driver.c
index f09203a..1275e4b 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -811,6 +811,9 @@ Bool intel_crtc_on(xf86CrtcPtr crtc)
 	xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
 	int i, active_outputs = 0;
 
+	if (!crtc->enabled)
+		return FALSE;
+
 	/* Kernel manages CRTC status based out output config */
 	for (i = 0; i < xf86_config->num_output; i++) {
 		xf86OutputPtr output = xf86_config->output[i];

commit 145c42a101c3150fb1e2cae8a1780b26e8b56f42
Author: Adam Jackson <ajax@redhat.com>
Date:   Mon Jan 3 17:52:27 2011 -0500

    dri2: Fix interlace computation
    
    scrn->currentMode is a hack for xf86vidmode and in general is wrong for
    RANDRful drivers.  Use the mode on the associated CRTC instead.
    
    Signed-off-by: Adam Jackson <ajax@redhat.com>
    [ickle: crtc->mode is a ModeRec not Ptr]
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/intel_dri.c b/src/intel_dri.c
index 7096369..7b60e14 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -433,8 +433,7 @@ I830DRI2CopyRegion(DrawablePtr drawable, RegionPtr pRegion,
 
 	/* Wait for the scanline to be outside the region to be copied */
 	if (pixmap_is_scanout(get_drawable_pixmap(dst)) &&
-	    intel->swapbuffers_wait &&
-	    scrn->currentMode) {
+	    intel->swapbuffers_wait) {
 		BoxPtr box;
 		BoxRec crtcbox;
 		int y1, y2;
@@ -485,7 +484,7 @@ I830DRI2CopyRegion(DrawablePtr drawable, RegionPtr pRegion,
 				    event = MI_WAIT_FOR_PIPEB_SVBLANK;
 			}
 
-			if (scrn->currentMode->Flags & V_INTERLACE) {
+			if (crtc->mode.Flags & V_INTERLACE) {
 				/* DSL count field lines */
 				y1 /= 2;
 				y2 /= 2;

commit b0d10ff04a24a951256a79710ba22b325b549ba4
Author: Adam Jackson <ajax@redhat.com>
Date:   Mon Jan 3 17:52:26 2011 -0500

    xv: Fix interlace computation
    
    scrn->currentMode is a hack for xf86vidmode and in general is wrong for
    RANDRful drivers.  Use the mode on the associated CRTC instead.
    
    Signed-off-by: Adam Jackson <ajax@redhat.com>
    [ickle: crtc->mode is a ModeRec]
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/intel_video.c b/src/intel_video.c
index cdff149..2786201 100644
--- a/src/intel_video.c
+++ b/src/intel_video.c
@@ -1348,7 +1348,7 @@ intel_wait_for_scanline(ScrnInfoPtr scrn, PixmapPtr pixmap,
 			event = MI_WAIT_FOR_PIPEB_SVBLANK;
 	}
 
-	if (scrn->currentMode->Flags & V_INTERLACE) {
+	if (crtc->mode.Flags & V_INTERLACE) {
 		/* DSL count field lines */
 		y1 /= 2;
 		y2 /= 2;

commit 0ad6d6e1a678de7d8c2d4cd7c734887e1deb2f9b
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Jan 3 16:52:07 2011 +0000

    dri: Only issue a warning for an "impossible" flip return 5 times
    
    As it appears that some kernels do indeed return the "wrong" value,
    issuing a warning 60 times a second is a cruel and unusual punishment.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=32680
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/intel_dri.c b/src/intel_dri.c
index b577c7d..7096369 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -802,10 +802,19 @@ void I830DRI2FlipEventHandler(unsigned int frame, unsigned int tv_sec,
 		 * causing wrong (msc, ust) return values and possible visual corruption.
 		 */
 		if ((frame < flip->frame) && (flip->frame - frame < 5)) {
-			xf86DrvMsg(scrn->scrnIndex, X_WARNING,
-				   "%s: Pageflip completion has impossible msc %d < target_msc %d\n",
-				   __func__, frame, flip->frame);
-			/* All-Zero values signal failure of timestamping to client. */
+			static int limit = 5;
+
+			/* XXX we are currently hitting this path with older
+			 * kernels, so make it quieter.
+			 */
+			if (limit) {
+				xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+					   "%s: Pageflip completion has impossible msc %d < target_msc %d\n",
+					   __func__, frame, flip->frame);
+				limit--;
+			}
+
+			/* All-0 values signal timestamping failure. */
 			frame = tv_sec = tv_usec = 0;
 		}
 

commit d729ef02f2955f7476df4c65403bc1f8e705b780
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Jan 2 09:11:10 2011 +0000

    dri: Don't wait upon a NULL current mode
    
    There is a race condition between the dri swapbuffers code and
    hotplugging whereby we might attempt to execute a wait upon a
    non-existent output. This causes a NULL dereference and a loud crash.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=32770
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/intel_dri.c b/src/intel_dri.c
index b80a755..b577c7d 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -432,8 +432,9 @@ I830DRI2CopyRegion(DrawablePtr drawable, RegionPtr pRegion,
 	ValidateGC(dst, gc);
 
 	/* Wait for the scanline to be outside the region to be copied */
-	if (pixmap_is_scanout(get_drawable_pixmap(dst))
-	    && intel->swapbuffers_wait) {
+	if (pixmap_is_scanout(get_drawable_pixmap(dst)) &&
+	    intel->swapbuffers_wait &&
+	    scrn->currentMode) {
 		BoxPtr box;
 		BoxRec crtcbox;
 		int y1, y2;

commit 537fa55ed2449e91f3dd1e04abc720c6818d7227
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Jan 2 09:06:28 2011 +0000

    dri: Fix the use of the uninitialised bo for flink
    
    Reported-by: Jeff Chua <jeff.chua.linux@gmail.com>
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/intel_dri.c b/src/intel_dri.c
index f404ea4..b80a755 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -77,12 +77,11 @@ static uint32_t pixmap_flink(PixmapPtr pixmap)
 {
 	struct intel_pixmap *priv = intel_get_pixmap_private(pixmap);
 	uint32_t name;
-	dri_bo *bo;
 
 	if (priv == NULL || priv->bo == NULL)
 		return 0;
 
-	if (dri_bo_flink(bo, &name) != 0)
+	if (dri_bo_flink(priv->bo, &name) != 0)
 		return 0;
 
 	priv->pinned = 1;

commit dbc542b9d38ff9781efcdf1d5308e97f04499138
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Dec 31 23:29:05 2010 +0000

    dri: Protect against using dri with an non-gem pixmap
    
    Reported-by: Jeff Chua <jeff.chua.linux@gmail.com>
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/intel_dri.c b/src/intel_dri.c
index dcd3a1a..f404ea4 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -79,7 +79,7 @@ static uint32_t pixmap_flink(PixmapPtr pixmap)
 	uint32_t name;
 	dri_bo *bo;
 
-	if (priv->bo == NULL)
+	if (priv == NULL || priv->bo == NULL)
 		return 0;
 
 	if (dri_bo_flink(bo, &name) != 0)

commit 53fbc9f1760ee481cba1f6dceb9e7c97282a2976
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Dec 30 15:32:40 2010 +0000

    Don't replace the scanout bo through PutImage
    
    As the bo may be pinned for either use by the scanout or through sharing
    with another application, under those circumstances we cannot replace
    the bo itself but must force the blit for PutImage.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=31367
    Reported-and-tested-by: Bjørn Mork <bjorn@mork.no>
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/intel.h b/src/intel.h
index 04c679f..9063328 100644
--- a/src/intel.h
+++ b/src/intel.h
@@ -184,6 +184,7 @@ struct intel_pixmap {
 	int8_t busy :2;
 	int8_t batch_write :1;
 	int8_t offscreen :1;
+	int8_t pinned :1;
 };
 
 #if HAS_DEVPRIVATEKEYREC
diff --git a/src/intel_dri.c b/src/intel_dri.c
index b7afffd..dcd3a1a 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -73,6 +73,22 @@ typedef struct {
 	unsigned int attachment;
 } I830DRI2BufferPrivateRec, *I830DRI2BufferPrivatePtr;
 
+static uint32_t pixmap_flink(PixmapPtr pixmap)
+{
+	struct intel_pixmap *priv = intel_get_pixmap_private(pixmap);
+	uint32_t name;
+	dri_bo *bo;
+
+	if (priv->bo == NULL)
+		return 0;
+
+	if (dri_bo_flink(bo, &name) != 0)
+		return 0;
+
+	priv->pinned = 1;
+	return name;
+}
+
 static PixmapPtr get_front_buffer(DrawablePtr drawable)
 {
 	ScreenPtr screen = drawable->pScreen;
@@ -179,10 +195,9 @@ I830DRI2CreateBuffers(DrawablePtr drawable, unsigned int *attachments,
 	ScrnInfoPtr scrn = xf86Screens[screen->myNum];
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 	DRI2BufferPtr buffers;
-	dri_bo *bo;
-	int i;
 	I830DRI2BufferPrivatePtr privates;
 	PixmapPtr pixmap, pDepthPixmap;
+	int i;
 
 	buffers = calloc(count, sizeof *buffers);
 	if (buffers == NULL)
@@ -251,8 +266,7 @@ I830DRI2CreateBuffers(DrawablePtr drawable, unsigned int *attachments,
 		privates[i].pixmap = pixmap;
 		privates[i].attachment = attachments[i];
 
-		bo = intel_get_pixmap_bo(pixmap);
-		if (bo == NULL || dri_bo_flink(bo, &buffers[i].name) != 0) {
+		if ((buffers[i].name = pixmap_flink(pixmap)) == 0) {
 			/* failed to name buffer */
 			screen->DestroyPixmap(pixmap);
 			goto unwind;
@@ -297,7 +311,6 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int attachment,
 	ScrnInfoPtr scrn = xf86Screens[screen->myNum];
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 	DRI2Buffer2Ptr buffer;
-	dri_bo *bo;
 	I830DRI2BufferPrivatePtr privates;
 	PixmapPtr pixmap;
 
@@ -358,8 +371,7 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int attachment,
 	privates->pixmap = pixmap;
 	privates->attachment = attachment;
 
-	bo = intel_get_pixmap_bo(pixmap);
-	if (bo == NULL || dri_bo_flink(bo, &buffer->name) != 0) {
+	if ((buffer->name = pixmap_flink(pixmap)) == 0) {
 		/* failed to name buffer */
 		screen->DestroyPixmap(pixmap);
 		free(privates);
diff --git a/src/intel_uxa.c b/src/intel_uxa.c
index 3f231ad..1a591f1 100644
--- a/src/intel_uxa.c
+++ b/src/intel_uxa.c
@@ -770,7 +770,8 @@ static Bool intel_uxa_put_image(PixmapPtr pixmap,
 	} else {
 		ScreenPtr screen = pixmap->drawable.pScreen;
 
-		if (x == 0 && y == 0 &&
+		if (!priv->pinned &&
+		    x == 0 && y == 0 &&
 		    w == pixmap->drawable.width &&
 		    h == pixmap->drawable.height)
 		{
@@ -1101,7 +1102,7 @@ void intel_uxa_create_screen_resources(ScreenPtr screen)
 	} else {
 		PixmapPtr pixmap = screen->GetScreenPixmap(screen);
 		intel_set_pixmap_bo(pixmap, bo);
-		intel_get_pixmap_private(pixmap)->busy = 1;
+		intel_get_pixmap_private(pixmap)->pinned = 1;
 		screen->ModifyPixmapHeader(pixmap,
 					   scrn->virtualX,
 					   scrn->virtualY,

commit 7667ad8432c032aec3a2aa004fc4dfc1877971b3
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Dec 24 09:42:29 2010 +0000

    dri: Differentiate identical "get vblank failed" messages with line no
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/intel_dri.c b/src/intel_dri.c
index a41555c..b7afffd 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -1038,7 +1038,9 @@ I830DRI2GetMSC(DrawablePtr draw, CARD64 *ust, CARD64 *msc)
 	ret = drmWaitVBlank(intel->drmSubFD, &vbl);
 	if (ret) {
 		xf86DrvMsg(scrn->scrnIndex, X_WARNING,
-			   "get vblank counter failed: %s\n", strerror(errno));
+			   "%s:%d get vblank counter failed: %s\n",
+			   __FUNCTION__, __LINE__,
+			   strerror(errno));
 		return FALSE;
 	}
 
@@ -1092,7 +1094,9 @@ I830DRI2ScheduleWaitMSC(ClientPtr client, DrawablePtr draw, CARD64 target_msc,
 	ret = drmWaitVBlank(intel->drmSubFD, &vbl);
 	if (ret) {
 		xf86DrvMsg(scrn->scrnIndex, X_WARNING,
-			   "get vblank counter failed: %s\n", strerror(errno));
+			   "%s:%d get vblank counter failed: %s\n",
+			   __FUNCTION__, __LINE__,
+			   strerror(errno));
 		goto out_complete;
 	}
 
@@ -1120,7 +1124,9 @@ I830DRI2ScheduleWaitMSC(ClientPtr client, DrawablePtr draw, CARD64 target_msc,
 		ret = drmWaitVBlank(intel->drmSubFD, &vbl);
 		if (ret) {
 			xf86DrvMsg(scrn->scrnIndex, X_WARNING,
-				   "get vblank counter failed: %s\n", strerror(errno));
+				   "%s:%d get vblank counter failed: %s\n",
+				   __FUNCTION__, __LINE__,
+				   strerror(errno));
 			goto out_complete;
 		}
 
@@ -1153,7 +1159,9 @@ I830DRI2ScheduleWaitMSC(ClientPtr client, DrawablePtr draw, CARD64 target_msc,
 	ret = drmWaitVBlank(intel->drmSubFD, &vbl);
 	if (ret) {
 		xf86DrvMsg(scrn->scrnIndex, X_WARNING,
-			   "get vblank counter failed: %s\n", strerror(errno));
+			   "%s:%d get vblank counter failed: %s\n",
+			   __FUNCTION__, __LINE__,
+			   strerror(errno));
 		goto out_complete;
 	}
 

commit 875d4828352c501ec5d0169735fb078807e76f2e
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Dec 23 19:36:12 2010 +0000

    i830: amalgamate consecutive composites into a single primitive
    
    Improve aa10text on i845 from 218kglyphs/s to 234kglyphs/s
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/i830_render.c b/src/i830_render.c
index 2c40b5d..3f3d2ef 100644
--- a/src/i830_render.c
+++ b/src/i830_render.c
@@ -669,7 +669,7 @@ i830_emit_composite_primitive(PixmapPtr dest,
 	ScrnInfoPtr scrn = xf86Screens[dest->drawable.pScreen->myNum];
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 	Bool is_affine_src, is_affine_mask = TRUE;
-	int per_vertex, num_floats;
+	int per_vertex;
 	float src_x[3], src_y[3], src_w[3], mask_x[3], mask_y[3], mask_w[3];
 
 	per_vertex = 2;		/* dest x/y */
@@ -786,9 +786,10 @@ i830_emit_composite_primitive(PixmapPtr dest,
 		}
 	}
 
-	num_floats = 3 * per_vertex;
-
-	OUT_BATCH(PRIM3D_INLINE | PRIM3D_RECTLIST | (num_floats - 1));
+	if (intel->vertex_count == 0) {
+		intel->vertex_index = intel->batch_used;
+		OUT_BATCH(PRIM3D_INLINE | PRIM3D_RECTLIST);
+	}
 	OUT_BATCH_F(dstX + w);
 	OUT_BATCH_F(dstY + h);
 	OUT_BATCH_F(src_x[2] / intel->scale_units[0][0]);
@@ -833,6 +834,17 @@ i830_emit_composite_primitive(PixmapPtr dest,
 			OUT_BATCH_F(mask_w[0]);
 		}
 	}
+
+	intel->vertex_count += 3 * per_vertex;
+
+}
+
+void i830_vertex_flush(intel_screen_private *intel)
+{
+	if (intel->vertex_count) {
+		intel->batch_ptr[intel->vertex_index] |= intel->vertex_count - 1;
+		intel->vertex_count = 0;
+	}
 }
 
 /**
diff --git a/src/intel.h b/src/intel.h
index 8d31ac1..04c679f 100644
--- a/src/intel.h
+++ b/src/intel.h
@@ -570,9 +570,10 @@ Bool i830_check_composite_texture(ScreenPtr screen, PicturePtr picture);
 Bool i830_prepare_composite(int op, PicturePtr sourcec, PicturePtr mask,
 			    PicturePtr dest, PixmapPtr sourcecPixmap,
 			    PixmapPtr maskPixmap, PixmapPtr destPixmap);
-
 void i830_composite(PixmapPtr dest, int srcX, int srcY,
 		    int maskX, int maskY, int dstX, int dstY, int w, int h);
+void i830_vertex_flush(intel_screen_private *intel);
+
 /* i915_render.c */
 Bool i915_check_composite(int op,
 			  PicturePtr sourcec, PicturePtr mask, PicturePtr dest,
diff --git a/src/intel_uxa.c b/src/intel_uxa.c
index 2be26b2..3f231ad 100644
--- a/src/intel_uxa.c
+++ b/src/intel_uxa.c
@@ -1220,6 +1220,7 @@ Bool intel_uxa_init(ScreenPtr screen)
 		intel->uxa_driver->composite = i830_composite;
 		intel->uxa_driver->done_composite = i830_done_composite;
 
+		intel->vertex_flush = i830_vertex_flush;
 		intel->batch_commit_notify = i830_batch_commit_notify;
 	} else if (IS_GEN3(intel)) {
 		intel->uxa_driver->check_composite = i915_check_composite;

commit 58d9912e447cf6e29b20747b5ed6ee595687ce8d
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Dec 22 13:50:53 2010 +0000

    Remove the deprecated function 'XNFprintf'
    
    As we know the maximum length of the string, we can replace our single
    usage of XNFprintf with snprintf.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/intel_driver.c b/src/intel_driver.c
index 962ee50..f09203a 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -354,26 +354,22 @@ static Bool intel_open_drm_master(ScrnInfoPtr scrn)
 {
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 	struct pci_device *dev = intel->PciInfo;
-	char *busid;
 	drmSetVersion sv;
 	struct drm_i915_getparam gp;
 	int err, has_gem;
+	char busid[20];
 
-	/* We wish we had asprintf, but all we get is XNFprintf. */
-	busid = XNFprintf("pci:%04x:%02x:%02x.%d",
-			  dev->domain, dev->bus, dev->dev, dev->func);
+	snprintf(busid, sizeof(busid), "pci:%04x:%02x:%02x.%d",
+		 dev->domain, dev->bus, dev->dev, dev->func);
 
 	intel->drmSubFD = drmOpen("i915", busid);
 	if (intel->drmSubFD == -1) {
 		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
 			   "[drm] Failed to open DRM device for %s: %s\n",
 			   busid, strerror(errno));
-		free(busid);
 		return FALSE;
 	}
 
-	free(busid);
-
 	/* Check that what we opened was a master or a master-capable FD,
 	 * by setting the version of the interface we'll use to talk to it.
 	 * (see DRIOpenDRMMaster() in DRI1)

commit e8db77e019e19ace48592b2f6d96af6baa9a228e
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Dec 21 23:03:21 2010 +0000

    Revert "Suggest where to find xorg-macros in case it's missing"
    
    I failed my reading comprehension and didn't spot that the help strings
    pointed to two separate downstream packages.
    
    Thanks to Carl Worth for pointing out my mistake.
    
    This reverts commit ebb7aca66785730737bc739624006e55d43dfe1b.

diff --git a/configure.ac b/configure.ac
index 5eaf0e5..e6517e6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,17 +35,17 @@ AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
 
 # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
-m4_define(xorg_macros_help,
-[[must install xorg-macros 1.8 or later before running autoconf/autogen.
-Either install xorg-macros from source,
-git://anongit.freedesktop.org/xorg/util/macros, or try
-"apt-get install xutils-dev" or "yum install xorg-x11-util-macros".]])
-m4_ifndef([XORG_MACROS_VERSION], [m4_fatal(xorg_macros_help)])
-m4_ifndef([XORG_DRIVER_CHECK_EXT], [m4_fatal(xorg_macros_help)])
-
+m4_ifndef([XORG_MACROS_VERSION],
+          [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen.
+  Try "apt-get install xutils-dev" or "yum install xorg-x11-util-macros"])])
 XORG_MACROS_VERSION(1.8)
 XORG_DEFAULT_OPTIONS
 
+# Require X.Org server macros (i.e. XORG_DRIVER_CHECK_EXT) to check for required modules 
+m4_ifndef([XORG_DRIVER_CHECK_EXT],
+          [m4_fatal([must install xorg-server macros before running autoconf/autogen.
+  Try "apt-get install xserver-xorg-dev" or "yum install xorg-x11-server-devel"])])
+
 # Initialize libtool
 AC_DISABLE_STATIC
 AC_PROG_LIBTOOL

commit ebb7aca66785730737bc739624006e55d43dfe1b
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Dec 21 22:23:24 2010 +0000

    Suggest where to find xorg-macros in case it's missing
    
    [Modified version of U. Artie Eoff's commit to remove the duplicated
    string. The paraphrased commit message is repeated below for clarity.]
    
    xorg-macros is often package under an unusual name, so provide some
    clues as to what name to try on the user's distribution. Installing
    build-deps would be just too easy...
    
    Also include a check for the existence of the XORG_DRIVER_CHECK_EXT
    macro, otherwise configure might continue in spite of the missing macro
    and cause obtuse syntax errors.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/configure.ac b/configure.ac
index e6517e6..5eaf0e5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,17 +35,17 @@ AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
 
 # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
-m4_ifndef([XORG_MACROS_VERSION],
-          [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen.
-  Try "apt-get install xutils-dev" or "yum install xorg-x11-util-macros"])])
+m4_define(xorg_macros_help,
+[[must install xorg-macros 1.8 or later before running autoconf/autogen.
+Either install xorg-macros from source,
+git://anongit.freedesktop.org/xorg/util/macros, or try
+"apt-get install xutils-dev" or "yum install xorg-x11-util-macros".]])
+m4_ifndef([XORG_MACROS_VERSION], [m4_fatal(xorg_macros_help)])
+m4_ifndef([XORG_DRIVER_CHECK_EXT], [m4_fatal(xorg_macros_help)])
+
 XORG_MACROS_VERSION(1.8)
 XORG_DEFAULT_OPTIONS
 
-# Require X.Org server macros (i.e. XORG_DRIVER_CHECK_EXT) to check for required modules 
-m4_ifndef([XORG_DRIVER_CHECK_EXT],
-          [m4_fatal([must install xorg-server macros before running autoconf/autogen.
-  Try "apt-get install xserver-xorg-dev" or "yum install xorg-x11-server-devel"])])
-
 # Initialize libtool
 AC_DISABLE_STATIC
 AC_PROG_LIBTOOL

commit 90576f95f35e528fa2c667df162c5dc7ec98975d
Author: U. Artie Eoff <ullysses.a.eoff@intel.com>
Date:   Tue Dec 21 15:10:41 2010 -0700

    configure: updated m4 macro check in configure.ac
    
    Added m4 check for XORG_DRIVER_CHECK_EXT macro definition.  Updated m4 fatal messages to give better hint on how to resolve error when xorg macros are missing.  Previously, configure would continue in spite of the missing macros and the build would fail for syntax errors.

diff --git a/configure.ac b/configure.ac
index 05848ea..e6517e6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,10 +36,16 @@ AM_MAINTAINER_MODE
 
 # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
 m4_ifndef([XORG_MACROS_VERSION],
-          [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
+          [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen.
+  Try "apt-get install xutils-dev" or "yum install xorg-x11-util-macros"])])
 XORG_MACROS_VERSION(1.8)
 XORG_DEFAULT_OPTIONS
 
+# Require X.Org server macros (i.e. XORG_DRIVER_CHECK_EXT) to check for required modules 
+m4_ifndef([XORG_DRIVER_CHECK_EXT],
+          [m4_fatal([must install xorg-server macros before running autoconf/autogen.
+  Try "apt-get install xserver-xorg-dev" or "yum install xorg-x11-server-devel"])])
+
 # Initialize libtool
 AC_DISABLE_STATIC
 AC_PROG_LIBTOOL

commit 1ac2e04023f84dbf1f3db2ecad1cadd159aa614d
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Dec 20 10:55:11 2010 +0000

    Undo: Disable BLT for i830 and 845G
    
    Reported-by: György Balló  <ballogy@freestart.hu>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=32482
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/intel_driver.c b/src/intel_driver.c
index a3d924f..962ee50 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -470,7 +470,7 @@ static void I830XvInit(ScrnInfoPtr scrn)
 
 static Bool can_accelerate_blt(struct intel_screen_private *intel)
 {
-	if (IS_I830(intel) || IS_845G(intel)) {
+	if (0 && (IS_I830(intel) || IS_845G(intel))) {
 		/* These pair of i8xx chipsets have a crippling erratum
 		 * that prevents the use of a PTE entry by the BLT
 		 * engine immediately following updating that
@@ -479,6 +479,8 @@ static Bool can_accelerate_blt(struct intel_screen_private *intel)
 		 * As the BLT is fundamental to our 2D acceleration,
 		 * and the workaround is lost in the midst of time,
 		 * fallback.
+		 *
+		 * XXX disabled for release as causes regressions in GL.
 		 */
 		return FALSE;
 	}

commit 6f21405454487adf7623cf22f0fdd9f127099afd
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Dec 17 16:37:55 2010 +0000

    G35 is gen4 and not gen3
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=32478
    Reported-and-tested-by: Michal Marek <mmarek@suse.cz>
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/intel_module.c b/src/intel_module.c
index 898e697..528ecf4 100644
--- a/src/intel_module.c
+++ b/src/intel_module.c
@@ -315,7 +315,7 @@ void intel_detect_chipset(ScrnInfoPtr scrn,
 	break;
     case PCI_CHIP_G35_G:
 	chipset->name = "G35";
-	chipset->info = &intel_g33_info;
+	chipset->info = &intel_i965_info;
 	break;
     case PCI_CHIP_I965_Q:
 	chipset->name = "965Q";

commit 5743c223877fbff710cdd5114cff6d3ee3108309
Author: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
Date:   Thu Dec 9 03:27:59 2010 +0100

    Check consistency of pageflip completion vblank count.
    
    Implements a consistency check on returned vblank
    count values of pageflip completion. Impossible
    values are detected, a x-warning is logged and
    returned (msc,ust) values are marked invalid,
    so clients could perform error handling. Such
    a warning would indicate bugs in the pageflip
    completion routine of future kms drivers or the
    ddx and thereby aid driver debugging.
    
    Signed-off-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/intel_dri.c b/src/intel_dri.c
index e383548..a41555c 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -629,7 +629,8 @@ I830DRI2ExchangeBuffers(DrawablePtr draw, DRI2BufferPtr front,
 static Bool
 I830DRI2ScheduleFlip(struct intel_screen_private *intel,
 		     ClientPtr client, DrawablePtr draw, DRI2BufferPtr front,
-		     DRI2BufferPtr back, DRI2SwapEventPtr func, void *data)
+		     DRI2BufferPtr back, DRI2SwapEventPtr func, void *data,
+		     unsigned int target_msc)
 {
 	I830DRI2BufferPrivatePtr back_priv;
 	DRI2FrameEventPtr flip_info;
@@ -646,6 +647,7 @@ I830DRI2ScheduleFlip(struct intel_screen_private *intel,
 	flip_info->type = DRI2_SWAP;
 	flip_info->event_complete = func;
 	flip_info->event_data = data;
+	flip_info->frame = target_msc;
 
 	/* Page flip the full screen buffer */
 	back_priv = back->driverPrivate;
@@ -712,7 +714,7 @@ void I830DRI2FrameEventHandler(unsigned int frame, unsigned int tv_sec,
 		    I830DRI2ScheduleFlip(intel,
 					 event->client, drawable, event->front,
 					 event->back, event->event_complete,
-					 event->event_data)) {
+					 event->event_data, event->frame)) {
 			I830DRI2ExchangeBuffers(drawable,
 						event->front, event->back);
 			break;
@@ -783,6 +785,18 @@ void I830DRI2FlipEventHandler(unsigned int frame, unsigned int tv_sec,
 	/* We assume our flips arrive in order, so we don't check the frame */
 	switch (flip->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)) {
+			xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+				   "%s: Pageflip completion has impossible msc %d < target_msc %d\n",
+				   __func__, frame, flip->frame);
+			/* All-Zero values signal failure of timestamping to client. */
+			frame = tv_sec = tv_usec = 0;
+		}
+
 		DRI2SwapComplete(flip->client, drawable, frame, tv_sec, tv_usec,
 				 DRI2_FLIP_COMPLETE, flip->event_complete,
 				 flip->event_data);

commit 2177e6032146f4720f244e98f7c0d6df1b925784
Author: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
Date:   Thu Dec 9 03:12:35 2010 +0100

    Fix reporting of pageflip completion events on multi-head.
    
    When a drawable is page-flipped on multiple crtc's (fullscreen
    drawable on mirror-mode or multi-head x-screen), only one pageflip
    event is finally delivered, after the last participating crtc signals
    flip completion, this to avoid visual corruption.
    
    Old code returned vblank count and timestamps of flip completion
    of this last crtc, instead of the values of the "master crtc", the
    one that was used for initially scheduling/triggering the pagflip
    via vblank events. (master = I830DRI2DrawablePipe(drawable))
    
    This patch makes sure that the pageflip completion values of the
    "master" crtc are returned, otherwise client applications will
    get confused by the random (msc, ust) values returned by whichever
    crtc was the last to complete its flip. Without this, the returned
    values change randomly and jump forward and backward in time and
    count.
    
    Signed-off-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

diff --git a/src/intel.h b/src/intel.h
index dc88d74..8d31ac1 100644
--- a/src/intel.h
+++ b/src/intel.h
@@ -503,7 +503,7 @@ extern int intel_output_dpms_status(xf86OutputPtr output);
 
 extern Bool intel_do_pageflip(intel_screen_private *intel,
 			      dri_bo *new_front,
-			      void *data);
+			      void *data, int ref_crtc_hw_id);
 
 static inline intel_screen_private *
 intel_get_screen_private(ScrnInfoPtr scrn)
diff --git a/src/intel_display.c b/src/intel_display.c
index bb8d708..1198013 100644
--- a/src/intel_display.c
+++ b/src/intel_display.c
@@ -53,11 +53,19 @@ struct intel_mode {
 	void *event_data;
 	int old_fb_id;
 	int flip_count;
+	unsigned int fe_frame;
+	unsigned int fe_tv_sec;
+	unsigned int fe_tv_usec;
 
 	struct list outputs;
 	struct list crtcs;
 };
 
+struct intel_pageflip {
+	struct intel_mode *mode;
+	Bool dispatch_me;
+};
+
 struct intel_crtc {
 	struct intel_mode *mode;
 	drmModeModeInfo kmode;
@@ -1416,13 +1424,14 @@ fail:
 Bool
 intel_do_pageflip(intel_screen_private *intel,
 		  dri_bo *new_front,
-		  void *data)
+		  void *data, int ref_crtc_hw_id)
 {
 	ScrnInfoPtr scrn = intel->scrn;
 	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
 	struct intel_crtc *crtc = config->crtc[0]->driver_private;
 	struct intel_mode *mode = crtc->mode;
 	unsigned int pitch = scrn->displayWidth * intel->cpp;
+	struct intel_pageflip *flip;
 	int i, old_fb_id;
 
 	/*
@@ -1443,18 +1452,39 @@ intel_do_pageflip(intel_screen_private *intel,
 	 * Also, flips queued on disabled or incorrectly configured displays
 	 * may never complete; this is a configuration error.
 	 */
+	mode->fe_frame = 0;
+	mode->fe_tv_sec = 0;
+	mode->fe_tv_usec = 0;
+
 	for (i = 0; i < config->num_crtc; i++) {
 		if (!config->crtc[i]->enabled)
 			continue;
 
 		mode->event_data = data;
 		mode->flip_count++;
+
+		crtc = config->crtc[i]->driver_private;
+
+		flip = calloc(1, sizeof(struct intel_pageflip));
+		if (flip == NULL) {
+			xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+				   "flip queue: carrier alloc failed.\n");
+			goto error_undo;
+		}
+
+		/* Only the reference crtc will finally deliver its page flip
+		 * completion event. All other crtc's events will be discarded.
+		 */
+		flip->dispatch_me = (intel_crtc_to_pipe(crtc->crtc) == ref_crtc_hw_id);
+		flip->mode = mode;
+
 		if (drmModePageFlip(mode->fd,
-				    crtc_id(config->crtc[i]->driver_private),
+				    crtc_id(crtc),
 				    mode->fb_id,
-				    DRM_MODE_PAGE_FLIP_EVENT, mode)) {
+				    DRM_MODE_PAGE_FLIP_EVENT, flip)) {
 			xf86DrvMsg(scrn->scrnIndex, X_WARNING,
 				   "flip queue failed: %s\n", strerror(errno));
+			free(flip);


Reply to: