Skip to content

MUI: portduino SDL support for Linux/Windows - #11121

Draft
mverch67 wants to merge 21 commits into
developfrom
sdl-support-windows
Draft

MUI: portduino SDL support for Linux/Windows#11121
mverch67 wants to merge 21 commits into
developfrom
sdl-support-windows

Conversation

@mverch67

@mverch67 mverch67 commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

This PR adds support for SDL for Linux+Windows (replaces #11090)

Note: requires device-ui PR#227 and patched lvgl 9.5.0

🤝 Attestations

  • I have tested that my proposed changes behave as described.
  • I have tested that my proposed changes do not cause any obvious regressions on the following devices:
    • Heltec (Lora32) V3
    • LilyGo T-Deck
    • LilyGo T-Beam
    • RAK WisBlock 4631
    • Seeed Studio T-1000E tracker card
    • Other (please specify below)
      • native linux
      • native Windows

Summary by CodeRabbit

  • New Features

    • Added configurable display zoom for Portduino setups, including save/load support in the display configuration.
    • Expanded native display support to better handle SDL rendering, including Windows build configurations.
  • Bug Fixes

    • Improved Portduino display initialization and display task startup to ensure the screen is brought up correctly.
    • Refined SDL/TFT rendering logic so the correct rendering path is used when the corresponding display options are enabled.

@mverch67 mverch67 added the enhancement New feature or request label Jul 21, 2026
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 4c789c09-7b49-4e79-841a-a9909f89900b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Portduino display handling now supports runtime SDL selection, thread-local screen initialization, and YAML-configured zoom. Native TFT and Windows environments receive SDL build dependencies and flags, while the device UI dependency is updated to a newer archived revision.

Changes

Portduino display integration

Layer / File(s) Summary
Display configuration and YAML support
src/platform/portduino/PortduinoGlue.*
Adds displayZoom, loads Display.Zoom, and emits it when non-default.
Runtime display initialization
src/graphics/tftSetup.cpp, src/main.cpp
Adds runtime SDL/X11/framebuffer selection and initializes deviceScreen from the Portduino display thread.
Native SDL build integration
variants/native/portduino/platformio.ini, platformio.ini
Enables SDL-related native build settings, installs SDL2 for Windows, adjusts library handling, and updates the device UI dependency.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant tftSetup
  participant DisplayThread
  participant deviceScreen
  participant PacketClient
  participant tft_task_handler
  tftSetup->>DisplayThread: start tft_thread_entry()
  DisplayThread->>deviceScreen: init(new PacketClient)
  deviceScreen->>PacketClient: create packet client
  DisplayThread->>tft_task_handler: run display task handler
Loading

Possibly related PRs

Suggested labels: dependencies

Suggested reviewers: jp-bennett, thebentern, vidplace7

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: SDL support for native Linux and Windows.
Description check ✅ Passed The description includes a summary, dependency note, and completed testing attestations for native Linux and Windows.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sdl-support-windows

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

⚡ Try this PR in the Web Flasher

Flash this PR in the Web Flasher

firmware commit boards expires

Warning

This is an automated, unreviewed CI test build. Back up your device configuration
before flashing, and only flash devices you are able to recover.

Supported boards built by this PR (31)
Device Board Platform
Crowpanel Adv 3.5 TFT elecrow-adv-35-tft esp32-s3
Heltec HT62 heltec-ht62-esp32c3-sx1262 esp32-c3
Heltec Mesh Node 096 heltec-mesh-node-t096 nrf52840
Heltec Mesh Node T1 heltec-mesh-node-t1 nrf52840
Heltec Mesh Node T114 heltec-mesh-node-t114 nrf52840
Heltec V3 heltec-v3 esp32-s3
Heltec V4 heltec-v4 esp32-s3
Meshnology W10 meshnology_w10 esp32-s3
Meshnology W12 meshnology_w12 esp32-s3
Raspberry Pi Pico pico rp2040
Raspberry Pi Pico W picow rp2040
RAK WisMesh Pocket V3 rak_wismesh_pocket nrf52840
RAK WisMesh Pod rak_wismesh_pod nrf52840
RAK WisMesh Repeater Mini V2 rak_wismesh_repeater_mini nrf52840
RAK WisMesh Tag rak_wismeshtag nrf52840
RAK WisBlock 11200 rak11200 esp32
RAK WisBlock 11310 rak11310 rp2040
RAK3312 rak3312 esp32-s3
RAK WisBlock 4631 rak4631 nrf52840
Seeed SenseCAP Mesh-Tracker-X1 seeed_mesh_tracker_X1 nrf52840
Seeed Wio Tracker L1 seeed_wio_tracker_L1 nrf52840
Seeed Xiao NRF52840 Kit seeed_xiao_nrf52840_kit nrf52840
Seeed Xiao ESP32-S3 seeed-xiao-s3 esp32-s3
Station G2 station-g2 esp32-s3
Station G3 station-g3 esp32-s3
LILYGO T-Deck t-deck-tft esp32-s3
LILYGO T-Echo t-echo nrf52840
LILYGO T-Echo Plus t-echo-plus nrf52840
LILYGO T-Impulse Plus t-impulse-plus nrf52840
LilyGo T3-C6 tlora-c6 esp32-c6
Seeed SenseCAP T1000-E tracker-t1000-e nrf52840

Build artifacts expire on 2026-08-24. Updated for 262e28b.

@mverch67
mverch67 marked this pull request as ready for review July 23, 2026 18:14

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/graphics/tftSetup.cpp (1)

42-47: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use camelCase for the new thread entry point.

Rename tft_thread_entry to tftThreadEntry and update its call site. As per coding guidelines, C++ functions and members use camelCase.

Suggested rename
-void tft_thread_entry(void)
+void tftThreadEntry(void)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/graphics/tftSetup.cpp` around lines 42 - 47, Rename the thread entry
function tft_thread_entry to tftThreadEntry and update every call site to use
the new camelCase name, preserving its existing behavior.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/graphics/tftSetup.cpp`:
- Around line 59-60: Handle the HUB75/hub75 panel selection before the fallback
lookup into panels, since its enum value is outside the panels array range.
Update the panel-selection logic around the panels array to return or process
the HUB75-specific path directly, while preserving indexed lookup for the
existing panel values.

In `@variants/native/portduino/platformio.ini`:
- Around line 310-327: Update the Windows build environment configuration around
HAS_TFT and USE_SDL so it no longer simultaneously defines HAS_SCREEN=0 or
MESHTASTIC_EXCLUDE_SCREEN=1 and no longer excludes Panel_sdl.cpp or
TFTDisplay.cpp. Preserve the intended SDL/MUI display build behavior and clarify
the configuration only if the environment is meant to remain headless.

---

Nitpick comments:
In `@src/graphics/tftSetup.cpp`:
- Around line 42-47: Rename the thread entry function tft_thread_entry to
tftThreadEntry and update every call site to use the new camelCase name,
preserving its existing behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ad520ca7-be95-49a4-8510-82ad05d35089

📥 Commits

Reviewing files that changed from the base of the PR and between d0d029c and 7535014.

📒 Files selected for processing (6)
  • platformio.ini
  • src/graphics/tftSetup.cpp
  • src/main.cpp
  • src/platform/portduino/PortduinoGlue.cpp
  • src/platform/portduino/PortduinoGlue.h
  • variants/native/portduino/platformio.ini

Comment thread src/graphics/tftSetup.cpp Outdated
Comment on lines 59 to 60
static char *panels[] = {"NOSCREEN", "X11", "SDL", "FB", "ST7789", "ST7735", "ST7735S",
"ST7796", "ILI9341", "ILI9342", "ILI9486", "ILI9488", "HX8357D"};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win

Handle hub75 before indexing panels.

hub75 is enum index 13, but panels[] ends at index 12. A valid Display.Panel: HUB75 configuration therefore performs an out-of-bounds lookup in the fallback branch.

Suggested fix
-                                 "ST7796",   "ILI9341", "ILI9342", "ILI9486", "ILI9488", "HX8357D"};
+                                 "ST7796",   "ILI9341", "ILI9342", "ILI9486", "ILI9488", "HX8357D", "HUB75"};
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
static char *panels[] = {"NOSCREEN", "X11", "SDL", "FB", "ST7789", "ST7735", "ST7735S",
"ST7796", "ILI9341", "ILI9342", "ILI9486", "ILI9488", "HX8357D"};
static char *panels[] = {"NOSCREEN", "X11", "SDL", "FB", "ST7789", "ST7735", "ST7735S",
"ST7796", "ILI9341", "ILI9342", "ILI9486", "ILI9488", "HX8357D", "HUB75"};
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/graphics/tftSetup.cpp` around lines 59 - 60, Handle the HUB75/hub75 panel
selection before the fallback lookup into panels, since its enum value is
outside the panels array range. Update the panel-selection logic around the
panels array to return or process the HUB75-specific path directly, while
preserving indexed lookup for the existing panel values.

Comment thread variants/native/portduino/platformio.ini
@mverch67
mverch67 marked this pull request as draft July 25, 2026 07:08
@mverch67

mverch67 commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator Author

Converted to draft as lvgl 9.5.0 crashes (needs someone with a smarter AI model to throw at lv_draw_sdl.c)

@coderabbitai coderabbitai Bot mentioned this pull request Jul 25, 2026
12 tasks
@mverch67

Copy link
Copy Markdown
Collaborator Author
Screenshot From 2026-07-25 19-04-59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant