"unhandled level 3 translation fault" for accessing the /dev/fb0

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(
			( fbVarInfo.xres * fbVarInfo.yres * fbVarInfo.bits_per_pixel ) >> 3, 
			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~

How is tmpVidBuf obtained?
Also, can you narrow it down further to see whether accessing source/destination is the issue?

“scrBuffer” holds the memory handle from mmap, but “scrbuf” is used as destination in memcpy. Shouldn’t “scrBuffer” be used?


  1. scrBuffer = scrbuf, they just equal to each other, sorry for the ambiguity of variable identifiers

  2. tmpVidBuf is just an array of 0xFF, statically defined array, like,

u8 tmpVidBuf[16*1024];
  memset(tmpVidBuf, 0xFF, 16*1024);
  1. once “memcpy” is commented, the program runs normally
unhandled level 3 translation fault

will be triggered !

  1. I’ve even tried the following
scrbuf[0] = 0xFF;

the same error

unhandled level 3 translation fault

will appear !!

please help…

has it something to do with SMMU for display related component ??

OOPS, my bad …

this is a bug of my code.

access to 'scrbuf ’ takes place just in adavnce of mmap …,

really sorry for the disturbance…

this post better be deleted as soon as possible…