summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2005-08-15 18:53:43 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2005-08-15 18:53:43 +0000
commit1a10859ffe564a14c717a1326ced43b120221dba (patch)
tree545c7e1689ce01d059ada73cd5f821e85f712053 /regress
parent55a6a8029a2140b7cf9900449b57fba9935ee6de (diff)
Add regression test for fbBltOne().
Diffstat (limited to 'regress')
-rw-r--r--regress/misc/Makefile4
-rw-r--r--regress/misc/X11/Makefile7
-rw-r--r--regress/misc/X11/bltone/Makefile6
-rw-r--r--regress/misc/X11/bltone/bltone.c57
4 files changed, 72 insertions, 2 deletions
diff --git a/regress/misc/Makefile b/regress/misc/Makefile
index 4f9df04225c..0a4892ec942 100644
--- a/regress/misc/Makefile
+++ b/regress/misc/Makefile
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile,v 1.2 2005/03/26 17:21:25 kettenis Exp $
+# $OpenBSD: Makefile,v 1.3 2005/08/15 18:53:41 kettenis Exp $
-SUBDIR+= exceptions objc
+SUBDIR+= X11 exceptions objc
install:
diff --git a/regress/misc/X11/Makefile b/regress/misc/X11/Makefile
new file mode 100644
index 00000000000..4ac98f60dc0
--- /dev/null
+++ b/regress/misc/X11/Makefile
@@ -0,0 +1,7 @@
+# $OpenBSD: Makefile,v 1.1 2005/08/15 18:53:42 kettenis Exp $
+
+SUBDIR+= bltone
+
+install:
+
+.include <bsd.subdir.mk>
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;
+}