xf86-video-intel: 10 commits - configure.ac src/intel_dri.c src/intel.h src/intel_module.c src/sna/gen6_render.c src/sna/gen7_render.c src/sna/sna_dri.c uxa/uxa-render.c

Chris Wilson ickle at kemper.freedesktop.org
Tue Nov 20 03:44:29 PST 2012


 configure.ac          |    4 +-
 src/intel.h           |    3 +
 src/intel_dri.c       |   54 ++++++++++++++-------------------
 src/intel_module.c    |    6 +--
 src/sna/gen6_render.c |    9 ++++-
 src/sna/gen7_render.c |    9 ++++-
 src/sna/sna_dri.c     |    8 +++-
 uxa/uxa-render.c      |   81 +++++++++++++++++---------------------------------
 8 files changed, 78 insertions(+), 96 deletions(-)

New commits:
commit fa5c573455cf63090dbb6d167d4e5f1cb23daf72
Author: Eric Anholt <eric at anholt.net>
Date:   Sat Nov 17 13:11:13 2012 -0800

    uxa: Refactor early-exit paths of uxa_try_driver_composite().
    
    Saves 200b of code at -O2.

diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index d783ea2..3678f6a 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -965,8 +965,9 @@ uxa_try_driver_composite(CARD8 op,
 	int xDst_copy = 0, yDst_copy = 0;
 	int src_off_x, src_off_y, mask_off_x, mask_off_y, dst_off_x, dst_off_y;
 	PixmapPtr pSrcPix, pMaskPix = NULL, pDstPix;
-	PicturePtr localSrc, localMask = NULL;
+	PicturePtr localSrc = NULL, localMask = NULL;
 	PicturePtr localDst = pDst;
+	int ret = 0;
 
 	if (uxa_screen->info->check_composite &&
 	    !(*uxa_screen->info->check_composite) (op, pSrc, pMask, pDst, width, height))
@@ -1018,9 +1019,8 @@ uxa_try_driver_composite(CARD8 op,
 	pDstPix =
 	    uxa_get_offscreen_pixmap(localDst->pDrawable, &dst_off_x, &dst_off_y);
 	if (!pDstPix) {
-		if (localDst != pDst)
-			FreePicture(localDst, 0);
-		return -1;
+		ret = -1;
+		goto error;
 	}
 
 	xDst += localDst->pDrawable->x;
@@ -1031,9 +1031,8 @@ uxa_try_driver_composite(CARD8 op,
 				      width, height,
 				      &xSrc, &ySrc);
 	if (!localSrc) {
-		if (localDst != pDst)
-			FreePicture(localDst, 0);
-		return 0;
+		ret = 0;
+		goto error;
 	}
 
 	if (pMask) {
@@ -1042,72 +1041,38 @@ uxa_try_driver_composite(CARD8 op,
 					     width, height,
 					     &xMask, &yMask);
 		if (!localMask) {
-			if (localSrc != pSrc)
-				FreePicture(localSrc, 0);
-			if (localDst != pDst)
-				FreePicture(localDst, 0);
-
-			return 0;
+			ret = 0;
+			goto error;
 		}
 	}
 
 	if (!miComputeCompositeRegion(&region, localSrc, localMask, localDst,
 				      xSrc, ySrc, xMask, yMask, xDst, yDst,
 				      width, height)) {
-		if (localSrc != pSrc)
-			FreePicture(localSrc, 0);
-		if (localMask && localMask != pMask)
-			FreePicture(localMask, 0);
-		if (localDst != pDst)
-			FreePicture(localDst, 0);
-
-		return 1;
+		ret = 1;
+		goto error;
 	}
 
 	pSrcPix = uxa_get_offscreen_pixmap(localSrc->pDrawable,
 					   &src_off_x, &src_off_y);
 	if (!pSrcPix) {
-		REGION_UNINIT(screen, &region);
-
-		if (localSrc != pSrc)
-			FreePicture(localSrc, 0);
-		if (localMask && localMask != pMask)
-			FreePicture(localMask, 0);
-		if (localDst != pDst)
-			FreePicture(localDst, 0);
-
-		return 0;
+		ret = 0;
+		goto error;
 	}
 
 	if (localMask) {
 		pMaskPix = uxa_get_offscreen_pixmap(localMask->pDrawable,
 						    &mask_off_x, &mask_off_y);
 		if (!pMaskPix) {
-			REGION_UNINIT(screen, &region);
-
-			if (localSrc != pSrc)
-				FreePicture(localSrc, 0);
-			if (localMask && localMask != pMask)
-				FreePicture(localMask, 0);
-			if (localDst != pDst)
-				FreePicture(localDst, 0);
-
-			return 0;
+			ret = 0;
+			goto error;
 		}
 	}
 
 	if (!(*uxa_screen->info->prepare_composite)
 	    (op, localSrc, localMask, localDst, pSrcPix, pMaskPix, pDstPix)) {
-		REGION_UNINIT(screen, &region);
-
-		if (localSrc != pSrc)
-			FreePicture(localSrc, 0);
-		if (localMask && localMask != pMask)
-			FreePicture(localMask, 0);
-		if (localDst != pDst)
-			FreePicture(localDst, 0);
-
-		return -1;
+		ret = -1;
+		goto error;
 	}
 
 	if (pMask) {
@@ -1156,6 +1121,18 @@ uxa_try_driver_composite(CARD8 op,
 	}
 
 	return 1;
+
+error:
+	REGION_UNINIT(screen, &region);
+
+	if (localSrc && localSrc != pSrc)
+		FreePicture(localSrc, 0);
+	if (localMask && localMask != pMask)
+		FreePicture(localMask, 0);
+	if (localDst != pDst)
+		FreePicture(localDst, 0);
+
+	return ret;
 }
 
 /**
commit edefb64d2b1c95b0b678cb222273ab64b2e6db2a
Author: Eric Anholt <eric at anholt.net>
Date:   Sat Nov 17 13:11:12 2012 -0800

    uxa: Work around uninitialized-value warning.
    
    The compiler isn't noticing that localDst only diverges from pDst when
    the _copy variables have also been set.

diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index 4463dc2..d783ea2 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -962,7 +962,7 @@ uxa_try_driver_composite(CARD8 op,
 	RegionRec region;
 	BoxPtr pbox;
 	int nbox;
-	int xDst_copy, yDst_copy;
+	int xDst_copy = 0, yDst_copy = 0;
 	int src_off_x, src_off_y, mask_off_x, mask_off_y, dst_off_x, dst_off_y;
 	PixmapPtr pSrcPix, pMaskPix = NULL, pDstPix;
 	PicturePtr localSrc, localMask = NULL;
commit 18b2e2a82724407196001ca853bd83150c66c5bd
Author: Eric Anholt <eric at anholt.net>
Date:   Sat Nov 17 13:11:10 2012 -0800

    uxa: Add printf attribute to intel_debug_fallback().
    
    Shuts up a bunch of warnings with xorg's shared warning flags, and
    should give us more informative warnings in our code.

diff --git a/src/intel.h b/src/intel.h
index d394750..53ce33c 100644
--- a/src/intel.h
+++ b/src/intel.h
@@ -553,6 +553,9 @@ intel_get_transformed_coordinates_3d(int x, int y, PictTransformPtr transform,
 				    float *x_out, float *y_out, float *z_out);
 
 static inline void
+intel_debug_fallback(ScrnInfoPtr scrn, const char *format, ...) _X_ATTRIBUTE_PRINTF(2, 3);
+
+static inline void
 intel_debug_fallback(ScrnInfoPtr scrn, const char *format, ...)
 {
 	intel_screen_private *intel = intel_get_screen_private(scrn);
commit 2d1e267e662505ca0dd318765464a24739dc5bd8
Author: Eric Anholt <eric at anholt.net>
Date:   Sat Nov 17 13:11:09 2012 -0800

    uxa/dri: Factor out the repeated swap fallback code.

diff --git a/src/intel_dri.c b/src/intel_dri.c
index 17d9d50..4c0827d 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -547,6 +547,23 @@ I830DRI2CopyRegion(DrawablePtr drawable, RegionPtr pRegion,
 	intel_batch_submit(scrn);
 }
 
+static void
+I830DRI2FallbackBlitSwap(DrawablePtr drawable,
+			 DRI2BufferPtr dst,
+			 DRI2BufferPtr src)
+{
+	BoxRec box;
+	RegionRec region;
+
+	box.x1 = 0;
+	box.y1 = 0;
+	box.x2 = drawable->width;
+	box.y2 = drawable->height;
+	REGION_INIT(pScreen, &region, &box, 0);
+
+	I830DRI2CopyRegion(drawable, &region, dst, src);
+}
+
 #if DRI2INFOREC_VERSION >= 4
 
 static void I830DRI2ReferenceBuffer(DRI2Buffer2Ptr buffer)
@@ -996,17 +1013,8 @@ void I830DRI2FrameEventHandler(unsigned int frame, unsigned int tv_sec,
 
 		/* else fall through to exchange/blit */
 	case DRI2_SWAP: {
-		BoxRec box;
-		RegionRec region;
-
-		box.x1 = 0;
-		box.y1 = 0;
-		box.x2 = drawable->width;
-		box.y2 = drawable->height;
-		REGION_INIT(pScreen, &region, &box, 0);
-
-		I830DRI2CopyRegion(drawable,
-				   &region, swap_info->front, swap_info->back);
+		I830DRI2FallbackBlitSwap(drawable,
+					 swap_info->front, swap_info->back);
 		DRI2SwapComplete(swap_info->client, drawable, frame, tv_sec, tv_usec,
 				 DRI2_BLIT_COMPLETE,
 				 swap_info->client ? swap_info->event_complete : NULL,
@@ -1089,17 +1097,10 @@ void I830DRI2FlipEventHandler(unsigned int frame, unsigned int tv_sec,
 				i830_dri2_del_frame_event(chain_drawable, chain);
 			} else if (!can_exchange(chain_drawable, chain->front, chain->back) ||
 				   !I830DRI2ScheduleFlip(intel, chain_drawable, chain)) {
-				BoxRec box;
-				RegionRec region;
-
-				box.x1 = 0;
-				box.y1 = 0;
-				box.x2 = chain_drawable->width;
-				box.y2 = chain_drawable->height;
-				REGION_INIT(pScreen, &region, &box, 0);
+				I830DRI2FallbackBlitSwap(drawable,
+							 chain->front,
+							 chain->back);
 
-				I830DRI2CopyRegion(chain_drawable, &region,
-						   chain->front, chain->back);
 				DRI2SwapComplete(chain->client, chain_drawable, frame, tv_sec, tv_usec,
 						 DRI2_BLIT_COMPLETE,
 						 chain->client ? chain->event_complete : NULL,
@@ -1162,8 +1163,6 @@ I830DRI2ScheduleSwap(ClientPtr client, DrawablePtr draw, DRI2BufferPtr front,
 	DRI2FrameEventPtr swap_info = NULL;
 	enum DRI2FrameEventType swap_type = DRI2_SWAP;
 	CARD64 current_msc;
-	BoxRec box;
-	RegionRec region;
 
 	/* Drawable not displayed... just complete the swap */
 	if (pipe == -1)
@@ -1313,14 +1312,7 @@ I830DRI2ScheduleSwap(ClientPtr client, DrawablePtr draw, DRI2BufferPtr front,
 	return TRUE;
 
 blit_fallback:
-	box.x1 = 0;
-	box.y1 = 0;
-	box.x2 = draw->width;
-	box.y2 = draw->height;
-	REGION_INIT(pScreen, &region, &box, 0);
-
-	I830DRI2CopyRegion(draw, &region, front, back);
-
+	I830DRI2FallbackBlitSwap(draw, front, back);
 	DRI2SwapComplete(client, draw, 0, 0, 0, DRI2_BLIT_COMPLETE, func, data);
 	if (swap_info)
 	    i830_dri2_del_frame_event(draw, swap_info);
commit cd2f373da7a14e004c999f9f0efaf88c785d3d3f
Author: Eric Anholt <eric at anholt.net>
Date:   Sat Nov 17 13:11:08 2012 -0800

    configure.ac: Fix bad syntax for test calls

diff --git a/configure.ac b/configure.ac
index d92269f..92c77f5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -113,7 +113,7 @@ AC_ARG_ENABLE(udev,
 
 if test x$UDEV != "xno"; then
 	PKG_CHECK_MODULES(UDEV, [libudev], [udev=yes], [udev=no])
-	if test x$UDEV == xyes -a x$udev != xyes; then
+	if test x$UDEV = xyes -a x$udev != xyes; then
 		AC_MSG_ERROR([udev support requested but not found (libudev)])
 	fi
 	if test x$udev = xyes; then
@@ -409,7 +409,7 @@ if test "x$UMS_ONLY" = xyes; then
 fi
 
 AM_CONDITIONAL(DEBUG, test x$DEBUG != xno)
-AM_CONDITIONAL(FULL_DEBUG, test x$FULL_DEBUG == xfull)
+AM_CONDITIONAL(FULL_DEBUG, test x$FULL_DEBUG = xfull)
 if test "x$DEBUG" = xno; then
 	AC_DEFINE(NDEBUG,1,[Disable internal debugging])
 fi
commit b8c01d9bd7ce5656706ebebd16e5a8c5ca0ba487
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Nov 19 15:20:10 2012 +0000

    sna/dri: Add an assert that the cached DRI2 buffer is pinned for DRI
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index 9282867..5729950 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -259,6 +259,7 @@ sna_dri_create_buffer(DrawablePtr draw,
 
 			assert(private->pixmap == pixmap);
 			assert(sna_pixmap(pixmap)->gpu_bo == private->bo);
+			assert(sna_pixmap(pixmap)->pinned & PIN_DRI);
 			assert(kgem_bo_flink(&sna->kgem, private->bo) == buffer->name);
 			assert(8*private->bo->pitch >= pixmap->drawable.width * pixmap->drawable.bitsPerPixel);
 			assert(private->bo->pitch * pixmap->drawable.height <= kgem_bo_size(private->bo));
commit 84b1a02fa9fde02366e0384044526982e70d0e8d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Nov 19 13:41:28 2012 +0000

    sna/dri: Avoid setting off-delay after a failed flip (use-after-free)
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index e203519..9282867 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -1539,11 +1539,11 @@ static void sna_dri_flip_event(struct sna *sna,
 					 DRI2_FLIP_COMPLETE,
 					 flip->client ? flip->event_complete : NULL,
 					 flip->event_data);
-			if (flip->count)
+			if (flip->count) {
+				flip->off_delay = FLIP_OFF_DELAY;
 				sna->dri.flip_pending = flip;
-			else
+			} else
 				sna_dri_frame_event_info_free(sna, flip->draw, flip);
-			flip->off_delay = FLIP_OFF_DELAY;
 		} else {
 			DBG(("%s: no longer able to flip\n", __FUNCTION__));
 
commit b4dd1103a55406bcd65f137c668701074a5c41b6
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Nov 18 12:21:49 2012 +0000

    sna/gen6+: Tweak prefer-blt to offset latency when in rc6
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index 97c61a8..16d5d90 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -3249,8 +3249,13 @@ static inline bool prefer_blt_copy(struct sna *sna,
 	if (PREFER_RENDER)
 		return PREFER_RENDER > 0;
 
-	return (sna->kgem.ring == KGEM_BLT ||
-		(flags & COPY_LAST && sna->kgem.mode == KGEM_NONE) ||
+	if (sna->kgem.ring == KGEM_BLT)
+		return true;
+
+	if (src_bo == dst_bo && can_switch_to_blt(sna))
+		return true;
+
+	return ((flags & COPY_LAST && sna->kgem.ring != KGEM_RENDER) ||
 		prefer_blt_bo(sna, src_bo) ||
 		prefer_blt_bo(sna, dst_bo));
 }
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index 888c707..a329112 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -3335,8 +3335,13 @@ static inline bool prefer_blt_copy(struct sna *sna,
 				   struct kgem_bo *dst_bo,
 				   unsigned flags)
 {
-	return (sna->kgem.ring == KGEM_BLT ||
-		(flags & COPY_LAST && sna->kgem.mode == KGEM_NONE) ||
+	if (sna->kgem.ring == KGEM_BLT)
+		return true;
+
+	if (src_bo == dst_bo && can_switch_to_blt(sna))
+		return true;
+
+	return ((flags & COPY_LAST && sna->kgem.ring != KGEM_RENDER) ||
 		prefer_blt_bo(sna, src_bo) ||
 		prefer_blt_bo(sna, dst_bo));
 }
commit 0cb8544dc16d4c1e9ae7f1ee74ee26c7501a9ed7
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Nov 18 12:13:46 2012 +0000

    Remove useless indirection of intel_chipsets
    
    Once upon a time this was used to hide a compiler warning about a
    pointer mismatch, now the compiler still warns about the cast, making
    the indirect moot.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/intel_module.c b/src/intel_module.c
index ef62667..08c9696 100644
--- a/src/intel_module.c
+++ b/src/intel_module.c
@@ -111,7 +111,7 @@ static const struct intel_device_info intel_haswell_info = {
 	.gen = 75,
 };
 
-static const SymTabRec _intel_chipsets[] = {
+static const SymTabRec intel_chipsets[] = {
 	{PCI_CHIP_I810,				"i810"},
 	{PCI_CHIP_I810_DC100,			"i810-dc100"},
 	{PCI_CHIP_I810_E,			"i810e"},
@@ -199,9 +199,7 @@ static const SymTabRec _intel_chipsets[] = {
 	{PCI_CHIP_VALLEYVIEW_PO,		"ValleyView PO board" },
 	{-1,					NULL}
 };
-#define NUM_CHIPSETS (sizeof(_intel_chipsets) / sizeof(_intel_chipsets[0]))
-
-static SymTabRec *intel_chipsets = (SymTabRec *) _intel_chipsets;
+#define NUM_CHIPSETS (sizeof(intel_chipsets) / sizeof(intel_chipsets[0]))
 
 #define INTEL_DEVICE_MATCH(d,i) \
     { 0x8086, (d), PCI_MATCH_ANY, PCI_MATCH_ANY, 0x3 << 16, 0xff << 16, (intptr_t)(i) }
commit 8509e474f57533fc6afcf213165f4c8633631fb5
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Nov 16 23:02:44 2012 +0000

    sna/dri: Clear the last-used-cpu flag when performing CopyRegion
    
    Keeps the internal bookkeeping intact after the small bypass.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index f7fd293..e203519 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -448,6 +448,7 @@ damage_all:
 			goto damage_all;
 		sna_damage_add(&priv->gpu_damage, region);
 	}
+	priv->cpu = false;
 }
 
 static void set_bo(PixmapPtr pixmap, struct kgem_bo *bo)


More information about the xorg-commit mailing list