Skip to content

Conversation

@gulafaran
Copy link
Contributor

@gulafaran gulafaran commented Aug 16, 2025

instead of storing used async bufs in the renderer and dropping them on the first monitor pageflip, store them per monitor and drop on the monitors pageflip.

problem before was the first monitor could be dropping the second monitors surfaces before it had even rendered them causing glitches. especially noticeable on dual gpu laptop and external monitor.

move surface frames to CSurfaceManager aswell and schedule them for scanout, and make third pending frame call it aswell in new_render_scheduling.

#TODO

  • ensure the new_render_scheduler actually works as intended
  • test toplevel export

fixes: #12181
maybe: #10979

Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

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

yes, but we need a cross-monitor solution too...

I propose to make a manager like CBufferReleaseManager that has:

  • ::add(surf, mon)
  • ::drop(mon)

Each surface stored gets a state with a std::vector<PHLMONITORREF> and it gets dropped once that vec has either 0 elements or all elements are null or disabled (in case of a monitor disconnect)

@gulafaran
Copy link
Contributor Author

yes, but we need a cross-monitor solution too...

I propose to make a manager like CBufferReleaseManager that has:

* `::add(surf, mon)`

* `::drop(mon)`

Each surface stored gets a state with a std::vector<PHLMONITORREF> and it gets dropped once that vec has either 0 elements or all elements are null or disabled (in case of a monitor disconnect)

can be a way to deal with surfaces showing on more then one monitor yes, should buffers even be dropped if the rendermode isnt RENDER_MODE_NORMAL?

@vaxerski
Copy link
Member

vaxerski commented Aug 16, 2025

can be a way to deal with surfaces showing on more then one monitor yes, should buffers even be dropped if the rendermode isnt RENDER_MODE_NORMAL?

uhh... in general no, but there is toplevel export, which doesn't use NORMAL, and should drop to avoid the window going stale... It already uses a flag there blockSurfaceFeedback iirc, you could use that. If the feedback isnt blocked, add it to be dropped

@gulafaran
Copy link
Contributor Author

@vaxerski did some pseudo thing here. it breaks DS here but rest seems fine. and im a bit unsure if on that visible check and also the CHLBufferReference implentation, is it like a shared pointer or do the monitors just end up with 2 different local ones so the syncreleasers are seperate and doesnt actually merge the fences of both, but just keeps them seperate one per monitor.

but this is in general is the idea that should probably be done. to get buffer releases somewhat right. new_render_shed i got no clue if it broke even further. it already was here heh

@gulafaran
Copy link
Contributor Author

@vaxerski ok got buffer releases working without breaking DS or OBS now. i still dont know how to proceed with new_render_shed tho since its all sorts of wonky even before

@gulafaran
Copy link
Contributor Author

@Zebra2711 wanna test this now? i still have to figure out if there can be something done on laptops tho, seems now its blitting a lot more making it actually slower on new_render_shed when having dualgpu/external monitor tho

@gulafaran
Copy link
Contributor Author

@outfoxxed seeing you had various stall/lag issues would be neat if you could test aswell.

what i do know is DS might require some finicking now that commitpendinganddoexplicit is called on new_render_scheduling while it isnt on setting it false.

@Zebra2711
Copy link
Contributor

@Zebra2711 wanna test this now? i still have to figure out if there can be something done on laptops tho, seems now its blitting a lot more making it actually slower on new_render_shed when having dualgpu/external monitor tho

It hit my performance so hard, my hyprland on the iGPU couldn't get more than 60 fps with or without new_render_scheduling enabled

@gulafaran
Copy link
Contributor Author

@Zebra2711 wanna test this now? i still have to figure out if there can be something done on laptops tho, seems now its blitting a lot more making it actually slower on new_render_shed when having dualgpu/external monitor tho

It hit my performance so hard, my hyprland on the iGPU couldn't get more than 60 fps with or without new_render_scheduling enabled

Lol wat in what? I finally got overlay showing 240 + 160 here and cs2 200+ on external

@gulafaran
Copy link
Contributor Author

@Zebra2711 wanna test this now? i still have to figure out if there can be something done on laptops tho, seems now its blitting a lot more making it actually slower on new_render_shed when having dualgpu/external monitor tho

It hit my performance so hard, my hyprland on the iGPU couldn't get more than 60 fps with or without new_render_scheduling enabled

