xf86-video-intel: 7 commits - src/legacy/i810 src/sna/fb src/sna/kgem.h src/sna/sna_display.c src/sna/sna_glyphs.c src/sna/sna_video_sprite.c src/uxa/intel_display.c src/uxa/intel_present.c src/uxa/uxa.c src/uxa/uxa-glyphs.c test/basic-copyarea.c test/basic-fillrect.c test/basic-putimage.c test/render-composite-solid.c test/render-copy-alphaless.c test/render-copyarea.c test/render-fill.c test/render-fill-copy.c test/render-trapezoid.c test/render-trapezoid-image.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Mar 21 21:27:42 UTC 2025


 src/legacy/i810/i810_dri.c    |    2 -
 src/legacy/i810/i810_driver.c |    2 -
 src/sna/fb/fbspan.c           |   22 ++++++-----
 src/sna/kgem.h                |    9 ++++
 src/sna/sna_display.c         |    4 +-
 src/sna/sna_glyphs.c          |    4 +-
 src/sna/sna_video_sprite.c    |   79 ++++++++++++++++++++----------------------
 src/uxa/intel_display.c       |    8 ++--
 src/uxa/intel_present.c       |    2 -
 src/uxa/uxa-glyphs.c          |    2 -
 src/uxa/uxa.c                 |    2 -
 test/basic-copyarea.c         |    3 +
 test/basic-fillrect.c         |    3 +
 test/basic-putimage.c         |    3 +
 test/render-composite-solid.c |    3 +
 test/render-copy-alphaless.c  |    3 +
 test/render-copyarea.c        |    3 +
 test/render-fill-copy.c       |    3 +
 test/render-fill.c            |    3 +
 test/render-trapezoid-image.c |    3 +
 test/render-trapezoid.c       |    3 +
 21 files changed, 93 insertions(+), 73 deletions(-)

New commits:
commit 4a64400ec6a7d8c0aba0e6a39b16a5e86d0af843
Author: Ville Syrjälä <ville.syrjala at linux.intel.com>
Date:   Mon Nov 11 18:45:40 2019 +0200

    sna/video/sprite: Reset colorkey whenever disabling the sprite plane
    
    Let's disable the colorkey whenever we hide the sprite. The colorkey
    is a non-standard thing so generic kms clients have no way to disable
    it, and the kernel may reject certain otherwise legal things if
    colorkeying is left active.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

diff --git a/src/sna/sna_video_sprite.c b/src/sna/sna_video_sprite.c
index 5f1e4616..5cb9e638 100644
--- a/src/sna/sna_video_sprite.c
+++ b/src/sna/sna_video_sprite.c
@@ -93,15 +93,34 @@ static const XvAttributeRec attribs[] = {
 	{ XvSettable | XvGettable, 0, 1, (char *)"XV_ALWAYS_ON_TOP" },
 };
 
+#define DRM_I915_SET_SPRITE_COLORKEY 0x2b
+#define LOCAL_IOCTL_I915_SET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct local_intel_sprite_colorkey)
+#define LOCAL_IOCTL_MODE_ADDFB2 DRM_IOWR(0xb8, struct local_mode_fb_cmd2)
+
+struct local_intel_sprite_colorkey {
+	uint32_t plane_id;
+	uint32_t min_value;
+	uint32_t channel_mask;
+	uint32_t max_value;
+	uint32_t flags;
+};
+
 static void sna_video_sprite_hide(xf86CrtcPtr crtc, struct sna_video *video)
 {
 	struct local_mode_set_plane s = {
 		.plane_id = sna_crtc_to_sprite(crtc, video->idx),
 	};
+	struct local_intel_sprite_colorkey key = {
+		.plane_id = sna_crtc_to_sprite(crtc, video->idx),
+	};
+	int index = sna_crtc_index(crtc);
 
 	if (drmIoctl(video->sna->kgem.fd, LOCAL_IOCTL_MODE_SETPLANE, &s))
 		xf86DrvMsg(video->sna->scrn->scrnIndex, X_ERROR,
 			   "failed to disable plane\n");
+
+	drmIoctl(video->sna->kgem.fd, LOCAL_IOCTL_I915_SET_SPRITE_COLORKEY, &key);
+	video->color_key_changed |= 1 << index;
 }
 
 static int sna_video_sprite_stop(ddStopVideo_ARGS)
