xf86-video-intel: 7 commits - src/i915_video.c src/intel_dri.c src/sna/gen4_render.c src/sna/gen5_render.c src/sna/gen6_render.c src/sna/gen7_render.c src/sna/kgem.c src/sna/sna_accel.c src/sna/sna_dri.c src/sna/sna_tiling.c src/sna/sna_trapezoids.c uxa/uxa-render.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Jun 6 09:40:48 PDT 2012


 src/i915_video.c         |    2 ++
 src/intel_dri.c          |   11 +++++++++--
 src/sna/gen4_render.c    |    2 ++
 src/sna/gen5_render.c    |    3 +++
 src/sna/gen6_render.c    |    3 +++
 src/sna/gen7_render.c    |    3 +++
 src/sna/kgem.c           |    4 +++-
 src/sna/sna_accel.c      |    4 +++-
 src/sna/sna_dri.c        |   26 +++++++++++++-------------
 src/sna/sna_tiling.c     |    6 ------
 src/sna/sna_trapezoids.c |    8 --------
 uxa/uxa-render.c         |   46 +++++++++++++++++++---------------------------
 12 files changed, 60 insertions(+), 58 deletions(-)

New commits:
commit 3f5b94f3d1625b06840c6441a0b175604ee3d2f9
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jun 6 17:24:07 2012 +0100

    sna: Check against integer overflows when computing cache size
    
    Even with a 1nm process, I doubt we will see 4+GiB cache sizes ;-)
    
    Reported-by: Zdenek Kabelac <zkabelac at redhat.com>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 3d1e5be..3078f49 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -523,7 +523,9 @@ cpu_cache_size(void)
 		while (getline(&line, &len, file) != -1) {
 			int mb;
 			if (sscanf(line, "cache size : %d KB", &mb) == 1) {
-				size = mb * 1024;
+				/* Paranoid check against gargantuan caches */
+				if (mb <= 1<<20)
+					size = mb * 1024;
 				break;
 			}
 		}
commit 902391bd798775e1a7a53503d4dd1756162f737f
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jun 6 17:20:39 2012 +0100

    uxa: Remove dead-code for SourcePictures
    
    All SourcePictures are now converted into Drawables, which had been
    assumed by the driver backend. However, the code still existed to
    attempt to pass procedural pictures onwards and so set pSrcPix to NULL
    which was being flagged by the static analyser as a potential NULL
    dereference.
    
    Reported-by: Zdenek Kabelac <zkabelac at redhat.com>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index 1e88c5d..4463dc2 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -1064,10 +1064,25 @@ uxa_try_driver_composite(CARD8 op,
 		return 1;
 	}
 
