1317c648bSmrg/*
21b18d63aSmrg * Test program, which can detect some problems with nearest neighbour
31b18d63aSmrg * and bilinear scaling in pixman. Testing is done by running lots
41b18d63aSmrg * of random SRC and OVER compositing operations a8r8g8b8, x8a8r8g8b8
51b18d63aSmrg * and r5g6b5 color formats.
6317c648bSmrg *
71b18d63aSmrg * Script 'fuzzer-find-diff.pl' can be used to narrow down the problem in
81b18d63aSmrg * the case of test failure.
9317c648bSmrg */
10317c648bSmrg#include <stdlib.h>
11317c648bSmrg#include <stdio.h>
12952204abSmrg#include "utils.h"
13317c648bSmrg
146ba797d6Smrg#define MAX_SRC_WIDTH  48
156ba797d6Smrg#define MAX_SRC_HEIGHT 8
166ba797d6Smrg#define MAX_DST_WIDTH  48
176ba797d6Smrg#define MAX_DST_HEIGHT 8
18317c648bSmrg#define MAX_STRIDE     4
19317c648bSmrg
20317c648bSmrg/*
21317c648bSmrg * Composite operation with pseudorandom images
22317c648bSmrg */
239ad247e8Sjmcneill
249ad247e8Sjmcneillstatic pixman_format_code_t
259ad247e8Sjmcneillget_format (int bpp)
269ad247e8Sjmcneill{
279ad247e8Sjmcneill    if (bpp == 4)
289ad247e8Sjmcneill    {
29f4f78bb6Smrg	switch (prng_rand_n (4))
309ad247e8Sjmcneill	{
319ad247e8Sjmcneill	default:
329ad247e8Sjmcneill	case 0:
339ad247e8Sjmcneill	    return PIXMAN_a8r8g8b8;
349ad247e8Sjmcneill	case 1:
359ad247e8Sjmcneill	    return PIXMAN_x8r8g8b8;
369ad247e8Sjmcneill	case 2:
379ad247e8Sjmcneill	    return PIXMAN_a8b8g8r8;
389ad247e8Sjmcneill	case 3:
399ad247e8Sjmcneill	    return PIXMAN_x8b8g8r8;
409ad247e8Sjmcneill	}
419ad247e8Sjmcneill    }
429ad247e8Sjmcneill    else
439ad247e8Sjmcneill    {
449ad247e8Sjmcneill	return PIXMAN_r5g6b5;
459ad247e8Sjmcneill    }
469ad247e8Sjmcneill}
479ad247e8Sjmcneill
48d0321353Smrguint32_t
491b18d63aSmrgtest_composite (int      testnum,
50d0321353Smrg		int      verbose)
51317c648bSmrg{
52d0321353Smrg    int                i;
53d0321353Smrg    pixman_image_t *   src_img;
546ba797d6Smrg    pixman_image_t *   mask_img;
55d0321353Smrg    pixman_image_t *   dst_img;
56317c648bSmrg    pixman_transform_t transform;
57d0321353Smrg    pixman_region16_t  clip;
58d0321353Smrg    int                src_width, src_height;
596ba797d6Smrg    int                mask_width, mask_height;
60d0321353Smrg    int                dst_width, dst_height;
616ba797d6Smrg    int                src_stride, mask_stride, dst_stride;
62d0321353Smrg    int                src_x, src_y;
636ba797d6Smrg    int                mask_x, mask_y;
64d0321353Smrg    int                dst_x, dst_y;
65d0321353Smrg    int                src_bpp;
666ba797d6Smrg    int                mask_bpp = 1;
67d0321353Smrg    int                dst_bpp;
68d0321353Smrg    int                w, h;
691b18d63aSmrg    pixman_fixed_t     scale_x = 65536, scale_y = 65536;
701b18d63aSmrg    pixman_fixed_t     translate_x = 0, translate_y = 0;
716ba797d6Smrg    pixman_fixed_t     mask_scale_x = 65536, mask_scale_y = 65536;
726ba797d6Smrg    pixman_fixed_t     mask_translate_x = 0, mask_translate_y = 0;
736ba797d6Smrg    pixman_op_t        op;
746ba797d6Smrg    pixman_repeat_t    repeat = PIXMAN_REPEAT_NONE;
756ba797d6Smrg    pixman_repeat_t    mask_repeat = PIXMAN_REPEAT_NONE;
766ca29ff0Smrg    pixman_format_code_t src_fmt, mask_fmt, dst_fmt;
77d0321353Smrg    uint32_t *         srcbuf;
78d0321353Smrg    uint32_t *         dstbuf;
796ba797d6Smrg    uint32_t *         maskbuf;
80d0321353Smrg    uint32_t           crc32;
811b18d63aSmrg    FLOAT_REGS_CORRUPTION_DETECTOR_START ();
82d0321353Smrg
83f4f78bb6Smrg    prng_srand (testnum);
84d0321353Smrg
85f4f78bb6Smrg    src_bpp = (prng_rand_n (2) == 0) ? 2 : 4;
86f4f78bb6Smrg    dst_bpp = (prng_rand_n (2) == 0) ? 2 : 4;
87f4f78bb6Smrg    switch (prng_rand_n (3))
886ba797d6Smrg    {
896ba797d6Smrg    case 0:
906ba797d6Smrg	op = PIXMAN_OP_SRC;
916ba797d6Smrg	break;
926ba797d6Smrg    case 1:
936ba797d6Smrg	op = PIXMAN_OP_OVER;
946ba797d6Smrg	break;
956ba797d6Smrg    default:
966ba797d6Smrg	op = PIXMAN_OP_ADD;
976ba797d6Smrg	break;
986ba797d6Smrg    }
99d0321353Smrg
100f4f78bb6Smrg    src_width = prng_rand_n (MAX_SRC_WIDTH) + 1;
101f4f78bb6Smrg    src_height = prng_rand_n (MAX_SRC_HEIGHT) + 1;
1026ba797d6Smrg
103f4f78bb6Smrg    if (prng_rand_n (2))
1046ba797d6Smrg    {
105f4f78bb6Smrg	mask_width = prng_rand_n (MAX_SRC_WIDTH) + 1;
106f4f78bb6Smrg	mask_height = prng_rand_n (MAX_SRC_HEIGHT) + 1;
1076ba797d6Smrg    }
1086ba797d6Smrg    else
1096ba797d6Smrg    {
1106ba797d6Smrg	mask_width = mask_height = 1;
1116ba797d6Smrg    }
1126ba797d6Smrg
113f4f78bb6Smrg    dst_width = prng_rand_n (MAX_DST_WIDTH) + 1;
114f4f78bb6Smrg    dst_height = prng_rand_n (MAX_DST_HEIGHT) + 1;
115f4f78bb6Smrg    src_stride = src_width * src_bpp + prng_rand_n (MAX_STRIDE) * src_bpp;
116f4f78bb6Smrg    mask_stride = mask_width * mask_bpp + prng_rand_n (MAX_STRIDE) * mask_bpp;
117f4f78bb6Smrg    dst_stride = dst_width * dst_bpp + prng_rand_n (MAX_STRIDE) * dst_bpp;
118d0321353Smrg
119d0321353Smrg    if (src_stride & 3)
120d0321353Smrg	src_stride += 2;
121952204abSmrg
1226ba797d6Smrg    if (mask_stride & 1)
1236ba797d6Smrg	mask_stride += 1;
1246ba797d6Smrg    if (mask_stride & 2)
1256ba797d6Smrg	mask_stride += 2;
1266ba797d6Smrg
127d0321353Smrg    if (dst_stride & 3)
128d0321353Smrg	dst_stride += 2;
129d0321353Smrg
130f4f78bb6Smrg    src_x = -(src_width / 4) + prng_rand_n (src_width * 3 / 2);
131f4f78bb6Smrg    src_y = -(src_height / 4) + prng_rand_n (src_height * 3 / 2);
132f4f78bb6Smrg    mask_x = -(mask_width / 4) + prng_rand_n (mask_width * 3 / 2);
133f4f78bb6Smrg    mask_y = -(mask_height / 4) + prng_rand_n (mask_height * 3 / 2);
134f4f78bb6Smrg    dst_x = -(dst_width / 4) + prng_rand_n (dst_width * 3 / 2);
135f4f78bb6Smrg    dst_y = -(dst_height / 4) + prng_rand_n (dst_height * 3 / 2);
136f4f78bb6Smrg    w = prng_rand_n (dst_width * 3 / 2 - dst_x);
137f4f78bb6Smrg    h = prng_rand_n (dst_height * 3 / 2 - dst_y);
138d0321353Smrg
139d0321353Smrg    srcbuf = (uint32_t *)malloc (src_stride * src_height);
1406ba797d6Smrg    maskbuf = (uint32_t *)malloc (mask_stride * mask_height);
141d0321353Smrg    dstbuf = (uint32_t *)malloc (dst_stride * dst_height);
142d0321353Smrg
143f4f78bb6Smrg    prng_randmemset (srcbuf, src_stride * src_height, 0);
144f4f78bb6Smrg    prng_randmemset (maskbuf, mask_stride * mask_height, 0);
145f4f78bb6Smrg    prng_randmemset (dstbuf, dst_stride * dst_height, 0);
146317c648bSmrg
1479ad247e8Sjmcneill    src_fmt = get_format (src_bpp);
1486ca29ff0Smrg    mask_fmt = PIXMAN_a8;
1499ad247e8Sjmcneill    dst_fmt = get_format (dst_bpp);
150317c648bSmrg
151de17ff4aSmrg    if (prng_rand_n (2))
152de17ff4aSmrg    {
153de17ff4aSmrg	srcbuf += (src_stride / 4) * (src_height - 1);
154de17ff4aSmrg	src_stride = - src_stride;
155de17ff4aSmrg    }
156de17ff4aSmrg
157de17ff4aSmrg    if (prng_rand_n (2))
158de17ff4aSmrg    {
159de17ff4aSmrg	maskbuf += (mask_stride / 4) * (mask_height - 1);
160de17ff4aSmrg	mask_stride = - mask_stride;
161de17ff4aSmrg    }
162de17ff4aSmrg
163de17ff4aSmrg    if (prng_rand_n (2))
164de17ff4aSmrg    {
165de17ff4aSmrg	dstbuf += (dst_stride / 4) * (dst_height - 1);
166de17ff4aSmrg	dst_stride = - dst_stride;
167de17ff4aSmrg    }
168de17ff4aSmrg
169d0321353Smrg    src_img = pixman_image_create_bits (
170317c648bSmrg        src_fmt, src_width, src_height, srcbuf, src_stride);
171317c648bSmrg
1726ba797d6Smrg    mask_img = pixman_image_create_bits (
1736ca29ff0Smrg        mask_fmt, mask_width, mask_height, maskbuf, mask_stride);
1746ba797d6Smrg
175d0321353Smrg    dst_img = pixman_image_create_bits (
176317c648bSmrg        dst_fmt, dst_width, dst_height, dstbuf, dst_stride);
177317c648bSmrg
1786ba797d6Smrg    image_endian_swap (src_img);
1796ba797d6Smrg    image_endian_swap (dst_img);
180d0321353Smrg
181f4f78bb6Smrg    if (prng_rand_n (4) > 0)
182d0321353Smrg    {
183f4f78bb6Smrg	scale_x = -32768 * 3 + prng_rand_n (65536 * 5);
184f4f78bb6Smrg	scale_y = -32768 * 3 + prng_rand_n (65536 * 5);
185f4f78bb6Smrg	translate_x = prng_rand_n (65536);
186f4f78bb6Smrg	translate_y = prng_rand_n (65536);
187d0321353Smrg	pixman_transform_init_scale (&transform, scale_x, scale_y);
1881b18d63aSmrg	pixman_transform_translate (&transform, NULL, translate_x, translate_y);
189d0321353Smrg	pixman_image_set_transform (src_img, &transform);
190317c648bSmrg    }
191317c648bSmrg
192f4f78bb6Smrg    if (prng_rand_n (2) > 0)
1936ba797d6Smrg    {
194f4f78bb6Smrg	mask_scale_x = -32768 * 3 + prng_rand_n (65536 * 5);
195f4f78bb6Smrg	mask_scale_y = -32768 * 3 + prng_rand_n (65536 * 5);
196f4f78bb6Smrg	mask_translate_x = prng_rand_n (65536);
197f4f78bb6Smrg	mask_translate_y = prng_rand_n (65536);
1986ba797d6Smrg	pixman_transform_init_scale (&transform, mask_scale_x, mask_scale_y);
1996ba797d6Smrg	pixman_transform_translate (&transform, NULL, mask_translate_x, mask_translate_y);
2006ba797d6Smrg	pixman_image_set_transform (mask_img, &transform);
2016ba797d6Smrg    }
2026ba797d6Smrg
203f4f78bb6Smrg    switch (prng_rand_n (4))
2046ba797d6Smrg    {
2056ba797d6Smrg    case 0:
2066ba797d6Smrg	mask_repeat = PIXMAN_REPEAT_NONE;
2076ba797d6Smrg	break;
2086ba797d6Smrg
2096ba797d6Smrg    case 1:
2106ba797d6Smrg	mask_repeat = PIXMAN_REPEAT_NORMAL;
2116ba797d6Smrg	break;
2126ba797d6Smrg
2136ba797d6Smrg    case 2:
2146ba797d6Smrg	mask_repeat = PIXMAN_REPEAT_PAD;
2156ba797d6Smrg	break;
2166ba797d6Smrg
2176ba797d6Smrg    case 3:
2186ba797d6Smrg	mask_repeat = PIXMAN_REPEAT_REFLECT;
2196ba797d6Smrg	break;
2206ba797d6Smrg
2216ba797d6Smrg    default:
2226ba797d6Smrg        break;
2236ba797d6Smrg    }
2246ba797d6Smrg    pixman_image_set_repeat (mask_img, mask_repeat);
2256ba797d6Smrg
226f4f78bb6Smrg    switch (prng_rand_n (4))
227d0321353Smrg    {
228d0321353Smrg    case 0:
229d0321353Smrg	repeat = PIXMAN_REPEAT_NONE;
230d0321353Smrg	break;
231d0321353Smrg
232d0321353Smrg    case 1:
233d0321353Smrg	repeat = PIXMAN_REPEAT_NORMAL;
234d0321353Smrg	break;
235d0321353Smrg
236d0321353Smrg    case 2:
237d0321353Smrg	repeat = PIXMAN_REPEAT_PAD;
238d0321353Smrg	break;
239d0321353Smrg
240d0321353Smrg    case 3:
241d0321353Smrg	repeat = PIXMAN_REPEAT_REFLECT;
242d0321353Smrg	break;
243952204abSmrg
244952204abSmrg    default:
245952204abSmrg        break;
246317c648bSmrg    }
247d0321353Smrg    pixman_image_set_repeat (src_img, repeat);
248d0321353Smrg
249f4f78bb6Smrg    if (prng_rand_n (2))
250952204abSmrg	pixman_image_set_filter (src_img, PIXMAN_FILTER_NEAREST, NULL, 0);
251952204abSmrg    else
252952204abSmrg	pixman_image_set_filter (src_img, PIXMAN_FILTER_BILINEAR, NULL, 0);
253952204abSmrg
254f4f78bb6Smrg    if (prng_rand_n (2))
2556ba797d6Smrg	pixman_image_set_filter (mask_img, PIXMAN_FILTER_NEAREST, NULL, 0);
2566ba797d6Smrg    else
2576ba797d6Smrg	pixman_image_set_filter (mask_img, PIXMAN_FILTER_BILINEAR, NULL, 0);
2586ba797d6Smrg
259f4f78bb6Smrg    if (prng_rand_n (8) == 0)
260d0321353Smrg    {
261d0321353Smrg	pixman_box16_t clip_boxes[2];
262f4f78bb6Smrg	int            n = prng_rand_n (2) + 1;
263d0321353Smrg
264d0321353Smrg	for (i = 0; i < n; i++)
265d0321353Smrg	{
266f4f78bb6Smrg	    clip_boxes[i].x1 = prng_rand_n (src_width);
267f4f78bb6Smrg	    clip_boxes[i].y1 = prng_rand_n (src_height);
268d0321353Smrg	    clip_boxes[i].x2 =
269f4f78bb6Smrg		clip_boxes[i].x1 + prng_rand_n (src_width - clip_boxes[i].x1);
270d0321353Smrg	    clip_boxes[i].y2 =
271f4f78bb6Smrg		clip_boxes[i].y1 + prng_rand_n (src_height - clip_boxes[i].y1);
272d0321353Smrg
273d0321353Smrg	    if (verbose)
274d0321353Smrg	    {
275d0321353Smrg		printf ("source clip box: [%d,%d-%d,%d]\n",
276d0321353Smrg		        clip_boxes[i].x1, clip_boxes[i].y1,
277d0321353Smrg		        clip_boxes[i].x2, clip_boxes[i].y2);
278d0321353Smrg	    }
279d0321353Smrg	}
280952204abSmrg
281d0321353Smrg	pixman_region_init_rects (&clip, clip_boxes, n);
282d0321353Smrg	pixman_image_set_clip_region (src_img, &clip);
283d0321353Smrg	pixman_image_set_source_clipping (src_img, 1);
284d0321353Smrg	pixman_region_fini (&clip);
285317c648bSmrg    }
286317c648bSmrg
287f4f78bb6Smrg    if (prng_rand_n (8) == 0)
2886ba797d6Smrg    {
2896ba797d6Smrg	pixman_box16_t clip_boxes[2];
290f4f78bb6Smrg	int            n = prng_rand_n (2) + 1;
2916ba797d6Smrg
2926ba797d6Smrg	for (i = 0; i < n; i++)
2936ba797d6Smrg	{
294f4f78bb6Smrg	    clip_boxes[i].x1 = prng_rand_n (mask_width);
295f4f78bb6Smrg	    clip_boxes[i].y1 = prng_rand_n (mask_height);
2966ba797d6Smrg	    clip_boxes[i].x2 =
297f4f78bb6Smrg		clip_boxes[i].x1 + prng_rand_n (mask_width - clip_boxes[i].x1);
2986ba797d6Smrg	    clip_boxes[i].y2 =
299f4f78bb6Smrg		clip_boxes[i].y1 + prng_rand_n (mask_height - clip_boxes[i].y1);
3006ba797d6Smrg
3016ba797d6Smrg	    if (verbose)
3026ba797d6Smrg	    {
3036ba797d6Smrg		printf ("mask clip box: [%d,%d-%d,%d]\n",
3046ba797d6Smrg		        clip_boxes[i].x1, clip_boxes[i].y1,
3056ba797d6Smrg		        clip_boxes[i].x2, clip_boxes[i].y2);
3066ba797d6Smrg	    }
3076ba797d6Smrg	}
3086ba797d6Smrg
3096ba797d6Smrg	pixman_region_init_rects (&clip, clip_boxes, n);
3106ba797d6Smrg	pixman_image_set_clip_region (mask_img, &clip);
3116ba797d6Smrg	pixman_image_set_source_clipping (mask_img, 1);
3126ba797d6Smrg	pixman_region_fini (&clip);
3136ba797d6Smrg    }
3146ba797d6Smrg
315f4f78bb6Smrg    if (prng_rand_n (8) == 0)
316d0321353Smrg    {
317d0321353Smrg	pixman_box16_t clip_boxes[2];
318f4f78bb6Smrg	int            n = prng_rand_n (2) + 1;
319d0321353Smrg	for (i = 0; i < n; i++)
320d0321353Smrg	{
321f4f78bb6Smrg	    clip_boxes[i].x1 = prng_rand_n (dst_width);
322f4f78bb6Smrg	    clip_boxes[i].y1 = prng_rand_n (dst_height);
323d0321353Smrg	    clip_boxes[i].x2 =
324f4f78bb6Smrg		clip_boxes[i].x1 + prng_rand_n (dst_width - clip_boxes[i].x1);
325d0321353Smrg	    clip_boxes[i].y2 =
326f4f78bb6Smrg		clip_boxes[i].y1 + prng_rand_n (dst_height - clip_boxes[i].y1);
327d0321353Smrg
328d0321353Smrg	    if (verbose)
329d0321353Smrg	    {
330d0321353Smrg		printf ("destination clip box: [%d,%d-%d,%d]\n",
331d0321353Smrg		        clip_boxes[i].x1, clip_boxes[i].y1,
332d0321353Smrg		        clip_boxes[i].x2, clip_boxes[i].y2);
333d0321353Smrg	    }
334d0321353Smrg	}
335d0321353Smrg	pixman_region_init_rects (&clip, clip_boxes, n);
336d0321353Smrg	pixman_image_set_clip_region (dst_img, &clip);
337d0321353Smrg	pixman_region_fini (&clip);
338317c648bSmrg    }
339317c648bSmrg
340f4f78bb6Smrg    if (prng_rand_n (2) == 0)
3416ca29ff0Smrg    {
3426ca29ff0Smrg	mask_fmt = PIXMAN_null;
3436ca29ff0Smrg	pixman_image_unref (mask_img);
3446ca29ff0Smrg	mask_img = NULL;
3456ca29ff0Smrg	mask_x = 0;
3466ca29ff0Smrg	mask_y = 0;
3476ca29ff0Smrg    }
3486ca29ff0Smrg
3496ca29ff0Smrg    if (verbose)
3506ca29ff0Smrg    {
3516ca29ff0Smrg	printf ("op=%s, src_fmt=%s, mask_fmt=%s, dst_fmt=%s\n",
3526ca29ff0Smrg	        operator_name (op), format_name (src_fmt),
3536ca29ff0Smrg	        format_name (mask_fmt), format_name (dst_fmt));
3546ca29ff0Smrg	printf ("scale_x=%d, scale_y=%d, repeat=%d, filter=%d\n",
3556ca29ff0Smrg	        scale_x, scale_y, repeat, src_img->common.filter);
3566ca29ff0Smrg	printf ("translate_x=%d, translate_y=%d\n",
3576ca29ff0Smrg	        translate_x, translate_y);
3586ca29ff0Smrg	if (mask_fmt != PIXMAN_null)
3596ca29ff0Smrg	{
3606ca29ff0Smrg	    printf ("mask_scale_x=%d, mask_scale_y=%d, "
3616ca29ff0Smrg	            "mask_repeat=%d, mask_filter=%d\n",
3626ca29ff0Smrg	            mask_scale_x, mask_scale_y, mask_repeat,
3636ca29ff0Smrg	            mask_img->common.filter);
3646ca29ff0Smrg	    printf ("mask_translate_x=%d, mask_translate_y=%d\n",
3656ca29ff0Smrg	            mask_translate_x, mask_translate_y);
3666ca29ff0Smrg	}
3676ca29ff0Smrg	printf ("src_width=%d, src_height=%d, src_x=%d, src_y=%d\n",
3686ca29ff0Smrg	        src_width, src_height, src_x, src_y);
3696ca29ff0Smrg	if (mask_fmt != PIXMAN_null)
3706ca29ff0Smrg	{
3716ca29ff0Smrg	    printf ("mask_width=%d, mask_height=%d, mask_x=%d, mask_y=%d\n",
3726ca29ff0Smrg	            mask_width, mask_height, mask_x, mask_y);
3736ca29ff0Smrg	}
3746ca29ff0Smrg	printf ("dst_width=%d, dst_height=%d, dst_x=%d, dst_y=%d\n",
3756ca29ff0Smrg	        dst_width, dst_height, dst_x, dst_y);
3766ca29ff0Smrg	printf ("w=%d, h=%d\n", w, h);
3776ca29ff0Smrg    }
3786ca29ff0Smrg
3796ca29ff0Smrg    pixman_image_composite (op, src_img, mask_img, dst_img,
3806ba797d6Smrg                            src_x, src_y, mask_x, mask_y, dst_x, dst_y, w, h);
381317c648bSmrg
382de17ff4aSmrg    crc32 = compute_crc32_for_image (0, dst_img);
383de17ff4aSmrg
384d0321353Smrg    if (verbose)
385de17ff4aSmrg	print_image (dst_img);
386317c648bSmrg
387317c648bSmrg    pixman_image_unref (src_img);
3886ca29ff0Smrg    if (mask_img != NULL)
3896ca29ff0Smrg	pixman_image_unref (mask_img);
390317c648bSmrg    pixman_image_unref (dst_img);
391317c648bSmrg
392de17ff4aSmrg    if (src_stride < 0)
393de17ff4aSmrg	srcbuf += (src_stride / 4) * (src_height - 1);
394de17ff4aSmrg
395de17ff4aSmrg    if (mask_stride < 0)
396de17ff4aSmrg	maskbuf += (mask_stride / 4) * (mask_height - 1);
397de17ff4aSmrg
398de17ff4aSmrg    if (dst_stride < 0)
399de17ff4aSmrg	dstbuf += (dst_stride / 4) * (dst_height - 1);
400de17ff4aSmrg
401d0321353Smrg    free (srcbuf);
4026ba797d6Smrg    free (maskbuf);
403d0321353Smrg    free (dstbuf);
4041b18d63aSmrg
4051b18d63aSmrg    FLOAT_REGS_CORRUPTION_DETECTOR_FINISH ();
406317c648bSmrg    return crc32;
407317c648bSmrg}
408317c648bSmrg
409de17ff4aSmrg#if BILINEAR_INTERPOLATION_BITS == 7
410de17ff4aSmrg#define CHECKSUM 0x92E0F068
4119ad247e8Sjmcneill#elif BILINEAR_INTERPOLATION_BITS == 4
412de17ff4aSmrg#define CHECKSUM 0x8EFFA1E5
4139ad247e8Sjmcneill#else
4149ad247e8Sjmcneill#define CHECKSUM 0x00000000
4159ad247e8Sjmcneill#endif
4169ad247e8Sjmcneill
417d0321353Smrgint
4181b18d63aSmrgmain (int argc, const char *argv[])
419317c648bSmrg{
420d0321353Smrg    pixman_disable_out_of_bounds_workaround ();
421d0321353Smrg
4229ad247e8Sjmcneill    return fuzzer_test_main("scaling", 8000000, CHECKSUM,
4231b18d63aSmrg			    test_composite, argc, argv);
424317c648bSmrg}
425