udevbe / greenfield

HTML5 Wayland compositor :seedling:
GNU Affero General Public License v3.0
913 stars 28 forks source link

hardware acceleration #92

Closed Zubnix closed 2 years ago

Zubnix commented 2 years ago

Currently the native compositor-proxy does not expose any hardware acceleration to clients. This means clients are force to communicate their content using RAM shared memory which is generally slow, especially if we're to upload them to the GPU for video encoding.

TODO:

rosensvv commented 2 years ago

So which part is hardware accelerated now? How to set it up and test if it's working? What hardware do I need?

Zubnix commented 2 years ago

You basically need to check if you have a /dev/dri/renderD128 and a /dev/dri/card0 entry. If you have multiple cards there can be addtional renderD129 and card1 etc. entries.

You then need to configure the proxy to use the render device of your choosing: https://github.com/udevbe/greenfield/blob/master/compositor-proxy/src/config.yaml#L13

This allows applications to utilize the GPU to do their rendering (e.g. GTK4, XWayland) and should give you a modest but noticeable speed improvement (depending if the client application uses software or hardware accelerated rendering).

This was tested on the Intel open source driver and the nvidia closed source driver (version 515).

The real speed improvement will come once https://github.com/udevbe/greenfield/issues/104 lands. (First tests shows a ±2.5x increase in FPS)