# HW accelerated video decoding on Firefox (Fedora 38, AMD iGPU and GTX 1650 dGPU)

**URL:** <https://forums.developer.nvidia.com/t/hw-accelerated-video-decoding-on-firefox-fedora-38-amd-igpu-and-gtx-1650-dgpu/263915>\
**Category:** Linux\
**Tags:** fedora, video\
**Created:** [August 21, 2023, 9:53pm UTC](https://forums.developer.nvidia.com/t/hw-accelerated-video-decoding-on-firefox-fedora-38-amd-igpu-and-gtx-1650-dgpu/263915 "2023-08-21T21:53:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![andre.ocosta](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/andre.ocosta/32/365763_2.png) [@andre.ocosta](https://forums.developer.nvidia.com/u/andre.ocosta)\
**Post date:** [August 21, 2023, 9:53pm UTC](https://forums.developer.nvidia.com/t/hw-accelerated-video-decoding-on-firefox-fedora-38-amd-igpu-and-gtx-1650-dgpu/263915/1 "2023-08-21T21:53:28Z")

</div>

My setup is:

- Notebook Acer Nitro 5 with AMD Renoir iGPU and GTX 1650 dGPU
- Fedora 38
- GNOME 44 on Wayland
- Firefox 116
- Nvidia driver 535.98
- `nvidia-vaapi-driver` package installed

Firefox’s `about:support` page shows:

```auto
Compositing = WebRender
GPU 1
Active = Yes
Description = AMD Radeon Graphics (renoir, LLVM 16.0.6, DRM 3.52, 6.4.11-200.fc38.x86_64)
GPU 2
Active = No
Vendor ID = 0x10de
Device ID = 0x1f99

```

If I run Firefox with `DRI_PRIME=1`, Compositing changes to `WebRender (Software)`, `llvmpipe` is reported as active GPU 1, and `HARDWARE_VIDEO_DECODING` is reported as

```auto
runtime | unavailable | Force disabled by gfxInfo | Blocklisted; failure code FEATURE_FAILURE_VIDEO_DECODING_TEST_FAILED

```

Some relevant Firefox settings have been modified:

```auto
media.ffmpeg.vaapi.enabled = true
media.hardware-video-decoding.force-enabled = true

```

These shell env vars are set:

```auto
MOZ_DISABLE_RDD_SANDBOX=1
MOZ_ENABLE_WAYLAND=1
NVD_BACKEND=direct
LIBVA_DRIVER_NAME=nvidia
XDG_SESSION_TYPE=wayland
EGL_PLATFORM=wayland

```

So, the question is: **is it possible to enable HW accelerated video decoding on Firefox with this setup? If so, what am I missing?**

Thanks!

---

<div class="post-metadata">

**Author:** ![andre.ocosta](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/andre.ocosta/32/365763_2.png) [@andre.ocosta](https://forums.developer.nvidia.com/u/andre.ocosta)\
**Post date:** [August 24, 2023, 10:04pm UTC](https://forums.developer.nvidia.com/t/hw-accelerated-video-decoding-on-firefox-fedora-38-amd-igpu-and-gtx-1650-dgpu/263915/2 "2023-08-24T22:04:15Z")

</div>

I guess the first obstacle is enabling Firefox to correctly detect and use the GTX 1650 as GPU #1 on Wayland.

---

<div class="post-metadata">

**Author:** ![VulkanGuy](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/vulkanguy/32/11251_2.png) [@VulkanGuy](https://forums.developer.nvidia.com/u/VulkanGuy)\
**Post date:** [August 25, 2023, 12:32am UTC](https://forums.developer.nvidia.com/t/hw-accelerated-video-decoding-on-firefox-fedora-38-amd-igpu-and-gtx-1650-dgpu/263915/3 "2023-08-25T00:32:04Z")

</div>

Maybe you should try without those Wayland wars unset first.

And for avoiding DRI\_PRIME var at every launch, you might wanna try editing firefox.desktop to have it set in there.

---

<div class="post-metadata">

**Author:** ![andre.ocosta](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/andre.ocosta/32/365763_2.png) [@andre.ocosta](https://forums.developer.nvidia.com/u/andre.ocosta)\
**Post date:** [August 25, 2023, 3:19pm UTC](https://forums.developer.nvidia.com/t/hw-accelerated-video-decoding-on-firefox-fedora-38-amd-igpu-and-gtx-1650-dgpu/263915/4 "2023-08-25T15:19:01Z")

</div>

Hi @VulkanGuy ,

> [@VulkanGuy](#):
>
> Maybe you should try without those Wayland wars unset first.

I just tried again without setting the environment vars, and the result was pretty much the same: GPU #1 is detected as `llvmpipe`, and `WebRender` falls back to software rendering.

**EDIT** : running from the console, this is the output:

```auto
❯ DRI_PRIME=1 firefox
libEGL warning: egl: failed to create dri2 screen
libEGL warning: egl: failed to create dri2 screen
libEGL warning: egl: failed to create dri2 screen

```

Also, regardless of the environment variables, if I try to start Firefox from GNOME launcher with the _“Launch using Discrete Graphics Card”_, Firefox becomes unable to render its content, all windows open completely transparent (only the frames are displayed).

> [@VulkanGuy](#):
>
> And for avoiding DRI\_PRIME var at every launch, you might wanna try editing firefox.desktop to have it set in there.

Yes, I will definitely do that once I come to a working solution, but thanks for the suggestion anyway ;-)

---

<div class="post-metadata">

**Author:** ![mmbossoni](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mmbossoni](https://forums.developer.nvidia.com/u/mmbossoni)\
**Post date:** [August 25, 2023, 8:08pm UTC](https://forums.developer.nvidia.com/t/hw-accelerated-video-decoding-on-firefox-fedora-38-amd-igpu-and-gtx-1650-dgpu/263915/5 "2023-08-25T20:08:32Z")

</div>

> [@andre.ocosta](#):
>
> `DRI_PRIME=1`

FYI `DRI_PRIME=1` is not the proper variable for nvidia, just saying  
[http://us.download.nvidia.com/XFree86/Linux-x86\_64/535.104.05/README/primerenderoffload.html](http://us.download.nvidia.com/XFree86/Linux-x86_64/535.104.05/README/primerenderoffload.html)

---

<div class="post-metadata">

**Author:** ![andre.ocosta](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/andre.ocosta/32/365763_2.png) [@andre.ocosta](https://forums.developer.nvidia.com/u/andre.ocosta)\
**Post date:** [August 26, 2023, 2:34pm UTC](https://forums.developer.nvidia.com/t/hw-accelerated-video-decoding-on-firefox-fedora-38-amd-igpu-and-gtx-1650-dgpu/263915/6 "2023-08-26T14:34:44Z")

</div>

Nice @mmbossoni , thanks for pointing that out!

By setting `__NV_PRIME_RENDER_OFFLOAD=1` before launching Firefox, I get the same result as if I had launched it with GNOME’s “Launch using discrete graphics card” option: Firefox’s windows are not rendered. This is how it looks like (had to take a picture):

 ![photo_2023-08-26_11-32-54](https://global.discourse-cdn.com/nvidia/original/4X/9/d/6/9d62c07f67811fabc72f6d8bb3f645b5a68286ce.jpeg)

And this is the console output:

```auto
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Crash Annotation GraphicsCriticalError: |[C0][GFX1-]: CompositorBridgeChild receives IPC close with reason=AbnormalShutdown (t=132.041) Exiting due to channel error.
Crash Annotation GraphicsCriticalError: |[C0][GFX1-]: CompositorBridgeChild receives IPC close with reason=AbnormalShutdown (t=1Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Crash Annotation GraphicsCriticalError: |[C0][GFX1-]: CompositorBridgeChild receives IPC close with reason=AbnormalShutdown (t=135.595) Killed

```

---

<div class="post-metadata">

**Author:** ![mmbossoni](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mmbossoni](https://forums.developer.nvidia.com/u/mmbossoni)\
**Post date:** [August 28, 2023, 11:08am UTC](https://forums.developer.nvidia.com/t/hw-accelerated-video-decoding-on-firefox-fedora-38-amd-igpu-and-gtx-1650-dgpu/263915/7 "2023-08-28T11:08:24Z")

</div>

Only thing I can think of is wayland x xwayland problems.  
If you are running wayland, try running firefox in both modes, wayland and xwayland and see which one works. (`MOZ_ENABLE_WAYLAND=` 1 to enabled wayland mode, 0 to disable/run in xwayland)  
If you are on X11, double check egl platform and play with Firefox EGL settings (enabled/disabled) ( `MOZ_X11_EGL` variable to quick check  
But at this point, I would also check firefox bugtracker

---

<div class="post-metadata">

**Author:** ![andre.ocosta](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/andre.ocosta/32/365763_2.png) [@andre.ocosta](https://forums.developer.nvidia.com/u/andre.ocosta)\
**Post date:** [August 28, 2023, 12:54pm UTC](https://forums.developer.nvidia.com/t/hw-accelerated-video-decoding-on-firefox-fedora-38-amd-igpu-and-gtx-1650-dgpu/263915/8 "2023-08-28T12:54:14Z")

</div>

I tried with `MOZ_ENABLE_WAYLAND=0` and `__NV_PRIME_RENDER_OFFLOAD=1`, and the result was pretty much the same, except with black windows instead of transparent ones. One thing worth noticing is that Firefox still reports window protocol as being “wayland” with these settings, don’t know if this was expected.

Also, it’s worth noticing that without setting

```auto
NVD_BACKEND=direct
MOZ_DISABLE_RDD_SANDBOX=1
EGL_PLATFORM=wayland
LIBVA_DRIVER_NAME=nvidia

```

Firefox reports that hardware video decoding _is_ available, at least for VP9. This is a step in the right direction, although I would rather be using Nvidia for video decoding instead of Renoir.

I will also post this to Firefox lists to see if they are able to help (I’ve already posted to [Fedora’s discussion forum](https://discussion.fedoraproject.org/t/firefox-sticks-do-amd-igpu-refuses-to-use-nvidia-dgpu/87933/7)).
