Skip to Content
Linux Device Drivers Development
book

Linux Device Drivers Development

by John Madieu
October 2017
Intermediate to advanced
586 pages
14h 8m
English
Packt Publishing
Content preview from Linux Device Drivers Development

Framebuffer from user space

You usually access framebuffer memory by means of the mmap() command in order to map the framebuffer memory to the part of the system RAM, so that drawing pixels on the screen becomes a simple matter of affecting memory value. Screen parameters (variable and fixed) are extracted by means of ioctl commands, especially FBIOGET_VSCREENINFO and FBIOGET_FSCREENINFO. The complete list is available at include/uapi/linux/fb.h in the kernel source.

The following is a sample code to draw a 300*300 square on the framebuffer:

#include <stdlib.h> #include <unistd.h> #include <stdio.h> #include <fcntl.h> #include <linux/fb.h> #include <sys/mman.h> #include <sys/ioctl.h> #define FBCTL(_fd, _cmd, _arg) \ if(ioctl(_fd, _cmd, _arg) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Linux Device Drivers, Second Edition

Linux Device Drivers, Second Edition

Jonathan Corbet, Alessandro Rubini
Linux Device Drivers, 3rd Edition

Linux Device Drivers, 3rd Edition

Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman

Publisher Resources

ISBN: 9781785280009Supplemental Content