Skip to content

fix(linux/wlgrab): add frame_timestamp using wayland's ready timestamp#4787

Merged
ReenigneArcher merged 3 commits intoLizardByte:masterfrom
andygrundman:andyg.linux-wlgrab-timestamp
Mar 7, 2026
Merged

fix(linux/wlgrab): add frame_timestamp using wayland's ready timestamp#4787
ReenigneArcher merged 3 commits intoLizardByte:masterfrom
andygrundman:andyg.linux-wlgrab-timestamp

Conversation

@andygrundman
Copy link
Contributor

@andygrundman andygrundman commented Feb 27, 2026

Description

This PR adds frame_timestamp to the wlgrab backend, used with headless Wayland. The timestamp comes from Wayland's ready callback, which I think is the best place to take it from. I also added framerateX100 support since it's very simple.

I also wanted to make the logs a bit easier to understand across all the various Wayland code, so I added prefixes to all the logging. I also removed a couple logs from very hot callbacks.

I'll submit a future PR for wlgrab to ignore duplicate frames for variable fps.

Screenshot

Issues Fixed or Closed

Roadmap Issues

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Unit tests have been added or updated for any new or modified functionality

AI Usage

  • None: No AI tools were used in creating this PR
  • Light: AI provided minor assistance (formatting, simple suggestions)
  • Moderate: AI helped with code generation or debugging specific parts
  • Heavy: AI generated most or all of the code changes

@andygrundman
Copy link
Contributor Author

cc @psyke83 Have you ever used the wlgrab backend?

ReenigneArcher
ReenigneArcher previously approved these changes Feb 28, 2026

if (!display_name) {
BOOST_LOG(error) << "Environment variable WAYLAND_DISPLAY has not been defined"sv;
BOOST_LOG(error) << "[wayland] Environment variable WAYLAND_DISPLAY has not been defined"sv;
Copy link
Member

Choose a reason for hiding this comment

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

I like this pattern. It would be nice if we could automatically include the source file and line number from where a log message was initiated. I don't know how hard it would be to implement in Sunshine, but I did something similar in our python discord bot recently.

2026-02-27 23:14:42 - src.common.database - [database.py:321] - INFO - Committed changes to git data repository
2026-02-27 23:14:43 - src.common.database - [database.py:329] - INFO - Pushed changes to remote git data repository
2026-02-27 23:18:58 - src.common.webapp - [webapp.py:297] - INFO - received webhook from github_status
2026-02-27 23:18:58 - src.common.webapp - [webapp.py:299] - INFO - received webhook data: 

In any event, it would be nice to have the capture method as a prefix for all the capture methods, whether on Linux, Windows, or macOS (even though there's only one on macOS right now).

@psyke83
Copy link
Contributor

psyke83 commented Mar 2, 2026

cc @psyke83 Have you ever used the wlgrab backend?

Unfortunately not. I only have KDE and GNOME set up on my host (which is actually headless, making it a bit awkward to set up a new DE from scratch).

@codecov
Copy link

codecov bot commented Mar 7, 2026

Bundle Report

Bundle size has no change ✅

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 7, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
3.1% Duplication on New Code (required ≤ 2%)
2 Duplicated Blocks on New Code (required ≤ 0)

See analysis details on SonarQube Cloud

@codecov
Copy link

codecov bot commented Mar 7, 2026

Codecov Report

❌ Patch coverage is 0% with 58 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (master@e776b65). Learn more about missing BASE report.
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/platform/linux/wlgrab.cpp 0.00% 10 Missing and 20 partials ⚠️
src/platform/linux/wayland.cpp 0.00% 5 Missing and 23 partials ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master    #4787   +/-   ##
=========================================
  Coverage          ?   16.75%           
=========================================
  Files             ?      106           
  Lines             ?    21761           
  Branches          ?     9736           
=========================================
  Hits              ?     3647           
  Misses            ?    14296           
  Partials          ?     3818           
Flag Coverage Δ
Archlinux 11.05% <0.00%> (?)
FreeBSD-14.3-amd64 13.06% <0.00%> (?)
Homebrew-ubuntu-22.04 13.26% <0.00%> (?)
Linux-AppImage 11.47% <0.00%> (?)
Windows-AMD64 13.43% <ø> (?)
Windows-ARM64 12.34% <ø> (?)
macOS-arm64 16.96% <ø> (?)
macOS-x86_64 15.53% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/platform/linux/wayland.h 0.00% <ø> (ø)
src/platform/linux/wayland.cpp 2.98% <0.00%> (ø)
src/platform/linux/wlgrab.cpp 0.00% <0.00%> (ø)

@ReenigneArcher ReenigneArcher merged commit 76c3463 into LizardByte:master Mar 7, 2026
72 of 73 checks passed
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