@@ -300,18 +319,8 @@ sna_video_sprite_show(struct sna *sna,
 	VG_CLEAR(s);
 	s.plane_id = sna_crtc_to_sprite(crtc, video->idx);
 
-#define DRM_I915_SET_SPRITE_COLORKEY 0x2b
-#define LOCAL_IOCTL_I915_SET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct local_intel_sprite_colorkey)
-#define LOCAL_IOCTL_MODE_ADDFB2 DRM_IOWR(0xb8, struct local_mode_fb_cmd2)
-
 	if (video->color_key_changed & (1 << index) && video->has_color_key) {
-		struct local_intel_sprite_colorkey {
-			uint32_t plane_id;
-			uint32_t min_value;
-			uint32_t channel_mask;
-			uint32_t max_value;
-			uint32_t flags;
-		} set;
+		struct local_intel_sprite_colorkey set;
 
 		DBG(("%s: updating color key: %x\n",
 		     __FUNCTION__, video->color_key));
commit b45e222e71b6bf6e101241932338e62d3283e4aa
Author: Ville Syrjälä <ville.syrjala at linux.intel.com>
Date:   Mon Nov 11 19:02:15 2019 +0200

    sna/video/sprite: Extract sna_video_sprite_hide()
    
    Extract the code that turns off the sprite into a small helper.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

diff --git a/src/sna/sna_video_sprite.c b/src/sna/sna_video_sprite.c
index e2541e35..5f1e4616 100644
--- a/src/sna/sna_video_sprite.c
+++ b/src/sna/sna_video_sprite.c
@@ -93,10 +93,20 @@ static const XvAttributeRec attribs[] = {
 	{ XvSettable | XvGettable, 0, 1, (char *)"XV_ALWAYS_ON_TOP" },
 };
 
+static void sna_video_sprite_hide(xf86CrtcPtr crtc, struct sna_video *video)
+{
+	struct local_mode_set_plane s = {
+		.plane_id = sna_crtc_to_sprite(crtc, video->idx),
+	};
+
+	if (drmIoctl(video->sna->kgem.fd, LOCAL_IOCTL_MODE_SETPLANE, &s))
+		xf86DrvMsg(video->sna->scrn->scrnIndex, X_ERROR,
+			   "failed to disable plane\n");
+}
+
 static int sna_video_sprite_stop(ddStopVideo_ARGS)
 {
 	struct sna_video *video = port->devPriv.ptr;
-	struct local_mode_set_plane s;
 	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(video->sna->scrn);
 	int i;
 
@@ -109,12 +119,7 @@ static int sna_video_sprite_stop(ddStopVideo_ARGS)
 		if (video->bo[index] == NULL)
 			continue;
 
-		memset(&s, 0, sizeof(s));
-		s.plane_id = sna_crtc_to_sprite(crtc, video->idx);
-		if (drmIoctl(video->sna->kgem.fd, LOCAL_IOCTL_MODE_SETPLANE, &s))
-			xf86DrvMsg(video->sna->scrn->scrnIndex, X_ERROR,
-				   "failed to disable plane\n");
-
+		sna_video_sprite_hide(crtc, video);
 		kgem_bo_replace(&video->sna->kgem, &video->bo[index], NULL);
 	}
 
@@ -322,13 +327,8 @@ sna_video_sprite_show(struct sna *sna,
 		if (drmIoctl(sna->kgem.fd,
 			     LOCAL_IOCTL_I915_SET_SPRITE_COLORKEY,
 			     &set)) {
-			memset(&s, 0, sizeof(s));
-			s.plane_id = sna_crtc_to_sprite(crtc, video->idx);
-
 			/* try to disable the plane first */
-			if (drmIoctl(video->sna->kgem.fd, LOCAL_IOCTL_MODE_SETPLANE, &s))
-				xf86DrvMsg(video->sna->scrn->scrnIndex, X_ERROR,
-					   "failed to disable plane\n");
+			sna_video_sprite_hide(crtc, video);
 
 			if (drmIoctl(sna->kgem.fd, LOCAL_IOCTL_I915_SET_SPRITE_COLORKEY, &set)) {
 				xf86DrvMsg(sna->scrn->scrnIndex, X_ERROR,
@@ -542,12 +542,7 @@ retry:
 off:
 			assert(index < ARRAY_SIZE(video->bo));
 			if (video->bo[index]) {
-				struct local_mode_set_plane s;
-				memset(&s, 0, sizeof(s));
-				s.plane_id = sna_crtc_to_sprite(crtc, video->idx);
-				if (drmIoctl(video->sna->kgem.fd, LOCAL_IOCTL_MODE_SETPLANE, &s))
-					xf86DrvMsg(video->sna->scrn->scrnIndex, X_ERROR,
-						   "failed to disable plane\n");
+				sna_video_sprite_hide(crtc, video);
 				kgem_bo_replace(&sna->kgem, &video->bo[index], NULL);
 			}
 			continue;
commit ee0cc334df22ddebe31868d2ba5fa834a7487cc4
Author: Ville Syrjälä <ville.syrjala at linux.intel.com>
Date:   Mon Nov 11 19:08:18 2019 +0200

    sna/video/sprite: Plug bo leak
    
    Looks like we're leaking video->bo[index] if the entire
    sprite gets clipped. Let's plug that leak.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

diff --git a/src/sna/sna_video_sprite.c b/src/sna/sna_video_sprite.c
index ce09d890..e2541e35 100644
--- a/src/sna/sna_video_sprite.c
+++ b/src/sna/sna_video_sprite.c
@@ -548,7 +548,7 @@ off:
 				if (drmIoctl(video->sna->kgem.fd, LOCAL_IOCTL_MODE_SETPLANE, &s))
 					xf86DrvMsg(video->sna->scrn->scrnIndex, X_ERROR,
 						   "failed to disable plane\n");
-				video->bo[index] = NULL;
+				kgem_bo_replace(&sna->kgem, &video->bo[index], NULL);
 			}
 			continue;
 		}
commit 8583b09ef6e648af464a9c64fadcd4709cbfa6bf
Author: Ville Syrjälä <ville.syrjala at linux.intel.com>
Date:   Mon Nov 11 19:08:07 2019 +0200

    sna/video/sprite: Use kgem_bo_replace()
    
    Replace the hand rolled bo unref+ref stuff with
    kgem_bo_replace().
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

diff --git a/src/sna/sna_video_sprite.c b/src/sna/sna_video_sprite.c
index db3865b9..ce09d890 100644
--- a/src/sna/sna_video_sprite.c
+++ b/src/sna/sna_video_sprite.c
@@ -115,9 +115,7 @@ static int sna_video_sprite_stop(ddStopVideo_ARGS)
 			xf86DrvMsg(video->sna->scrn->scrnIndex, X_ERROR,
 				   "failed to disable plane\n");
 
-		if (video->bo[index])
-			kgem_bo_destroy(&video->sna->kgem, video->bo[index]);
-		video->bo[index] = NULL;
+		kgem_bo_replace(&video->sna->kgem, &video->bo[index], NULL);
 	}
 
 	sna_window_set_port((WindowPtr)draw, NULL);
@@ -468,18 +466,13 @@ sna_video_sprite_show(struct sna *sna,
 
 	if (drmIoctl(sna->kgem.fd, LOCAL_IOCTL_MODE_SETPLANE, &s)) {
 		DBG(("SET_PLANE failed: ret=%d\n", errno));
-		if (video->bo[index]) {
-			kgem_bo_destroy(&sna->kgem, video->bo[index]);
-			video->bo[index] = NULL;
-		}
+		kgem_bo_replace(&sna->kgem, &video->bo[index], NULL);
 		return false;
 	}
 
 	__kgem_bo_clear_dirty(frame->bo);
 
-	if (video->bo[index])
-		kgem_bo_destroy(&sna->kgem, video->bo[index]);
-	video->bo[index] = kgem_bo_reference(frame->bo);
+	kgem_bo_replace(&sna->kgem, &video->bo[index], frame->bo);
 	return true;
 }
 
commit 7c227f1844fe11caa546d64662753ccbb8ccd96e
Author: Ville Syrjälä <ville.syrjala at linux.intel.com>
Date:   Mon Nov 11 19:07:33 2019 +0200

    sna/kgem: Add kgem_bo_replace()
    
    Add a helper to do the unref old + ref new bo dance.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index 6a087a57..205a4eae 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -411,6 +411,15 @@ static inline void kgem_bo_destroy(struct kgem *kgem, struct kgem_bo *bo)
 		_kgem_bo_destroy(kgem, bo);
 }
 
+static inline void kgem_bo_replace(struct kgem *kgem,
+				   struct kgem_bo **bo,
+				   struct kgem_bo *new_bo)
+{
+	if (*bo)
+		kgem_bo_destroy(kgem, *bo);
+	*bo = new_bo ? kgem_bo_reference(new_bo) : NULL;
+}
+
 void kgem_clear_dirty(struct kgem *kgem);
 
 static inline void kgem_set_mode(struct kgem *kgem,
commit 5f3526a16cdda9d1466d334de34f81d387a00299
Author: Ville Syrjälä <ville.syrjala at linux.intel.com>
Date:   Mon Oct 28 14:54:52 2019 +0200

    sna: Don't memcpy() between different types
    
    Currently we're doing a blind memcpy() from a DDXPointRec
    into the beginning of a BoxRec. While this apparently works
    it's quite dodgy. Get rid of the memcpy() and simply assign
    each member by hand.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

diff --git a/src/sna/fb/fbspan.c b/src/sna/fb/fbspan.c
index 18136c20..0700d881 100644
--- a/src/sna/fb/fbspan.c
+++ b/src/sna/fb/fbspan.c
@@ -37,14 +37,16 @@ fbFillSpans(DrawablePtr drawable, GCPtr gc,
 {
 	DBG(("%s x %d\n", __FUNCTION__, n));
 	while (n--) {
-		BoxRec box;
-
-		memcpy(&box, pt, sizeof(box));
-		box.x2 = box.x1 + *width++;
-		box.y2 = box.y1 + 1;
+		BoxRec box = {
+			.x1 = pt->x,
+			.y1 = pt->y,
+			.x2 = pt->x + *width,
+			.y2 = pt->y + 1,
+		};
 
 		/* XXX fSorted */
 		fbDrawableRun(drawable, gc, &box, fbFillSpan, NULL);
+		width++;
 		pt++;
 	}
 }
@@ -90,12 +92,14 @@ fbSetSpans(DrawablePtr drawable, GCPtr gc,
 
 	data.src = src;
 	while (n--) {
-		BoxRec box;
+		BoxRec box = {
+			.x1 = pt->x,
+			.y1 = pt->y,
+			.x2 = pt->x + *width,
+			.y2 = pt->y + 1,
+		};
 
-		memcpy(&box, pt, sizeof(box));
 		data.pt = *pt;
-		box.x2 = box.x1 + *width;
-		box.y2 = box.y1 + 1;
 
 		fbDrawableRun(drawable, gc, &box, fbSetSpan, &data);
 
commit fc07603ee033c33e37801100b9758b2e7d43fde5
Author: Ville Syrjälä <ville.syrjala at linux.intel.com>
Date:   Mon Feb 10 19:13:21 2025 +0200

    Fix transposed calloc() arguments
    
    gcc-14 complains:
    ../src/legacy/i810/i810_dri.c:281:48: warning: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
    ...
    
    Fix them all up via cocci:
    @@
    expression E1, E2;
    type T;
    @@
    (
    - calloc(sizeof(T), E2)
    + calloc(E2, sizeof(T))
    |
    - calloc(sizeof(E1), E2)
    + calloc(E2, sizeof(E1))
    )
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

diff --git a/src/legacy/i810/i810_dri.c b/src/legacy/i810/i810_dri.c
index cca35d66..6c747f48 100644
--- a/src/legacy/i810/i810_dri.c
+++ b/src/legacy/i810/i810_dri.c
@@ -278,7 +278,7 @@ I810DRIScreenInit(ScreenPtr pScreen)
    }
    pDRIInfo->SAREASize = SAREA_MAX;
 
-   if (!(pI810DRI = (I810DRIPtr) calloc(sizeof(I810DRIRec), 1))) {
+   if (!(pI810DRI = (I810DRIPtr) calloc(1, sizeof(I810DRIRec)))) {
       DRIDestroyInfoRec(pI810->pDRIInfo);
       pI810->pDRIInfo = NULL;
       return FALSE;
diff --git a/src/legacy/i810/i810_driver.c b/src/legacy/i810/i810_driver.c
index 778b1a41..c0de514e 100644
--- a/src/legacy/i810/i810_driver.c
+++ b/src/legacy/i810/i810_driver.c
@@ -1544,7 +1544,7 @@ I810ScreenInit(SCREEN_INIT_ARGS_DECL)
    pI810 = I810PTR(scrn);
    hwp = VGAHWPTR(scrn);
 
-   pI810->LpRing = calloc(sizeof(I810RingBuffer),1);
+   pI810->LpRing = calloc(1, sizeof(I810RingBuffer));
    if (!pI810->LpRing) {
      xf86DrvMsg(scrn->scrnIndex, X_ERROR,
 		"Could not allocate lpring data structure.\n");
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index d4fa7b0b..e4a26ac5 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -3793,7 +3793,7 @@ sna_crtc_add(ScrnInfoPtr scrn, unsigned id, int index)
 
 	DBG(("%s(%d): is-zaphod? %d\n", __FUNCTION__, id, is_zaphod(scrn)));
 
-	sna_crtc = calloc(sizeof(struct sna_crtc), 1);
+	sna_crtc = calloc(1, sizeof(struct sna_crtc));
 	if (sna_crtc == NULL)
 		return false;
 
@@ -5321,7 +5321,7 @@ sna_output_add(struct sna *sna, unsigned id, unsigned serial)
 		possible_crtcs >>= ffs(zaphod_crtcs) - 1;
 	}
 
-	sna_output = calloc(sizeof(struct sna_output), 1);
+	sna_output = calloc(1, sizeof(struct sna_output));
 	if (!sna_output)
 		return -1;
 
diff --git a/src/sna/sna_glyphs.c b/src/sna/sna_glyphs.c
index ebc061b5..285ded82 100644
--- a/src/sna/sna_glyphs.c
+++ b/src/sna/sna_glyphs.c
@@ -269,8 +269,8 @@ bool sna_glyphs_create(struct sna *sna)
 
 		cache->count = cache->evict = 0;
 		cache->picture = picture;
-		cache->glyphs = calloc(sizeof(struct sna_glyph *),
-				       GLYPH_CACHE_SIZE);
+		cache->glyphs = calloc(GLYPH_CACHE_SIZE,
+				       sizeof(struct sna_glyph *));
 		if (!cache->glyphs)
 			goto bail;
 
diff --git a/src/uxa/intel_display.c b/src/uxa/intel_display.c
index 409cbbcf..fc8e0811 100644
--- a/src/uxa/intel_display.c
+++ b/src/uxa/intel_display.c
@@ -313,7 +313,7 @@ intel_crtc_apply(xf86CrtcPtr crtc)
 	int fb_id, x, y;
 	int i, ret = FALSE;
 
-	output_ids = calloc(sizeof(uint32_t), xf86_config->num_output);
+	output_ids = calloc(xf86_config->num_output, sizeof(uint32_t));
 	if (!output_ids)
 		return FALSE;
 
@@ -734,7 +734,7 @@ intel_crtc_init(ScrnInfoPtr scrn, struct intel_mode *mode, drmModeResPtr mode_re
 	xf86CrtcPtr crtc;
 	struct intel_crtc *intel_crtc;
 
-	intel_crtc = calloc(sizeof(struct intel_crtc), 1);
+	intel_crtc = calloc(1, sizeof(struct intel_crtc));
 	if (intel_crtc == NULL)
 		return;
 
@@ -1542,7 +1542,7 @@ intel_output_init(ScrnInfoPtr scrn, struct intel_mode *mode, drmModeResPtr mode_
 			return;
 		}
 	}
-	kencoders = calloc(sizeof(drmModeEncoderPtr), koutput->count_encoders);
+	kencoders = calloc(koutput->count_encoders, sizeof(drmModeEncoderPtr));
 	if (!kencoders) {
 		goto out_free_encoders;
 	}
@@ -1558,7 +1558,7 @@ intel_output_init(ScrnInfoPtr scrn, struct intel_mode *mode, drmModeResPtr mode_
 		goto out_free_encoders;
 	}
 
-	intel_output = calloc(sizeof(struct intel_output), 1);
+	intel_output = calloc(1, sizeof(struct intel_output));
 	if (!intel_output) {
 		xf86OutputDestroy(output);
 		goto out_free_encoders;
diff --git a/src/uxa/intel_present.c b/src/uxa/intel_present.c
index b21e5c41..d92aebc6 100644
--- a/src/uxa/intel_present.c
+++ b/src/uxa/intel_present.c
@@ -168,7 +168,7 @@ intel_present_queue_vblank(RRCrtcPtr                    crtc,
 	int                                     ret;
 	uint32_t                                seq;
 
-	event = calloc(sizeof(struct intel_present_vblank_event), 1);
+	event = calloc(1, sizeof(struct intel_present_vblank_event));
 	if (!event)
 		return BadAlloc;
 	event->event_id = event_id;
diff --git a/src/uxa/uxa-glyphs.c b/src/uxa/uxa-glyphs.c
index d24ba518..98f02ffc 100644
--- a/src/uxa/uxa-glyphs.c
+++ b/src/uxa/uxa-glyphs.c
@@ -190,7 +190,7 @@ static Bool uxa_realize_glyph_caches(ScreenPtr pScreen)
 		ValidatePicture(picture);
 
 		cache->picture = picture;
-		cache->glyphs = calloc(sizeof(GlyphPtr), GLYPH_CACHE_SIZE);
+		cache->glyphs = calloc(GLYPH_CACHE_SIZE, sizeof(GlyphPtr));
 		if (!cache->glyphs)
 			goto bail;
 
diff --git a/src/uxa/uxa.c b/src/uxa/uxa.c
index b682dfd9..3a474ff6 100644
--- a/src/uxa/uxa.c
+++ b/src/uxa/uxa.c
@@ -470,7 +470,7 @@ Bool uxa_driver_init(ScreenPtr screen, uxa_driver_t * uxa_driver)
 	if (!dixRegisterPrivateKey(&uxa_screen_index, PRIVATE_SCREEN, 0))
 	    return FALSE;
 #endif
-	uxa_screen = calloc(sizeof(uxa_screen_t), 1);
+	uxa_screen = calloc(1, sizeof(uxa_screen_t));
 
 	if (!uxa_screen) {
 		LogMessage(X_WARNING,
diff --git a/test/basic-copyarea.c b/test/basic-copyarea.c
index a1ef3491..c70b6a65 100644
--- a/test/basic-copyarea.c
+++ b/test/basic-copyarea.c
@@ -154,7 +154,8 @@ static void area_tests(struct test *t, int reps, int sets, enum target target)
 {
 	struct test_target tt;
 	XImage image;
-	uint32_t *cells = calloc(sizeof(uint32_t), t->out.width*t->out.height);
+	uint32_t *cells = calloc(t->out.width * t->out.height,
+				 sizeof(uint32_t));
 	int r, s, x, y;
 
 	printf("Testing area sets (%s): ", test_target_name(target));
diff --git a/test/basic-fillrect.c b/test/basic-fillrect.c
index 80c219c7..967caacb 100644
--- a/test/basic-fillrect.c
+++ b/test/basic-fillrect.c
@@ -124,7 +124,8 @@ static void area_tests(struct test *t, int reps, int sets, enum target target)
 {
 	struct test_target tt;
 	XImage image;
-	uint32_t *cells = calloc(sizeof(uint32_t), t->out.width*t->out.height);
+	uint32_t *cells = calloc(t->out.width * t->out.height,
+				 sizeof(uint32_t));
 	int r, s, x, y;
 
 	printf("Testing area sets (%s): ", test_target_name(target));
diff --git a/test/basic-putimage.c b/test/basic-putimage.c
index e252fe3f..2a96e7cf 100644
--- a/test/basic-putimage.c
+++ b/test/basic-putimage.c
@@ -144,7 +144,8 @@ static void area_tests(struct test *t, int reps, int sets, enum target target, i
 {
 	struct test_target tt;
 	XImage image;
-	uint32_t *cells = calloc(sizeof(uint32_t), t->out.width*t->out.height);
+	uint32_t *cells = calloc(t->out.width * t->out.height,
+				 sizeof(uint32_t));
 	int r, s, x, y;
 
 	printf("Testing area sets (%s %s shm): ",
diff --git a/test/render-composite-solid.c b/test/render-composite-solid.c
index 9d779be2..4751c0c6 100644
--- a/test/render-composite-solid.c
+++ b/test/render-composite-solid.c
@@ -109,7 +109,8 @@ static void area_tests(struct test *t, int reps, int sets, enum target target)
 {
 	struct test_target tt;
 	XImage image;
-	uint32_t *cells = calloc(sizeof(uint32_t), t->out.width*t->out.height);
+	uint32_t *cells = calloc(t->out.width * t->out.height,
+				 sizeof(uint32_t));
 	int r, s, x, y;
 
 	printf("Testing area sets (%s): ", test_target_name(target));
diff --git a/test/render-copy-alphaless.c b/test/render-copy-alphaless.c
index 01c74a7e..5ba31291 100644
--- a/test/render-copy-alphaless.c
+++ b/test/render-copy-alphaless.c
@@ -139,7 +139,8 @@ static void area_tests(struct test *t, int reps, int sets, enum target target)
 {
 	struct test_target tt;
 	XImage image;
-	uint32_t *cells = calloc(sizeof(uint32_t), t->out.width*t->out.height);
+	uint32_t *cells = calloc(t->out.width * t->out.height,
+				 sizeof(uint32_t));
 	int r, s, x, y;
 
 	printf("Testing area sets (%s): ", test_target_name(target));
diff --git a/test/render-copyarea.c b/test/render-copyarea.c
index a202ddeb..ee7ff34e 100644
--- a/test/render-copyarea.c
+++ b/test/render-copyarea.c
@@ -158,7 +158,8 @@ static void area_tests(struct test *t, int reps, int sets, enum target target)
 {
 	struct test_target tt;
 	XImage image;
-	uint32_t *cells = calloc(sizeof(uint32_t), t->out.width*t->out.height);
+	uint32_t *cells = calloc(t->out.width * t->out.height,
+				 sizeof(uint32_t));
 	int r, s, x, y;
 
 	printf("Testing area sets (%s): ", test_target_name(target));
diff --git a/test/render-fill-copy.c b/test/render-fill-copy.c
index b5b475a0..0cbbe8c9 100644
--- a/test/render-fill-copy.c
+++ b/test/render-fill-copy.c
@@ -131,7 +131,8 @@ static void area_tests(struct test *t, int reps, int sets, enum target target)
 {
 	struct test_target tt;
 	XImage image;
-	uint32_t *cells = calloc(sizeof(uint32_t), t->out.width*t->out.height);
+	uint32_t *cells = calloc(t->out.width * t->out.height,
+				 sizeof(uint32_t));
 	int r, s, x, y;
 
 	printf("Testing area sets (%s): ", test_target_name(target));
diff --git a/test/render-fill.c b/test/render-fill.c
index 37c9d858..15310464 100644
--- a/test/render-fill.c
+++ b/test/render-fill.c
@@ -101,7 +101,8 @@ static void area_tests(struct test *t, int reps, int sets, enum target target)
 {
 	struct test_target tt;
 	XImage image;
-	uint32_t *cells = calloc(sizeof(uint32_t), t->out.width*t->out.height);
+	uint32_t *cells = calloc(t->out.width * t->out.height,
+				 sizeof(uint32_t));
 	int r, s, x, y;
 
 	printf("Testing area sets (%s): ", test_target_name(target));
diff --git a/test/render-trapezoid-image.c b/test/render-trapezoid-image.c
index 452b4ec9..0a84ef88 100644
--- a/test/render-trapezoid-image.c
+++ b/test/render-trapezoid-image.c
@@ -265,7 +265,8 @@ static void area_tests(struct test *t, int reps, int sets, enum target target, i
 {
 	struct test_target tt;
 	XImage image;
-	uint32_t *cells = calloc(sizeof(uint32_t), t->out.width*t->out.height);
+	uint32_t *cells = calloc(t->out.width * t->out.height,
+				 sizeof(uint32_t));
 	int r, s, x, y;
 
 	printf("Testing area sets (%s using %s source): ",
diff --git a/test/render-trapezoid.c b/test/render-trapezoid.c
index f15a78e3..38713a5f 100644
--- a/test/render-trapezoid.c
+++ b/test/render-trapezoid.c
@@ -151,7 +151,8 @@ static void area_tests(struct test *t, int reps, int sets, enum target target)
 {
 	struct test_target tt;
 	XImage image;
-	uint32_t *cells = calloc(sizeof(uint32_t), t->out.width*t->out.height);
+	uint32_t *cells = calloc(t->out.width * t->out.height,
+				 sizeof(uint32_t));
 	int r, s, x, y;
 
 	printf("Testing area sets (%s): ", test_target_name(target));


More information about the xorg-commit mailing list