Plotnus
Posts: 8
Joined: Sun Aug 19, 2018 7:09 pm

Help: Headless Framebuffer Programming with VNC??

Sun Aug 19, 2018 7:24 pm

Hello all. Thanks for taking the time to check this out.

The problem I want to solve:
I want to make a game in assembly that writes directly into the frame buffer.
The RPi is headless. I connect to the RPi with ssh and vnc to work on it from my laptop.
With my current setup I do not see and of the results of my writes to frame buffer.
When I connect my RPi to a monitor I do see the changes to the graphical output.
I want to be able to connect to my RPi from my laptop, and see the graphical output of the program that directly writes the pixel values to some buffer.

Use Story
I get the desire to write to a buffer on my RPi so I can see a graphical output that sounds fun. I connect to my RPi using VNC.
I follow a tutorial that writes to the frame buffer. Cool. I compile and run. No graphical output. Hmm does it work on the pi?
I connect the pi to a monitor and run the program. It works! Ok cool. I then wonder what happens if I VNC connect to the same desktop.
I do it and run the program from my laptop. On the laptop screen I see nothing. On the monitor connected to the RPi I see the visual output.
"I want to see the output in the vnc viewer as well" I think. I search for a while then come to these forums.


If you need any additional info let me know. :)

User avatar
topguy
Posts: 4927
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Help: Headless Framebuffer Programming with VNC??

Mon Aug 20, 2018 12:27 pm

Instead of using the real frambuffer, use a virtual framebuffer. One that is automatically shared over VNC protocol using this C library for example.
https://github.com/LibVNC/libvncserver

EDIT:
Wait you said you wanted to see both on monitor and vnc so this then:
https://github.com/zohead/fbvnc

Plotnus
Posts: 8
Joined: Sun Aug 19, 2018 7:09 pm

Re: Help: Headless Framebuffer Programming with VNC??

Mon Aug 20, 2018 4:39 pm

@topguy
Thanks. For the shares. After a quick look they look like libraries.

I'm looking for something I can start up much like "vncserver" and then just connect from my laptop and make the arm assembly game and see the output.

Maybe the best route would be to update the virtual frame buffers which leads to the question of how would I find the address of the virtual frame buffers.

User avatar
topguy
Posts: 4927
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Help: Headless Framebuffer Programming with VNC??

Mon Aug 20, 2018 6:44 pm

My first link is a library. You use it to create the framebuffer and then it will handle the sharing. But is it easy to use from Assembly ? IDK.

My second link I think is a seperate executable. ( fbvnc.c has a main() function )

Plotnus
Posts: 8
Joined: Sun Aug 19, 2018 7:09 pm

Re: Help: Headless Framebuffer Programming with VNC??

Wed Aug 22, 2018 6:20 am

@topguy
Yea, the second one is an exe. I built it but haven't figured out how to use it.
I'm figured it'd be what I'd run as the vnc server.
I read that requests for the frame buffer come from the client.
I think it may be for the client because for usage it shows:

Code: Select all

Usage: ./fbvnc [options] server [port]
Also when I try to run ./fbvnc server the error message is

Code: Select all

could not connect! server 5900 : -1
If it was meant to be the server I don't know of anything it would need to connect to.
I'd expect a client to be trying to connect to something.
Maybe the server has to "connect" to the port it will listen to?
I'm not sure.

User avatar
topguy
Posts: 4927
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Help: Headless Framebuffer Programming with VNC??

Wed Aug 22, 2018 9:21 am

I totally misread the description of fbvnc, its a client/viewer, not a server... ooops, my bad..

Something like this was what I was looking for:
https://github.com/ponty/framebuffer-vncserver

Return to “Advanced users”