summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2005-08-31 20:53:50 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2005-08-31 20:53:50 +0000
commit597681c70c5ccbad5db8df77c1dd4029a632af4a (patch)
tree148f083b420592e027ac1eb03367e342d6a6a4a8 /regress
parent7c855bbc44540a77b2fbe0e5c3cb6044210f977e (diff)
Add regression test for fbBlt().
permission from deraadt@
Diffstat (limited to 'regress')
-rw-r--r--regress/misc/X11/Makefile4
-rw-r--r--regress/misc/X11/blt/Makefile6
-rw-r--r--regress/misc/X11/blt/blt.c58
3 files changed, 66 insertions, 2 deletions
diff --git a/regress/misc/X11/Makefile b/regress/misc/X11/Makefile
index 4ac98f60dc0..eb7c350253b 100644
--- a/regress/misc/X11/Makefile
+++ b/regress/misc/X11/Makefile
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile,v 1.1 2005/08/15 18:53:42 kettenis Exp $
+# $OpenBSD: Makefile,v 1.2 2005/08/31 20:53:49 kettenis Exp $
-SUBDIR+= bltone
+SUBDIR+= blt bltone
install:
diff --git a/regress/misc/X11/blt/Makefile b/regress/misc/X11/blt/Makefile
new file mode 100644
index 00000000000..f231185509c
--- /dev/null
+++ b/regress/misc/X11/blt/Makefile
@@ -0,0 +1,6 @@
+# $OpenBSD: Makefile,v 1.1 2005/08/31 20:53:49 kettenis Exp $
+
+PROG= blt
+LDADD+= /usr/X11R6/lib/modules/libfb.a
+
+.include <bsd.regress.mk>
diff --git a/regress/misc/X11/blt/blt.c b/regress/misc/X11/blt/blt.c
new file mode 100644
index 00000000000..d9e11e30598
--- /dev/null
+++ b/regress/misc/X11/blt/blt.c
@@ -0,0 +1,58 @@
+/* $OpenBSD: blt.c,v 1.1 2005/08/31 20:53:49 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;
+typedef int Bool;
+
+extern void fbBlt (FbBits *, FbStride, int, FbBits *, FbStride, int,
+ int, int, int, FbBits, int, Bool, Bool);
+
+FbBits map[] = { 0x77ff7700, 0x11335577 };
+
+int
+main (void)
+{
+ int pagesize;
+ FbBits *src;
+ FbBits *dst;
+ int srcX, dstX;
+ int bpp;
+ int alu = 1;
+ FbBits pm = 0xffffffff;
+
+ 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 = (FbBits *)((char *)src + (pagesize - sizeof map));
+ memcpy (src, map, sizeof map);
+
+ for (bpp = 8; bpp <= 32; bpp += 8)
+ for (dstX = 0; dstX < 64; dstX += bpp)
+ for (srcX = 0; srcX < 32; srcX += bpp)
+ fbBlt(src, 1, srcX, dst, 256, dstX,
+ (32 - srcX), 2, alu, pm, bpp, 0, 0);
+
+ for (bpp = 8; bpp <= 32; bpp += 8)
+ for (dstX = 0; dstX < 64; dstX += bpp)
+ for (srcX = 0; srcX < 32; srcX += bpp)
+ fbBlt(src, 1, srcX, dst, 256, dstX,
+ (64 - srcX), 1, alu, pm, bpp, 0, 0);
+
+ return 0;
+}