diff --git a/AGENTS.md b/AGENTS.md index 0851010..30d1296 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -3,7 +3,7 @@ ## 1. Project overview **Bananarchy** is a keypad-first Linux distribution (`armv7` / Alpine `edge` / postmarketOS `v26.06` hardfork) for **Qualcomm MSM8905 (Snapdragon 205)** and **MSM8909 (Snapdragon 210)** smart feature phones with **240x320 QVGA non-touch SPI displays** and **12-key T9 keypads** (`nokia-argon`, `nokia-beatles`, `nokia-tough`, `nokia-sparkler`, `nokia-leo`). -It uses a pure **X11 (`Xlibre` + `sxmo-de-dwm`)** stack (no Wayland) optimized for `< 2 ms` UI wakeup latency and `< 95 MB` idle RAM on 512 MB devices. +It uses a pure **X11 (`Xlibre` + `sxmo-de-dwm`)** stack (no Wayland) with **Adreno 304 (`FD304`) Glamor + DRI3 + GLX GPU acceleration** over `panel-mipi-dbi` KMSRO, optimized for `< 2 ms` UI wakeup latency and `< 95 MB` idle RAM on 512 MB devices. ## 2. Repository layout - `src/sxmo-dwm/`: patched `dwm` window manager (`240x320` vertical `bstack` layout, 24px Pango status bar, desktop `"Menu"`/`"Names"` softkey bar, C-level `evdev` `SW_LID` slider and universal key wake handling, `*` + `#` screenshot chord via `bananarchy-screenshot`, live `.Xresources` reload, and `.so` plugin loader via `dwm_plugin.h`). @@ -29,8 +29,8 @@ All cross-compilation scripts run inside rootless Docker (`alpine:3.24` `armv7` - `./scripts/build-dmenu.sh` — rebuilds only `dmenu.so`, `stest`, `dmenu_path`, and `dmenu_run`. - `./scripts/build-games.sh` — builds standalone X11 games and emulators in `src/games/` (`snake`, `tetris`, `gambatte` / `gbemu`). - `./scripts/build-fcitx5-t9.sh` — builds `src/fcitx5-t9` (`libt9.so` / `t9.so`). -- `./scripts/build-kernel-audio.sh` — builds `6.12.1-msm8916` QDSP6 audio, torch LED, camera `.ko` modules, and device `.dtb` files. -- `./scripts/build-xlibre.sh` — builds Xlibre `Xorg` and `libinput`/`fbdev` DDX drivers. +- `./scripts/build-kernel-audio.sh` — builds `6.12.1-msm8916` Adreno 304 `drm/msm`, QDSP6 audio, torch LED, camera `.ko` modules, and device `.dtb` files. +- `./scripts/build-xlibre.sh` — builds Xlibre `Xorg`, `libglamoregl.so`, `libglx.so`, and `modesetting`/`libinput`/`fbdev` DDX drivers. - `./scripts/build-bantam.sh` — fetches and cross-compiles the `bantam` AI agent. - `./scripts/generate-artwork.py` — regenerates wallpapers, splashes, and icons from `artwork/icon-large.png`. - `./scripts/version.sh [--print | target_rootfs]` — computes the date-based release version (`
` with `2026 = a`) and substitutes `@BANANARCHY_VERSION@` in `etc/os-release`, `etc/issue`, and `etc/motd` (invoked automatically during overlay application and image builds). diff --git a/CHANGELOG.md b/CHANGELOG.md index eb41631..b63888f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,8 +12,14 @@ Release versions follow the `
` format (where `2026` is `a`, ## Build `a1027` — codename `bonkers` (2026-10-27) ### New features and improvements +- **Adreno 304 (`FD304`) 3D GPU hardware acceleration and Xlibre Glamor offload**: + - Added full Qualcomm **Adreno 304 (`0x03000400`)** GPU and `qcom,msm8909-iommu` (`gfx3d_user` / `gfx3d_priv` context banks at `0x1f08000`) support to the `6.12.1-msm8916` kernel (`drm/msm` module and MSM8905/MSM8909 device trees across `nokia-argon`, `nokia-beatles`, `nokia-tough`, `nokia-sparkler`, and `nokia-leo`), configured for Adreno 304's `96 KB` (`SZ_64K + SZ_32K`) GMEM cache, `a300_pm4.fw` / `a300_pfp.fw` microcode, VBIF/ROQ/clock-gating registers, hard-reset recovery quirk, `OXILI_GDSC` power domain, and OPP frequency scaling up to `409.6 MHz`. + - Enabled headless render-only `drm/msm` initialization (`card1` / `renderD128`) alongside the SPI `panel-mipi-dbi` display (`card0`) and enabled `FD304` (`chip_id = 0x030004ff`) in Mesa Freedreno (`libgallium`) for hardware-accelerated **OpenGL 3.1** and **OpenGL ES 3.0**. + - Rebuilt **Xlibre** with **Glamor**, **GLX**, **XVideo**, and **DRI3** (`libglamoregl.so`, `libglx.so`, and `modesetting_drv.so` with `glamor.finish` synchronization before `drmModeDirtyFB` SPI transfers) and enabled `Option "AccelMethod" "glamor"` in `/etc/X11/xorg.conf.d/10-bananarchy-msm8909.conf`. + - Preinstalled `glxinfo`, `eglinfo`, `glxgears`, `glteapot` (`teapot`), and `es2gears_x11` (`mesa-utils` and `mesa-demos`). - **Dual-SIM Dual Standby (DSDS) and outgoing SIM selection**: - Updated `msm-modem-uim-selection` to provision both physical SIM slots simultaneously (`primary-gw-provisioning` and `secondary-gw-provisioning`) with QMI `NAS` Dual-Standby Preference (`DualStandbyWithTuneAway`) and network registration across both subscriptions, plus `--swap-gw` support to swap which physical slot holds `primary-gw-provisioning` (4G/LTE/3G + Mobile Data) versus `secondary-gw-provisioning` (2G GSM DSDS standby). + - Fixed SIM PIN startup prompting (`sxmo_sim_pin_prompt.sh`) so that when two SIM cards are inserted and only one requires PIN entry, only a single PIN prompt is shown (polling live `uim-get-card-status` per slot and deduplicating simultaneous `sxmo_modemmonitor.sh` / `bananarchy-x11-session.sh` invocations via `flock`). - Added an event-driven QMI `WMS` and `VOICE` QRTR listener (`dsds-daemon`, supervised by `sxmo_modemmonitor.sh`) so both SIM cards can receive incoming voice calls (with `q6voiced` `hw:0,4` audio routing) and SMS messages (single and multipart GSM-7 / UCS-2) simultaneously. - Added interactive `[1] SIM 1` / `[2] SIM 2` outgoing SIM selection prompts when two SIM cards are active across voice calls (`xcallscreen` / `sxmo_modemdial.sh`), SMS (`xsms` / `sxmo_modemsendsms.sh`), and USSD queries (`xdialer` / `msm-modem-uim-selection ussd`), plus live dual-SIM role badges (`[PRI 4G / DEFAULT]`, `[PRI 4G / DSDS]`, `[SEC 2G / DEFAULT]`, `[SEC 2G / DSDS]`), instant default SIM switching, and full Primary/Secondary GW (`4G/Data`) slot swapping in `xmodem`. - Synchronized incoming call ringtone and vibration lifecycle (`sxmo_hook_ring.sh`, `callscreen.so`, `sxmo_modem.sh`, and `dsds-daemon`) with `flock` single-instance locking, `0 dB` (`RX3 Digital Volume <= 84`) hardware volume capping, and immediate `sxmo_hook_ring.sh` / `pw-play` / `sxmo_vibrate` termination before audio teardown on remote hangup. diff --git a/MANUAL.md b/MANUAL.md index 355dec4..20e4828 100644 --- a/MANUAL.md +++ b/MANUAL.md @@ -426,3 +426,25 @@ Both the rear loudspeaker (`Speaker`, with boosted `RX3 Digital Volume` for loud ```bash mmcli -m any ``` + +### 5.5 Adreno 304 GPU hardware acceleration and OpenGL / OpenGL ES demos + +Bananarchy includes full kernel (`drm/msm` + `qcom-iommu` with `96 KB` GMEM, `a300_pfp.fw` / `a300_pm4.fw`, and up to `409.6 MHz` OPP scaling) and userspace (**Mesa Freedreno `FD304`**) hardware acceleration for the Qualcomm **Adreno 304 (`0x03000400`)** GPU across all supported MSM8905 and MSM8909 devices. + +The **Xlibre** display server (`modesetting_drv.so`) uses **Glamor + DRI3 + GLX + KMSRO** to offload X11 rendering to the Adreno 304 GPU (`/dev/dri/card1` / `/dev/dri/renderD128`) and synchronize GMEM resolves before transferring damaged rectangles over DMA to the `panel-mipi-dbi` SPI display (`/dev/dri/card0`). + +- **Query active OpenGL 3.1 / OpenGL ES 3.0 and EGL hardware renderer info**: + ```bash + DISPLAY=:0 glxinfo -B + DISPLAY=:0 eglinfo -B + ``` +- **Run 3D OpenGL and OpenGL ES hardware-accelerated demos on the `240x320` display**: + ```bash + DISPLAY=:0 glxgears -info + DISPLAY=:0 glteapot + DISPLAY=:0 es2gears_x11 + ``` +- **Inspect live Adreno 304 GPU hardware state, frequency, and ringbuffer fences**: + ```bash + doas cat /sys/kernel/debug/dri/1/gpu + ``` diff --git a/README.md b/README.md index c497421..c45e27d 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,9 @@ ## Key features ### System and hardware support -- **Mainline Linux 6.12 kernel**: custom patches and out-of-tree drivers for Qualcomm QDSP6/Q6Voice audio routing, Dual-SIM modem control, the rear 2MP GalaxyCore `GC2395` / `GC2385` / `GC2365` camera (`/dev/video0`), the `SY7807` flashlight LED (`white:torch`), physical keypad/slider events, and clean PM8909 poweroff. +- **Mainline Linux 6.12 kernel**: custom patches and out-of-tree drivers for Qualcomm **Adreno 304 (`FD304`, 96 KB GMEM)** 3D GPU acceleration (`drm/msm` + `qcom-iommu`), Qualcomm QDSP6/Q6Voice audio routing, Dual-SIM modem control, the rear 2MP GalaxyCore `GC2395` / `GC2385` / `GC2365` camera (`/dev/video0`), the `SY7807` flashlight LED (`white:torch`), physical keypad/slider events, and clean PM8909 poweroff. - **Alpine Linux Edge base**: full access to the Alpine package ecosystem with `< 95 MB` idle RAM usage on 512 MB devices and full local root access out of the box. -- **Pure X11 graphical stack**: cross-compiled **Xlibre** (`X11Libre/xserver`) display server paired with a customized **Sxmo (`sxmo-de-dwm`)** window manager (`240x320` vertical stack layout, Conky desktop clock and system status widget, `< 2 ms` slider/key wake latency, and zero Wayland overhead). +- **Pure X11 graphical stack with GPU acceleration**: cross-compiled **Xlibre** (`X11Libre/xserver`) display server offloading 2D/3D screen rendering to the **Adreno 304 GPU** via **Glamor, DRI3, GLX, and Mesa Freedreno (`FD304`, OpenGL 3.1 / OpenGL ES 3.0)** over `panel-mipi-dbi` KMSRO, paired with a customized **Sxmo (`sxmo-de-dwm`)** window manager (`240x320` vertical stack layout, Conky desktop clock and system status widget, `< 2 ms` slider/key wake latency, and zero Wayland overhead). ### Keypad-first user experience and native DWM plugins Instead of spawning slow shell scripts for everyday phone tasks, Bananarchy runs a suite of preloaded C/C++ plugins inside DWM that sleep at 0% CPU and open in `< 2 ms`: @@ -34,7 +34,7 @@ Instead of spawning slow shell scripts for everyday phone tasks, Bananarchy runs ### Input, terminal, and developer tools - **6-mode `fcitx5-t9` keypad input**: press `#` to cycle between `abc`, `Abc`, `ABC`, `Sym` (all 32 ASCII punctuation symbols), `Ctl` (`Ctrl` sequences, arrows, `PageUp`/`PageDown`, `F1`–`F12`), and `123` numeric modes with a fixed bottom candidate bar. - **First-class Linux terminal (`st`)**: patched with HarfBuzz OpenType ligatures (`Fira Code` as the default system and terminal font), XIM T9 input, and live theme reloading. -- **On-device development, scripting, and gaming**: preinstalled `gcc`/`g++`, `make`, `git`, GNU `coreutils`, GNU `bc`/`dc`, `mandoc`, `nano`, `ed`, `sqlite3`, `lua` (`5.5` and `5.4`), `yabasic` (with full `yabasic-doc` manual and HTML documentation), `perl`, `tcl`, the [Janet](https://janet-lang.org/) language and `jpm`, the [Bantam](https://bantam.luxferre.top/) coding agent, `frotz` (interactive fiction), standalone X11 keypad games (`Snake` and `Tetris`), and a full-featured Gambatte-based Game Boy / Game Boy Color emulator (`gambatte` / `gbemu`) with readjustable keypad controls (`B=8`, `Turbo B=5`, `A=9`, `Turbo A=6`, `D-pad`, `Start=2`, `Select=3`, `Palette=*`), 10 color palettes, save states, and file manager `.gb`/`.gbc` integration. +- **On-device development, scripting, 3D demos, and gaming**: preinstalled `gcc`/`g++`, `make`, `git`, GNU `coreutils`, GNU `bc`/`dc`, `mandoc`, `nano`, `ed`, `sqlite3`, `lua` (`5.5` and `5.4`), `yabasic` (with full `yabasic-doc` manual and HTML documentation), `perl`, `tcl`, the [Janet](https://janet-lang.org/) language and `jpm`, the [Bantam](https://bantam.luxferre.top/) coding agent, `frotz` (interactive fiction), OpenGL / OpenGL ES hardware diagnostics and demos (`glxinfo`, `eglinfo`, `glxgears`, `glteapot`, `es2gears_x11`), standalone X11 keypad games (`Snake` and `Tetris`), and a full-featured Gambatte-based Game Boy / Game Boy Color emulator (`gambatte` / `gbemu`) with readjustable keypad controls (`B=8`, `Turbo B=5`, `A=9`, `Turbo A=6`, `D-pad`, `Start=2`, `Select=3`, `Palette=*`), 10 color palettes, save states, and file manager `.gb`/`.gbc` integration. - **NeoUI `240x320` UI SDK (`libneoui.so` + `/usr/include/neoui.h` + `neoui.yab`) and NeoNet (`neonet.yab`)**: unified C-compatible FFI and C++20 UI SDK wrapping Xlib, Xft, Pango, `libjpeg`/`libpng`, `.Xresources` / `~/.xthemes/*.xth` live theme resolution, offscreen `Pixmap` double buffering, standardized OS shell widgets (headers, tabs, softkey bars, list/toggle/slider rows, input boxes, progress bars, scrollbars, modals, popup menus, and toasts), keypad/softkey chord handling, and multi-tap text entry—usable from C, C++, or Yabasic (`~/Projects/neoui.yab` and `~/Projects/neoui_demo.yab`), paired with **NeoNet (`~/Projects/neonet.yab` and `~/Projects/neonet_demo.yab`)** for `libcurl`-based HTTP/HTTPS requests with custom headers and TCP/TLS/UDP socket exchange in Yabasic. See [SDK.md](./SDK.md) for full documentation. --- @@ -100,7 +100,7 @@ Whenever `artwork/icon-large.png` is updated, regenerate all icons, `240x320` wa ### 2. Recompile core components (optional — prebuilts included) All components are pre-compiled in `prebuilt/` and `overlay/rootfs/`, and can be rebuilt from source at any time using rootless Docker (`alpine:3.24`): ```bash -# Rebuild cross-compiled Xlibre (X11Libre/xserver) + libinput/fbdev DDX drivers +# Rebuild cross-compiled Xlibre (X11Libre/xserver) + Glamor/GLX + libinput/fbdev DDX drivers ./scripts/build-xlibre.sh # Rebuild patched sxmo-st, sxmo-dmenu, sxmo-dwm, and all 14 C++ DWM plugins @@ -115,7 +115,7 @@ All components are pre-compiled in `prebuilt/` and `overlay/rootfs/`, and can be # Fetch latest master from https://code.luxferre.top/luxferre/bantam-cpp and cross-compile Bantam AI agent ./scripts/build-bantam.sh -# Rebuild Linux 6.12.1-msm8916 QDSP6/Q6Voice audio modules, torch LED module, camera module, and DTBs +# Rebuild Linux 6.12.1-msm8916 Adreno 304 DRM/MSM GPU module, QDSP6/Q6Voice audio modules, torch LED module, camera module, and DTBs ./scripts/build-kernel-audio.sh ``` diff --git a/devices/nokia-beatles/qcom-msm8905-nokia-beatles.dts b/devices/nokia-beatles/qcom-msm8905-nokia-beatles.dts index 8b55b05..302aaa8 100644 --- a/devices/nokia-beatles/qcom-msm8905-nokia-beatles.dts +++ b/devices/nokia-beatles/qcom-msm8905-nokia-beatles.dts @@ -1037,6 +1037,60 @@ phandle = <0x15>; }; + gpu: gpu@1c00000 { + compatible = "qcom,adreno-304.0", "qcom,adreno"; + reg = <0x01c00000 0x20000>; + reg-names = "kgsl_3d0_reg_memory"; + interrupts = <0x00 33 0x04>; + interrupt-names = "kgsl_3d0_irq"; + clock-names = "core", "iface", "mem_iface", "alt_mem_iface", "gtcu_iface", "gfx3d"; + clocks = <0x14 124>, <0x14 123>, <0x14 72>, <0x14 73>, <0x14 66>, <0x14 35>; + power-domains = <0x14 1>; + operating-points-v2 = <&gpu_opp_table>; + iommus = <&gpu_iommu 1>, <&gpu_iommu 2>; + #cooling-cells = <2>; + + gpu_opp_table: opp-table { + compatible = "operating-points-v2"; + + opp-409600000 { + opp-hz = /bits/ 64 <409600000>; + }; + opp-307200000 { + opp-hz = /bits/ 64 <307200000>; + }; + opp-200000000 { + opp-hz = /bits/ 64 <200000000>; + }; + opp-19200000 { + opp-hz = /bits/ 64 <19200000>; + }; + }; + }; + + gpu_iommu: iommu@1f08000 { + #address-cells = <1>; + #size-cells = <1>; + #iommu-cells = <1>; + compatible = "qcom,msm8909-iommu", "qcom,msm8916-iommu", "qcom,msm-iommu-v1"; + ranges = <0 0x01f08000 0x10000>; + clocks = <0x14 69>, <0x14 65>, <0x14 64>; + clock-names = "iface", "bus", "tbu"; + qcom,iommu-secure-id = <18>; + + iommu-ctx@1000 { + compatible = "qcom,msm-iommu-v1-ns"; + reg = <0x1000 0x1000>; + interrupts = <0x00 241 0x04>; + }; + + iommu-ctx@2000 { + compatible = "qcom,msm-iommu-v1-ns"; + reg = <0x2000 0x1000>; + interrupts = <0x00 242 0x04>; + }; + }; + spmi@200f000 { compatible = "qcom,spmi-pmic-arb"; reg = <0x200f000 0x1000 0x2400000 0x400000 0x2c00000 0x400000 0x3800000 0x200000 0x200a000 0x2100>; diff --git a/devices/nokia-tough/qcom-msm8905-nokia-coconut.dts b/devices/nokia-tough/qcom-msm8905-nokia-coconut.dts index bdc02dd..112406b 100644 --- a/devices/nokia-tough/qcom-msm8905-nokia-coconut.dts +++ b/devices/nokia-tough/qcom-msm8905-nokia-coconut.dts @@ -1037,6 +1037,60 @@ phandle = <0x15>; }; + gpu: gpu@1c00000 { + compatible = "qcom,adreno-304.0", "qcom,adreno"; + reg = <0x01c00000 0x20000>; + reg-names = "kgsl_3d0_reg_memory"; + interrupts = <0x00 33 0x04>; + interrupt-names = "kgsl_3d0_irq"; + clock-names = "core", "iface", "mem_iface", "alt_mem_iface", "gtcu_iface", "gfx3d"; + clocks = <0x14 124>, <0x14 123>, <0x14 72>, <0x14 73>, <0x14 66>, <0x14 35>; + power-domains = <0x14 1>; + operating-points-v2 = <&gpu_opp_table>; + iommus = <&gpu_iommu 1>, <&gpu_iommu 2>; + #cooling-cells = <2>; + + gpu_opp_table: opp-table { + compatible = "operating-points-v2"; + + opp-409600000 { + opp-hz = /bits/ 64 <409600000>; + }; + opp-307200000 { + opp-hz = /bits/ 64 <307200000>; + }; + opp-200000000 { + opp-hz = /bits/ 64 <200000000>; + }; + opp-19200000 { + opp-hz = /bits/ 64 <19200000>; + }; + }; + }; + + gpu_iommu: iommu@1f08000 { + #address-cells = <1>; + #size-cells = <1>; + #iommu-cells = <1>; + compatible = "qcom,msm8909-iommu", "qcom,msm8916-iommu", "qcom,msm-iommu-v1"; + ranges = <0 0x01f08000 0x10000>; + clocks = <0x14 69>, <0x14 65>, <0x14 64>; + clock-names = "iface", "bus", "tbu"; + qcom,iommu-secure-id = <18>; + + iommu-ctx@1000 { + compatible = "qcom,msm-iommu-v1-ns"; + reg = <0x1000 0x1000>; + interrupts = <0x00 241 0x04>; + }; + + iommu-ctx@2000 { + compatible = "qcom,msm-iommu-v1-ns"; + reg = <0x2000 0x1000>; + interrupts = <0x00 242 0x04>; + }; + }; + spmi@200f000 { compatible = "qcom,spmi-pmic-arb"; reg = <0x200f000 0x1000 0x2400000 0x400000 0x2c00000 0x400000 0x3800000 0x200000 0x200a000 0x2100>; diff --git a/overlay/rootfs/etc/X11/xorg.conf.d/10-bananarchy-msm8909.conf b/overlay/rootfs/etc/X11/xorg.conf.d/10-bananarchy-msm8909.conf index 8e64cd8..8b7194d 100644 --- a/overlay/rootfs/etc/X11/xorg.conf.d/10-bananarchy-msm8909.conf +++ b/overlay/rootfs/etc/X11/xorg.conf.d/10-bananarchy-msm8909.conf @@ -18,8 +18,7 @@ Section "Device" Identifier "MSM8909 SPI Panel" Driver "modesetting" Option "kmsdev" "/dev/dri/card0" - Option "AccelMethod" "none" - Option "ShadowFB" "true" + Option "AccelMethod" "glamor" Option "SWCursor" "true" Option "PageFlip" "false" EndSection diff --git a/overlay/rootfs/etc/modules b/overlay/rootfs/etc/modules index e77b575..570ccbd 100644 --- a/overlay/rootfs/etc/modules +++ b/overlay/rootfs/etc/modules @@ -1,6 +1,7 @@ af_packet ipv6 panel_mipi_dbi +msm leds_msm8905_torch msm8905-cam rpmsg_wwan_ctrl diff --git a/overlay/rootfs/lib/firmware/qcom/a300_pfp.fw b/overlay/rootfs/lib/firmware/qcom/a300_pfp.fw new file mode 100644 index 0000000..5522677 Binary files /dev/null and b/overlay/rootfs/lib/firmware/qcom/a300_pfp.fw differ diff --git a/overlay/rootfs/lib/firmware/qcom/a300_pm4.fw b/overlay/rootfs/lib/firmware/qcom/a300_pm4.fw new file mode 100644 index 0000000..840e5a9 Binary files /dev/null and b/overlay/rootfs/lib/firmware/qcom/a300_pm4.fw differ diff --git a/overlay/rootfs/usr/bin/Xorg b/overlay/rootfs/usr/bin/Xorg index 10f585b..15eae03 100755 Binary files a/overlay/rootfs/usr/bin/Xorg and b/overlay/rootfs/usr/bin/Xorg differ diff --git a/overlay/rootfs/usr/bin/glteapot b/overlay/rootfs/usr/bin/glteapot new file mode 120000 index 0000000..8f86d69 --- /dev/null +++ b/overlay/rootfs/usr/bin/glteapot @@ -0,0 +1 @@ +teapot \ No newline at end of file diff --git a/overlay/rootfs/usr/lib/xorg/modules/xlibre-25/drivers/fbdev_drv.so b/overlay/rootfs/usr/lib/xorg/modules/xlibre-25/drivers/fbdev_drv.so index f01954b..2cbb18e 100755 Binary files a/overlay/rootfs/usr/lib/xorg/modules/xlibre-25/drivers/fbdev_drv.so and b/overlay/rootfs/usr/lib/xorg/modules/xlibre-25/drivers/fbdev_drv.so differ diff --git a/overlay/rootfs/usr/lib/xorg/modules/xlibre-25/drivers/modesetting_drv.so b/overlay/rootfs/usr/lib/xorg/modules/xlibre-25/drivers/modesetting_drv.so index bf5c65a..54c771d 100755 Binary files a/overlay/rootfs/usr/lib/xorg/modules/xlibre-25/drivers/modesetting_drv.so and b/overlay/rootfs/usr/lib/xorg/modules/xlibre-25/drivers/modesetting_drv.so differ diff --git a/overlay/rootfs/usr/lib/xorg/modules/xlibre-25/extensions/libglx.so b/overlay/rootfs/usr/lib/xorg/modules/xlibre-25/extensions/libglx.so new file mode 100755 index 0000000..ef83f51 Binary files /dev/null and b/overlay/rootfs/usr/lib/xorg/modules/xlibre-25/extensions/libglx.so differ diff --git a/overlay/rootfs/usr/lib/xorg/modules/xlibre-25/libglamoregl.so b/overlay/rootfs/usr/lib/xorg/modules/xlibre-25/libglamoregl.so new file mode 100755 index 0000000..d4e7974 Binary files /dev/null and b/overlay/rootfs/usr/lib/xorg/modules/xlibre-25/libglamoregl.so differ diff --git a/patches/kernel/0003-msm8909-adreno-304-gpu-support.patch b/patches/kernel/0003-msm8909-adreno-304-gpu-support.patch new file mode 100644 index 0000000..d142ebe --- /dev/null +++ b/patches/kernel/0003-msm8909-adreno-304-gpu-support.patch @@ -0,0 +1,307 @@ +--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.h ++++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.h +@@ -308,6 +308,11 @@ + return adreno_is_revn(gpu, 225); + } + ++static inline bool adreno_is_a304(const struct adreno_gpu *gpu) ++{ ++ return adreno_is_revn(gpu, 304); ++} ++ + static inline bool adreno_is_a305(const struct adreno_gpu *gpu) + { + return adreno_is_revn(gpu, 305); +--- a/drivers/gpu/drm/msm/adreno/a3xx_catalog.c ++++ b/drivers/gpu/drm/msm/adreno/a3xx_catalog.c +@@ -10,6 +10,17 @@ + + static const struct adreno_info a3xx_gpus[] = { + { ++ .chip_ids = ADRENO_CHIP_IDS(0x03000400), ++ .family = ADRENO_3XX, ++ .revn = 304, ++ .fw = { ++ [ADRENO_FW_PM4] = "a300_pm4.fw", ++ [ADRENO_FW_PFP] = "a300_pfp.fw", ++ }, ++ .gmem = (SZ_64K + SZ_32K), ++ .inactive_period = DRM_MSM_INACTIVE_PERIOD, ++ .init = a3xx_gpu_init, ++ }, { + .chip_ids = ADRENO_CHIP_IDS(0x03000512), + .family = ADRENO_3XX, + .fw = { +--- a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c ++++ b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c +@@ -118,7 +118,9 @@ + + DBG("%s", gpu->name); + +- if (adreno_is_a305(adreno_gpu)) { ++ if (adreno_is_a304(adreno_gpu)) { ++ gpu_write(gpu, REG_A3XX_VBIF_ROUND_ROBIN_QOS_ARB, 0x0003); ++ } else if (adreno_is_a305(adreno_gpu)) { + /* Set up 16 deep read/write request queues: */ + gpu_write(gpu, REG_A3XX_VBIF_IN_RD_LIM_CONF0, 0x10101010); + gpu_write(gpu, REG_A3XX_VBIF_IN_RD_LIM_CONF1, 0x10101010); +@@ -241,7 +243,8 @@ + gpu_write(gpu, REG_A3XX_UCHE_CACHE_MODE_CONTROL_REG, 0x00000001); + + /* Enable Clock gating: */ +- if (adreno_is_a305b(adreno_gpu) || ++ if (adreno_is_a304(adreno_gpu) || ++ adreno_is_a305b(adreno_gpu) || + adreno_is_a306(adreno_gpu) || + adreno_is_a306a(adreno_gpu)) + gpu_write(gpu, REG_A3XX_RBBM_CLOCK_CTL, 0xaaaaaaaa); +@@ -340,7 +343,8 @@ + gpu_write(gpu, REG_A3XX_CP_PFP_UCODE_DATA, ptr[i]); + + /* CP ROQ queue sizes (bytes) - RB:16, ST:16, IB1:32, IB2:64 */ +- if (adreno_is_a305(adreno_gpu) || ++ if (adreno_is_a304(adreno_gpu) || ++ adreno_is_a305(adreno_gpu) || + adreno_is_a306(adreno_gpu) || + adreno_is_a306a(adreno_gpu) || + adreno_is_a320(adreno_gpu)) { +@@ -365,6 +369,7 @@ + + static void a3xx_recover(struct msm_gpu *gpu) + { ++ struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); + int i; + + adreno_dump_info(gpu); +@@ -378,9 +383,15 @@ + if (hang_debug) + a3xx_dump(gpu); + +- gpu_write(gpu, REG_A3XX_RBBM_SW_RESET_CMD, 1); +- gpu_read(gpu, REG_A3XX_RBBM_SW_RESET_CMD); +- gpu_write(gpu, REG_A3XX_RBBM_SW_RESET_CMD, 0); ++ /* Do not do soft reset for A304 because it cannot do SMMU programming ++ * of any kind after a soft reset; rely on hard power-domain reset in ++ * adreno_recover(). ++ */ ++ if (!adreno_is_a304(adreno_gpu)) { ++ gpu_write(gpu, REG_A3XX_RBBM_SW_RESET_CMD, 1); ++ gpu_read(gpu, REG_A3XX_RBBM_SW_RESET_CMD); ++ gpu_write(gpu, REG_A3XX_RBBM_SW_RESET_CMD, 0); ++ } + adreno_recover(gpu); + } + +--- a/drivers/gpu/drm/msm/adreno/adreno_device.c ++++ b/drivers/gpu/drm/msm/adreno/adreno_device.c +@@ -237,10 +237,12 @@ + .unbind = adreno_unbind, + }; + ++static struct platform_device *msm_headless_pdev; ++ + static void adreno_device_register_headless(void) + { +- /* on imx5, we don't have a top-level mdp/dpu node +- * this creates a dummy node for the driver for that case ++ /* on imx5 and headless SPI-panel devices, we don't have a top-level ++ * mdp/dpu node; this creates a dummy node for the driver for that case + */ + struct platform_device_info dummy_info = { + .parent = NULL, +@@ -252,7 +254,34 @@ + .size_data = 0, + .dma_mask = ~0, + }; +- platform_device_register_full(&dummy_info); ++ if (!msm_headless_pdev) { ++ struct platform_device *pdev = platform_device_register_full(&dummy_info); ++ if (!IS_ERR(pdev)) ++ msm_headless_pdev = pdev; ++ } ++} ++ ++static bool adreno_has_display_node(void) ++{ ++ static const char * const compat[] = { ++ "qcom,mdss", ++ "qcom,mdp4", ++ "qcom,mdp5", ++ "qcom,dpu1", ++ }; ++ struct device_node *np; ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(compat); i++) { ++ np = of_find_compatible_node(NULL, NULL, compat[i]); ++ if (np) { ++ bool avail = of_device_is_available(np); ++ of_node_put(np); ++ if (avail) ++ return true; ++ } ++ } ++ return false; + } + + static int adreno_probe(struct platform_device *pdev) +@@ -264,7 +293,8 @@ + if (ret) + return ret; + +- if (of_device_is_compatible(pdev->dev.of_node, "amd,imageon")) ++ if (of_device_is_compatible(pdev->dev.of_node, "amd,imageon") || ++ !adreno_has_display_node()) + adreno_device_register_headless(); + + return 0; +@@ -272,6 +302,10 @@ + + static void adreno_remove(struct platform_device *pdev) + { ++ if (msm_headless_pdev) { ++ platform_device_unregister(msm_headless_pdev); ++ msm_headless_pdev = NULL; ++ } + component_del(&pdev->dev, &a3xx_ops); + } + +--- a/drivers/gpu/drm/msm/msm_drv.c ++++ b/drivers/gpu/drm/msm/msm_drv.c +@@ -115,11 +115,27 @@ + /* + * a2xx comes with its own MMU + * On other platforms IOMMU can be declared specified either for the +- * MDP/DPU device or for its parent, MDSS device. ++ * MDP/DPU device, its parent MDSS device, or the GPU device (headless). + */ +- return priv->is_a2xx || +- device_iommu_mapped(dev->dev) || +- device_iommu_mapped(dev->dev->parent); ++ if (priv->is_a2xx || ++ device_iommu_mapped(dev->dev) || ++ device_iommu_mapped(dev->dev->parent) || ++ (priv->gpu_pdev && device_iommu_mapped(&priv->gpu_pdev->dev))) ++ return true; ++ ++ if (!dev->dev->of_node) { ++ struct device_node *np = of_find_compatible_node(NULL, NULL, "qcom,adreno"); ++ if (!np) ++ np = of_find_compatible_node(NULL, NULL, "qcom,kgsl-3d0"); ++ if (np) { ++ bool has_iommu = of_property_present(np, "iommus"); ++ of_node_put(np); ++ if (has_iommu) ++ return true; ++ } ++ } ++ ++ return false; + } + + static int msm_init_vram(struct drm_device *dev) +--- a/arch/arm/boot/dts/qcom/qcom-msm8909.dtsi ++++ b/arch/arm/boot/dts/qcom/qcom-msm8909.dtsi +@@ -830,6 +830,76 @@ + reg = <0x01937000 0x30000>; + }; + ++ gpu: gpu@1c00000 { ++ compatible = "qcom,adreno-304.0", "qcom,adreno"; ++ reg = <0x01c00000 0x20000>; ++ reg-names = "kgsl_3d0_reg_memory"; ++ interrupts = ; ++ interrupt-names = "kgsl_3d0_irq"; ++ clock-names = ++ "core", ++ "iface", ++ "mem_iface", ++ "alt_mem_iface", ++ "gtcu_iface", ++ "gfx3d"; ++ clocks = ++ <&gcc GCC_OXILI_GFX3D_CLK>, ++ <&gcc GCC_OXILI_AHB_CLK>, ++ <&gcc GCC_BIMC_GFX_CLK>, ++ <&gcc GCC_BIMC_GPU_CLK>, ++ <&gcc GCC_GTCU_AHB_CLK>, ++ <&gcc GFX3D_CLK_SRC>; ++ power-domains = <&gcc OXILI_GDSC>; ++ operating-points-v2 = <&gpu_opp_table>; ++ iommus = <&gpu_iommu 1>, <&gpu_iommu 2>; ++ #cooling-cells = <2>; ++ ++ gpu_opp_table: opp-table { ++ compatible = "operating-points-v2"; ++ ++ opp-409600000 { ++ opp-hz = /bits/ 64 <409600000>; ++ }; ++ opp-307200000 { ++ opp-hz = /bits/ 64 <307200000>; ++ }; ++ opp-200000000 { ++ opp-hz = /bits/ 64 <200000000>; ++ }; ++ opp-19200000 { ++ opp-hz = /bits/ 64 <19200000>; ++ }; ++ }; ++ }; ++ ++ gpu_iommu: iommu@1f08000 { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ #iommu-cells = <1>; ++ compatible = "qcom,msm8909-iommu", "qcom,msm8916-iommu", "qcom,msm-iommu-v1"; ++ ranges = <0 0x01f08000 0x10000>; ++ clocks = <&gcc GCC_SMMU_CFG_CLK>, ++ <&gcc GCC_GFX_TCU_CLK>, ++ <&gcc GCC_GFX_TBU_CLK>; ++ clock-names = "iface", "bus", "tbu"; ++ qcom,iommu-secure-id = <18>; ++ ++ /* GFX3D_USER */ ++ iommu-ctx@1000 { ++ compatible = "qcom,msm-iommu-v1-ns"; ++ reg = <0x1000 0x1000>; ++ interrupts = ; ++ }; ++ ++ /* GFX3D_PRIV */ ++ iommu-ctx@2000 { ++ compatible = "qcom,msm-iommu-v1-ns"; ++ reg = <0x2000 0x1000>; ++ interrupts = ; ++ }; ++ }; ++ + spmi_bus: spmi@200f000 { + compatible = "qcom,spmi-pmic-arb"; + reg = <0x0200f000 0x001000>, +@@ -1524,11 +1594,23 @@ + + thermal-sensors = <&tsens 2>; + ++ cooling-maps { ++ map0 { ++ trip = <&gpu_alert0>; ++ cooling-device = <&gpu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ }; ++ }; ++ + trips { + gpu_alert0: trip-point0 { +- temperature = <90000>; ++ temperature = <75000>; ++ hysteresis = <2000>; ++ type = "passive"; ++ }; ++ gpu_crit: gpu-crit { ++ temperature = <95000>; + hysteresis = <2000>; +- type = "hot"; ++ type = "critical"; + }; + }; + }; diff --git a/patches/xlibre/0001-xlibre-msm8905-spi-drm-and-shared-vt.patch b/patches/xlibre/0001-xlibre-msm8905-spi-drm-and-shared-vt.patch index d8a2027..f753810 100644 --- a/patches/xlibre/0001-xlibre-msm8905-spi-drm-and-shared-vt.patch +++ b/patches/xlibre/0001-xlibre-msm8905-spi-drm-and-shared-vt.patch @@ -1,3 +1,693 @@ +diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md +deleted file mode 100644 +index f1b1cb3..0000000 +--- a/CODE_OF_CONDUCT.md ++++ /dev/null +@@ -1 +0,0 @@ +-404 +diff --git a/CODE_OVERVIEW.md b/CODE_OVERVIEW.md +deleted file mode 100644 +index 6229dee..0000000 +--- a/CODE_OVERVIEW.md ++++ /dev/null +@@ -1,314 +0,0 @@ +-# Overview of XLibre Server Source Code Structure +- +-The XLibre Server is a modular codebase that implements a X Window System (X11) +-server. It's written in C, and supports a wide variety of platforms, hardware +-configurations, and extensions. +- +-The codebase is organized into: +- - OS abstractions, +- - core components (device-independent and machine-independent code), +- - extensions, +- - hardware drivers and servers (device-dependant code), and +- - supporting utilities. +- +-The Meson build system orchestrates compilation, handling dependencies, +-conditional builds, and configuration options. +- +-## Key Principles of the Codebase +- +-**Modularity**: Code is split into libraries (e.g., `libxserver_*`) that are +-linked into different server binaries (`Xorg`, `Xnest`, `Xquartz`, etc.). +- +-**Platform Independence**: Device Independent X (DIX) and Machine Independent +-(MI) layers abstract hardware and OS differences. +- +-**Extensions**: Many features (e.g., `RandR`, `Composite`) are implemented as +-loadable extensions. These can depend on one another, and many rely on +-`Render` (render/) for drawing. +- +-**Build Flexibility**: Meson options allow enabling/disabling features, servers, +-and extensions, with auto-detection for many. +- +-## Diagram of XLibre +- +-Below is a visual overview of how the components of the XLibre Server fit +-together. This diagram should be read from the bottom up to understand how each +-layer builds on those below. +- +-``` +- +==========================================================+ +- | DDX (Hardware and Servers) | +- +==========================================================+ +- | Xorg (hw/xfree86/: modes, drivers, int10) | +- +----------------------------+-----------------------------+ +- | Xnest (hw/xnest/: nested) | Xvfb (hw/vfb/: virtual) | +- +------------------------------+---------------------------+ +- | Xquartz (hw/xquartz/: macOS) | XWin (hw/xwin/: Windows) | +- +----------------------------------------------------------+ +- | +- | +- +=================================================================+ +- | Extensions & Acceleration | +- +=================================================================+ +- | Others: XFixes, Record, DBE, Sync (miext/sync), DRI3, etc. | +- | Xnamespace (Xext/namespace/: isolation) | +- +-----------------------+------------------+----------------------+ +- | XInput (Xi/: devices) | XKB (xkb/: keys) | GLX (glx/: OpenGL) | +- +-----------------------+----------------+-+----------------------+ +- | Glamor (glamor/: OpenGL 2D accel.) | EXA (exa/: 2D accel.) | +- +--------------+------------+------------+------------------------+ +- | Composite | Damage | Present | RandR | Xinerama | +- | (effects) | (tracking) | (vsync) | (resize) | (monitors) | +- +--------------+------------+------------+------------------------+ +- | Render (render/: 2D primitives, glyphs, etc.) | +- | --> Core rendering, used by Composite, Glamor, etc. | +- +-----------------------------------------------------------------+ +- | +- | +- +=================================================================+ +- | DIX (Core Layers) | +- +=================================================================+ +- | DIX (dix/: dispatch, events, windows, resources) | +- | --> Central hub for requests; extensions register here. | +- +-----------------------------------------------------------------+ +- | MI (mi/: generic draw, GC, sprites) | FB (fb/: framebuffer) | +- +---------------------------------------+-------------------------+ +- | +- | +- +==========================================================+ +- | OS Abstraction Layer | +- +==========================================================+ +- | OS (os/: sockets, I/O, auth, etc.) | +- | --> Provides poll, log, connection, etc. for all above. | +- +----------------------------------------------------------+ +- +- +=======================================================================+ +- | External Deps (Protocols/Libs: xproto, pixman, libdrm, etc.) | +- +=======================================================================+ +- | Protocols (xorgproto) | Rendering (pixman, etc.) | OS (libudev, etc.) | +- +-----------------------------------------------------------------------+ +-``` +- +-The flow of a typical request is: +- +- 1. Client request arrives (via OS layer) +- 2. DIX dispatches request (Core op? Handle in DIX. No? Check extensions.) +- 3. DIX/MI/FB/Extension handles request (including input, rendering, etc.) +- 4. Output via DDX (hardware or simulated) +- +-## Top-Level Directory Layout +- +-The source tree is organized by functional areas. Below is an *introductory* +-summary of each directory; this is a starting point, not a comprehensive +-explanation. +- +-### Core +- +-- **config/**: Server configuration handling +- Manages server configuration parsing and hotplugging, including input +- devices, monitors, and modules via files like `config.c` and `udev.c`. It +- interconnects with the input extensions (e.g., Xi/ for device detection) +- and OS layer (os/ for platform-specific I/O), relying on optional +- dependencies like libudev for dynamic device handling on Linux. +- +-- **dix/**: Device Independent X (DIX) - Core server logic +- Orchestrates protocol dispatching, event handling, resource management, +- and window operations through files like `dispatch.c` and `main.c`. It +- serves as the central hub, interconnecting with all extensions (which +- register here via `extension.c`) and the MI layer (mi/ for generic +- implementations). Depends on protocols from xorgproto for request routing. +- Key components include: Request handlers, property system, colormap +- management, etc. +- +-- **hw/**: Device Dependant X (DDX) - Hardware-specific code and servers +- Hardware-dependent drivers and server variants, including subdirectories +- like `xfree86/` (the main XLibre DDX), `kdrive/` (includes Xephyr), +- `vfb/`, `xnest/`, `xquartz/` (macOS), and `xwin/` (Windows). These link +- the various XLibre libraries/components (libxserver_*) into executables. +- +- NOTE: Drivers (e.g., modesetting, intel, amd) are currently in separate +- repositories and are loaded as modules. There is an ongoing discussion +- about moving these into the core source tree in the future. +- +-- **include/**: Global headers and configuration +- Global headers and generated configs (like `dix-config.h`), defining core +- structures (e.g., `dixstruct.h`) and macros (e.g., `misc.h`) used across +- the codebase. This directory interconnects with nearly every component as +- an inclusion base, supporting platform independence by abstracting types +- and configs for DIX, MI, and extensions. +- +-- **fb/**: Framebuffer abstraction +- A software framebuffer abstraction that implements generic rendering +- primitives (e.g., `fbpict.c` for pictures) as a fallback when hardware +- acceleration is unavailable. It interconnects closely with the MI layer +- (mi/ for drawing ops) and Render extension (render/ for accelerated +- paths). Depends on pixman for pixel manipulation. +- +-- **mi/**: Machine Independent (MI) - Generic implementations +- The Machine Independent layer offers generic, non-hardware-specific +- implementations for drawing, window management, and graphics contexts +- via files like `miwindow.c` and `migc.c`. It acts as a fallback interconnect +- between DIX (for protocol handling) and FB (for rendering), extended via +- miext/ for specialized MI features like damage tracking. +- +-- **os/**: OS abstraction layer +- The OS abstraction layer manages platform-agnostic I/O, sockets, signals, +- timers, and authentication (e.g., `connection.c` and `xdmcp.c` if enabled). +- It interconnects as the foundational bridge for all upper layers, supporting +- DIX events and extensions via polling (`ospoll.c`). Optionally depends on +- SHA1 providers for authentication and dbus for systemd integration. +- +-### Rendering Acceleration +- +-- **exa/**: EXA acceleration +- EXA provides an older framework for 2D hardware acceleration, handling +- operations like rendering and glyphs through e.g., `exa_render.c`. It +- provides a fallback to Glamor. It interconnects with the Render extension +- for primitives. Primarily used in XLibre or Xephyr builds. Depends on +- pixman. +- +-- **glamor/**: Glamor acceleration +- Enables OpenGL-based 2D acceleration as a modern replacement for EXA, with +- core logic in `glamor_render.c` for efficient drawing and XV support. It +- interconnects with the Render extension for primitives and GLX for OpenGL. +- Depends on epoxy and gbm for hardware access. +- +-### Extensions +- +-- **Xext/composite/**: Composite extension +- Supports window redirection and compositing effects (e.g., transparency) +- via files like `compwindow.c`. It interconnects with Render (for drawing) +- and Damage (for efficiency). +- +-- **damageext/**: Damage extension +- Tracks damaged screen regions for optimized redraws, implemented in +- `damageext.c`. It interconnects with miext/damage/ for MI-level tracking +- and Composite for effects. Depends on damageproto. +- +-- **dbe/**: Double Buffer Extension (DBE) +- Provides double-buffering to minimize flicker in drawing operations, with +- `midbe.c` offering MI support. It interconnects as a simple extension to DIX +- for protocol handling, and optionally integrats with Render for buffered +- primitives. +- +-- **dri3/**: Direct Rendering Infrastructure 3 (DRI3) extension +- Facilitates modern buffer sharing for direct rendering, handled in e.g., +- `dri3_request.c`. It interconnects with GLX for OpenGL and hw/xfree86/dri/ +- for hardware. Depends on libdrm and xshmfence. +- +-- **glx/**: OpenGL Extension to X (GLX) +- Extends X for OpenGL applications, dispatching commands via `glxcmds.c`. +- It interconnects with Glamor/DRI for acceleration and Render for 2D ops. +- +-- **miext/**: MI Extensions +- Contains Machine Independent extensions for specialized features like: +- - `damage` (MI damage tracking) +- - `rootless` (rootless windowing for Xquartz) +- - `shadow` (shadow framebuffer) +- - `sync` (fence synchronization) +- Interconnects as helpers for core MI (mi/) and extensions like Damage or +- Rootless (for Xquartz) +- +-- **present/**: Present extension +- Manages vsync and buffer flipping for smooth graphics, via e.g., +- `present_vblank.c`. It interconnects with DRI for hardware sync and RandR +- for screen ops. A modern alternative to Xv. Depends on presentproto. +- +-- **pseudoramiX/**: PseudoramiX +- Emulates/Provides multi-monitor support for specific servers, implemented in +- `pseudoramiX.c`. It interconnects with Xwin or Xquartz servers for platform +- multi-head setups, integrating with RandR for compatibility in non-native +- environments. +- +-- **randr/**: Resize and Rotate (RandR) extension +- RandR handles dynamic screen resizing, rotation, and multi-monitor configs +- via files like `rrtransform.c` and `rrcrtc.c`. It interconnects with +- hw/xfree86/modes/ for hardware modesetting and Render for drawing. Depends +- on randrproto. +- +-- **record/**: Record extension +- Captures protocol streams for testing or debugging, via `record.c`. It +- interconnects with DIX for request interception. Depends on recordproto. +- +-- **render/**: Render extension +- Accelerates 2D operations like glyphs and gradients via files like +- `render.c` and `picture.c`. As a central extension, it interconnects with +- Composite/Damage for effects, Glamor/EXA for acceleration, and FB for +- fallback. Depends on pixman. +- +-- **Xext/**: Core X extensions +- Bundles core extensions like SHM (`shm.c`), Sync (`sync.c`), BigRequests +- (`bigreq.c`), VidMode (`vidmode.c`), Xinerama (`panoramiX.c`), and others. +- It interconnects broadly with DIX for base protocol enhancements and miext/ +- for MI support. In XLibre, namespace/ adds client isolation/containers. +- +-- **xfixes/**: X Fixes extension +- Protocol fixes and enhancements, like cursor confinement via `cursor.c`. +- It interconnects with XInput for input tweaks and Render for drawing. +- Depends on fixesproto. +- +-- **Xi/**: X Input extension +- Manages advanced input devices, touch, and gestures, e.g. through +- `xiquerydevice.c`. It interconnects with config/ for hotplugging and +- XKB for keyboard integration. +- +-- **xkb/**: X Keyboard (XKB) extension +- Oversees keyboard layouts, mappings, and actions, e.g. in `xkbActions.c` +- and `xkbEvents.c`. It interconnects with Xi/ for input devices and config/ +- for rules loading. Depends on kbproto. +- +-### Documentation and Tests +- +-- **doc/**: Documentation +-- **man/**: Manual pages for the server and tools +-- **test/**: Unit/integration tests +- +-### Other Files +- +-- **meson.build** and **meson_options.txt** provide build process and +- configuration. +- +-- **include/dix-config.h** is generated as part of the build process. +- +-## Key Information for Working on the Code +- +-- **Entry Point**: Server starts in `dix/main.c` (Dispatch loop). +- Extensions load via `dix/extension.c`. +- +-- **Important Headers**: `include/dix-config.h` (config macros), +- `dix/dispatch.h` (request handlers), `os/osdep.h` (OS funcs). +- +-- **X11 Protocol**: Read the `xorgproto` docs. Core is in DIX, +- extensions add opcodes. +- +-- **Resources**: Read `doc/` output. Read Xorg docs at +- (freedesktop.org/wiki/Xorg)[freedesktop.org/wiki/Xorg]. Check GitHub issues +- and discussions. +- +-- **Modules**: Drivers and extensions load dynamically from +- `module_dir` (default: lib/xorg/modules). +- +-- **Debugging**: Use `-verbose` and `-logverbose` server flags for detailed +- output and logging. Enable libunwind for better backtraces. Enable +- AddressSanitizer in your build. Use tools like gdb, valgrind, perf, etc. +- +- Use Xephyr for isolated testing in a nested X11 window. +- +- For debugging on real hardware, you need functional input devices +- (keyboard/mouse) to interact with the server or switch back to a text console +- (VT). Input is provided by separate driver modules (e.g., by +- [xf86-input-libinput](https://github.com/X11Libre/xf86-input-libinput) for +- modern devices via libinput), which need to be "installed" with your +- development build. +- +- For example, for `xf86-input-libinput` place `libinput_drv.so` in +- `your_prefix/lib64/xorg/modules/xlibre-25/input` (you can copy this from your +- main XLibre `usr/lib/` directory as long as it is ABI-compatible) and place +- `80-libinput.conf` in `your_prefix/share/X11/xorg.conf.d/`. +- +- For gdb debugging, it is highly recommended to use SSH from another machine or +- a serial terminal to avoid input lockup during breakpoints, which prevents +- local VT switching and could freeze your session. +- +-- **Contributing and Community Interaction**: See the `CONTRIBUTING.md` and +- `README.md` files for additional information. +diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md +deleted file mode 100644 +index 896faae..0000000 +--- a/CONTRIBUTING.md ++++ /dev/null +@@ -1,18 +0,0 @@ +-# Contribution Guidelines +- +-1. All commits need a sign-off by the author (except for drafts) +- If additional reviewers gave their ack, a proper attribution +- header may be added. +- +-2. Commit messages should explain what's really done here, and their +- headlines need a short and precise subject. See history for examples. +- +- Keep in mind that history is also a piece of documentation. +- +-3. Once a release is out, bugfixes should be submitted separately, against +- the affected release branch(es) as well as master (so multiple pull requests) +- +-4. If new functions or types are introduced, these should be documented +- in-code, so we can generate docs directly from the code :) +- +-5. Use pull request tags if you can - if we need some more, just ask. +diff --git a/CoC.md b/CoC.md +deleted file mode 100644 +index a85de19..0000000 +--- a/CoC.md ++++ /dev/null +@@ -1 +0,0 @@ +--ENOENT +diff --git a/HISTORY.md b/HISTORY.md +deleted file mode 100644 +index 04d70f4..0000000 +--- a/HISTORY.md ++++ /dev/null +@@ -1,229 +0,0 @@ +-# History of the XLibre fork +- +-This file contains a brief historical overview of the events surrounding the fork of Xorg into XLibre. It includes copies of the original unmodified documents, including references to their sources, so that readers can form their own opinions. +- +-The only two changes made were to reduce the original heading levels to improve readability and, where necessary, to add headings and short introductions to provide factual and chronological context. Spelling errors have been retained. +- +- +-## Message of metux sent to the X.org mailing list +- +-This is the e-mail sent from Enrico Weigelt alias metux to the X.org mailing list hosted at freedesktop.org on June 6, 2025. +- +---- +- +-### History repeats: Redhat censored me on freedesktop.org - Xlibre fork release coming in few days +- +-**Enrico Weigelt, metux IT consult** [info at metux.net](mailto:xorg-devel%40lists.x.org?Subject=Re%3A%20History%20repeats%3A%20Redhat%20censored%20me%20on%20freedesktop.org%20-%20Xlibre%20fork%0A%20release%20coming%20in%20few%20days&In-Reply-To=%3C1a9d25cc-6f02-4fe3-a206-3388c07ab81f%40metux.net%3E "History repeats: Redhat censored me on freedesktop.org - Xlibre fork release coming in few days") +-_Fri Jun 6 13:50:32 UTC 2025_ +- +-- Next message (by thread): [Reminder: Registration & Call for Proposals open for XDC 2025](https://lists.x.org/archives/xorg-devel/2025-June/059397.html) +-- **Messages sorted by:** [\[ date \]](https://lists.x.org/archives/xorg-devel/2025-June/date.html#59396) [\[ thread \]](https://lists.x.org/archives/xorg-devel/2025-June/thread.html#59396) [\[ subject \]](https://lists.x.org/archives/xorg-devel/2025-June/subject.html#59396) [\[ author \]](https://lists.x.org/archives/xorg-devel/2025-June/author.html#59396) +- +-Hello everybody, +- +- +-this morning, Redhat employees banned me from the freedesktop.org gitlab +-infrastructure - so censored all my work (not just on Xorg). They killed +-my account, my git repos, my tickets in Xorg and closed all my merge +-requests. And then making fun on social media about it. +- +-They fired the shot that's heared around the world. +- +-So much for freedesktop.org being "independent" and embracing freedom. +-Perhaps we should nominate them for the next Orwell award. +- +-It's now clear that freedesktop.org *is* the Redskirts, and they want +-to kill X. By the way, the same corporation that tied to proprietarize a +-lot of FOSS code, including the Linux kernel (and I've been one of those +-who warned them about terminating our license grants them). +- +-My most evil heresies probably were: +- +-a) forking Xorg and making *actual progress*
+-b) talking to a journalist whose name must not be spoken in many other +- Redhat/IBM tax evasion outlets, like GNOME (they're also banning +- honorable long time contributors for just mentioning that name)
+-c) inviting *anybody* to join me, without discrimination +- +-I don't know why, but it really looks they're quite scared by one guy +-that's just trying to actually bring X11 forward. Hard to find he right +-words for telling how honored I'm about that. +- +-This didn't actually surprise me, I knew this would be coming for about +-a year now. Just didn't expect them to do such an extremely irrational +-and dumb move. Now I'm taking great pleasure seeing the Streisand effect +-kicking in (my inbox is exploding). Thanks for that great publicity. +- +-It's not the first time this happens in FOSS world, and it's not the +-first time it's happening in X: remember what Xfree86 board did to +-the honorable Keith Packard, back about two decades ago - what lead to +-the birth of Xorg and the death of Xfree86. Same is happening again. +- +-History repeats itself. +- +-And now the Redskirts placed me onto the same stage as the great +-honorable Keith Packard. WOOOOW. +- +-Just to be clear, I didn't want to fork, I tried my best to work +-together with the Xorg team. But I knew for long time, this day would +-come. Xorg has been captured by Redhat, in order to get rid of destroy +-competition. The necessary consequence is a fork, more competition. +- +-For those interested in bringing X forward, feel free to join the +-mailing list: +- +-https://www.freelists.org/list/xlibre +- +-Git repo:
+-https://github.com/X11Libre/xserver.git +- +-I'm expecting to be banned from whole freedesktop.org mail system, too. +-Excommunication unfortunately had become a common thing in the so-called +-"free software" world - GNOME is just one of many examples. So if you +-don't hear anymore from me on freedesktop.org lists, you know what's +-going on. +- +-Join the xlibre mailing list to stay tuned. +- +-Together, we'll make X great again. +- +- +-have fun,
+---mtx +- +---
+-\--- Enrico Weigelt, metux IT consult
+-Free software and Linux embedded engineering
+-[info at metux.net](https://lists.x.org/mailman/listinfo/xorg-devel) -- +49-151-27565287 +- +---- +- +-Source: [History repeats: Redhat censored me on freedesktop.org - Xlibre fork release coming in few days](https://lists.x.org/archives/xorg-devel/2025-June/059396.html) +- +- +-## First version of the README of XLibre at Github +- +-The first version of the XLibre-specific [`README.md`](https://github.com/X11Libre/xserver/blob/master/README.md) file was created on June 12, 2025, and updated throughout the day. The version below reflects the status at the end of June 12, 2025. +- +---- +- +-### XLibre Xserver +- +-Xlibre is a fork of the Xorg Xserver, with lots of code cleanups +-and enhanced functionality. +- +-This fork was necessary since toxic elements within Xorg projects, moles +-from BigTech, are boycotting any substantial work on Xorg, in order to +-destroy the project, to eliminate competition of their own products. +-Classic "embrace, extend, extinguish" tactics. +- +-Right after journalists first began covering the planned fork Xlibre, +-on June 6th 2025, Redhat employees started a purge on the Xlibre founder's +-GitLab account on freedesktop.org: deleted the git repo, tickets, merge +-requests, etc, and so fired the shot that the whole world heard. +- +-This is an independent project, not at all affiliated with BigTech or any +-of their subsidiaries or tax evasion tools, nor any political activists +-groups, state actors, etc. It's explicitly free of any "DEI" or similar +-discriminatory policies. Anybody who's treating others nicely is welcomed. +- +-It doesn't matter which country you're coming from, your political views, +-your race, your sex, your age, your food menu, whether you wear boots or +-heels, whether you're furry or fairy, Conan or McKay, comic character, a +-small furry creature from Alpha Centauri, or just an boring average person. +-Anybody who's interested in bringing X forward is welcome. +- +-Together we'll make X great again! +- +-#### Upgrade notice +- +-* Module ABIs have changed - drivers MUST be recompiled against this Xserver +- version, otherwise the Xserver can crash or fail to start up correctly. +- +-* If your console is locked up (no input possible, not even VT switch), then +- most likely the input driver couldn't be loaded due to a version mismatch. +- When unsure, it's best be prepared to ssh into your machine from another one +- or set a timer that's calling `chvt 1` after certain time, so you don't +- need a cold reboot. +- +-* Proprietary Nvidia drivers might break: they still haven't managed to do +- do even simple cleanups to catch up with Xorg master for about a year. +- All attempts to get into direct mail contact have failed. We're trying to +- work around this, but cannot give any guarantees. +- +-* Most Xorg drivers should run as-is (once recompiled!), with some exceptions. +- See `.gitlab-ci.yml` for the versions/branches built along with Xlibre. +- +-#### Driver repositories +- +-Since Redhat had deleted and banned all X11Libre repositories from freedesktop.org, +-the driver repositories are now moved to github: +- +-| Driver | Git repository | +-| --- | --- | +-| xf86-input-elographics: | https://github.com/X11Libre/xf86-input-elographics | +-| xf86-input-evdev: | https://github.com/X11Libre/xf86-input-evdev | +-| xf86-input-joystick: | https://github.com/X11Libre/xf86-input-joystick | +-| xf86-input-keyboard: | https://github.com/X11Libre/xf86-input-keyboard | +-| xf86-input-libinput: | https://github.com/X11Libre/xf86-input-libinput | +-| xf86-input-mouse: | https://github.com/X11Libre/xf86-input-mouse | +-| xf86-input-synaptics: | https://github.com/X11Libre/xf86-input-synaptics | +-| xf86-input-vmmouse: | https://github.com/X11Libre/xf86-input-vmmouse | +-| xf86-video-amdgpu: | https://github.com/X11Libre/xf86-video-amdgpu | +-| xf86-video-apm: | https://github.com/X11Libre/xf86-video-apm | +-| xf86-video-ark: | https://github.com/X11Libre/xf86-video-ark | +-| xf86-video-ast: | https://github.com/X11Libre/xf86-video-ast | +-| xf86-video-ati: | https://github.com/X11Libre/xf86-video-ati | +-| xf86-video-chips: | https://github.com/X11Libre/xf86-video-chips | +-| xf86-video-cirrus: | https://github.com/X11Libre/xf86-video-cirrus | +-| xf86-video-dummy: | https://github.com/X11Libre/xf86-video-dummy | +-| xf86-video-fbdev: | https://github.com/X11Libre/xf86-video-fbdev | +-| xf86-video-freedreno: | https://github.com/X11Libre/xf86-video-freedreno | +-| xf86-video-geode: | https://github.com/X11Libre/xf86-video-geode | +-| xf86-video-i128: | https://github.com/X11Libre/xf86-video-i128 | +-| xf86-video-i740: | https://github.com/X11Libre/xf86-video-i740 | +-| xf86-video-i740: | https://github.com/X11Libre/xf86-video-i740 | +-| xf86-video-intel: | https://github.com/X11Libre/xf86-video-intel | +-| xf86-video-mach64: | https://github.com/X11Libre/xf86-video-mach64 | +-| xf86-video-mga: | https://github.com/X11Libre/xf86-video-mga | +-| xf86-video-neomagic: | https://github.com/X11Libre/xf86-video-neomagic | +-| xf86-video-nested: | https://github.com/X11Libre/xf86-video-nested | +-| xf86-video-nouveau: | https://github.com/X11Libre/xf86-video-nouveau | +-| xf86-video-nv: | https://github.com/X11Libre/xf86-video-nv | +-| xf86-video-omap: | https://github.com/X11Libre/xf86-video-omap | +-| xf86-video-qxl: | https://github.com/X11Libre/xf86-video-qxl | +-| xf86-video-r128: | https://github.com/X11Libre/xf86-video-r128 | +-| xf86-video-rendition: | https://github.com/X11Libre/xf86-video-rendition | +-| xf86-video-s3virge: | https://github.com/X11Libre/xf86-video-s3virge | +-| xf86-video-savage: | https://github.com/X11Libre/xf86-video-savage | +-| xf86-video-siliconmotion: | https://github.com/X11Libre/xf86-video-siliconmotion | +-| xf86-video-sis: | https://github.com/X11Libre/xf86-video-sis | +-| xf86-video-sisusb: | https://github.com/X11Libre/xf86-video-sisusb | +-| xf86-video-suncg14: | https://github.com/X11Libre/xf86-video-suncg14 | +-| xf86-video-suncg3: | https://github.com/X11Libre/xf86-video-suncg3 | +-| xf86-video-suncg6: | https://github.com/X11Libre/xf86-video-suncg6 | +-| xf86-video-sunffb: | https://github.com/X11Libre/xf86-video-sunffb | +-| xf86-video-sunleo: | https://github.com/X11Libre/xf86-video-sunleo | +-| xf86-video-suntcx: | https://github.com/X11Libre/xf86-video-suntcx | +-| xf86-video-tdfx: | https://github.com/X11Libre/xf86-video-tdfx | +-| xf86-video-trident: | https://github.com/X11Libre/xf86-video-trident | +-| xf86-video-v4l: | https://github.com/X11Libre/xf86-video-v4l | +-| xf86-video-vesa: | https://github.com/X11Libre/xf86-video-vesa | +-| xf86-video-vmware: | https://github.com/X11Libre/xf86-video-vmware | +-| xf86-video-voodoo: | https://github.com/X11Libre/xf86-video-voodoo | +-| xf86-video-wsfb: | https://github.com/X11Libre/xf86-video-wsfb | +-| xf86-video-xgi: | https://github.com/X11Libre/xf86-video-xgi | +- +- +-#### Contact +- +-| | | +-| --- | --- | +-| Mailing list: | https://www.freelists.org/list/xlibre | +-| Telegram channel: | https://t.me/x11dev | +-| Matrix room (mirror of tg group): | https://matrix.to/#/#xlibre:matrix.org | +- +---- +- +-Source: [xserver/README.md at fea8b78 - X11Libre/xserver - Github](https://github.com/X11Libre/xserver/blob/fea8b78358a169238a288952b77e15422837e8a5/README.md)
+-Also see: [History for README.md - X11Libre/xserver - Github](https://github.com/X11Libre/xserver/commits/master/README.md) +diff --git a/README.md b/README.md +deleted file mode 100644 +index 1962ca9..0000000 +--- a/README.md ++++ /dev/null +@@ -1,91 +0,0 @@ +-# XLibre Xserver +- +-[![GetMerged Scorecard](https://getmerged.abhishekco.de/api/badge/X11Libre/xserver)](https://getmerged.abhishekco.de/X11Libre/xserver) +- +- +-The XLibre Xserver is the community-managed display server for the [X Window System Protocol Version 11 (Wikipedia)](https://en.wikipedia.org/wiki/X_Window_System_core_protocol), in short, X11. +- +-

+-

1 year of XLibre screenshot
One Year of XLibre. See more liberated screens here.
+-
+-

+- +-## Selected Features +- +-* All the good things from [X.Org Server](https://en.wikipedia.org/wiki/X.Org_Server), including its unreleased features +-* [TearFree modesetting](https://github.com/X11Libre/xserver/commit/0dacee6c5149b63a563e9bed63502da2e9f1ac1f) by default and optionally [atomic modesetting](https://github.com/X11Libre/xserver/commit/461411c798c263f70daa96f7136614dfefda6adc) +-* Support for the Nvidia drivers 340, 390, 470, 570, and newer +-* [Xnamespace extension](https://github.com/X11Libre/xserver/blob/master/doc/Xnamespace.md) for separating X clients +-* Support for seat management via [seatd](https://sr.ht/~kennylevinsen/seatd) besides [systemd-logind](https://www.freedesktop.org/software/systemd/man/latest/systemd-logind.service.html) +-* [Xfbdev](https://github.com/X11Libre/xserver/tree/master/hw/kdrive), the generic framebuffer Xserver for Linux +-* CI builds for several BSDs, Linux, MacOS, and Microsoft Windows +-* Active community, cleanups, fixes, and development based on merit +- +-To learn more about the features and mission of XLibre, please [visit our homepage](https://xlibre.net). +- +- +-## Switching to XLibre +- +-The easiest way to install and run XLibre is to use your distribution's provided packages. Please see the [Are We XLibre Yet? - (X11Libre/xserver Wiki)](https://github.com/X11Libre/xserver/wiki/Are-We-XLibre-Yet%3F) page for a list of the available options. If there is no option, then go on with building and installing XLibre from source. +- +- +-### Building XLibre +- +-After cloning the [Xserver repository](https://github.com/X11Libre/xserver.git) or unpacking the sources and installing the dependencies, change into the source directory and run the [Meson](https://mesonbuild.com) build tool: +- +-```shell +-cd "" +-meson setup build +-ninja -C build install +-``` +- +-You may specify the install `` with, for example, `--prefix="$(pwd)/image"` and add build time [``](https://github.com/X11Libre/xserver/blob/master/meson_options.txt) like so: `-Dxnest=false`. You may also want to build and install some graphics and input drivers. Please refer to the [Building XLibre (X11Libre/xserver Wiki)](https://github.com/X11Libre/xserver/wiki/Building-XLibre) page for more details. +- +- +-### Configuring XLibre +- +-Until XLibre releases its own, you can find a detailed description of the configuration on the [Configuration - Xorg (ArchWiki)](https://wiki.archlinux.org/title/Xorg#Configuration) page. If you have built and installed XLibre yourself, then change into the `` directory with `cd ` and create a directory `etc/X11` with a file `xorg.conf` and adjust it accordingly. +- +-Starting with version 25.0.0.16, the proprietary Nvidia driver is autodetected and handled internally without any special configuration. Please see the [Compatibility of XLibre (X11Libre/xserver Wiki)](https://github.com/X11Libre/xserver/wiki/Compatibility-of-XLibre) page for [more details on the Nvidia driver](https://github.com/X11Libre/xserver/wiki/Compatibility-of-XLibre#nvidia-proprietary-driver) and compatibility in general. +- +- +-### Running XLibre +- +-If you installed XLibre using your distribution's provided packages, then the Xserver is usually started by [init (Wikipedia)](https://en.wikipedia.org/wiki/Init) on system start. On other systems it should be possible to manually start XLibre with user permissions by invoking `startx`. Please refer to [`man startx`](https://linux.die.net/man/1/startx) for how to use it. +- +-If you have built and installed XLibre yourself, then you may want to shutdown other Xservers, change into the `` directory, and create a simple `testx.sh` file with the following contents: +- +-```shell +-#!/bin/sh +-./bin/X :1 vt8 -logfile /dev/stdout & +-_pid=$! +-sleep 10 && kill $_pid +-``` +- +-You can adjust the `:1 vt8` and other options in the `testx.sh` file as detailed in [`man Xorg`](https://linux.die.net/man/1/xorg). Make the `testx.sh` executable and run it: +- +-```shell +-chmod 0770 testx.sh +-./testx.sh +-``` +- +-This should give you 10 glorious seconds of a black and beautiful and empty screen. Afterwards the Xserver complains about being killed, but there should be no other critical errors for a "test passed." For more details, please see [Building XLibre (X11Libre/xserver Wiki)](https://github.com/X11Libre/xserver/wiki/Building-XLibre). +- +-If you are using seatd for rootless operation instead of (e)logind, create the following file named `.xserverrc` in your home directory: +-```shell +-#!/bin/sh +-exec X -keeptty "$@" +-``` +-Then, run `chmod +x ~/.xserverrc`. +- +- +-## I want to help! +- +-That's great; there's enough to do for everyone. You may consider [one](https://github.com/orgs/X11Libre/discussions/categories/1-new-ideas) of the [many](https://github.com/orgs/X11Libre/discussions/categories/2-rfcs-of-the-core-team) [ideas](https://github.com/orgs/X11Libre/discussions/categories/3-ideas-soon-to-be-addressed) and [feature requests](https://github.com/X11Libre/xserver/issues?q=is%3Aissue%20state%3Aopen%20label%3Aenhancement) out there. To help in testing, you may consider becoming an [XLibre Test Driver](https://github.com/X11Libre/xserver/wiki/XLibre-Test-Drivers). Please also have a look at the [good first](https://github.com/X11Libre/xserver/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22good%20first%20issue%22) and [help wanted](https://github.com/X11Libre/xserver/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22help%20wanted%22) issues and the [Liberated Screens](https://github.com/orgs/X11Libre/discussions/211). +- +-If you want to work on anything, just let us know. If you have any questions, [just ask](https://github.com/orgs/X11Libre/discussions/categories/q-a). Thank you! +- +- +-## Contact +- +-[XLibre Discussions at GitHub](https://github.com/orgs/X11Libre/discussions) | [XLibre mailing list at FreeLists](https://www.freelists.org/list/xlibre) | [@x11dev channel at Telegram](https://t.me/x11dev) | [#xlibredev space at Matrix](https://matrix.to/#/#xlibredev:matrix.org) | [XLibre security contact at GitHub](https://github.com/X11Libre/xserver/security/policy) diff --git a/Xext/xfixes/cursor.c b/Xext/xfixes/cursor.c index d017da0..a530caa 100644 --- a/Xext/xfixes/cursor.c @@ -14,6 +704,503 @@ index d017da0..a530caa 100644 static CursorPtr CursorForDevice(DeviceIntPtr pDev) +diff --git a/doc/Xnamespace-protocol.md b/doc/Xnamespace-protocol.md +deleted file mode 100644 +index 673da98..0000000 +--- a/doc/Xnamespace-protocol.md ++++ /dev/null +@@ -1,440 +0,0 @@ +-Xnamespace protocol extension — design v0.1 (DRAFT) +-=================================================== +- +-This document specifies an X11 protocol extension for the Xnamespace +-feature. Its purpose is to let an authorized management client +-**dynamically manage namespaces at runtime** — the settings that today can +-only be provisioned statically from the `namespace.conf` file at server +-startup (see `doc/Xnamespace.md` and `Xext/namespace/config.c`). +- +-The expected user is a container/session manager: it creates a namespace +-when a container starts and deletes it when the container finishes. Traffic +-is very low, so requests are kept simple and synchronous (round-tripped) +-rather than optimised for throughput — many X11 packets are needlessly +-complex and this extension deliberately avoids that. +- +-The wire protocol mirrors the existing in-memory model (`struct Xnamespace` +-in `Xext/namespace/namespace.h`) so the extension stays a thin, auditable +-layer over data the server already maintains. +- +-Status: DESIGN DRAFT. Opcodes, encodings and the capability bit layout are +-not yet frozen. +- +- +-1. Goals and non-goals +----------------------- +- +-Goals: +- +- * Enumerate namespaces and their settings. +- * Create and delete namespaces at runtime. +- * Query and modify per-namespace capability flags +- (`mouse-motion`, `shape`, `transparency`, `xinput`, `xkeyboard`, +- `superpower`). +- * Add, list and remove authentication tokens that map clients into a +- namespace (the `auth` lines in the config file today). +- * Auto-remove a namespace when its last client exits (transient +- namespaces for transient containers). +- +-Non-goals (decided, not just deferred): +- +- * **No persistence.** Xservers never persist state; runtime changes live +- only in memory. The config file remains the boot-time seed and is never +- rewritten. There is no `SaveConfig`/`ReloadConfig`. +- * **No client reassignment.** A client's namespace is fixed at connect +- time by its auth token. There is no `AssignClient` request. A namespace +- is emptied by terminating its clients, not by moving them. +- * **No namespace hierarchy yet.** A name delimiter is reserved for future +- nesting (section 3), but inheritance semantics are undefined and using +- the delimiter now is an error. +- * **No events yet.** With a single synchronous manager there is no +- multi-manager consistency problem to solve. A `NamespaceNotify` event +- may be added later if a use case appears. +- +- +-2. Security model (the load-bearing part) +------------------------------------------ +- +-The entire point of namespaces is isolation, and a management protocol is a +-direct path to subverting it. So the access rule is simple and absolute: +- +-> **The whole extension is reachable only by clients in a `superPower` +-> namespace** (today only the built-in `root`, plus any namespace +-> explicitly granted `superpower`). To every other client the extension +-> does not exist. +- +-This is enforced exactly where the existing code already enforces the same +-boundary for `SECURITY`, `RECORD` and `XTEST` — the two Xace extension +-hooks, both of which already gate on `subj->ns->superPower`: +- +- * `hook-ext-access.c` (fires on `QueryExtension`): non-superPower clients +- get `BadAccess`, so the extension is **invisible** — it reports as not +- present. A sandboxed client cannot even discover it exists. +- * `hook-ext-dispatch.c` (fires on every request to the extension): +- non-superPower clients get `BadAccess`, so even a client that hard-codes +- the major opcode cannot invoke anything. +- +-Adding `Xnamespace-mgmt` to the blacklist in both hooks is the entire +-access-control implementation. Consequences: +- +- * There is **no per-request privilege table**. Every request handler may +- assume its caller is superPower. One choke point to audit, not twelve. +- * `QueryVersion` is reachable only by superPower clients too. That is +- fine: a client that cannot see the extension has nothing to negotiate, +- and "not present" is the honest answer for it. +- * No client can grant itself capabilities it lacks, because a +- non-superPower client cannot reach any request, mutating or not. +- +-The built-in namespaces `root` and `anon` are **immutable** over the +-protocol: their name, capabilities, attributes and token set are fixed at +-boot. Any mutating request targeting them (delete, set-flags, add/remove +-token) returns `BadAccess`. They are configured only via the config file. +- +- +-3. Naming and identity +------------------------ +- +-Namespaces are identified **by name** — the same unique key the code +-already uses (`XnsFindByName()`, `select_ns()`). Names are the only +-namespace identifier on the wire; there are no protocol-level numeric IDs. +-The server is free to keep an internal id or resource for its own +-bookkeeping, but that is an implementation detail and never appears in a +-request, reply or error. Given the low, synchronous traffic, string lookup +-costs nothing and a single identifier is simpler to reason about. +- +-Name rules (violations return `BadName`): +- +- * Must be non-empty. +- * Must be unique (duplicate on `CreateNamespace` → `BadName`). +- * Must not contain the reserved nesting delimiter `'/'`. The delimiter is +- reserved now so that a future hierarchy (`parent/child`) can be added +- without a grammar break; using it today is rejected. +- * Should be restricted to printable, non-whitespace characters so that any +- protocol-created name remains expressible in `namespace.conf` (the +- config parser splits on whitespace and treats `#` as a comment). +- Implementations reject other characters with `BadName`. +- +-`BadName` (core error 15) is reused as the single name-related error: +-malformed, reserved-delimiter, duplicate-on-create, or no-such-namespace. +- +-Auth tokens, which have no natural human name, are referenced within a +-namespace by a small server-assigned opaque handle (`CARD32`) returned at +-creation. This is a per-namespace bookkeeping handle, not a global resource. +- +- +-4. Capabilities and attributes +-------------------------------- +- +-Two `CARD32` words describe a namespace. +- +-**Capabilities** — access permissions (the `allow*` / `superPower` fields): +- +- | Bit | Name | +- | ------- | ------------------------------ | +- | 1 << 0 | `XNS_CAPABILITY_MOUSE_MOTION` | +- | 1 << 1 | `XNS_CAPABILITY_SHAPE` | +- | 1 << 2 | `XNS_CAPABILITY_TRANSPARENCY` | +- | 1 << 3 | `XNS_CAPABILITY_INPUT` | +- | 1 << 4 | `XNS_CAPABILITY_KEYBOARD` | +- | 1 << 5 | `XNS_CAPABILITY_ADMIN` | +- +-**Attributes** — lifecycle/status (new fields on `struct Xnamespace`): +- +- | Bit | Name | meaning | +- | ------- | --------------------- | --------------------------------------- | +- | 1 << 0 | `XNS_ATTR_IMMUTABLE` | read-only; set by server for root/anon | +- | 1 << 1 | `XNS_ATTR_TRANSIENT` | destroy namespace when last client exits| +- +-Unused bits in either word are reserved, must be 0, and yield `BadValue`. +-New capabilities/attributes are added by allocating the next bit and +-bumping the minor version. +- +- +-5. Versioning +-------------- +- +-`QueryVersion` negotiates (major, minor). This document is major 1, minor 0. +-The client sends the highest version it supports; the server replies with +-the highest it supports that is not greater than the client's. +- +- +-6. Requests +------------ +- +-Every request begins with the standard 4-byte extension header (major +-opcode, 1-byte minor opcode, 16-bit length in 4-byte units). All requests +-are 4-byte aligned. A namespace name is encoded as a single length-prefixed +-STRING8 (`CARD16` length + bytes + zero padding to a 4-byte boundary) — one +-uniform encoding, easy to parse. +- +-All mutating requests carry a reply so the manager round-trips and learns +-success or failure synchronously, instead of relying on asynchronous error +-delivery. Replies are deliberately minimal. +- +-Minor opcodes: +- +- | Opcode | Request | Reply | +- | ------ | -------------------- | ----- | +- | 0 | `QueryVersion` | yes | +- | 1 | `ListNamespaces` | yes | +- | 2 | `CreateNamespace` | yes (ack) | +- | 3 | `DeleteNamespace` | yes (ack) | +- | 4 | `QueryNamespace` | yes | +- | 5 | `SetNamespaceFlags` | yes (ack) | +- | 6 | `AddAuthToken` | yes | +- | 7 | `RemoveAuthToken` | yes (ack) | +- | 8 | `ListAuthTokens` | yes | +- | 9 | `GetClientNamespace` | yes | +- +-### 6.0 QueryVersion +- +-``` +- QueryVersion +- client-major-version: CARD16 +- client-minor-version: CARD16 +- => +- major-version: CARD16 +- minor-version: CARD16 +-``` +- +-### 6.1 ListNamespaces +- +-``` +- ListNamespaces +- => +- namespaces: LISTofNAMESPACEINFO +-``` +- +-where each NAMESPACEINFO is a fixed header followed by the name: +- +-``` +- capabilities: CARD32 (section 4) +- attributes: CARD32 (section 4) +- refcnt: CARD32 (clients currently assigned) +- num-tokens: CARD32 +- name: STRING8 (length-prefixed, padded) +-``` +- +-### 6.2 CreateNamespace +- +-``` +- CreateNamespace +- capabilities: CARD32 (initial caps) +- attributes: CARD32 (XNS_ATTR_TRANSIENT honored; XNS_ATTR_IMMUTABLE +- rejected with BadValue if set) +- name: STRING8 +- => +- (empty ack) +-``` +- +-Errors: `BadName` (empty / illegal char / reserved `'/'` / duplicate), +-`BadValue` (reserved capability or attribute bit set), `BadAlloc`. +- +-### 6.3 DeleteNamespace +- +-``` +- DeleteNamespace +- onclients: CARD8 (0 = fail if any client present, +- 1 = terminate all clients, then delete) +- pad: 3 bytes +- name: STRING8 +- => +- (empty ack) +-``` +- +- * Deleting a built-in namespace → `BadAccess`. +- * `onclients == 0` and the namespace still has clients → `BadAccess` +- (busy). The manager must terminate them first or pass `onclients == 1`. +- * `onclients == 1`: the server disconnects every client in the namespace +- (as if each had closed its connection), then frees the namespace and +- removes its auth tokens (calling `RemoveAuthorization()` for each). +- * Any other `onclients` value → `BadValue`. +- +-### 6.4 QueryNamespace +- +-``` +- QueryNamespace +- name: STRING8 +- => +- capabilities: CARD32 +- attributes: CARD32 +- refcnt: CARD32 +- num-tokens: CARD32 +-``` +- +-`BadName` if no such namespace. +- +-### 6.5 SetNamespaceFlags +- +-Atomically updates the subset of capability bits selected by `value-mask`: +- +-``` +- SetNamespaceFlags +- value-mask: CARD32 (which capability bits to apply) +- values: CARD32 (new values for the masked bits) +- name: STRING8 +- => +- capabilities: CARD32 (resulting capabilities) +-``` +- +-`new_caps = (old_caps & ~value-mask) | (values & value-mask)`. Targeting a +-built-in namespace → `BadAccess`. A reserved bit in `value-mask` → +-`BadValue`. `BadName` if no such namespace. (Attributes are set only at +-creation in v0.1; there is no runtime attribute change.) +- +-### 6.6 AddAuthToken +- +-Runtime equivalent of an `auth` config line; internally calls +-`AddAuthorization()` exactly as `config.c` does and records the token. +- +-``` +- AddAuthToken +- name: STRING8 (namespace name) +- auth-proto: STRING8 (e.g. "MIT-MAGIC-COOKIE-1") +- auth-data: STRING8 (raw key bytes, length-prefixed — NOT hex) +- => +- token-handle: CARD32 (per-namespace handle for removal) +-``` +- +-The key is carried as raw bytes; the hex encoding in the config file +-(`hex2bin()` in `config.c`) is a text-file affordance with no place in a +-binary protocol. Targeting a built-in namespace → `BadAccess`. `BadName` +-if no such namespace; `BadValue` if `auth-proto` is empty; `BadAlloc` on +-failure. +- +-(Three length-prefixed STRING8s in a fixed order — the request stays +-trivially parseable despite three variable-length fields.) +- +-### 6.7 RemoveAuthToken +- +-``` +- RemoveAuthToken +- token-handle: CARD32 +- name: STRING8 +- => +- (empty ack) +-``` +- +-Calls `RemoveAuthorization()` and unlinks the token. Removing a token does +-not disconnect clients already authenticated with it (standard X +-authorization semantics); it only prevents future connections from using +-it. `BadMatch` if the handle does not belong to the named namespace; +-`BadAccess` for a built-in namespace; `BadName` if no such namespace. +- +-### 6.8 ListAuthTokens +- +-``` +- ListAuthTokens +- name: STRING8 +- => +- tokens: LISTofAUTHTOKENINFO +-``` +- +-where AUTHTOKENINFO is: +- +-``` +- token-handle: CARD32 +- proto: STRING8 (length-prefixed, padded) +-``` +- +-Secret key material is **never** returned — only the protocol name and the +-handle. A compromised manager cannot exfiltrate cookies it did not create. +- +-### 6.9 GetClientNamespace +- +-Read-only introspection: which namespace a given client belongs to. Useful +-for auditing a namespace's members before a `DeleteNamespace onclients=1`. +- +-``` +- GetClientNamespace +- client-resource: CARD32 (a resource base; 0 = the calling client) +- => +- is-server: BOOL +- pad: 3 bytes +- name: STRING8 (the client's namespace name) +-``` +- +-This is the protocol view of `XnsClientPriv(client)->ns`. +- +- +-7. Errors +---------- +- +-The extension defines no new error codes; it reuses core errors: +- +- * `BadAccess` — operation on an immutable built-in namespace; delete of a +- busy namespace without `onclients=1`. (Also the result of a +- non-superPower client reaching the extension, though the Xace hooks make +- that unreachable in practice — defence in depth.) +- * `BadName` — namespace name empty, illegal, reserved-delimiter, +- duplicate on create, or not found. +- * `BadValue` — reserved capability/attribute bit set; bad `onclients` +- value; empty auth protocol. +- * `BadMatch` — token handle does not belong to the named namespace. +- * `BadAlloc` — out of memory. +- +- +-8. Mapping to the existing implementation +------------------------------------------ +- +-Registered like any other extension (`AddExtension`, cf. +-`Xext/dpms/dpms.c:515`) from `NamespaceExtensionInit()` in +-`Xext/namespace/namespace.c`, after `XnsLoadConfig()` succeeds — no point +-exposing management when namespaces are disabled. +- +- | Protocol concept | Existing code | +- | ---------------------- | ----------------------------------------------- | +- | namespace record | `struct Xnamespace` (`namespace.h`) | +- | capability bits | `allow*` / `superPower` bool fields | +- | find by name | `XnsFindByName()` | +- | create namespace | `select_ns()` logic, factored out of `config.c` | +- | add token | `AddAuthorization()` + `xorg_list_append` | +- | remove token | `RemoveAuthorization()` + `xorg_list_del` | +- | client → namespace | `XnsClientPriv()->ns` | +- | refcount | `struct Xnamespace.refcnt` | +- +-Required changes: +- +- 1. **Access gate.** Add `Xnamespace-mgmt` to the blacklist in both +- `hook-ext-access.c` (invisible to non-superPower) and +- `hook-ext-dispatch.c` (`BadAccess` on dispatch), alongside +- `SECURITY`/`RECORD`/`XTEST`. +- 2. **Shared setters.** Factor the per-field parsing in `parseLine()` into +- helpers (`XnsCreateNamespace`, `XnsSetCaps`, `XnsAddToken`, +- `XnsRemoveToken`) so the config loader and the protocol handlers share +- one code path and cannot drift apart. +- 3. **Removable tokens.** Add an opaque per-namespace `token-handle` to +- `struct auth_token` and support unlinking + `RemoveAuthorization()` +- (today tokens are only ever appended at boot). +- 4. **New attribute fields.** `Bool builtin` already exists; add +- `Bool autoRemove`. Set `builtin` for `root`/`anon`. +- 5. **Auto-remove.** Centralise in `XnamespaceAssignClient()`: after the +- `priv->ns->refcnt--` path, if the namespace is non-builtin, has +- `autoRemove` set, and refcnt reached 0, destroy it (free tokens via +- `RemoveAuthorization()`, unlink from `ns_list`, free). This is reached +- naturally from `hookClientDestroy()`, which already calls +- `XnamespaceAssignClient(subj, NULL)`. `root`/`anon` are safe because +- they are builtin and start at `refcnt = 1`. +- 6. **Client termination on delete.** For `DeleteNamespace onclients=1`, +- walk clients whose `XnsClientPriv()->ns` matches and close them +- (`CloseDownClient`), then free the namespace. +- 7. **Dispatch.** A `ProcXnsDispatch` / `SProcXnsDispatch` pair with the +- usual byte-swapped variants for each request. +- +-Serialization: everything runs in the single-threaded dispatch loop, so no +-locking is needed. Refcount and list mutations are safe as they happen only +-from request handlers and the existing callbacks. +- +- +-9. Remaining minor questions +----------------------------- +- +- 1. **Reserved name charset.** `'/'` is reserved for nesting. Confirm the +- full allowed charset (proposal: printable ASCII excluding whitespace, +- `#`, and `/`) so protocol-created names round-trip through the config +- grammar. +- 2. **Auto-remove vs. explicit delete race.** If a transient namespace +- auto-removes just before a manager issues `DeleteNamespace`, the delete +- sees no such name and returns `BadName`. Is that acceptable (treat as +- "already gone, success") or should auto-removed names linger briefly? +- Proposal: `BadName` is fine; the namespace is gone either way. +diff --git a/doc/Xnamespace.md b/doc/Xnamespace.md +deleted file mode 100644 +index ce1aecd..0000000 +--- a/doc/Xnamespace.md ++++ /dev/null +@@ -1,26 +0,0 @@ +-Xnamespace extension v1.0 +-========================= +- +-This extension separates clients into several namespaces (a bit similar to +-Linux's kernel namespaces), which are isolated from each other. For example, +-namespaces have their own selections and clients cannot directly interact +-(send messages) or access other client's resources across namespace borders. +- +-An exception is the `root` namespace, which completely is unrestricted. +- +-Configuration +-------------- +- +-Namespaces are defined in a separate configuration file, which is loaded at +-server startup (no dynamic provisioning in this version yet). The extension +-is enabled when a namespace config is passed to the Xserver via the +-`-namespace ` flag. +- +- +-See `Xext/namespace/ns.conf.example` for a configuration file example. +- +-Authentication / Namespace assignment +-------------------------------------- +- +-Assignment of clients into namespaces is done by the authentication token the +-client is using to authenticate. Thus, token authentication needs to enabled. +diff --git a/hw/xfree86/drivers/video/modesetting/driver.c b/hw/xfree86/drivers/video/modesetting/driver.c +index 8d32bc8..c8dab70 100644 +--- a/hw/xfree86/drivers/video/modesetting/driver.c ++++ b/hw/xfree86/drivers/video/modesetting/driver.c +@@ -794,6 +794,14 @@ dispatch_dirty(ScreenPtr pScreen) + uint32_t fb_id; + int ret, c, x, y ; + ++ if (!ms->damage || !RegionNotEmpty(DamageRegion(ms->damage))) ++ return; ++ ++#ifdef GLAMOR ++ if (ms->drmmode.glamor_gbm) ++ ms->glamor.finish(pScreen); ++#endif ++ + for (c = 0; c < xf86_config->num_crtc; c++) { + xf86CrtcPtr crtc = xf86_config->crtc[c]; + PixmapPtr pmap; diff --git a/hw/xfree86/drivers/video/modesetting/drmmode_bo.c b/hw/xfree86/drivers/video/modesetting/drmmode_bo.c index b39aa73..71c876e 100644 --- a/hw/xfree86/drivers/video/modesetting/drmmode_bo.c @@ -235,3 +1422,216 @@ index 6653dd9..e04b69c 100644 } nTty = tty_attr; +diff --git a/include/meson.build b/include/meson.build +index bffd8fb..7863b9d 100644 +--- a/include/meson.build ++++ b/include/meson.build +@@ -234,7 +234,7 @@ conf_data.set('DRI2', build_dri2 ? '1' : false) + conf_data.set('DRI3', build_dri3 ? '1' : false) + if build_glx + if build_glx_dri +- conf_data.set_quoted('DRI_DRIVER_PATH', dri_dep.get_variable(pkgconfig : 'dridriverdir')) ++ conf_data.set_quoted('DRI_DRIVER_PATH', '/usr/lib/dri') + conf_data.set('BUILD_GLX_DRI', 1) + endif + endif +diff --git a/test/pyxtest/README.md b/test/pyxtest/README.md +deleted file mode 100644 +index ae63f69..0000000 +--- a/test/pyxtest/README.md ++++ /dev/null +@@ -1,194 +0,0 @@ +-# pyxtest - pytest-based X server test suite +- +-This is a pytest-based test suite that launches X servers and sends crafted +-protocol requests to verify that security vulnerabilities and other bugs +-are properly handled. +- +-It can be run against Xvfb, Xwayland, or Xorg but the latter typically +-requires root and/or some setup outside the test suite. The test suite +-uses both AddressSanitizer (ASAN) and valgrind for detecting +-memory errors such as out-of-bounds reads/writes and use-after-free. +- +- +-## Running tests +- +-### Via meson +-The test suite (via Xvfb) is integrated into the meson tests and can be +-run with normal meson commands. +- +-```sh +-# run the python test suite +-meson test --suite pyxtest +-# run a set of tests +-meson test pyxtest-test_randr.py +-``` +-Consult the meson documentation for further details. +- +-### Directly with pytest +- +-For running against a custom path, point the test suite at the server binary to +-test using environment variables or CLI options: +- +-```sh +-# Using environment variable +-XVFB_PATH=build/hw/vfb/Xvfb pytest test/pyxtest/ -v +- +-# Using --server-path +-pytest test/pyxtest/ -v --server-path=build/hw/vfb/Xvfb +- +-# Using the system Xvfb (fallback if no path is set) +-pytest test/pyxtest/ -v +-``` +- +-The normal pytest options work as expected (`-k` for test selection, etc.) +- +-Tests can be run against a manually-started server using the `--display` +-option: +- +-```sh +-./build/hw/vfb/Xvfb :2 +-pytest test/pyxtest --display :2 +-``` +- +-### Running with AddressSanitizer (ASAN) +- +-ASAN is a compile-time instrumentation that detects memory errors such as +-heap buffer overflows and use-after-free. To use ASAN, build the server with +-sanitizer support: +- +-```sh +-meson setup build-asan -Db_sanitize=address -Db_lundef=false +-meson compile -C build-asan +-``` +- +-Then run the tests against the ASAN-built binary: +- +-```sh +-XSERVER_ASAN=1 XVFB_PATH=build-asan/hw/vfb/Xvfb pytest test/pyxtest/ -v +-``` +- +-When using meson test, `XSERVER_ASAN` is set automatically if the build +-was configured with `-Db_sanitize=address`. +- +-Tests marked with `@pytest.mark.asan` are skipped unless `XSERVER_ASAN=1` +-is set. When ASAN detects an error, the server process is killed and the +-ASAN error report is included in the test failure message. +- +-**Note:** ASAN and valgrind are mutually incompatible. When `XSERVER_ASAN=1` +-is set, valgrind wrapping is automatically disabled even if `--valgrind` is +-passed. +- +-### Running with valgrind +- +-The `--valgrind` flag runs **all** servers under valgrind: +- +-```sh +-pytest test/pyxtest/ -v --valgrind +-``` +- +-Tests marked with `@pytest.mark.valgrind` automatically run their server +-under valgrind even without the `--valgrind` flag. This is useful for +-bugs that are only detectable via valgrind (e.g. use of uninitialised +-values). +- +-### Testing multiple server types +- +-By default only `Xvfb` is tested. Use `--server-type` to test additional +-servers. Tests using the `xserver` fixture are automatically run once per +-server type: +- +-```sh +-pytest test/pyxtest/ -v --server-type=xvfb --server-type=xwayland +-``` +- +-## CLI options +- +-| Option | Description | +-|--------------------------------|-------------------------------------------| +-| `--valgrind` | Run all X servers under valgrind memcheck | +-| `--valgrind-suppressions=PATH` | Path to a valgrind suppressions file | +-| `--valgrind-log-dir=PATH` | Persist a per-test valgrind XML report here (plus a `.txt` summary when there are findings), independent of pass/fail. Also settable via `VALGRIND_LOG_DIR`. | +-| `--server-type=TYPE` | Server type to test (`xvfb`, `xwayland`, `xorg`). Repeatable. Default: `xvfb` | +-| `--server-path=PATH` | Explicit path to the X server binary | +-| `--display=DISPLAY` | Connect to an existing server instead of starting one. Accepts `:N` or `N`. Mutually exclusive with `--valgrind` and `--server-path` | +- +-## Environment variables +- +-The server binary is located by checking, in order: +- +-1. `--server-path` CLI option +-2. `XVFB_PATH` / `XWAYLAND_PATH` / `XORG_PATH` environment variable +-3. `XSERVER_BUILDDIR` environment variable (looks for `hw/vfb/Xvfb` etc.) +-4. `build/` directory relative to the source root +-5. System `PATH` (prints a warning) +- +-`VALGRIND_SUPPRESSIONS` can point to a suppressions file. +- +-`VALGRIND_LOG_DIR` is the environment-variable form of `--valgrind-log-dir`. +- +-`XSERVER_ASAN` set to `1` indicates the server binary was built with +-AddressSanitizer. This is set automatically by meson when +-`-Db_sanitize=address` is used. It can also be set manually. +- +-## Test markers +- +-| Marker | Effect | +-|-------------------------------|-------------------------------------------------------------| +-| `@pytest.mark.asan` | Test requires ASAN (`XSERVER_ASAN=1` must be set | +-| `@pytest.mark.valgrind` | Test requires valgrind (skipped if `XSERVER_ASAN` is set) | +-| `@pytest.mark.xwayland_only` | Test is skipped unless `--server-type=xwayland` | +-| `@pytest.mark.xorg_only` | Test is skipped unless `--server-type=xorg` | +-| `@pytest.mark.swapped_client` | Test uses a byte-swapped (big-endian) client connection | +- +- +-## Writing a new test +- +-1. Create or edit a `test_*.py` file. +- +-2. Use the `xserver` and `xclient` or `xclient_swapped` fixtures to get a +- running server and connection: +- +- ```python +- def test_something(self, xserver, xclient): +- # xclient is a RawX11Connection to xserver +- ... +- assert xserver.is_alive, "Server crashed" +- ``` +- +-3. If the test needs an extension, create a fixture that handles +- negotiation: +- +- ```python +- @pytest.fixture +- def render_client(xclient): +- ext = xclient.query_extension(Extension.RENDER) +- if not ext: +- pytest.skip("RENDER not available") +- # ... send version negotiation ... +- return xclient +- ``` +- +-4. Build protocol requests using dataclasses from `proto/` and send them +- with `send_request()`. The byte order is handled automatically based +- on the connection type (native or swapped): +- +- ```python +- from proto import xi +- +- req = xi.XIChangeHierarchyRequest( +- opcode=opcode, +- num_changes=1, +- changes_data=change_data, +- ) +- xclient.send_request(req) +- ``` +- +-5. If a new extension module is needed, create `proto/myext.py` with +- constants and `@dataclass` request builders following the existing +- pattern. +- +-6. If the bug is only detectable via a memory sanitizer (OOB reads, +- use-after-free), mark the test with `@pytest.mark.asan`. Use +- `@pytest.mark.valgrind` only for bugs that specifically require +- valgrind (e.g. use of uninitialised values that ASAN does not +- detect). diff --git a/prebuilt/kernel-6.12.1-msm8916/drm/msm.ko b/prebuilt/kernel-6.12.1-msm8916/drm/msm.ko new file mode 100644 index 0000000..208fad1 Binary files /dev/null and b/prebuilt/kernel-6.12.1-msm8916/drm/msm.ko differ diff --git a/prebuilt/kernel-6.12.1-msm8916/drm/msm.ko.zst b/prebuilt/kernel-6.12.1-msm8916/drm/msm.ko.zst new file mode 100644 index 0000000..35bbf11 Binary files /dev/null and b/prebuilt/kernel-6.12.1-msm8916/drm/msm.ko.zst differ diff --git a/prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8905-nokia-argon.dtb b/prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8905-nokia-argon.dtb index 3927f65..b036121 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8905-nokia-argon.dtb and b/prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8905-nokia-argon.dtb differ diff --git a/prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8905-nokia-beatles.dtb b/prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8905-nokia-beatles.dtb index beda68e..115929b 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8905-nokia-beatles.dtb and b/prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8905-nokia-beatles.dtb differ diff --git a/prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8905-nokia-coconut.dtb b/prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8905-nokia-coconut.dtb index 7b4e2c2..cdf8d16 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8905-nokia-coconut.dtb and b/prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8905-nokia-coconut.dtb differ diff --git a/prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8909-nokia-leo.dtb b/prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8909-nokia-leo.dtb index 1578220..c2950eb 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8909-nokia-leo.dtb and b/prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8909-nokia-leo.dtb differ diff --git a/prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8909-nokia-sparkler.dtb b/prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8909-nokia-sparkler.dtb index e2a7291..57c33ba 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8909-nokia-sparkler.dtb and b/prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8909-nokia-sparkler.dtb differ diff --git a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6adm.ko b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6adm.ko index 7a9aa81..cfc027b 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6adm.ko and b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6adm.ko differ diff --git a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6adm.ko.zst b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6adm.ko.zst index 49f22ce..467a9fa 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6adm.ko.zst and b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6adm.ko.zst differ diff --git a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6afe.ko b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6afe.ko index 8e4fbc5..52e5460 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6afe.ko and b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6afe.ko differ diff --git a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6afe.ko.zst b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6afe.ko.zst index 261d89b..76be070 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6afe.ko.zst and b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6afe.ko.zst differ diff --git a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6asm.ko b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6asm.ko index 4279d40..fa6c877 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6asm.ko and b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6asm.ko differ diff --git a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6asm.ko.zst b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6asm.ko.zst index 0c2283b..5ce6bb8 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6asm.ko.zst and b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6asm.ko.zst differ diff --git a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6core.ko b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6core.ko index 74d90af..06985db 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6core.ko and b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6core.ko differ diff --git a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6core.ko.zst b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6core.ko.zst index 6d2dcff..c99e0ab 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6core.ko.zst and b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6core.ko.zst differ diff --git a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6cvp.ko b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6cvp.ko index 3d5813f..079c44a 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6cvp.ko and b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6cvp.ko differ diff --git a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6cvp.ko.zst b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6cvp.ko.zst index 480e9be..28a3480 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6cvp.ko.zst and b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6cvp.ko.zst differ diff --git a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6cvs.ko b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6cvs.ko index 8657876..762edf8 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6cvs.ko and b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6cvs.ko differ diff --git a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6cvs.ko.zst b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6cvs.ko.zst index 9e84fc5..688c510 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6cvs.ko.zst and b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6cvs.ko.zst differ diff --git a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6mvm.ko b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6mvm.ko index 3cea40d..e756b23 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6mvm.ko and b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6mvm.ko differ diff --git a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6mvm.ko.zst b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6mvm.ko.zst index 084acf2..bd64f09 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6mvm.ko.zst and b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6mvm.ko.zst differ diff --git a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6prm.ko b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6prm.ko index 5016c62..7226a6c 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6prm.ko and b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6prm.ko differ diff --git a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6prm.ko.zst b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6prm.ko.zst index fe2e4df..93b4c54 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6prm.ko.zst and b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6prm.ko.zst differ diff --git a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6voice-common.ko b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6voice-common.ko index 67b74b2..67f26b2 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6voice-common.ko and b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6voice-common.ko differ diff --git a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6voice-common.ko.zst b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6voice-common.ko.zst index 49219ef..bf59583 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6voice-common.ko.zst and b/prebuilt/kernel-6.12.1-msm8916/qdsp6/q6voice-common.ko.zst differ diff --git a/prebuilt/kernel-6.12.1-msm8916/qdsp6/snd-q6apm.ko b/prebuilt/kernel-6.12.1-msm8916/qdsp6/snd-q6apm.ko index bc1c628..d4b9390 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/qdsp6/snd-q6apm.ko and b/prebuilt/kernel-6.12.1-msm8916/qdsp6/snd-q6apm.ko differ diff --git a/prebuilt/kernel-6.12.1-msm8916/qdsp6/snd-q6apm.ko.zst b/prebuilt/kernel-6.12.1-msm8916/qdsp6/snd-q6apm.ko.zst index 8ea3b31..a8947dc 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/qdsp6/snd-q6apm.ko.zst and b/prebuilt/kernel-6.12.1-msm8916/qdsp6/snd-q6apm.ko.zst differ diff --git a/prebuilt/xlibre/usr/bin/Xorg b/prebuilt/xlibre/usr/bin/Xorg index 10f585b..15eae03 100755 Binary files a/prebuilt/xlibre/usr/bin/Xorg and b/prebuilt/xlibre/usr/bin/Xorg differ diff --git a/prebuilt/xlibre/usr/include/xorg/xf86xv.h b/prebuilt/xlibre/usr/include/xorg/xf86xv.h new file mode 100644 index 0000000..19c0272 --- /dev/null +++ b/prebuilt/xlibre/usr/include/xorg/xf86xv.h @@ -0,0 +1,225 @@ + +/* + * Copyright (c) 1998-2003 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + +#ifndef _XF86XV_H_ +#define _XF86XV_H_ + +#include "xlibre_ptrtypes.h" +#include "xvdix.h" +#include "xf86str.h" + +#define VIDEO_OVERLAID_IMAGES 0x00000004 +#define VIDEO_OVERLAID_STILLS 0x00000008 +/* + * Usage of VIDEO_CLIP_TO_VIEWPORT is not recommended. + * It can make reput behaviour inconsistent. + */ +#define VIDEO_CLIP_TO_VIEWPORT 0x00000010 + +typedef XvImageRec XF86ImageRec, *XF86ImagePtr; + +typedef struct { + ScrnInfoPtr pScrn; + int id; + unsigned short width, height; + int *pitches; /* bytes */ + int *offsets; /* in bytes from start of framebuffer */ + DevUnion devPrivate; +} XF86SurfaceRec, *XF86SurfacePtr; + +typedef int (*PutVideoFuncPtr) (ScrnInfoPtr pScrn, + short vid_x, short vid_y, short drw_x, + short drw_y, short vid_w, short vid_h, + short drw_w, short drw_h, RegionPtr clipBoxes, + void *data, DrawablePtr pDraw); +typedef int (*PutStillFuncPtr) (ScrnInfoPtr pScrn, short vid_x, short vid_y, + short drw_x, short drw_y, short vid_w, + short vid_h, short drw_w, short drw_h, + RegionPtr clipBoxes, void *data, + DrawablePtr pDraw); +typedef int (*GetVideoFuncPtr) (ScrnInfoPtr pScrn, short vid_x, short vid_y, + short drw_x, short drw_y, short vid_w, + short vid_h, short drw_w, short drw_h, + RegionPtr clipBoxes, void *data, + DrawablePtr pDraw); +typedef int (*GetStillFuncPtr) (ScrnInfoPtr pScrn, short vid_x, short vid_y, + short drw_x, short drw_y, short vid_w, + short vid_h, short drw_w, short drw_h, + RegionPtr clipBoxes, void *data, + DrawablePtr pDraw); +typedef void (*StopVideoFuncPtr) (ScrnInfoPtr pScrn, void *data, Bool Exit); +typedef int (*SetPortAttributeFuncPtr) (ScrnInfoPtr pScrn, Atom attribute, + INT32 value, void *data); +typedef int (*GetPortAttributeFuncPtr) (ScrnInfoPtr pScrn, Atom attribute, + INT32 *value, void *data); +typedef void (*QueryBestSizeFuncPtr) (ScrnInfoPtr pScrn, Bool motion, + short vid_w, short vid_h, short drw_w, + short drw_h, unsigned int *p_w, + unsigned int *p_h, void *data); +typedef int (*PutImageFuncPtr) (ScrnInfoPtr pScrn, short src_x, short src_y, + short drw_x, short drw_y, short src_w, + short src_h, short drw_w, short drw_h, + int image, unsigned char *buf, short width, + short height, Bool Sync, RegionPtr clipBoxes, + void *data, DrawablePtr pDraw); +typedef int (*ReputImageFuncPtr) (ScrnInfoPtr pScrn, short src_x, short src_y, + short drw_x, short drw_y, short src_w, + short src_h, short drw_w, short drw_h, + RegionPtr clipBoxes, void *data, + DrawablePtr pDraw); +typedef int (*QueryImageAttributesFuncPtr) (ScrnInfoPtr pScrn, int image, + unsigned short *width, + unsigned short *height, + int *pitches, int *offsets); + +typedef enum { + XV_OFF, + XV_PENDING, + XV_ON +} XvStatus; + +/*** this is what the driver needs to fill out ***/ + +typedef struct { + int id; + const char *name; + unsigned short width, height; + XvRationalRec rate; +} XF86VideoEncodingRec, *XF86VideoEncodingPtr; + +typedef struct { + char depth; + short class; +} XF86VideoFormatRec, *XF86VideoFormatPtr; + +typedef XvAttributeRec XF86AttributeRec, *XF86AttributePtr; + +typedef struct { + unsigned int type; + int flags; + const char *name; + int nEncodings; + XF86VideoEncodingPtr pEncodings; + int nFormats; + XF86VideoFormatPtr pFormats; + int nPorts; + DevUnion *pPortPrivates; + int nAttributes; + XF86AttributePtr pAttributes; + int nImages; + XF86ImagePtr pImages; + PutVideoFuncPtr PutVideo; + PutStillFuncPtr PutStill; + GetVideoFuncPtr GetVideo; + GetStillFuncPtr GetStill; + StopVideoFuncPtr StopVideo; + SetPortAttributeFuncPtr SetPortAttribute; + GetPortAttributeFuncPtr GetPortAttribute; + QueryBestSizeFuncPtr QueryBestSize; + PutImageFuncPtr PutImage; + ReputImageFuncPtr ReputImage; /* image/still */ + QueryImageAttributesFuncPtr QueryImageAttributes; +} XF86VideoAdaptorRec, *XF86VideoAdaptorPtr; + +typedef struct { + XF86ImagePtr image; + int flags; + int (*alloc_surface) (ScrnInfoPtr pScrn, + int id, + unsigned short width, + unsigned short height, XF86SurfacePtr surface); + int (*free_surface) (XF86SurfacePtr surface); + int (*display) (XF86SurfacePtr surface, + short vid_x, short vid_y, + short drw_x, short drw_y, + short vid_w, short vid_h, + short drw_w, short drw_h, RegionPtr clipBoxes); + int (*stop) (XF86SurfacePtr surface); + int (*getAttribute) (ScrnInfoPtr pScrn, Atom attr, INT32 *value); + int (*setAttribute) (ScrnInfoPtr pScrn, Atom attr, INT32 value); + int max_width; + int max_height; + int num_attributes; + XF86AttributePtr attributes; +} XF86OffscreenImageRec, *XF86OffscreenImagePtr; + +extern _X_EXPORT Bool + xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * Adaptors, int num); + +typedef int (*xf86XVInitGenericAdaptorPtr) (ScrnInfoPtr pScrn, + XF86VideoAdaptorPtr ** Adaptors); + +extern _X_EXPORT int + xf86XVRegisterGenericAdaptorDriver(xf86XVInitGenericAdaptorPtr InitFunc); + +extern _X_EXPORT int + xf86XVListGenericAdaptors(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr ** Adaptors); + +extern _X_EXPORT Bool + +xf86XVRegisterOffscreenImages(ScreenPtr pScreen, + XF86OffscreenImagePtr images, int num); + +extern _X_EXPORT XF86OffscreenImagePtr +xf86XVQueryOffscreenImages(ScreenPtr pScreen, int *num); + +extern _X_EXPORT XF86VideoAdaptorPtr xf86XVAllocateVideoAdaptorRec(ScrnInfoPtr + pScrn); + +extern _X_EXPORT void xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr); + +extern _X_EXPORT void + xf86XVFillKeyHelper(ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes); + +extern _X_EXPORT void + +xf86XVFillKeyHelperDrawable(DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes); + +extern _X_EXPORT Bool + +xf86XVClipVideoHelper(BoxPtr dst, + INT32 *xa, + INT32 *xb, + INT32 *ya, + INT32 *yb, RegionPtr reg, INT32 width, INT32 height); + +extern _X_EXPORT void + +xf86XVCopyYUV12ToPacked(const void *srcy, + const void *srcv, + const void *srcu, + void *dst, + int srcPitchy, + int srcPitchuv, int dstPitch, int h, int w); + +extern _X_EXPORT void + +xf86XVCopyPacked(const void *src, + void *dst, int srcPitch, int dstPitch, int h, int w); + +#endif /* _XF86XV_H_ */ diff --git a/prebuilt/xlibre/usr/include/xorg/xf86xvmc.h b/prebuilt/xlibre/usr/include/xorg/xf86xvmc.h new file mode 100644 index 0000000..20ed0ee --- /dev/null +++ b/prebuilt/xlibre/usr/include/xorg/xf86xvmc.h @@ -0,0 +1,142 @@ + +/* + * Copyright (c) 2001 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + +#ifndef _XF86XVMC_H +#define _XF86XVMC_H + +#include "xlibre_ptrtypes.h" +#include "xvmcext.h" +#include "xf86xv.h" + +typedef struct { + int num_xvimages; + int *xvimage_ids; /* reference the subpictures in the XF86MCAdaptorRec */ +} XF86MCImageIDList; + +typedef struct { + int surface_type_id; /* Driver generated. Must be unique on the port */ + int chroma_format; + int color_description; /* no longer used */ + unsigned short max_width; + unsigned short max_height; + unsigned short subpicture_max_width; + unsigned short subpicture_max_height; + int mc_type; + int flags; + XF86MCImageIDList *compatible_subpictures; /* can be null, if none */ +} XF86MCSurfaceInfoRec, *XF86MCSurfaceInfoPtr; + +/* + xf86XvMCCreateContextProc + + DIX will fill everything out in the context except the driver_priv. + The port_priv holds the private data specified for the port when + Xv was initialized by the driver. + The driver may store whatever it wants in driver_priv and edit + the width, height and flags. If the driver wants to return something + to the client it can allocate space in priv and specify the number + of 32 bit words in num_priv. This must be dynamically allocated + space because DIX will free it after it passes it to the client. +*/ + +typedef int (*xf86XvMCCreateContextProcPtr) (ScrnInfoPtr pScrn, + XvMCContextPtr context, + int *num_priv, CARD32 **priv); + +typedef void (*xf86XvMCDestroyContextProcPtr) (ScrnInfoPtr pScrn, + XvMCContextPtr context); + +/* + xf86XvMCCreateSurfaceProc + + DIX will fill everything out in the surface except the driver_priv. + The driver may store whatever it wants in driver_priv. The driver + may pass data back to the client in the same manner as the + xf86XvMCCreateContextProc. +*/ + +typedef int (*xf86XvMCCreateSurfaceProcPtr) (ScrnInfoPtr pScrn, + XvMCSurfacePtr surface, + int *num_priv, CARD32 **priv); + +typedef void (*xf86XvMCDestroySurfaceProcPtr) (ScrnInfoPtr pScrn, + XvMCSurfacePtr surface); + +/* + xf86XvMCCreateSubpictureProc + + DIX will fill everything out in the subpicture except the driver_priv, + num_palette_entries, entry_bytes and component_order. The driver may + store whatever it wants in driver_priv and edit the width and height. + If it is a paletted subpicture the driver needs to fill out the + num_palette_entries, entry_bytes and component_order. These are + not communicated to the client until the time the surface is + created. + + The driver may pass data back to the client in the same manner as the + xf86XvMCCreateContextProc. +*/ + +typedef int (*xf86XvMCCreateSubpictureProcPtr) (ScrnInfoPtr pScrn, + XvMCSubpicturePtr subpicture, + int *num_priv, CARD32 **priv); + +typedef void (*xf86XvMCDestroySubpictureProcPtr) (ScrnInfoPtr pScrn, + XvMCSubpicturePtr subpicture); + +typedef struct { + const char *name; + int num_surfaces; + XF86MCSurfaceInfoPtr *surfaces; + int num_subpictures; + XF86ImagePtr *subpictures; + xf86XvMCCreateContextProcPtr CreateContext; + xf86XvMCDestroyContextProcPtr DestroyContext; + xf86XvMCCreateSurfaceProcPtr CreateSurface; + xf86XvMCDestroySurfaceProcPtr DestroySurface; + xf86XvMCCreateSubpictureProcPtr CreateSubpicture; + xf86XvMCDestroySubpictureProcPtr DestroySubpicture; +} XF86MCAdaptorRec, *XF86MCAdaptorPtr; + +/* + xf86XvMCScreenInit + + Unlike Xv, the adaptor data is not copied from this structure. + This structure's data is used so it must stick around for the + life of the server. Note that it's an array of pointers not + an array of structures. +*/ + +extern _X_EXPORT Bool xf86XvMCScreenInit(ScreenPtr pScreen, + int num_adaptors, + XF86MCAdaptorPtr * adaptors); + +extern _X_EXPORT XF86MCAdaptorPtr xf86XvMCCreateAdaptorRec(void); +extern _X_EXPORT void xf86XvMCDestroyAdaptorRec(XF86MCAdaptorPtr adaptor); + +#endif /* _XF86XVMC_H */ diff --git a/prebuilt/xlibre/usr/include/xorg/xlibre-server.h b/prebuilt/xlibre/usr/include/xorg/xlibre-server.h index 28fb7b9..1fe280e 100644 --- a/prebuilt/xlibre/usr/include/xorg/xlibre-server.h +++ b/prebuilt/xlibre/usr/include/xorg/xlibre-server.h @@ -33,7 +33,7 @@ #define DRI3 1 /* Build GLX extension */ -#undef GLXEXT +#define GLXEXT 1 /* Support XDM-AUTH*-1 */ #define HASXDMAUTH 1 @@ -122,7 +122,7 @@ #define XORG_VERSION_CURRENT 12502000 /* Build Xv Extension */ -#undef XvExtension +#define XvExtension 1 /* Build XvMC Extension */ #undef XvMCExtension @@ -134,7 +134,7 @@ #define XTEST 1 /* Support Xv Extension */ -#undef XV +#define XV 1 /* BSD-compliant source */ /* #undef _BSD_SOURCE */ diff --git a/prebuilt/xlibre/usr/include/xorg/xorg-server.h b/prebuilt/xlibre/usr/include/xorg/xorg-server.h index 28fb7b9..1fe280e 100644 --- a/prebuilt/xlibre/usr/include/xorg/xorg-server.h +++ b/prebuilt/xlibre/usr/include/xorg/xorg-server.h @@ -33,7 +33,7 @@ #define DRI3 1 /* Build GLX extension */ -#undef GLXEXT +#define GLXEXT 1 /* Support XDM-AUTH*-1 */ #define HASXDMAUTH 1 @@ -122,7 +122,7 @@ #define XORG_VERSION_CURRENT 12502000 /* Build Xv Extension */ -#undef XvExtension +#define XvExtension 1 /* Build XvMC Extension */ #undef XvMCExtension @@ -134,7 +134,7 @@ #define XTEST 1 /* Support Xv Extension */ -#undef XV +#define XV 1 /* BSD-compliant source */ /* #undef _BSD_SOURCE */ diff --git a/prebuilt/xlibre/usr/lib/xorg/modules/xlibre-25/drivers/fbdev_drv.so b/prebuilt/xlibre/usr/lib/xorg/modules/xlibre-25/drivers/fbdev_drv.so index f01954b..2cbb18e 100755 Binary files a/prebuilt/xlibre/usr/lib/xorg/modules/xlibre-25/drivers/fbdev_drv.so and b/prebuilt/xlibre/usr/lib/xorg/modules/xlibre-25/drivers/fbdev_drv.so differ diff --git a/prebuilt/xlibre/usr/lib/xorg/modules/xlibre-25/drivers/modesetting_drv.so b/prebuilt/xlibre/usr/lib/xorg/modules/xlibre-25/drivers/modesetting_drv.so index bf5c65a..54c771d 100755 Binary files a/prebuilt/xlibre/usr/lib/xorg/modules/xlibre-25/drivers/modesetting_drv.so and b/prebuilt/xlibre/usr/lib/xorg/modules/xlibre-25/drivers/modesetting_drv.so differ diff --git a/prebuilt/xlibre/usr/lib/xorg/modules/xlibre-25/extensions/libglx.so b/prebuilt/xlibre/usr/lib/xorg/modules/xlibre-25/extensions/libglx.so new file mode 100755 index 0000000..ef83f51 Binary files /dev/null and b/prebuilt/xlibre/usr/lib/xorg/modules/xlibre-25/extensions/libglx.so differ diff --git a/prebuilt/xlibre/usr/lib/xorg/modules/xlibre-25/libglamoregl.so b/prebuilt/xlibre/usr/lib/xorg/modules/xlibre-25/libglamoregl.so new file mode 100755 index 0000000..d4e7974 Binary files /dev/null and b/prebuilt/xlibre/usr/lib/xorg/modules/xlibre-25/libglamoregl.so differ diff --git a/scripts/apply-bananarchy-overlay.sh b/scripts/apply-bananarchy-overlay.sh index 61b8847..7ac7b58 100755 --- a/scripts/apply-bananarchy-overlay.sh +++ b/scripts/apply-bananarchy-overlay.sh @@ -51,11 +51,17 @@ chmod 640 "$TARGET_ROOTFS/etc/doas.d/50-sxmo.conf" 2>/dev/null || true chown 0:0 "$TARGET_ROOTFS/usr/bin/sudo" "$TARGET_ROOTFS/usr/bin/doas" "$TARGET_ROOTFS/bin/su" 2>/dev/null || true chmod 4755 "$TARGET_ROOTFS/usr/bin/sudo" "$TARGET_ROOTFS/usr/bin/doas" "$TARGET_ROOTFS/bin/su" 2>/dev/null || true -echo "[2/4] Installing prebuilt QDSP6/Q6Voice kernel modules, torch LED module, camera module, and DTBs..." +echo "[2/4] Installing prebuilt QDSP6/Q6Voice kernel modules, Adreno 304 DRM module, torch LED module, camera module, and DTBs..." if [ -d "$TARGET_ROOTFS/lib/modules/6.12.1-msm8916/kernel/sound/soc/qcom/qdsp6" ]; then cp -af "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/qdsp6/"*.ko* \ "$TARGET_ROOTFS/lib/modules/6.12.1-msm8916/kernel/sound/soc/qcom/qdsp6/" fi +if [ -d "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/drm" ] && \ + [ -d "$TARGET_ROOTFS/lib/modules/6.12.1-msm8916/kernel/drivers/gpu/drm/msm" ]; then + rm -f "$TARGET_ROOTFS/lib/modules/6.12.1-msm8916/kernel/drivers/gpu/drm/msm/msm.ko" + cp -af "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/drm/msm.ko.zst" \ + "$TARGET_ROOTFS/lib/modules/6.12.1-msm8916/kernel/drivers/gpu/drm/msm/msm.ko.zst" +fi if [ -d "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/leds" ] && \ [ -d "$TARGET_ROOTFS/lib/modules/6.12.1-msm8916/kernel/drivers/leds" ]; then cp -af "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/leds/"*.ko* \ @@ -86,6 +92,31 @@ fi cp -af "$BASE_DIR/prebuilt/fcitx5-t9/usr/." "$TARGET_ROOTFS/usr/" cp -af "$BASE_DIR/prebuilt/bantam/bantam" "$TARGET_ROOTFS/usr/bin/bantam" cp -af "$BASE_DIR/prebuilt/bantam/bantam" "$TARGET_ROOTFS/usr/local/bin/bantam" +python3 - "$TARGET_ROOTFS" <<'PYEOF' +import glob, os, struct, sys + +rootfs = sys.argv[1] +for path in glob.glob(os.path.join(rootfs, "usr/lib/libgallium-*.so")): + if os.path.islink(path): + continue + with open(path, "rb") as f: + data = bytearray(f.read()) + changed = False + str_off = data.find(b"FD305B\x00") + if str_off != -1: + data[str_off:str_off + 7] = b"FD304\x00\x00" + changed = True + rec_old = struct.pack("/dev/null; then + echo "[2b/5] Applying Adreno 304 GPU and MSM8909 IOMMU/GPU DT patch..." + patch -p1 < /bananarchy/patches/kernel/0003-msm8909-adreno-304-gpu-support.patch + fi if [ ! -f include/config/auto.conf ]; then echo "[3/5] Preparing kernel configuration..." cp /bananarchy/patches/kernel/config-bananarchy-msm8909.armv7 .config @@ -85,6 +89,7 @@ EOF echo "[2/5] Applying Bananarchy QDSP6/Q6Voice and MSM8905/MSM8909 DTS patches..." patch -p1 < /bananarchy/patches/kernel/0001-msm8909-qdsp6-voice-sound-nokia-argon-6.12.patch + patch -p1 < /bananarchy/patches/kernel/0003-msm8909-adreno-304-gpu-support.patch echo "[3/5] Preparing kernel configuration and Module.symvers..." cp /bananarchy/patches/kernel/config-bananarchy-msm8909.armv7 .config @@ -92,9 +97,11 @@ EOF make ARCH=arm CROSS_COMPILE=armv7-alpine-linux-musleabihf- modules_prepare fi - echo "[4/5] Building QDSP6/Q6Voice sound modules, torch LED module, camera module, and Nokia MSM8905/MSM8909 DTBs..." + echo "[4/5] Building QDSP6/Q6Voice sound modules, Adreno 304 DRM module, torch LED module, camera module, and Nokia MSM8905/MSM8909 DTBs..." make ARCH=arm CROSS_COMPILE=armv7-alpine-linux-musleabihf- -j"$(nproc)" \ KBUILD_MODPOST_WARN=1 M=sound/soc/qcom/qdsp6 modules + make ARCH=arm CROSS_COMPILE=armv7-alpine-linux-musleabihf- -j"$(nproc)" \ + KBUILD_MODPOST_WARN=1 M=drivers/gpu/drm/msm modules make ARCH=arm CROSS_COMPILE=armv7-alpine-linux-musleabihf- -j"$(nproc)" \ KBUILD_MODPOST_WARN=1 M=/bananarchy/src/leds-msm8905-torch modules make ARCH=arm CROSS_COMPILE=armv7-alpine-linux-musleabihf- -j"$(nproc)" \ @@ -106,20 +113,24 @@ EOF echo "[5/5] Exporting built modules and DTBs to prebuilt/kernel-6.12.1-msm8916..." mkdir -p /bananarchy/prebuilt/kernel-6.12.1-msm8916/qdsp6 \ + /bananarchy/prebuilt/kernel-6.12.1-msm8916/drm \ /bananarchy/prebuilt/kernel-6.12.1-msm8916/leds \ /bananarchy/prebuilt/kernel-6.12.1-msm8916/camera \ /bananarchy/prebuilt/kernel-6.12.1-msm8916/dtbs cp -a sound/soc/qcom/qdsp6/*.ko /bananarchy/prebuilt/kernel-6.12.1-msm8916/qdsp6/ + cp -a drivers/gpu/drm/msm/msm.ko /bananarchy/prebuilt/kernel-6.12.1-msm8916/drm/ cp -a /bananarchy/src/leds-msm8905-torch/leds-msm8905-torch.ko \ /bananarchy/prebuilt/kernel-6.12.1-msm8916/leds/ cp -a /bananarchy/src/msm8905-cam/msm8905-cam.ko \ /bananarchy/prebuilt/kernel-6.12.1-msm8916/camera/ armv7-alpine-linux-musleabihf-strip --strip-unneeded \ /bananarchy/prebuilt/kernel-6.12.1-msm8916/qdsp6/*.ko \ + /bananarchy/prebuilt/kernel-6.12.1-msm8916/drm/*.ko \ /bananarchy/prebuilt/kernel-6.12.1-msm8916/leds/*.ko \ /bananarchy/prebuilt/kernel-6.12.1-msm8916/camera/*.ko for ko in \ /bananarchy/prebuilt/kernel-6.12.1-msm8916/qdsp6/*.ko \ + /bananarchy/prebuilt/kernel-6.12.1-msm8916/drm/*.ko \ /bananarchy/prebuilt/kernel-6.12.1-msm8916/leds/*.ko \ /bananarchy/prebuilt/kernel-6.12.1-msm8916/camera/*.ko; do zstd -f -q -k "$ko" -o "${ko}.zst" diff --git a/scripts/build-xlibre.sh b/scripts/build-xlibre.sh index d983e89..af2878b 100755 --- a/scripts/build-xlibre.sh +++ b/scripts/build-xlibre.sh @@ -69,6 +69,7 @@ EOF libxau-dev \ libxcvt-dev \ libdrm-dev \ + libepoxy-dev \ mesa-dev \ eudev-dev \ dbus-dev \ @@ -103,7 +104,7 @@ endian = '\''little'\'' EOF ABI_MOD_DIR="/usr/lib/xorg/modules/xlibre-25" - if [ "${FORCE_REBUILD:-0}" = "1" ] || [ ! -f /bananarchy/prebuilt/xlibre/usr/bin/Xorg ] || ! grep -q "continuing in shared VT mode" /bananarchy/prebuilt/xlibre/usr/bin/Xorg 2>/dev/null; then + if [ "${FORCE_REBUILD:-0}" = "1" ] || [ ! -f /bananarchy/prebuilt/xlibre/usr/bin/Xorg ] || [ ! -f "/bananarchy/prebuilt/xlibre$ABI_MOD_DIR/extensions/libglx.so" ] || [ ! -f "/bananarchy/prebuilt/xlibre$ABI_MOD_DIR/libglamoregl.so" ] || ! grep -q "continuing in shared VT mode" /bananarchy/prebuilt/xlibre/usr/bin/Xorg 2>/dev/null; then echo "[3/5] Configuring and compiling Xlibre (X11Libre/xserver) for armv7..." rm -rf /tmp/build-xlibre meson setup /tmp/build-xlibre "$XLIBRE_SRC" \ @@ -116,8 +117,8 @@ EOF --buildtype=release \ -Dxorg=true \ -Dxorg-sdk=true \ - -Dglamor=false \ - -Dglx=false \ + -Dglamor=true \ + -Dglx=true \ -Ddri1=false \ -Ddri2=true \ -Ddri3=true \ @@ -132,7 +133,7 @@ EOF -Dvgahw=false \ -Dint10=false \ -Ddga=false \ - -Dxv=false \ + -Dxv=true \ -Dxvmc=false \ -Dxephyr=false \ -Dxnest=false \ @@ -173,8 +174,8 @@ EOF --buildtype=release \ -Dxorg=true \ -Dxorg-sdk=true \ - -Dglamor=false \ - -Dglx=false \ + -Dglamor=true \ + -Dglx=true \ -Ddri1=false \ -Ddri2=true \ -Ddri3=true \ @@ -189,7 +190,7 @@ EOF -Dvgahw=false \ -Dint10=false \ -Ddga=false \ - -Dxv=false \ + -Dxv=true \ -Dxvmc=false \ -Dxephyr=false \ -Dxnest=false \