Skip to content

Reduce GPU memory usage when used by a general purpose compositor #6

Description

@hansihe

Currently, windows are rendered as platform views. This works very well for our internal usecase (embedded with a low number of windows), but might not work as well if the goal is to implement a general purpose window manager.

Using platform views could cause the GPU memory usage to get up to (Size of fullscreen texture) * ((Number of surfaces on screen) + 1).

There are multiple potential solutions for this, each with its own advantages and disadvantages:

  1. Switch from platform views to textures
    1. Advantage: Memory usage greatly reduced
    2. Advantage: Filters like blur will work since skia controls the rendering
    3. Disadvantage: Each time a client surface is damaged, the flutter engine will need to be asked to redraw
    4. This is also tricky to implement, and will likely require changes to wlroots internals because textures can't be destroyed until the flutter render is done with them.
  2. Draw surfaces on top of the flutter texture, communicate details through an out of band channel.
    1. Advantage: Memory usage greatly reduced
    2. Disadvantage: We are basically working against how flutter does rendering, this will be complicated
    3. Disadvantage: Layering stuff from the in process flutter program will be impossible
  3. Hybrid approach between platform views and 2. Render all windows on a single platform view.
    1. Advantage/Disadvantage: Memory usage is worse than 1. and 2., but will not go above (Size of fullscreen texture) * 2.
    2. Disadvantage: We are basically working against how flutter does rendering, this will be complicated

Depending on how flutter optimizes its output layers, we might already be mostly at option 3. If this is the case, then this issue is much less of a problem, and things will simply require some consideration when writing a shell in flutter. This should be checked/validated before any other approach is started.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    externalThis issue is not needed or prioritized by PlayPulse

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions