LekKit / RVVM

The RISC-V Virtual Machine
GNU General Public License v3.0
858 stars 59 forks source link

Asking for vnc support #101

Open fish4terrisa-MSDSM opened 1 year ago

fish4terrisa-MSDSM commented 1 year ago

Right now we have sdl and x11 supports, but maybe RVVM is run on a server with no screen,and both x11 and sdl is diffcult to stream through internet.And vnc support is also useful for me to add display support in archriscv-term(as I just need to add vnc module to archriscv-term).I have just tried Xvnc , but it`s too complex and has much performance cost.

fish4terrisa-MSDSM commented 1 year ago

Right now we have sdl and x11 supports, but maybe RVVM is run on a server with no screen,and both x11 and sdl is diffcult to stream through internet.And vnc support is also useful for me to add display support in archriscv-term(as I just need to add vnc module to archriscv-term).I have just tried Xvnc , but it`s too complex and has much performance cost.

Maybe we can use libvncserver

LekKit commented 1 year ago

Nice idea overall, two issues tho:

I will look into it, but be aware that having a native renderer for Android (via JNI or whatever) would be a lot better. I have seen examples of rendering a raw framebuffer context but didn't dig that personally yet.

fish4terrisa-MSDSM commented 6 months ago

I have found the way to have a vnc server without libvncserver in the qemu code. They wrote a simple vnce server. The code is here. Maybe we can port that code to RVVM directly? (However, the code is a bit complex...)

LekKit commented 6 months ago

Is it possible to implement framebuffer rendering (from Java ByteBuffer) in android app?

fish4terrisa-MSDSM commented 6 months ago

Is it possible to implement framebuffer rendering (from Java ByteBuffer) in android app?

I'm not much familiar with jni, may be there is , just like pelya's XSDL on android. However, Android jni and java code are just too unstable to trust (Many of the UI related codes won't work across various roms, and we have to deal with each different Android environment manually). It seems that even running an Xserver and sdl in an Android app won't cause much performance loss, so including a simple vnc server and bundle RVVM with an Android vnc viewer seems just fine. (Just as the code from qemu I mentioned above, it is possible to implement a vnc window layer for RVVM without libvncserver, and it will also benefit the users who run RVVM in docker or server)

LekKit commented 6 months ago

I am already working on a JNI binding for some other usecases, which might cover this usecase too (We just need to implement a GUI in java). This is why I am more interested in this approach rather than using some third-party app to share screen over network, and it will be faster, too

LekKit commented 4 months ago

See 3ad7e2f. I think it is possible to implement a native framebuffer GUI with this on Android. To build JNI native lib, run make lib USE_JNI=1, then use RVVMNative.loadLib("/path/to/librvvm.so"); in Java

This is WIP but overall it captures my idea of using librvvm from Java. Any lacking feature can be added.

To render the framebuffer, call Framebuffer method getBuffer() to get a ByteBuffer. It's contents are technically shared memory between Java and RVVM display.