microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.18k stars 806 forks source link

/dev/fb0 reports bad data, can't map it with mmap #230

Open allykzam opened 8 years ago

allykzam commented 8 years ago

Just quickly pulling apart one of my old projects, calling ioctl and passing FBIOGET_FSCREENINFO and FBIOGET_VSCREENINFO gives me some basic information about the frame-buffer, and I can see that it has a bit-depth of 16bpp, with a resolution of 800x600. Other fields from the two structures returned (a fb_fix_screeninfo and a fb_var_screeninfo value, respectively) give me bad values; for example, on a 1280x800 display I use, the fixed-info structure reports a line_length of 5120 (it's got 32bpp, so 1280 x 4 bytes = 5120), but in this environment, the fixed-info structure reports a line_length of zero?

Moving forward anyway, my code tries to map the buffer with mmap, but fails because buffer is -1. The relevant code looks roughly like this:

int fbDevice = open("/dev/fb0", 0_RDWR);
char *buffer = (char *)mmap(0, (xres * yres * (bpp / 8)), PROT_READ | PROT_WRITE, MAP_SHARED, fbDevice, 0);

Since there's not much of an error from the system, I assume I'm just not allowed read/write access to the buffer.

Is the frame-buffer intended to work at some point, or am I poking a placeholder file that will never do anything?

benhillis commented 8 years ago

@amazingant - great questions. The framebuffer device is not ready for prime time. We've actually removed it in our develop branch so soon you'll receive a flight where /dev/fb0 will be gone.

If this is preventing a scenario you feel strongly about I'd suggest filing a task on our user voice page and based on interest we can look at a more complete fb0 device in the future...

Thanks for reporting this issue, and thanks for trying out WSL! Ben

allykzam commented 8 years ago

@benhillis Thanks for the feedback; I'm certainly disappointed to hear of the device's demise, but I don't have any important uses for it. The only real use I have for frame buffers is fbterm, which I use on my headless systems for those odd times I plug a monitor into them, but that doesn't seem applicable here; Windows already has a UI and wallpaper support. :)

benhillis commented 8 years ago

Closing out this thread, thanks again for trying out WSL.