Lines Matching refs:fb
25 #include <linux/fb.h>
42 struct FB {
50 #define fb_width(fb) ((fb)->vi.xres)
51 #define fb_height(fb) ((fb)->vi.yres)
52 #define fb_size(fb) ((fb)->vi.xres * (fb)->vi.yres * 2)
54 static int fb_open(struct FB *fb)
56 fb->fd = open("/dev/graphics/fb0", O_RDWR);
57 if (fb->fd < 0)
60 if (ioctl(fb->fd, FBIOGET_FSCREENINFO, &fb->fi) < 0)
62 if (ioctl(fb->fd, FBIOGET_VSCREENINFO, &fb->vi) < 0)
65 fb->bits = mmap(0, fb_size(fb), PROT_READ | PROT_WRITE,
66 MAP_SHARED, fb->fd, 0);
67 if (fb->bits == MAP_FAILED)
73 close(fb->fd);
77 static void fb_close(struct FB *fb)
79 munmap(fb->bits, fb_size(fb));
80 close(fb->fd);
84 static void fb_update(struct FB *fb)
86 fb->vi.yoffset = 1;
87 ioctl(fb->fd, FBIOPUT_VSCREENINFO, &fb->vi);
88 fb->vi.yoffset = 0;
89 ioctl(fb->fd, FBIOPUT_VSCREENINFO, &fb->vi);
107 struct FB fb;
130 if (fb_open(&fb))
133 max = fb_width(&fb) * fb_height(&fb);
136 bits = fb.bits;
149 fb_update(&fb);
150 fb_close(&fb);