Skip to content
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 Linux framebuffer backend #3

Closed
jserv opened this issue Jul 17, 2024 · 12 comments
Closed

Implement Linux framebuffer backend #3

jserv opened this issue Jul 17, 2024 · 12 comments
Assignees

Comments

@jserv
Copy link
Contributor

jserv commented Jul 17, 2024

Mado should provide a Linux framebuffer/DRM backend, which is more suitable for embedded systems. In addition, the use of the Linux input subsystem is crucial for integration.

Reference:

@shengwen-tw
Copy link
Collaborator

shengwen-tw commented Jul 24, 2024

Pull request #15 implements the Linux framebuffer backend for the Mado.

@jserv
Copy link
Contributor Author

jserv commented Jul 25, 2024

With the inclusion of kconfiglib, the build system is now fully configurable like "menuconfig" when building the Linux kernel. This flexibility is also useful for developers to integrate additional backends such as Linux framebuffer and DRM device support. (#18)

@jserv
Copy link
Contributor Author

jserv commented Aug 1, 2024

@shengwen-tw
Copy link
Collaborator

Add information of Virtual Terminal (Console) as the Linux framebuffer/DRM backend should also take care of the VT switching:

@shengwen-tw
Copy link
Collaborator

In GNU/Linux, the user can switch between different virtual terminals using Ctrl+Alt+Fn. The first virtual terminal (VT1, accessed with Ctrl+Alt+F1) is typically used by the graphical desktop environment.

We should deactivate the virtual terminal when Mado is running and restore it in opposite case.

@jserv
Copy link
Contributor Author

jserv commented Aug 8, 2024

drm-framebuffer is a simple application which can be used to test a Linux DRM device.

@shengwen-tw
Copy link
Collaborator

@shengwen-tw
Copy link
Collaborator

shengwen-tw commented Aug 10, 2024

pslash, a lightweight framebuffer splashscreen for embedded devices, provides good reference for virtual terminal (VT) management.

@jserv jserv changed the title Implement Linux framebuffer/DRM backend Implement Linux framebuffer backend Sep 14, 2024
@jserv
Copy link
Contributor Author

jserv commented Sep 14, 2024

Let's focus on Linux framebuffer support for now. DRM support can be considered as a follow-up once the non-SDL display target and VT implementation are merged.

@shengwen-tw
Copy link
Collaborator

shengwen-tw commented Sep 16, 2024

DirectFB uses the event device and udev to manage Human Interface Devices (HIDs), in which the udev is for handling device plug-in and removal.

Let's handle the mouse events (i.e., EV_REL and EV_ABS) first by reading all event devices (i.e., /dev/input/eventX) using poll() (or any suitable APIs) in a thread and later adding support for udev.

@jserv
Copy link
Contributor Author

jserv commented Sep 16, 2024

Let's handle the mouse events (i.e., EV_REL and EV_ABS) first by reading all event devices (i.e., /dev/input/eventX) using poll() (or any suitable APIs) in a thread and later adding support for udev.

Related: #4

@jserv
Copy link
Contributor Author

jserv commented Oct 2, 2024

According to Linux 6.12 To Optionally Display A QR Code During Kernel Panics, a new feature allows the display of a QR code within the DRM panic handler infrastructure when a Linux kernel panic occurs. We could consider integrating parts of the Mado codebase into the Linux kernel (as a module) to enhance text rendering capabilities. As a graphical library and window system, Mado does not rely on floating-point operations, making it suitable for Linux kernel integration where no FPU is available.

shengwen-tw added a commit to shengwen-tw/mado that referenced this issue Oct 6, 2024
This commit adds a Linux framebuffer backend to Mado, utilizing framebuffer
and event devices for basic input and display.

Note that though TWIN (and by extension, Mado) was designed to operate in
single-threaded environments, the Linux framebuffer backend in Mado currently
uses POSIX thread to manage input system events. Coroutines could potentially
be used as an alternative.

Follow-up tasks:
1. Protect mouse event update with mutex (see linux_input.c)
2. Fix an existing unexpected termination bug (see linux_input.c)
3. Support DRM/KMS backend
4. Support hot-pluging and removal of input devices with udev
5. Refine event handling (i.e., remove POSIX thread if possible)

Close sysprog21#3
@jserv jserv closed this as completed in a416a32 Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants