A recent change in open-source Mesa package config file in Fedora 37 disables the decoding of h264dec, h264enc, h265dec, h265enc, vc1dec via GPU.
If you use the open-source graphics library Mesa in AMD/Intl GPU devices, then you will lose the hardware acceleration support while playing videos with h264, h265 and decoding of VC1.
Reason? Patent and licencing for H264/H265 codecs.
But you might be wondering why Fedora/ any distro needs to take care of hardware licensing and NOT the hardware vendor. I mean, if AMD provides GPU with decoding capabilities, it’s up to them to take care of the legal technicalities.
Since the open-source patents and licensing are a mess, it looks like Redhat (sponsor of Fedora) doesn’t get into trouble by “shipping any code/API which exposes patent algorithms”.
“The patent licensing around H264/H265 is such that providing this could leave Red Hat and other Fedora distributors exposed to legal problems.” – as debated on the current ongoing discussion in the mailing list.
At the beginning of Q2 2022, Mesa 22.2 release added a switch to its code, allowing you to build Mesa by turning off/on specific video codecs.
Changes to Fedora
Although the switch landed in Mesa a few months back, it was never used in the prior Fedora 36, citing “oversight” from the Fedora team, probably.
But last week, the Mesa build config file saw a patch in Fedora 37 which removes the code related to h264dec, h264enc, h265dec, h265enc and vc1dec.
Mesa 22.2.x version, which is currently being built for the upcoming Fedora release, seems to disable these decodings.
What is the impact for you?
In layman’s terms, your GPU will sit idle, and the CPU needs to take the load of heavy graphics-intensive work.
So, if you have a laptop/desktop using AMD (mostly) GPU & using open-source Mesa, then you are impacted.
When you watch videos or do in-house gaming and streaming, there will not be any GPU-based decoding in Firefox. Since the CPU would be loaded, there is a chance that your battery will drain faster. And when it does, your Laptop’s overall age may get reduced more quickly.
For a change, this won’t affect much to the NVIDIA devices much, which are already in a mess anyway.
What about self-contained packages such as Flatpak?
You might be wondering, hey, Flatpak executables come with Mesa pre-packaged. Does it work there?
Eventually, all the Flatpak builds have to follow the Mesa 22.2 upstream change for the same legal issue!
What about Ubuntu and others?
Since this change (the switch to enable/disable) is made Mesa upstream, all the distros might follow the same.
Is there any workaround?
Well, you have to compile the Mesa by yourself by adding the codec line back to the
mesa.spec file. Then you have to install the RPM/DEB package in your distros.
Obviously, this is not even a viable long-term solution.
I, personally avoided NVIDIA laptops and chose AMD for better Mesa support. But it seems many users like myself will face degraded performance in the coming days, starting with Fedora 37.
The worst of this change is other distros may follow suit eventually. And the change might get backported to the past releases (which are under support).
What do you think about this change, and how will it impact your daily workflow? Let me know.
Update 9/29: It looks like openSUSE disabled it after Fedora’s decision.