GTK 4.14 Adding Graphics Offloading Capabilities Under Wayland
The GNOME GTK toolkit is introducing support for graphics offloading within the toolkit. This new GTK "GraphicsOffload" support is Wayland-only at this time and not working either for non-Linux platforms.
Red Hat's Matthias Clasen has written a new GTK blog post around the work they've been engaged in for graphics offloading that is making use of DMA-BUFs under Wayland. In turn this can yield more efficient video playback on the GNOME Wayland desktop and other benefits.
Clasen explains on GTK.org:
Besides the blog post, there is also the GTK documentation on the new GraphicsOffload class. That documentation sums up GTK's GraphicsOffload as:
It's sure looking more and more like all the starts are aligning that 2024 could be the year of the Wayland Linux desktop.
Red Hat's Matthias Clasen has written a new GTK blog post around the work they've been engaged in for graphics offloading that is making use of DMA-BUFs under Wayland. In turn this can yield more efficient video playback on the GNOME Wayland desktop and other benefits.
Clasen explains on GTK.org:
GTK 4.14 will introduce a GtkGraphicsOffload widget, whose only job it is to give a hint that GTK should try to offload the content of its child widget by attaching it to a subsurface instead of letting GSK process it like it usually does.
To create suitable content for offloading, the new GdkDmabufTextureBuilder wraps dmabufs in GdkTexture objects. Typical sources for dmabufs are pipewire, video4linux or gstreamer. The dmabuf support in gstreamer will be much more solid in the upcoming 1.24 release.
...
The GTK 4.14 release will have some interesting new capabilities for media playback. You can try it now, with the just-released 4.13.3 snapshot.
Besides the blog post, there is also the GTK documentation on the new GraphicsOffload class. That documentation sums up GTK's GraphicsOffload as:
"A widget that allows to bypass gsk rendering for its child by passing the content directly to the compositor.
Graphics offload is an optimization to reduce overhead and battery use that is most useful for video content. It only works on some platforms and in certain situations. GTK will automatically fall back to normal rendering if it doesn’t.
Graphics offload is most efficient if there are no controls drawn on top of the video content.
You should consider using graphics offload for your main widget if it shows frequently changing content (such as a video, or a VM display) and you provide the content in the form of dmabuf textures (see GdkDmabufTextureBuilder), in particular if it may be fullscreen."
It's sure looking more and more like all the starts are aligning that 2024 could be the year of the Wayland Linux desktop.
21 Comments