Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(wayland): Add a shared memory manager. #270

Merged
merged 1 commit into from Feb 6, 2023
Merged

feature(wayland): Add a shared memory manager. #270

merged 1 commit into from Feb 6, 2023

Conversation

ghost
Copy link

@ghost ghost commented Feb 2, 2023

Allowing backing buffers to be allocated on demand. In addition, the shared memory manager tracks buffer acquisition history (in Wayland EGL parlance 'buffer age'), allowing the acquiring code to perform a delta initialization (apply changes from previously acquired buffers to the most recent, as oppose to a full buffer initialization).
In particular, the shared memory manager, maintains a shared memory pool, wherein individual buffers, belonging to separate buffer groups (which all have the same size) are allocated from. A LRU cache is then used on top of this to keep a hot cycle (i.e. swap chain) available. Finally, the acquiring code, caches individual buffer damage in a ring buffer to be able to apply the aforementioned delta initialization.

This PR is my completion of the work started in #250.

Notes:

  • There's some toggles implemented (namely the ring buffer size and shared memory manager preferred number of buffers), which can be changed to tradeoff swap-chain length (and thus delta initialization time) and allocation overhead.
  • Still a lot of places where performance could be improved (and heuristics added), in particular the ring buffer could use a weighted size to make a decision of when to delta initialize or full initialize a buffer
  • This implementation has mostly been hacked on to the existing Wayland driver, to hopefully fix-up a couple bugs/make it more Wayland conformant
  • Moving forward I may look to implement the SHM interface backend on SDL, as I believe with this the SDL driver would be feature superior to this driver

@kisvegabor
Copy link
Member

Thank you very much @simplejack-src. Can I merge it or are we waiting feedback from someone?

@ghost
Copy link
Author

ghost commented Feb 5, 2023

It works for me(TM) :). @WallaceIT see anything out of place?

@WallaceIT
Copy link
Contributor

Seems very well done! I don't have time nor means to test it since I'm travelling, though.

@kisvegabor
Copy link
Member

Thanks for taking a look @WallaceIT.

I'll merge it now then. Please open a new issue if you find an issues later.

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.

None yet

2 participants