Writing to /dev/graphics/fb0 on Android


I have a native C program that mmaps /dev/graphics/fb0 and draws an image.
This works well on other SOC’s but on the 410C I don’t see anything on the screen.
The program itself runs without any errors. Any suggestion as why it doesn’t work ?
Perhaps I need to enable some features in the kernel config.


Hi Vasant

Do you have the frame buffer device in your filesystem (ie, does /dev/graphics/fb0 actually exist?)

Yes, all system calls execute correctly. It is just that there is nothing on screen.


thanks. Can I assume you are using release 15.06?

Also can you see any information that might be relevant in the kernel messages after executing your program? is just run

shell@msm8916_64 $ cat /proc/version
shell@msm8916_64 $ dmesg

Can you stop the Surfacelinger (adb shell stop) before running your program?

The Surfacelinger will also attempt to write to the display so it is possible that the buffer is being overridden.

I am running a 32 bit (msm8916_32) build of android that is built from source with qcom’s SDK.
cat /proc/version
Linux version 3.10.49-g3339759-00001-g9260ab8
I don’t see any thing in dmesg after a write to frame buffer.
Depending on the virtual resolution there are 2 or 3 frame buffers and one of them is displayed on the screen.
I am writing to all the frame buffers from ADB this ensures that it should display on screen.
Anyway I stopped surfaceflinger and did the same and still no display.


Vasanth -
How are you writing into the /dev/graphcis/fb0?
Are you using the right IOCTLs? or are you trying to cat a buffer into it. ‘cat’ -ing a buffer will not work.
As you have already downloaded the source, you can refer to bootable\recovery\minui\graphics_fbdev.c for the IOCTLs to be used.

Also try disabling the Display Hardware using its overlay hardware to composite the UI by ‘Turning ON’ the following: (Settings -> Developer Options -> Disable Hardware Overlays).