android mmap failed: invalid argument (errno 22)
prmatta,
Error code 22 is EINVAL
.
From the mmap()
documentation that tells you...
EINVAL We don't like start or length
or offset. (E.g., they are too large,
or not aligned on a page boundary.)
Perhaps you didn't page align your memory?
Linux DRM ( DRI ) Cannot Screen Scrape /dev/fb0 as before with FBDEV
finfo.line_length
gives the size of the actual physical scan line in bytes. It is not necessarily the same as screen width multiplied by pixel size, as scan lines may be padded.
However the QImage constructor you are using assumes no padding.
If xoffset is zero, it should be possible to construct a QImage directly from the framebuffer data using a constructor with the bytesPerLine argument. Otherwise there are two options:
- allocate a separate buffer and copy only the visible portion of each scanline to it
- create an image from the entire buffer (including the padding) and then crop it
Calling mmap on dumbbuffer with Linux’ Direct Rendering Manager in Rust fails while working in C
So I used strace
as recommended by Shepmaster, and found the problem: the offset
field of the CMapDumb
structure should have been a u64
instead of an u32
(I have been too quick copying from the C original). The actual offset returned by the DRM_IOCTL_MODE_MAP_DUMB
IOCTL is 33 bits long, and I was losing the most significant one. It now works fine.
Related Topics
File/Directory Permissions Trailing + ( Drwxr-Xr-X+ )
Trouble with Installing Nloptr by Locally on Ubuntu
Run Shell Script After Xserver Is Started
Sending Snmp2 Trap Message from Linux Command Lne
Shared Libraries (Dlopen) and Thread-Safety of Library Static Pointers
Difference Between $() and () in Bash
Get Access to Usb Device on Linux (Libusb-1.0)
What's a Simple Method to Dump Pipe Input to a File? (Linux)
Terraform - Unable to Run Multiple Commands in Local Exec
I Need a Binary Comparison Tool for Win/Linux
Dreaming of Making My Own Os- What Should I Use? (Suggestions)
Running Meteor Application on a Single Core
Raspberry-Pi Docker Error: Standard_Init_Linux.Go:178: Exec User Process Caused "Exec Format Error"
Apt-Update in Azure Nvidia Gives Publickey Error
Can "Text File Busy" Happen When Two Processes Trying to Execute a Perl File in The Same Time