diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2005-08-15 18:53:43 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2005-08-15 18:53:43 +0000 |
commit | 1a10859ffe564a14c717a1326ced43b120221dba (patch) | |
tree | 545c7e1689ce01d059ada73cd5f821e85f712053 /regress/misc/X11/bltone | |
parent | 55a6a8029a2140b7cf9900449b57fba9935ee6de (diff) |
Add regression test for fbBltOne().
Diffstat (limited to 'regress/misc/X11/bltone')
-rw-r--r-- | regress/misc/X11/bltone/Makefile | 6 | ||||
-rw-r--r-- | regress/misc/X11/bltone/bltone.c | 57 |
2 files changed, 63 insertions, 0 deletions
diff --git a/regress/misc/X11/bltone/Makefile b/regress/misc/X11/bltone/Makefile new file mode 100644 index 00000000000..a6127665a71 --- /dev/null +++ b/regress/misc/X11/bltone/Makefile @@ -0,0 +1,6 @@ +# $OpenBSD: Makefile,v 1.1 2005/08/15 18:53:42 kettenis Exp $ + +PROG= bltone +LDADD+= /usr/X11R6/lib/modules/libfb.a + +.include <bsd.regress.mk> diff --git a/regress/misc/X11/bltone/bltone.c b/regress/misc/X11/bltone/bltone.c new file mode 100644 index 00000000000..a7ece93a440 --- /dev/null +++ b/regress/misc/X11/bltone/bltone.c @@ -0,0 +1,57 @@ +/* $OpenBSD: bltone.c,v 1.1 2005/08/15 18:53:42 kettenis Exp $ */ +/* + * Written by Mark Kettenis <kettenis@openbsd.org> 2004 Public Domain + */ + +#include <sys/types.h> +#include <sys/mman.h> + +#include <assert.h> +#include <stddef.h> + +typedef unsigned FbStip; +typedef unsigned FbBits; +typedef int FbStride; + +extern void fbBltOne24 (FbStip *, FbStride, int, FbBits *, FbStride, int, int, + int, int, FbBits, FbBits, FbBits, FbBits); + +FbStip mask[] = { 0x77ff7700, 0x11335577 }; + +int +main (void) +{ + int pagesize; + FbStip *src; + FbBits *dst; + int srcX, dstX; + int dstBpp; + + pagesize = getpagesize(); + + src = mmap(NULL, 2 * pagesize, PROT_READ|PROT_WRITE, MAP_ANON, -1, 0); + assert (src); + + dst = mmap(NULL, 2 * pagesize, PROT_READ|PROT_WRITE, MAP_ANON, -1, 0); + assert (dst); + + mprotect((char *)src + pagesize, pagesize, PROT_NONE); + src = (FbStip *)((char *)src + (pagesize - sizeof mask)); + memcpy (src, mask, sizeof mask); + + for (dstBpp = 8; dstBpp <= 32; dstBpp += 8) + for (dstX = 0; dstX < 64; dstX += 8) + for (srcX = 0; srcX < 32; srcX++) + fbBltOne(src, 1, srcX, dst, 128, dstX, dstBpp, + (32 - srcX) * dstBpp, 2, + 0, 0, 0xffffffff, 0); + + for (dstBpp = 8; dstBpp <= 32; dstBpp += 8) + for (dstX = 0; dstX < 64; dstX += 8) + for (srcX = 0; srcX < 32; srcX++) + fbBltOne(src, 1, srcX, dst, 128, dstX, dstBpp, + (64 - srcX) * dstBpp, 1, + 0, 0, 0xffffffff, 0); + + return 0; +} |