10 static void cleanup(void);
15 static struct fb_fix_screeninfo finfo;
16 static struct fb_var_screeninfo vinfo;
22 if((fd = open("/dev/fb0", O_RDWR)) == -1) {
23 fprintf(stderr, "failed to open framebuffer device\n");
27 ioctl(fd, FBIOGET_FSCREENINFO, &finfo);
33 static void cleanup(void)
36 munmap(vmem, vmem_size);
43 void *fbgfx_set_video_mode(int x, int y, int depth)
51 void *fbgfx_get_video_mode(int *xptr, int *yptr, int *depthptr)
58 ioctl(fd, FBIOGET_VSCREENINFO, &vinfo);
59 vmem_size = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel / 8;
61 if((vmem = mmap(0, vmem_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) == (void*)-1) {
62 fprintf(stderr, "failed to map video memory\n");
68 *depthptr = vinfo.bits_per_pixel;