问题
I am using ioctl function to access framebuffer
The problem is that for each frame, I am writing framebuffer three times
For instance, each frame, I first fill frame with Red color, do some computation, fill Green, then do another computation, then fill Blue.
In other words, each frame, I have three layers, Red as the bottom, Green, then Blue as the top. Therefore, Red and Green is invisible and all I can see is the Blue.
Now, my question is that when I use ioctl call, it seems like it can't recognize Red and Green but only Blue.
For each frame, I did something like:
Red(); //Frame buffer will be all Red
getFrameBuffer(); // ioctl call
Green();
Blue();
And my getFrameBuffer() is something like:
int fd = open("/dev/fb0",O_RDWR);
if (fd == -1)
printf("Could not open framebuffer\n");
struct fb_var_screeninfo screen_info;
struct fb_fix_screeninfo fixed_info;
if (ioctl(fd, FBIOGET_FSCREENINFO, &fixed_info))
printf("Error reading fixed information.\n");
if (ioctl(fd, FBIOGET_VSCREENINFO, &screen_info))
printf("Could not read variable screen info.\n");
size_t screensize = fixed_info.line_length*screen_info.yres;
unsigned char *fbp = (unsigned char *)mmap(0, screensize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if ((int)fbp == -1)
printf("Cannot mapped\n");
munmap(fbp,screensize);
So far, when I call getFrameBuffer(), it returns all Blue color. Is there anyway to perhaps block writing framebuffer or something like that so that when I call getFrameBuffer(), I get Red color?
来源:https://stackoverflow.com/questions/8696335/ioctl-to-block-operation