Skip to content

Conversation

@sodiboo
Copy link
Contributor

@sodiboo sodiboo commented Aug 31, 2024

Fixes #539. cc @yuu-fur who originally brought this issue to my attention, he might find this interesting.

I don't really know what i'm doing here. Frame callbacks are confusing. But this looks entirely reasonable to my eyes, and i've tested it on my own system and it seems to work.

src/niri.rs Outdated
Comment on lines -3178 to -3182

// FIXME: when a window is hidden, it should probably still receive frame callbacks
// and get rendered for screen cast. This is currently
// unimplemented, but happens to work by chance, since output
// redrawing is more eager than it should be.
Copy link
Owner

Choose a reason for hiding this comment

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

So, this comment should not be removed, it still stands. What this PR does is sends frame callbacks to off-screen windows, which makes them commit a new buffer. Which currently makes niri always redraw the output and hence render a new frame for a screencast. However, ideally niri shouldn't redraw the output if the window that committed a new buffer is fully off-screen. I will at some point add that optimization, which will once again stop off-screen windows from rendering for screencasts (or receiving frame callbacks from this PR for that matter), until this is fixed in a different way.

output,
frame_callback_time,
FRAME_CALLBACK_THROTTLE,
|_, _| Some(output.clone()),
Copy link
Owner

Choose a reason for hiding this comment

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

I think instead of being a separate function, this cast check should be integrated into send_frame_callbacks() where it should be part of the if current_primary_output.as_ref() != Some(output) check. The stuff in send_frame_callbacks() does throttling to at most one frame callback per output refresh; without it windows will busy-loop frame callbacks (especially so off-screen windows, which is the primary case here).

@nukdokplex
Copy link

Are there any updates on this?

@YaLTeR
Copy link
Owner

YaLTeR commented Sep 19, 2025

no

@sodiboo
Copy link
Contributor Author

sodiboo commented Sep 19, 2025

there was review feedback and then I didn't respond and then I kinda forgot. that's the update lol. waiting on me to do literally anything i guess

@YaLTeR
Copy link
Owner

YaLTeR commented Sep 19, 2025

More like this isn't really a proper fix so it's back to waiting for me to sometime in the future do a proper fix or something

@raum-dellamorte
Copy link

A render-offscreen window rule might be a good solution. I suffer from being a VTuber, and I do apologise for that, but if I could make a window rule for VSeeFace to always render as if it were visible, that would reduce my suffering. It currently works as a floating window, which is not ideal.

In my head, a window rule would be easier than keeping track of windows that OBS or any other program is watching, but I've not looked at the code. How many windows could one need to maintain a normal refresh rate offscreen? (Never ask questions like that, ppl take it as a challenge)

@YaLTeR
Copy link
Owner

YaLTeR commented Sep 27, 2025

A render-offscreen window rule might be a good solution.

It would require the exact same solution as just fixing this for window screencasts would require

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.

Off-screen windows are not refreshed for screencasts

4 participants