unless ofc you just measured something that is vsynced, glxgears is normally. i dont think it has been correct before. hyprland pushes like 100fps if i crunch hard on the gpu before glxgears would still report 240., well if we are pageflipping at 100fps we cant exactly render glxgears at 240.

@Zebra2711
Copy link
Contributor

Lol wat in what? I finally got overlay showing 240 + 160 here and cs2 200+ on external

idk, my hyprland build with #11000, #11087, #11228, and #11216, and your old closed PR #11303, with new_render_scheduling=true when started. Everything is extremely smooth 🙃

@gulafaran
Copy link
Contributor Author

Lol wat in what? I finally got overlay showing 240 + 160 here and cs2 200+ on external

idk, my hyprland build with #11000, #11087, #11228, and #11216, and your old closed PR #11303, with new_render_scheduling=true when started. Everything is extremely smooth 🙃

yeah because its kinda cheating, two monitors? if so if any monitor pageflips its dropping the buffer no matter if the second monitor is still rendering it. only reason it didnt artifact or break is because clients mostly double or more buffer. so they begin working on another and once they reuse the dropped one if they do. its work is done luckily enough.

i mean turn on debug:overlay = true, and see the fps. the overlay comes with its own cost so it drops a bit too but. and then run glxgears, if it isnt matching something is very off in my mind

@gulafaran
Copy link
Contributor Author

new_render_sched also hits the blitting harder in AQ if this is a dual gpu thing. and its very slow sadly, needs some work.

@gulafaran
Copy link
Contributor Author

gulafaran commented Aug 20, 2025

started. Everything is extremely

what setup is it, dual gpu? dual monitors?

@Zebra2711
Copy link
Contributor

ok, I built hyprland with #11000, #11087, #11228, and #11216. This MR seems to be performant, close to #11303, and I tested it with glxgears.
186xx fps (#11303) vs 172xx fps this MR. debug:overlay = false

what setup is it, dual gpu? dual monitors?

intel igpu + nvidia gpu and no external display

@gulafaran
Copy link
Contributor Author

gulafaran commented Aug 21, 2025

ok, I built hyprland with #11000, #11087, #11228, and #11216. This MR seems to be performant, close to #11303, and I tested it with glxgears. 186xx fps (#11303) vs 172xx fps this MR. debug:overlay = false

what setup is it, dual gpu? dual monitors?

intel igpu + nvidia gpu and no external display

did a thing, hope its moving in the right direction. but havent tested all cases since im on my laptop atm, or well with my laptop away from my desk.

@Zebra2711
Copy link
Contributor

i think the main cause of the lag here is that hyprland is using more gpu than it normally would. Lag is reduced compared to the old version, but not much. I still feel laggy with this. Could be that my config is messing with this. I will test it out with the default config tomorrow

Out of the scope of this, when I resize a window or move my mouse, the igpu usage just jumps up

@outfoxxed
Copy link
Member

@outfoxxed seeing you had various stall/lag issues would be neat if you could test aswell.

what i do know is DS might require some finicking now that commitpendinganddoexplicit is called on new_render_scheduling while it isnt on setting it false.

I can try to test it soon

@gulafaran
Copy link
Contributor Author

@outfoxxed seeing you had various stall/lag issues would be neat if you could test aswell.
what i do know is DS might require some finicking now that commitpendinganddoexplicit is called on new_render_scheduling while it isnt on setting it false.

I can try to test it soon

still think new_render_sched is borked tho still not satisfied with that

instead of storing used async bufs in the renderer and dropping them on
the first monitor pageflip, store them per monitor and schedule drop on
the proper fence in the new CBufferReleaseManager.
make new_render_scheduler not drop buffers to early when third frame is
pending, by adding a parameter to commitPendingAndDoExplicitSync when to
drop buffers. also reuse monitor inFence to reduce flushing.
remove copy paste return early from debugging.
if the buffer gets locked to another monitor add the intersecting region
to monitor damage and schedule a frame.
if we have pending scanout a frame might be waiting on the sync and
racing the buffer drops from said commit. try to avoid that from
occuring.
move BufferReleaseManager to SurfaceManager and schedule frame callbacks
and send them on presented and ahead of third monitor rendering in new
frame sheduler.
remove monitor from scheduled frames on destroy.
schedule all frames instead of directly sending them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants