To calculate the line size, you should use line_length .
+-------------------------+----+ | | | | | | |<-------- XRES --------->| | = Xres is display resolution | | | | | | |<------- LINE LENGTH -------->| = Memory Size per line | | | | | | +-------------------------+----+ ^ ^ | | display on screen --+ +----> This is stride
The right pad is called the "step" (stride = (line_length in pixel) - width). Many devices had this step in the framebuffer if the display resolution was not multiplied by 8.
So the formula is:
fileSize = line_length * yres * numberOfFrames
Do not multiply it by bpp / 8 , since the line length is the size of the memory (not the size of the pixel).
To extract line_length , you should use FBIOGET_FSCREENINFO (0x4602 - 17922) and not FBIOGET_VSCREENINFO (0x4600 - 17922) as follows:
ioctl -rl 50 / dev / graphics / fb0 17922
My Galaxy Nexus will return like this:
return buf: 6f 6d 61 70 66 62 00 00 00 00 00 00 00 00 00 00 00 00 a0 ac 00 00 00 01 00 00 00 00 00 00 00 00 02 00 00 00 01 00 01 00 00 00 00 00 80 0b 00 00 00 00 ^_________^
My Galaxy Nexus has a line length: 2944 (0xb80).
source share