Skip to content

Prefer GPU-backed receiver rendering#56

Open
DrDavidL wants to merge 2 commits into
swellweb:mainfrom
DrDavidL:codex/prefer-receiver-gpu
Open

Prefer GPU-backed receiver rendering#56
DrDavidL wants to merge 2 commits into
swellweb:mainfrom
DrDavidL:codex/prefer-receiver-gpu

Conversation

@DrDavidL
Copy link
Copy Markdown
Contributor

Summary

  • prefer SDL's Metal renderer on macOS, with OpenGL/default accelerated fallback
  • allow TB_RECEIVER_RENDER_DRIVER to force a renderer for troubleshooting
  • prevent the active receiver loop from busy-spinning when the nonblocking socket has no data

Validation

  • Built receiver bundle locally with PATH=/opt/homebrew/bin:/usr/local/bin:$PATH TargetBridge-Receiver/scripts/build_tbreceiver_c_app.sh
  • Local bundle: build/TargetBridge Receiver.app

Notes

  • Local bundle was built on Apple Silicon and is arm64. Needs Intel iMac build/test before marking ready.

@DrDavidL DrDavidL marked this pull request as ready for review May 23, 2026 05:34
@ThomasWaldmann
Copy link
Copy Markdown
Contributor

ThomasWaldmann commented May 23, 2026

What about #11 and #12?

I tested the code (using defaults, no env var set):

Both: connected via TB cable, same receiver binary (code from this PR), extended display at 5K.

Intel iMac 5K 27" 2020, Tahoe 26.5

Colours are off, flickers all the time (especially, but not only, when moving the mouse cursor). This PR would basically revert my fix from #12 "by default".

Intel iMac 5K 27" 2017, Ventura 13.7.8

Interesting: I don't see flickering there, colours are ok.

So guess it is either a hw bug in the 2020 model or a Tahoe bug.

@ThomasWaldmann
Copy link
Copy Markdown
Contributor

The busy-spin fix seems to be out of scope of this PR, maybe it would be simpler to have it in a separate PR.

@swellweb
Copy link
Copy Markdown
Owner

I think it's bettere separate the fix in another branch but not for this version but for the coming soon versione with netlink.

@DrDavidL
Copy link
Copy Markdown
Contributor Author

No problem. Thanks for testing. Works fine on my 2019 iMac! I'll try to keep pace with main updates for future consideration.

@DrDavidL
Copy link
Copy Markdown
Contributor Author

Rebased on latest main (b916f1dbb457f3). Standing by for the additional update you mentioned before merging.

@swellweb
Copy link
Copy Markdown
Owner

Thanks again for this PR — I've now pulled the safe parts of it into our current feature/languages branch.

What I kept:

  • renderer override support via TB_RECEIVER_RENDER_DRIVER
  • a more robust accelerated renderer selection path
  • the socket busy-spin fix / idle yield improvement in the receiver loop

What I intentionally did not keep as-is is preferring Metal by default on macOS.
Thomas' testing on the 2020 5K iMac + Tahoe 26.5 showed flicker / wrong colours there, so I kept the default order conservative:

  • opengl first
  • metal as fallback
  • explicit override still possible via TB_RECEIVER_RENDER_DRIVER=metal

So the idea from this PR is definitely useful, but I'm integrating it in a way that preserves the safer Tahoe behaviour by default.

If you want, we can later still split the renderer/backend tuning into a smaller dedicated PR once we have more hardware-specific data.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants