Skip to content

Latest commit

 

History

History
45 lines (34 loc) · 2.17 KB

File metadata and controls

45 lines (34 loc) · 2.17 KB

XDisplay Architecture

XDisplay is a high-performance cross-platform virtual display solution designed for extremely low-latency desktop extension to Android devices.

High-Level Overview

graph TD
    subgraph Host [Linux Host - Rust]
        EVDI[EVDI Kernel Module] --> |Virtual Display| DRM[DRM Device]
        DRM --> Capture[Screen Capture]
        Capture --> Encoder[H.264 Hardware Encoder]
        Encoder --> Transport[UDP/USB Transport]
    end

    subgraph Client [Android Client - Kotlin/Rust]
        Transport --> |Network| Reassembly[Native Reassembly]
        Reassembly --> MediaCodec[NDK MediaCodec]
        MediaCodec --> Surface[Surface Rendering]
    end

    Input[Touch/Keyboard] -.-> |Feedback Loop| Transport
Loading

Core Components

1. Virtual Display (EVDI)

XDisplay utilizes the EVDI (Extensible Virtual Display Interface) kernel module to create virtual DRM devices. This allows Linux to treat the Android device as a real second monitor, complete with resolution switching and workspace management.

2. Encoder Path

The host application captures frames from the EVDI buffer and pipes them through xd-encoder. It targets H.264 (AVC) exclusively to ensure compatibility with Android hardware decoders. Raw pixel streaming is avoided to preserve bandwidth and reduce jitter.

3. Transport Layer (xd-transport)

  • UDP: Primary wireless transport. Implements a custom fragmentation and reassembly protocol optimized for real-time video (drops old frames instead of retrying).
  • USB (ADB): High-stability wired transport. Uses ADB port forwarding to tunnel traffic with minimal overhead.

4. Native Android Client

The client uses a hybrid architecture:

  • Rust (NDK): Handles high-frequency network packets and interacts directly with the Android MediaCodec C API. This bypasses Java overhead for frame queuing, achieving sub-16ms latency.
  • Kotlin (Compose): Manages the discovery UI, connection state, and provides a Java-based decoder fallback for maximum compatibility.

Security

  • All communication is designed for local networks.
  • No cloud dependencies; data stays on your local hardware.
  • Source code is open under AGPLv3.