Only force enable hardware video decode for NVIDIA

Enabling `media.hardware-video-decoding.force-enabled` for all video cards, not just NVIDIA ones, can lead to breakages where Mozilla's blacklist disables hardware video decode for a legitimate reason. Conditionally enable hardware decode if a NVIDIA card is present, and disable it otherwise.
This commit is contained in:
Thomas Duckworth
2025-11-08 19:44:13 +11:00
parent 8dc3a1cbf9
commit eff1079793

View File

@@ -28,5 +28,11 @@ elif ! flatpak info org.freedesktop.Platform.codecs-extra &>/dev/null; then
fi
# Install the KDE Linux default Firefox config into the Firefox flatpak system config extension.
mkdir -p "/var/lib/flatpak/extension/org.mozilla.firefox.systemconfig/${RUNTIME_ARCH}/stable/defaults/pref/"
cp -rf "/usr/share/firefox-config/00-kde-linux-default.js" "/var/lib/flatpak/extension/org.mozilla.firefox.systemconfig/${RUNTIME_ARCH}/stable/defaults/pref/00-kde-linux-default.js"
# This enables hardware acceleration on NVIDIA but can break it on other cards,
# so this should only be done conditionally.
if nvidia-smi > /dev/null 2>&1; then
mkdir -p "/var/lib/flatpak/extension/org.mozilla.firefox.systemconfig/${RUNTIME_ARCH}/stable/defaults/pref/"
cp -rf "/usr/share/firefox-config/00-kde-linux-default.js" "/var/lib/flatpak/extension/org.mozilla.firefox.systemconfig/${RUNTIME_ARCH}/stable/defaults/pref/00-kde-linux-default.js"
else
rm -rf "/var/lib/flatpak/extension/org.mozilla.firefox.systemconfig/${RUNTIME_ARCH}/stable/defaults/pref/00-kde-linux-default.js"
fi