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

Screencopy to dmabuf presented using subsurfaces #7

Merged
merged 1 commit into from
Mar 1, 2024

Conversation

ids1024
Copy link
Member

@ids1024 ids1024 commented Nov 9, 2023

Depends on pop-os/iced#79.

This is meant to address the performance issues we have with shm screencopy, and rendering the workspaces view. We can screencopy to a dmabuf and attach it to a subsurface without copying image data to main memory, or having the iced renderer deal with the image data. If incremental rendering is done properly, this should preform pretty well even with Iced's software renderer, so we don't depend on a glow or wgpu renderer without or without dmabuf import.

I initially prototyped this in the wip-dmabuf_nobuild branch, which just used sctk and removed iced (also losing text rendering, iced widget layout system, and any other features provided with iced). This showed it worked and performed well, but it needed some way to integrate with other UI elements. Adding a Subsurface widget to iced-sctk provides a clean way to do this.

The changes here are fairly minimal since I've pushed a lot of the groundwork (sharing a Wayland connection with iced, gbm buffer allocation, etc.) for it to master_jammy while keeping that working with the existing shm+iced image approach for now.

Current issues:

  • The iced-sctk PR needs to be cleaned up a bit before it's ready for merge.
  • We'll need some way to preserve aspect ratio. Perhaps Subsurface should offer similar options to the Image widget.
  • Dmabuf screencopy is working for toplevel capture, but failing for workspace capture
    • [EGL] 0x300c (BAD_PARAMETER) eglCreateImageKHR: EGL_BAD_PARAMETER error: In eglCreateImageKHR: requested buffer attributes are not supported
    • This is also failing on the older wip-dmabuf_nobuild branch, which worked before.
      • Some change in cosmic-comp, or a driver update?
  • We'll need some way to make sure we don't re-use a buffer until wl_buffer::release is called, while swapping between at least two capture buffers. I'm not sure about the best way to handle that yet.

@ids1024 ids1024 force-pushed the dmabuf-subsurfaces_jammy branch 2 times, most recently from 3daacea to 328b4ed Compare November 16, 2023 21:45
@ids1024 ids1024 force-pushed the dmabuf-subsurfaces_jammy branch 2 times, most recently from 4bff7d0 to 9570082 Compare November 18, 2023 00:07
@ids1024 ids1024 force-pushed the dmabuf-subsurfaces_jammy branch from 9570082 to e2e0211 Compare December 5, 2023 20:56
@ids1024 ids1024 force-pushed the dmabuf-subsurfaces_jammy branch from e2e0211 to 8bb0822 Compare December 14, 2023 21:18
@ids1024 ids1024 force-pushed the dmabuf-subsurfaces_jammy branch 5 times, most recently from 3da7d9b to 0ea9398 Compare January 27, 2024 05:16
@ids1024 ids1024 force-pushed the dmabuf-subsurfaces_jammy branch 4 times, most recently from e64d9a8 to b0fd76e Compare February 12, 2024 23:15
@ids1024 ids1024 force-pushed the dmabuf-subsurfaces_jammy branch from b0fd76e to c94f789 Compare February 29, 2024 23:54
More efficient than shm screencopy, and rendering an iced image into the
window. Done right, should espeically help with multiple GPUs, but more
testing and work is needed there.

Removes mmapping of dmabuf, which errored... I guess not allocated with
right options for that. Relevant only if we want a fallback/test that
involves reading dmabufs.

Using `OnDamage` doesn't seem to work correctly currently. Likely a
compositor issue.
@ids1024 ids1024 force-pushed the dmabuf-subsurfaces_jammy branch from a45c045 to 78b7bfe Compare March 1, 2024 22:35
@ids1024 ids1024 changed the title WIP Screencopy to dmabuf presented using subsurfaces Screencopy to dmabuf presented using subsurfaces Mar 1, 2024
@ids1024 ids1024 marked this pull request as ready for review March 1, 2024 22:36
@ids1024 ids1024 merged commit a9ab177 into master Mar 1, 2024
@ids1024 ids1024 deleted the dmabuf-subsurfaces_jammy branch March 1, 2024 22:37
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.

1 participant