swww icon indicating copy to clipboard operation
swww copied to clipboard

Use single-pixel-buffer for `Clear`

Open WhyNotHugo opened this issue 3 years ago • 2 comments
trafficstars

Clear renders a single colour, so single-pixel-buffer is ideal for it. It's a rather new protocol, and, from the description:

Some use-cases include drawing background surfaces or toplevel decorations.

See: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/104

Even for compositors where the new protocol is not supported, using a 1x1px buffer and wp_viewporter should reduce some unnecessary memory usage.

WhyNotHugo avatar Sep 23 '22 00:09 WhyNotHugo

Interesting. This would have to be first implemented in the smithay client toolkit for us to use it. Perhaps we should open an issue there? Though that fallback seems pretty complicated.

Nevertheless, this doesn't worry me too much (as in, it isn't urgent) since I fell like clearing the screen is not what most people will use swww for.

LGFae avatar Sep 23 '22 02:09 LGFae

Interesting. This would have to be first implemented in the smithay client toolkit for us to use it. Perhaps we should open an issue there?

It's already on master, but yeah, we need to wait for a stable release with it.

Though that fallback seems pretty complicated.

Not really, instead of a single-pixel-buffer it's possible to just use a regular 1x1px buffer. It's marginally less efficient (notably, the single-pixel one is immutable, so the compositor can do some optimisations).

Nevertheless, this doesn't worry me too much (as in, it isn't urgent) since I fell like clearing the screen is not what most people will use swww for.

Definitely urgent or important, it's more of a nice-to-have.

WhyNotHugo avatar Sep 23 '22 09:09 WhyNotHugo