microsoft / microsoft/WSL

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

Open
#230 3 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the /dev/fb0 entry point and the FBIOGET_FSCREENINFO/FBIOGET_VSCREENINFO ioctl calls, then inspect the mmap failure and its errno. Done means determining whether WSL's framebuffer is expected to expose valid screen information and a mappable buffer, and documenting or fixing that behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, linux
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.