-	if (localSrc->pDrawable) {
-		pSrcPix = uxa_get_offscreen_pixmap(localSrc->pDrawable,
-						   &src_off_x, &src_off_y);
-		if (!pSrcPix) {
+	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;
+	}
+
+	if (localMask) {
+		pMaskPix = uxa_get_offscreen_pixmap(localMask->pDrawable,
+						    &mask_off_x, &mask_off_y);
+		if (!pMaskPix) {
 			REGION_UNINIT(screen, &region);
 
 			if (localSrc != pSrc)
@@ -1079,29 +1094,6 @@ uxa_try_driver_composite(CARD8 op,
 
 			return 0;
 		}
-	} else {
-		pSrcPix = NULL;
-	}
-
-	if (localMask) {
-		if (localMask->pDrawable) {
-			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;
-			}
-		} else {
-			pMaskPix = NULL;
-		}
 	}
 
 	if (!(*uxa_screen->info->prepare_composite)
commit 3d8a1f7176877975a31ad7a6548fa8309065f617
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jun 6 17:15:42 2012 +0100

    sna/gen4+: Add missing "fall through" comments
    
    Reported-by: <zkabelac at redhat.com>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c
index aafe6d9..ad6f6c5 100644
--- a/src/sna/gen4_render.c
+++ b/src/sna/gen4_render.c
@@ -2409,6 +2409,7 @@ gen4_render_composite(struct sna *sna,
 		goto cleanup_dst;
 	case 0:
 		gen4_composite_solid_init(sna, &tmp->src, 0);
+		/* fall through to fixup */
 	case 1:
 		gen4_composite_channel_convert(&tmp->src);
 		break;
@@ -2455,6 +2456,7 @@ gen4_render_composite(struct sna *sna,
 				goto cleanup_src;
 			case 0:
 				gen4_composite_solid_init(sna, &tmp->mask, 0);
+				/* fall through to fixup */
 			case 1:
 				gen4_composite_channel_convert(&tmp->mask);
 				break;
diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c
index d51a83b..e31ac5c 100644
--- a/src/sna/gen5_render.c
+++ b/src/sna/gen5_render.c
@@ -2452,6 +2452,7 @@ gen5_render_composite(struct sna *sna,
 		goto cleanup_dst;
 	case 0:
 		gen5_composite_solid_init(sna, &tmp->src, 0);
+		/* fall through to fixup */
 	case 1:
 		gen5_composite_channel_convert(&tmp->src);
 		break;
@@ -2497,6 +2498,7 @@ gen5_render_composite(struct sna *sna,
 				goto cleanup_src;
 			case 0:
 				gen5_composite_solid_init(sna, &tmp->mask, 0);
+				/* fall through to fixup */
 			case 1:
 				gen5_composite_channel_convert(&tmp->mask);
 				break;
@@ -2809,6 +2811,7 @@ gen5_render_composite_spans(struct sna *sna,
 		goto cleanup_dst;
 	case 0:
 		gen5_composite_solid_init(sna, &tmp->base.src, 0);
+		/* fall through to fixup */
 	case 1:
 		gen5_composite_channel_convert(&tmp->base.src);
 		break;
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index d3b3e2a..d613fe1 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -2665,6 +2665,7 @@ gen6_render_composite(struct sna *sna,
 		goto cleanup_dst;
 	case 0:
 		gen6_composite_solid_init(sna, &tmp->src, 0);
+		/* fall through to fixup */
 	case 1:
 		gen6_composite_channel_convert(&tmp->src);
 		break;
@@ -2722,6 +2723,7 @@ gen6_render_composite(struct sna *sna,
 				goto cleanup_src;
 			case 0:
 				gen6_composite_solid_init(sna, &tmp->mask, 0);
+				/* fall through to fixup */
 			case 1:
 				gen6_composite_channel_convert(&tmp->mask);
 				break;
@@ -3112,6 +3114,7 @@ gen6_render_composite_spans(struct sna *sna,
 		goto cleanup_dst;
 	case 0:
 		gen6_composite_solid_init(sna, &tmp->base.src, 0);
+		/* fall through to fixup */
 	case 1:
 		gen6_composite_channel_convert(&tmp->base.src);
 		break;
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index 0029895..a7c498e 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -2758,6 +2758,7 @@ gen7_render_composite(struct sna *sna,
 		goto cleanup_dst;
 	case 0:
 		gen7_composite_solid_init(sna, &tmp->src, 0);
+		/* fall through to fixup */
 	case 1:
 		gen7_composite_channel_convert(&tmp->src);
 		break;
@@ -2815,6 +2816,7 @@ gen7_render_composite(struct sna *sna,
 				goto cleanup_src;
 			case 0:
 				gen7_composite_solid_init(sna, &tmp->mask, 0);
+				/* fall through to fixup */
 			case 1:
 				gen7_composite_channel_convert(&tmp->mask);
 				break;
@@ -3196,6 +3198,7 @@ gen7_render_composite_spans(struct sna *sna,
 		goto cleanup_dst;
 	case 0:
 		gen7_composite_solid_init(sna, &tmp->base.src, 0);
+		/* fall through to fixup */
 	case 1:
 		gen7_composite_channel_convert(&tmp->base.src);
 		break;
commit 8ae4407c43e6a8d26784508f61b416138f908132
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jun 6 17:13:05 2012 +0100

    sna: Silence static analyser complaining about potential NULL pointer
    
    Add an assert to prove that is not.
    
    Reported-by: Zdenek Kabelac <zkabelac at redhat.com>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 2ead80a..4a7d55e 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -12169,8 +12169,9 @@ static CARD32 sna_timeout(OsTimerPtr timer, CARD32 now, pointer arg)
 static void sna_accel_flush(struct sna *sna)
 {
 	struct sna_pixmap *priv = sna_accel_scanout(sna);
-	bool busy = priv->cpu_damage || priv->gpu_bo->rq;
+	bool busy;
 
+	assert(priv != NULL);
 	DBG(("%s (time=%ld), cpu damage? %p, exec? %d nbatch=%d, busy? %d\n",
 	     __FUNCTION__, (long)sna->time,
 	     priv->cpu_damage,
@@ -12178,6 +12179,7 @@ static void sna_accel_flush(struct sna *sna)
 	     sna->kgem.nbatch,
 	     sna->kgem.busy));
 
+	busy = priv->cpu_damage || priv->gpu_bo->rq;
 	if (!sna->kgem.busy && !busy)
 		sna_accel_disarm_timer(sna, FLUSH_TIMER);
 	sna->kgem.busy = busy;
commit 08010b23a3e2bc37d202251923fac814b18fa501
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jun 6 17:10:35 2012 +0100

    uxa/dri: Silence static analyser for potential NULL intel_pixmap
    
    If the intel_pixmap was NULL we should have failed to create the DRI2
    buffer, so we can safely assert here to keep the analyser quiet.
    
    Reported-by: Zdenek Kabelac <zkabelac at redhat.com>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/intel_dri.c b/src/intel_dri.c
index 2ed5559..6bf76d0 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -919,6 +919,13 @@ intel_glamor_create_back_pixmap(ScreenPtr screen,
 	return back_pixmap;
 }
 
+static drm_intel_bo *get_pixmap_bo(I830DRI2BufferPrivatePtr priv)
+{
+	drm_intel_bo *bo = intel_get_pixmap_bo(priv->pixmap);
+	assert(bo != NULL); /* guaranteed by construction of the DRI2 buffer */
+	return bo;
+}
+
 /*
  * Our internal swap routine takes care of actually exchanging, blitting, or
  * flipping buffers as necessary.
@@ -935,7 +942,7 @@ I830DRI2ScheduleFlip(struct intel_screen_private *intel,
 	if (!intel->use_triple_buffer) {
 		info->type = DRI2_SWAP;
 		if (!intel_do_pageflip(intel,
-				       intel_get_pixmap_bo(priv->pixmap),
+				       get_pixmap_bo(priv),
 				       info, info->pipe))
 			return FALSE;
 
@@ -990,7 +997,7 @@ I830DRI2ScheduleFlip(struct intel_screen_private *intel,
 		intel->back_buffer = NULL;
 	}
 
-	old_back = intel_get_pixmap_bo(priv->pixmap);
+	old_back = get_pixmap_bo(priv);
 	if (!intel_do_pageflip(intel, old_back, info, info->pipe)) {
 		intel->back_buffer = new_back;
 		return FALSE;
commit 06b1b875ba13227ddaf7f28dbdcdaa3eb49f0857
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jun 6 17:05:13 2012 +0100

    uxa/i915: check for failure to allocate temporary destination
    
    If the target drawable is too large for the render pipeline, we need to
    create a temporary surface. This may fail, so abort if it does.
    
    Reported-by: Zdenek Kabelac <zkabelac at redhat.com>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/i915_video.c b/src/i915_video.c
index c73615e..ae2e6bb 100644
--- a/src/i915_video.c
+++ b/src/i915_video.c
@@ -74,6 +74,8 @@ I915DisplayVideoTextured(ScrnInfoPtr scrn,
 					      dstRegion->extents.y2 - dyo,
 					      pixmap->drawable.depth,
 					      CREATE_PIXMAP_USAGE_SCRATCH);
+		if (target == NULL)
+			return;
 
 		pix_xoff = -dxo;
 		pix_yoff = -dyo;
commit c553dcae2dd714cac413ffc7c7779cd78c9a3e61
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jun 6 17:04:01 2012 +0100

    sna: Silence a few unused function warnings
    
    Reported-by: Zdenek Kabelac <zkabelac at redhat.com>
    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 000738b..da49e12 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -900,19 +900,6 @@ sna_dri_frame_event_info_free(struct sna_dri_frame_event *info)
 	free(info);
 }
 
-static void
-sna_dri_exchange_attachment(DRI2BufferPtr front, DRI2BufferPtr back)
-{
-	int tmp;
-
-	DBG(("%s(%d <--> %d)\n",
-	     __FUNCTION__, front->attachment, back->attachment));
-
-	tmp = front->attachment;
-	front->attachment = back->attachment;
-	back->attachment = tmp;
-}
-
 /*
  * Our internal swap routine takes care of actually exchanging, blitting, or
  * flipping buffers as necessary.
@@ -1714,6 +1701,19 @@ blit_fallback:
 }
 
 #if DRI2INFOREC_VERSION >= 7
+static void
+sna_dri_exchange_attachment(DRI2BufferPtr front, DRI2BufferPtr back)
+{
+	int tmp;
+
+	DBG(("%s(%d <--> %d)\n",
+	     __FUNCTION__, front->attachment, back->attachment));
+
+	tmp = front->attachment;
+	front->attachment = back->attachment;
+	back->attachment = tmp;
+}
+
 static Bool
 sna_dri_async_swap(ClientPtr client, DrawablePtr draw,
 		   DRI2BufferPtr front, DRI2BufferPtr back,
diff --git a/src/sna/sna_tiling.c b/src/sna/sna_tiling.c
index d7e6d40..33fee42 100644
--- a/src/sna/sna_tiling.c
+++ b/src/sna/sna_tiling.c
@@ -265,12 +265,6 @@ done:
 	free(tile);
 }
 
-static inline int split(int x, int y)
-{
-	int n = x / y + 1;
-	return (x + n - 1) / n;
-}
-
 Bool
 sna_tiling_composite(uint32_t op,
 		     PicturePtr src,
diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c
index bfb4e0c..780a0fa 100644
--- a/src/sna/sna_trapezoids.c
+++ b/src/sna/sna_trapezoids.c
@@ -1540,14 +1540,6 @@ inplace_row(struct active_list *active, uint8_t *row, int width)
 	}
 }
 
-static inline uint8_t clip255(int x)
-{
-	if (x > 255)
-		return 255;
-
-	return x;
-}
-
 inline static void
 inplace_subrow(struct active_list *active, int8_t *row,
 	       int width, int *min, int *max)


More information about the xorg-commit mailing list