Skip to content

Commit c0bd1e8

Browse files
committed
Reorganize backend documentation
README.md now focuses on SDL2 as the primary development backend with a simple quick-start guide. Full backend documentation (SDL, fbdev, VNC, headless) with dependencies, build, and run instructions is now in docs/backends.md.
1 parent eb5f9d6 commit c0bd1e8

File tree

2 files changed

+84
-73
lines changed

2 files changed

+84
-73
lines changed

README.md

Lines changed: 13 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -79,100 +79,51 @@ Install [Pixman](https://pixman.org/) before selecting the corresponding rendere
7979
* macOS: `brew install pixman`
8080
* Ubuntu Linux / Debian: `sudo apt install libpixman-1-dev`
8181

82+
### Graphics Backend
83+
8284
`Mado` supports multiple graphics backends. Choose one based on your deployment scenario:
8385
- SDL: Cross-platform desktop development with hardware acceleration
8486
- Linux framebuffer (fbdev): Direct hardware access for embedded Linux
8587
- VNC: Remote display via Virtual Network Computing protocol
8688
- Headless: Testing and automation without display output
8789

88-
### Backend-Specific Dependencies
90+
`Mado` uses SDL2 as the primary development and demonstration backend, providing cross-platform graphics with hardware acceleration. For other backend options (Linux framebuffer, VNC, headless), see [docs/backends.md](docs/backends.md).
8991

90-
For SDL backend, install the [SDL2 library](https://www.libsdl.org/).
92+
Install the [SDL2 library](https://www.libsdl.org/):
9193
* macOS: `brew install sdl2`
9294
* Ubuntu Linux / Debian: `sudo apt install libsdl2-dev`
9395

94-
For the VNC backend, please note that it has only been tested on GNU/Linux, and the prebuilt [neatvnc](https://github.com/any1/neatvnc) package might be outdated. To ensure you have the latest version, you can build the required packages from source by running the script:
95-
```shell
96-
$ tools/build-neatvnc.sh
97-
```
98-
99-
For Linux framebuffer backend, install `libudev` and `libuuid`:
100-
* Ubuntu Linux / Debian: `sudo apt install libudev-dev uuid-dev`
101-
102-
For the headless backend, no additional dependencies are required. This backend uses shared memory for rendering and can be controlled programmatically via `headless-ctl`.
103-
104-
For detailed information about each backend's features, use cases, and configuration options, see [docs/backends.md](docs/backends.md).
105-
10696
### Configuration
10797

108-
`Mado` uses [Kconfiglib](https://github.com/sysprog21/Kconfiglib) for flexible build configuration. Choose from multiple graphics backends: SDL, Linux framebuffer, VNC, or headless (for testing/automation).
98+
`Mado` uses [Kconfiglib](https://github.com/sysprog21/Kconfiglib) for flexible build configuration.
10999

110-
For interactive configuration with a terminal menu:
100+
For quick setup with defaults (SDL backend enabled):
111101
```shell
112-
$ make config
102+
$ make defconfig
113103
```
114104

115-
For quick scripted configuration (recommended for most users):
105+
For interactive configuration (to explore all options):
116106
```shell
117-
$ make defconfig
118-
$ python3 tools/kconfig/setconfig.py --kconfig configs/Kconfig \
119-
BACKEND_SDL=y \
120-
DEMO_MULTI=y
107+
$ make config
121108
```
122109

123-
For detailed configuration options and advanced usage, see [docs/kconfig-usage.md](docs/kconfig-usage.md).
124-
125-
### Build and execution
110+
### Build and Execution
126111

127112
Build the library and demo program:
128113

129114
```shell
130115
$ make
131116
```
132117

133-
To run demo program with SDL backend:
118+
Run the demo program:
134119

135120
```shell
136121
$ ./demo-sdl
137122
```
138123

139-
Once the window appears, you should be able to move the windows and interact with the widgets.
140-
141-
To run demo program with the Linux framebuffer backend:
142-
143-
```shell
144-
$ sudo ./demo-fbdev
145-
```
146-
147-
Normal users don't have access to `/dev/fb0` so require `sudo`. Alternatively, you can add the user to the video group to avoid typing `sudo` every time:
148-
149-
```shell
150-
$ sudo usermod -a -G video $USERNAME
151-
```
152-
153-
In addition, the framebuffer device can be assigned via the environment variable `FRAMEBUFFER`.
154-
155-
To run demo program with the VNC backend:
156-
157-
```shell
158-
$ ./demo-vnc
159-
```
160-
161-
This will start the VNC server. You can use any VNC client to connect using the specified IP address (default is `127.0.0.1`) and port (default is `5900`).
162-
The IP address can be set using the `MADO_VNC_HOST` environment variable, and the port can be configured using `MADO_VNC_PORT`.
163-
164-
To run demo program with the headless backend (for testing/automation):
165-
166-
```shell
167-
$ ./demo-headless &
168-
$ ./headless-ctl status # Check backend status
169-
$ ./headless-ctl shot output.png # Capture screenshot
170-
$ ./headless-ctl shutdown # Graceful shutdown
171-
```
124+
Once the window appears, you can move the windows and interact with the widgets.
172125

173-
The headless backend uses shared memory for rendering without display output. Use `headless-ctl` to monitor, control, and capture screenshots.
174-
Ideal for CI/CD pipelines, automated testing, and memory debugging.
175-
See [docs/backends.md](docs/backends.md) for advanced usage including event injection and live monitoring.
126+
For information about other backends (Linux framebuffer, VNC, headless), see [docs/backends.md](docs/backends.md).
176127

177128
## License
178129

docs/backends.md

Lines changed: 71 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,28 @@ The SDL (Simple DirectMedia Layer) backend provides cross-platform graphics outp
1616
- Windowed and fullscreen modes
1717
- Audio support (if needed)
1818

19+
**Dependencies:**
20+
Install the [SDL2 library](https://www.libsdl.org/):
21+
* macOS: `brew install sdl2`
22+
* Ubuntu Linux / Debian: `sudo apt install libsdl2-dev`
23+
1924
**Build:**
2025
```shell
21-
make BACKEND=sdl
22-
# or
23-
make config # Select "SDL video output support"
26+
make defconfig # SDL backend is enabled by default
27+
make
2428
```
2529

30+
**Run:**
31+
```shell
32+
./demo-sdl
33+
```
34+
35+
Once the window appears, you can move windows and interact with widgets.
36+
2637
**Use Cases:**
2738
- Desktop applications
2839
- Cross-platform development
29-
- Games and multimedia applications
40+
- Primary development and testing platform
3041

3142
### Linux Framebuffer (fbdev)
3243
Direct framebuffer access for embedded Linux systems without X11/Wayland.
@@ -38,13 +49,31 @@ Direct framebuffer access for embedded Linux systems without X11/Wayland.
3849
- Linux input subsystem integration
3950
- Virtual terminal switching support
4051

52+
**Dependencies:**
53+
Install `libudev` and `libuuid`:
54+
* Ubuntu Linux / Debian: `sudo apt install libudev-dev uuid-dev`
55+
4156
**Build:**
4257
```shell
43-
make BACKEND=fbdev
44-
# or
45-
make config # Select "Linux framebuffer support"
58+
make defconfig
59+
python3 tools/kconfig/setconfig.py --kconfig configs/Kconfig \
60+
BACKEND_FBDEV=y \
61+
BACKEND_SDL=n
62+
make
63+
```
64+
65+
**Run:**
66+
```shell
67+
sudo ./demo-fbdev
68+
```
69+
70+
Normal users don't have access to `/dev/fb0`, requiring `sudo`. Alternatively, add the user to the video group:
71+
```shell
72+
sudo usermod -a -G video $USERNAME
4673
```
4774

75+
The framebuffer device can be assigned via the environment variable `FRAMEBUFFER`.
76+
4877
**Use Cases:**
4978
- Embedded Linux systems
5079
- Kiosk applications
@@ -61,13 +90,30 @@ Provides remote display capabilities through the VNC (Virtual Network Computing)
6190
- Built-in authentication
6291
- Compression support
6392

93+
**Dependencies:**
94+
Install [neatvnc](https://github.com/any1/neatvnc). Note: The VNC backend has only been tested on GNU/Linux, and prebuilt packages might be outdated. To ensure the latest version, build from source:
95+
```shell
96+
tools/build-neatvnc.sh
97+
```
98+
6499
**Build:**
65100
```shell
66-
make BACKEND=vnc
67-
# or
68-
make config # Select "VNC server output support"
101+
make defconfig
102+
python3 tools/kconfig/setconfig.py --kconfig configs/Kconfig \
103+
BACKEND_VNC=y \
104+
BACKEND_SDL=n
105+
make
69106
```
70107

108+
**Run:**
109+
```shell
110+
./demo-vnc
111+
```
112+
113+
This starts the VNC server. Connect using any VNC client with the specified IP address (default: `127.0.0.1`) and port (default: `5900`).
114+
- IP address: Set via `MADO_VNC_HOST` environment variable
115+
- Port: Set via `MADO_VNC_PORT` environment variable
116+
71117
**Use Cases:**
72118
- Remote desktop applications
73119
- Server-side rendering
@@ -84,12 +130,16 @@ Renders to a memory buffer without any display output, ideal for testing and aut
84130
- Event injection for testing
85131
- Memory debugging friendly
86132

133+
**Dependencies:**
134+
No additional dependencies required. This backend uses shared memory for rendering.
135+
87136
**Build:**
88137
```shell
89138
# Using setconfig.py (recommended)
90139
make defconfig
91140
python3 tools/kconfig/setconfig.py --kconfig configs/Kconfig \
92141
BACKEND_HEADLESS=y \
142+
BACKEND_SDL=n \
93143
TOOLS=y \
94144
TOOL_HEADLESS_CTL=y
95145
make
@@ -99,10 +149,20 @@ make config # Select "Headless backend" and "Headless control tool"
99149
make
100150
```
101151

152+
**Run:**
153+
```shell
154+
./demo-headless &
155+
./headless-ctl status # Check backend status
156+
./headless-ctl shot output.png # Capture screenshot
157+
./headless-ctl shutdown # Graceful shutdown
158+
```
159+
160+
The headless backend uses shared memory for rendering without display output. Use `headless-ctl` to monitor, control, and capture screenshots.
161+
102162
**Use Cases:**
103163
- Automated testing
104164
- CI/CD pipelines
105-
- Memory analysis
165+
- Memory analysis with Valgrind or AddressSanitizer
106166
- Screenshot generation
107167
- Performance benchmarking
108168

0 commit comments

Comments
 (0)