1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/* $OpenBSD: bltone.c,v 1.4 2005/08/27 14:00:57 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 fbBltOne (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;
}
|