hi, all
I want to dispaly the captured video (from pcie) via frame-buffer of /dev/fb0, so i tried
the following things, but a serious kernel error will be triggered once i access the “mmap-ed”
frame buffer
i opened /dev/fb0 and ‘mmap’ its buffer to user space successfully, the codes are shown below
static int fb_dev =-1;
struct fb_var_screeninfo fbVarInfo;
struct fb_fix_screeninfo fbFixInfo;
u8 * scrbuf = NULL;
fb_dev = open("/dev/fb0", O_RDWR);
if(fb_dev < 0) {
return -1;
}
status = ioctl(fb_dev, FBIOGET_FSCREENINFO, &fbFixInfo);
if(status < 0) {
return -1;
}
status = ioctl(fb_dev, FBIOGET_VSCREENINFO, &fbVarInfo);
if(status < 0) {
return -1;
}
u8 * scrBuffer = mmap(
0,
( fbVarInfo.xres * fbVarInfo.yres * fbVarInfo.bits_per_pixel ) >> 3,
PROT_READ | PROT_WRITE,
MAP_SHARED, fb_dev, 0
);
/**< image capture and buffering process ... >**/
// ... ...
/**< key step for accessing the /dev/fb >**/
for(i = 0; i < yres; i ++) {
memcpy(scrbuf + i * fbFixInfo.line_length, tmpVidBuf + i * xres * 4, xres * 4);
}
In the last step, we copied image data to the screen buffer, but “dmesg” shows the following kernel error:
unhandled level 3 translation fault
what might be the root cause ?
how to fix this ?
any helpful suggestions are appreciated~