-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement VirtIO GPU and input devices #32
Comments
homebrew-qemu-virgl illustrates how virtio-gpu can be implemented via VirGL. |
Side note: The register 0xac, 0xb0, 0xb4, 0xb8, 0xbc and 0xc0 are only documented since v1.2. Update: |
By observation, when the Linux kernel loads virtio-gpu module, it reads register 0xac (SHMSel), 0xb0 (SHMLenLow), 0xb4 (SHMLenHigh), 0xb8 (SHMBaseLow), and 0xbc (SHMBaseHigh) for a shared memory space. (Those registers tell the address and length of a shared memory specified with an ID.) Seems like shared memory is meant to be a device by design, and may be registered via the device tree (I'm not quite sure). Eventually, I found that QEMU just passes |
embear illustrates a method for accessing DRM Framebuffer to display an image. The article first shows that to test whether a display is working or not, we can use:
For showing an image on the display, the author demonstrated a method that involves using libdrm. |
After loading
Next, type the following command to set up the drm buffer:
In addition, the following command can be used to show the
Before setting up the drm buffer, the output is |
psun3x's commit to the acrn-hypervisor is a good reference of understanding how to handle the virtio-gpu 2D command sequence. What worth mentioning are:
Update: The complete source code can be found at here. |
The article "Image Stride" by Microsoft illustrates the concept of scan-line, padding, and stride, which is helpful for understanding the code of acrn-hypervisor. |
References on SDL programming:
|
However, To enable X11, turn on the following options in the Buildroot with +BR2_INSTALL_LIBSTDCPP=y
+BR2_PACKAGE_XORG7=y
+BR2_PACKAGE_XSERVER_XORG_SERVER=y
+BR2_PACKAGE_XSERVER_XORG_SERVER_MODULAR=y
+BR2_PACKAGE_XAPP_XINIT=y
+BR2_PACKAGE_XTERM=y
+BR2_PACKAGE_XAPP_XCLOCK=y
+BR2_PACKAGE_XAPP_TWM=y To launch X11, initiate $ mkdir mnt
$ mount /dev/vda mnt
$ sh mnt/run.sh
$ startx The user should expect to observe the following result: Reference: How to install X11 on my own Linux Buildroot system? |
The following guild demonstrates the cross-compilation procedure of the 1. DirectFB2 Cross Compilation:
2. DirectFB-examples Cross Compilation
See also: References: |
Did you submit patches to buildroot project? |
I followed DirectFB2's official guide to build it with meson, but leveraged the toolchain and rootfs created by Buildroot (i.e., there is no patch to Buildroot involves here). Note that the sysroot by Buildroot provides necessary system headers for cross compilation. For the patch to the DirectFB2, so far I have no idea why cross compilation will complain the |
I tend to merge #34 if the proposed changes can be cleaned up. Meanwhile, we shall consider to implement virtio-input. cleverca22/mini-rv32ima implements virtio-input (and even virtio-snd!) in a minimalist way, and it would be great both virtio-gpu and virtio-input can work with DirectFB2. |
A pull request to resolve the compilation error of |
The struct virtio_input_event {
le16 type; /* Keyboard or mouse */
le16 code; /* Key or movement */
le32 value;
}; The |
A simple frame-buffer for Linux is described as a frame-buffer setup by firmware or the bootloader, assuming the display hardware is already configured to scan out from the memory specified by the reg property. The relevant configuration is I am considering to integrate simple framebuffer prior to the VirtIO GPU device for the sake of minimal changes required for graphics enablement. |
Understanding evdev is a good article for understanding event handling (i.e., Additionally, as a side note for
|
Record a sample code for reading Linux input events in C: Meanwhile, sudo apt install input-utils |
kernel.org provides an introduction to event codes of the Linux kernel: |
Virtqueues and virtio ring: How the data travels by Eugenio Pérez Martín explains the concept of Available ring, Used ring, and Descriptor table of the VirtIO. |
The key codes of the SDL2 can be found at: |
The header file of the virglrender, which contains references to the usable API, can be found at: |
EGL
Reference: https://en.wikipedia.org/wiki/EGL_(API) |
GLX
Reference: https://en.wikipedia.org/wiki/GLX |
GLES
Reference: https://en.wikipedia.org/wiki/OpenGL_ES |
crosvm (The Chrome OS Virtual Machine Monitor) is a Rust-implemented virtual machine monitor (VMM) based on Linux’s KVM hypervisor, with a focus on simplicity, security, and speed. It provides a reference for implementing virtio-gpu with 3D rendering mode as some operations are not well documented in the Virtual I/O Device Committee Specification: |
Since VirGL is not well documented even in the latest VirtIO spec, we collect some useful materials here: |
kmscube is a little demonstration program for how to drive bare metal graphics without a compositor like X11, wayland or similar, using DRM/KMS (kernel mode setting), GBM (graphics buffer manager) and EGL for rendering content using OpenGL or OpenGL ES. |
Currently semu does not support graphics rendering.
I think VirtIO GPU with 2D mode might be a good starting point to go.
Later we can then emulate mouse and keyboard for more sophisticated features.
The text was updated successfully, but these errors were encountered: