Skip to contentSkip to conversation

configure.ac: Fix bad syntax for test calls

PATCH In review Eric Anholt 2 participants 8 messages Nov 17, 2012 – Nov 18, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/7 configure.ac: Fix bad syntax for test calls

---
 configure.ac |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
configure.ac +2 -2
index d92269f..92c77f5 100644
@@ -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
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 2/7 intel: Factor out the repeated swap fallback code.

---
 src/intel_dri.c |   54 +++++++++++++++++++++++-------------------------------
 1 file changed, 23 insertions(+), 31 deletions(-)
src/intel_dri.c +23 -31
index 17d9d50..4c0827d 100644
@@ -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);
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 3/7 intel: Add printf attribute to intel_debug_fallback().

In reply to Eric Anholt

Shuts up a bunch of warnings with xorg's shared warning flags, and should give us more informative warnings in our code.

---
 src/intel.h |    3 +++
 1 file changed, 3 insertions(+)
src/intel.h +3 -0
index d394750..53ce33c 100644
@@ -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);
Signature · 1 line
1.7.10.4
#3 lore raw

PATCH 4/7 uxa: Fix const-cast warning.

In reply to Eric Anholt

The server interfaces take a non-const GCOps, because it expects you to be able to modify them.

---
 uxa/uxa-accel.c |    2 +-
 uxa/uxa-priv.h  |    2 +-
 uxa/uxa.c       |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
uxa/uxa-accel.c +1 -1
index 76425fe..522dd67 100644
@@ -1038,7 +1038,7 @@ fallback:
 	uxa_check_push_pixels(pGC, pBitmap, pDrawable, w, h, x, y);
 }
 
-const GCOps uxa_ops = {
+GCOps uxa_ops = {
 	uxa_fill_spans,
 	uxa_set_spans,
 	uxa_put_image,
uxa/uxa-priv.h +1 -1
index 3f639e7..4661575 100644
@@ -296,7 +296,7 @@ void
 uxa_add_traps(PicturePtr pPicture,
 	      INT16 x_off, INT16 y_off, int ntrap, xTrap * traps);
 
-extern const GCOps uxa_ops;
+extern GCOps uxa_ops;
 
 #ifdef RENDER
 
uxa/uxa.c +1 -1
index 2635b50..b15d3c1 100644
@@ -268,7 +268,7 @@ uxa_validate_gc(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
 	}
 
 set_ops:
-	pGC->ops = (GCOps *) & uxa_ops;
+	pGC->ops = & uxa_ops;
 }
 
 static GCFuncs uxaGCFuncs = {
Signature · 1 line
1.7.10.4
#4 lore raw

PATCH 5/7 uxa: Work around uninitialized-value warning.

In reply to Eric Anholt

The compiler isn't noticing that localDst only diverges from pDst when the _copy variables have also been set.

---
 uxa/uxa-render.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
uxa/uxa-render.c +1 -1
index 4463dc2..d783ea2 100644
@@ -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;
Signature · 1 line
1.7.10.4
#5 lore raw

PATCH 6/7 uxa: Refactor early-exit paths of uxa_try_driver_composite().

In reply to Eric Anholt

Saves 200b of code at -O2. I noticed this while fixing up the warning in HEAD~1.

---
 uxa/uxa-render.c |   79 +++++++++++++++++++-----------------------------------
 1 file changed, 28 insertions(+), 51 deletions(-)
uxa/uxa-render.c +28 -51
index d783ea2..3678f6a 100644
@@ -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;
 }
 
 /**
Signature · 1 line
1.7.10.4
#6 lore raw

PATCH 7/7 Don't mark the list of chipsets const when we just cast the const away.

In reply to Eric Anholt

Fixes another gcc warning.

---
 src/intel_module.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/intel_module.c +1 -1
index ef62667..06d2ee7 100644
@@ -111,7 +111,7 @@ static const struct intel_device_info intel_haswell_info = {
 	.gen = 75,
 };
 
-static const SymTabRec _intel_chipsets[] = {
+static SymTabRec _intel_chipsets[] = {
 	{PCI_CHIP_I810,				"i810"},
 	{PCI_CHIP_I810_DC100,			"i810-dc100"},
 	{PCI_CHIP_I810_E,			"i810e"},
Signature · 1 line
1.7.10.4
#7 lore raw

Re: [PATCH 7/7] Don't mark the list of chipsets const when we just cast the const away.

Quoted 1 line · Eric Anholt

Fixes another gcc warning.

So you would prefer to move it out of the ro ELF section to merely silence the compiler? And similarly remove the memory protection for the function pointers?
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre