NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.29k stars 13.54k forks source link

decklink: enabling kernel module causes freezes in firefox + obs #283669

Closed elizagamedev closed 3 weeks ago

elizagamedev commented 7 months ago

Describe the bug

This behavior is very odd. When hardware.decklink.enable is true for my PC with a DeckLink Quad HDMI Recorder installed, Firefox has freezing fits (especially on right click context menu) and OBS simply hangs on start until it receives a ^\.

The DeckLink works fine in Windows, so I can at least rule out defective hardware.

I wonder if this could be fixed with a simple update of the driver?

Steps To Reproduce

Steps to reproduce the behavior:

  1. Given that this might be specific to my hardware, I'm not sure it can be reproduced. However...
  2. Try right clicking in Firefox.
  3. Try starting OBS Studio. For the record, this seems to happen whether or not I explicitly enable Decklink support in my config for OBS Studio.

Expected behavior

Not that.

Screenshots

N/A

Additional context

$ lspci | grep DeckLink
05:00.0 Multimedia video controller: Blackmagic Design DeckLink Quad HDMI Recorder

Notify maintainers

@hexchen

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.74, NixOS, 23.11 (Tapir), 23.11.20240122.d7f206b`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(root): `"nixos-23.05"`
 - channels(eliza): `""`
 - nixpkgs: `/nix/store/2xgpqy6dyicqnhwym6nnaysd8mzrwkr8-source`

Add a :+1: reaction to issues you find important.

hexchen commented 7 months ago

Huh, weird. I don't have access to a Quad HDMI at the moment, but i'll try to reproduce it with my DeckLink Mini Recorder as well as my UltraStudio Recorder. I would guess that it might be related to the sound issues that the decklink driver sometimes causes; does sound still work as usual on your system (while Firefox hangs)?

also, side note: I'll try to get the latest version of the decklink driver merged finally, that might also be causing issues.

elizagamedev commented 7 months ago

Huh, interesting. I didn't notice anything with audio, but then again, I don't think I had anything playing. If the latest version of the driver doesn't fix things, I'll test for sound problems. Thank you for looking into the update :pray:

dacr commented 3 months ago

I have the same issues with :

03:00.0 Multimedia video controller: Blackmagic Design DeckLink Mini Recorder 4K

issues disappear when I turn off the decklink option (hardware.decklink.enable = false)

firefox becomes very very slow in particular when it starts while chrome almost starts instantaneously. It stays in this gray state for about 20s : image

obs starts and then freezes before the UI becomes available :

dcr@lanfeust:~$ obs
debug: Attempted path: share/obs/obs-studio/locale/en-US.ini
debug: Attempted path: /nix/store/dlwq8dzd0dgs41wjbsbmy95v6s87kzk3-obs-studio-30.1.2/share/obs/obs-studio/locale/en-US.ini
debug: Attempted path: share/obs/obs-studio/locale.ini
debug: Attempted path: /nix/store/dlwq8dzd0dgs41wjbsbmy95v6s87kzk3-obs-studio-30.1.2/share/obs/obs-studio/locale.ini
debug: Attempted path: share/obs/obs-studio/locale/fr-FR.ini
debug: Attempted path: /nix/store/dlwq8dzd0dgs41wjbsbmy95v6s87kzk3-obs-studio-30.1.2/share/obs/obs-studio/locale/fr-FR.ini
info: Using preferred locale 'fr-FR'
debug: Attempted path: share/obs/obs-studio/themes
debug: Attempted path: /nix/store/dlwq8dzd0dgs41wjbsbmy95v6s87kzk3-obs-studio-30.1.2/share/obs/obs-studio/themes
debug: Attempted path: share/obs/obs-studio/themes/Yami.qss
debug: Attempted path: /nix/store/dlwq8dzd0dgs41wjbsbmy95v6s87kzk3-obs-studio-30.1.2/share/obs/obs-studio/themes/Yami.qss
info: Using EGL/X11
info: CPU Name: Intel(R) Core(TM) i7-7740X CPU @ 4.30GHz
info: CPU Speed: 1999.991MHz
info: Physical Cores: 4, Logical Cores: 8
info: Physical Memory: 64224MB Total, 56604MB Free
info: Kernel Version: Linux 6.1.91
info: Distribution: NixOS "23.11"
info: Desktop Environment: none+i3 (none+i3)
info: Session Type: x11
info: Window System: X11.0, Vendor: The X.Org Foundation, Version: 1.21.1
info: Qt Version: 6.7.1 (runtime), 6.7.1 (compiled)
info: Portable mode: false
info: OBS 30.1.2 (linux)
info: ---------------------------------
info: ---------------------------------
info: audio settings reset:
    samples per sec: 48000
    speakers:        2
    max buffering:   960 milliseconds
    buffering type:  dynamically increasing
info: ---------------------------------
info: Initializing OpenGL...
info: Loading up OpenGL on adapter NVIDIA Corporation NVIDIA GeForce GTX 1060 6GB/PCIe/SSE2
info: OpenGL loaded successfully, version 3.3.0 NVIDIA 545.29.02, shading language 3.30 NVIDIA via Cg compiler
info: ---------------------------------
info: video settings reset:
    base resolution:   1920x1080
    output resolution: 1280x720
    downscale filter:  Bicubic
    fps:               30/1
    format:            NV12
    YUV mode:          Rec. 709/Partial
info: NV12 texture support enabled
info: P010 texture support not available
info: Audio monitoring device:
    name: Monitor of PCM2902 Audio Codec Stéréo analogique
    id: alsa_output.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo.monitor
info: ---------------------------------
warning: No AJA devices found, skipping loading AJA UI plugin
warning: Failed to initialize module 'aja-output-ui.so'
warning: No AJA devices found, skipping loading AJA plugin
warning: Failed to initialize module 'aja.so'
warning: Failed to load 'en-US' text for module: 'decklink-captions.so'
warning: Failed to load 'en-US' text for module: 'decklink-output-ui.so'
libDeckLinkAPI.so: cannot open shared object file: No such file or directory
warning: A DeckLink iterator could not be created.  The DeckLink drivers may not be installed
warning: Failed to initialize module 'decklink.so'
info: [pipewire] No captures available
info: [obs-browser]: Version 2.23.4
info: [obs-browser]: CEF Version 121.0.6167.184 (runtime), 121.3.13+g5c4a81b+chromium-121.0.6167.184 (compiled)
info: NVENC supported
info: VAAPI: API version 1.21
info: FFmpeg VAAPI H264 encoding supported
info: FFmpeg VAAPI AV1 encoding supported
info: FFmpeg VAAPI HEVC encoding supported
info: [obs-websocket] [obs_module_load] you can haz websockets (Version: 5.4.2 | RPC Version: 1)
info: [obs-websocket] [obs_module_load] Qt version (compile-time): 6.7.1 | Qt version (run-time): 6.7.1
info: [obs-websocket] [obs_module_load] Linked ASIO Version: 102400
info: [obs-websocket] [obs_module_load] Module loaded.
info: [vlc-video]: VLC 3.0.20 Vetinari found, VLC video source enabled
info: ---------------------------------
info:   Loaded Modules:
info:     vlc-video.so
info:     text-freetype2.so
info:     rtmp-services.so
info:     obs-x264.so
info:     obs-websocket.so
info:     obs-webrtc.so
info:     obs-vst.so
info:     obs-transitions.so
info:     obs-qsv11.so
info:     obs-outputs.so
info:     obs-libfdk.so
info:     obs-filters.so
info:     obs-ffmpeg.so
info:     obs-browser.so
info:     linux-v4l2.so
info:     linux-pulseaudio.so
info:     linux-pipewire.so
info:     linux-jack.so
info:     linux-capture.so
info:     linux-alsa.so
info:     image-source.so
info:     frontend-tools.so
info:     decklink-output-ui.so
info:     decklink-captions.so
info: ---------------------------------
warning: QWidget::setTabOrder: 'first' and 'second' must be in the same window
info: ==== Startup complete ===============================================
info: All scene data cleared
info: ------------------------------------------------
nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.91, NixOS, 23.11 (Tapir), 23.11.7313.9d29cd266ceb`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(dcr): `""`
 - channels(root): `"nixos-23.11, nixpkgs-unstable"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
dacr commented 3 months ago

yes there is relationship with audio, as soon as pulseaudio or pipewire is enabled then if I enable decklink while my blackmagic card is plugged, then all the sound system becomes unavailable !

boot logs contains BUG: kernel NULL pointer dereference :

mai 30 19:29:13 lanfeust kernel: BUG: kernel NULL pointer dereference, address: 0000000000000068
mai 30 19:29:13 lanfeust kernel: #PF: supervisor read access in kernel mode
mai 30 19:29:13 lanfeust kernel: #PF: error_code(0x0000) - not-present page
mai 30 19:29:13 lanfeust kernel: PGD 8000000111c43067 P4D 8000000111c43067 PUD 111c44067 PMD 0
mai 30 19:29:13 lanfeust kernel: Oops: 0000 [#1] PREEMPT SMP PTI
mai 30 19:29:13 lanfeust kernel: CPU: 2 PID: 1707 Comm: pulseaudio Tainted: P           O       6.1.91 #1-NixOS
mai 30 19:29:13 lanfeust kernel: Hardware name: System manufacturer System Product Name/PRIME X299-DELUXE, BIOS 3701 05/23/2022
mai 30 19:29:13 lanfeust kernel: RIP: 0010:_ZN20AudioOutputInterface16startAudioStreamEP27BlackmagicAudioOutputStreamP32BlackmagicAudioOutputStartParams+0x32/0x310 [blackmagic_io]
mai 30 19:29:13 lanfeust kernel: Code: e5 41 57 41 56 41 55 41 54 53 48 83 ec 48 44 8b 2a 41 8d 4d fe 83 f9 3e 77 19 49 b9 41 40 00 40 00 00 00 40 49 0f a3 c9 73 09 <0f> b6 4f 68 41 39 cd 76 15 48 83 c4 48 5b 41 5c 41 5d 41 5e 41 5f
mai 30 19:29:13 lanfeust kernel: RSP: 0018:ffffa978c2fc3db8 EFLAGS: 00010293
mai 30 19:29:13 lanfeust kernel: RAX: 00000000000003ea RBX: ffff9487ce979200 RCX: 0000000000000000
mai 30 19:29:13 lanfeust kernel: RDX: ffffa978c2fc3e40 RSI: ffff9487ce979268 RDI: 0000000000000000
mai 30 19:29:13 lanfeust kernel: RBP: ffffa978c2fc3e28 R08: ffff9487d22df8c8 R09: 4000000040004041
mai 30 19:29:13 lanfeust kernel: R10: ffffa978c2fc3ee8 R11: 0000000000000000 R12: 0000000000000002
mai 30 19:29:13 lanfeust kernel: R13: 0000000000000002 R14: ffff9487c5736b01 R15: 0000000000000000
mai 30 19:29:13 lanfeust kernel: FS:  00007f083f44b880(0000) GS:ffff94971ec80000(0000) knlGS:0000000000000000
mai 30 19:29:13 lanfeust kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
mai 30 19:29:13 lanfeust kernel: CR2: 0000000000000068 CR3: 0000000112b44002 CR4: 00000000003706e0
mai 30 19:29:13 lanfeust kernel: DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
mai 30 19:29:13 lanfeust kernel: DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
mai 30 19:29:13 lanfeust kernel: Call Trace:
mai 30 19:29:13 lanfeust kernel:  <TASK>
mai 30 19:29:13 lanfeust kernel:  ? __die_body.cold+0x1a/0x1f
mai 30 19:29:13 lanfeust kernel:  ? page_fault_oops+0xd2/0x2b0
mai 30 19:29:13 lanfeust kernel:  ? exc_page_fault+0x66/0x150
mai 30 19:29:13 lanfeust kernel:  ? asm_exc_page_fault+0x22/0x30
mai 30 19:29:13 lanfeust kernel:  ? _ZN20AudioOutputInterface16startAudioStreamEP27BlackmagicAudioOutputStreamP32BlackmagicAudioOutputStartParams+0x32/0x310 [blackmagic_io]
mai 30 19:29:13 lanfeust kernel:  ? bmio_audio_enable+0x64/0x120 [blackmagic_io]
mai 30 19:29:13 lanfeust kernel:  ? ioctl_has_perm.constprop.0.isra.0+0xdd/0x140
mai 30 19:29:13 lanfeust kernel:  ? bmio_audio_prepare+0x7a/0x90 [snd_blackmagic_io]
mai 30 19:29:13 lanfeust kernel:  ? snd_pcm_do_prepare+0x26/0x40 [snd_pcm]
mai 30 19:29:13 lanfeust kernel:  ? snd_pcm_action_single+0x33/0x80 [snd_pcm]
mai 30 19:29:13 lanfeust kernel:  ? snd_pcm_action_nonatomic+0x95/0xa0 [snd_pcm]
mai 30 19:29:13 lanfeust kernel:  ? snd_pcm_ioctl+0x23/0x40 [snd_pcm]
mai 30 19:29:13 lanfeust kernel:  ? __x64_sys_ioctl+0x8d/0xd0
mai 30 19:29:13 lanfeust kernel:  ? do_syscall_64+0x34/0x80
mai 30 19:29:13 lanfeust kernel:  ? entry_SYSCALL_64_after_hwframe+0x6e/0xd8
mai 30 19:29:13 lanfeust kernel:  </TASK>
mai 30 19:29:13 lanfeust kernel: Modules linked in: nft_chain_nat xt_MASQUERADE nf_conntrack_netlink xfrm_user xfrm_algo xt_addrtype overlay af_packet ip6_tables xt_conntrack ip6t_rpfilter ipt_rpfilter xt_pkttype xt_LOG nf_log_syslog xt_tcpudp nft_compat msr nf_tables nfnetlink sch_fq_codel sn>
mai 30 19:29:13 lanfeust kernel:  snd_seq_device nvidia_modeset(PO) sha1_ssse3 snd_intel_sdw_acpi mac80211 mac_hid aesni_intel ecc wil6210 nvidia_uvm(PO) libaes crypto_simd cryptd snd_hda_codec rapl snd_hda_core intel_cstate blackmagic_io(PO) drm_kms_helper igb i2c_i801 snd_hwdep cfg80211 e100>
mai 30 19:29:13 lanfeust kernel:  firmware_class libata xhci_hcd nvme nvme_core usbcore scsi_mod crc32c_intel t10_pi crc64_rocksoft crc64 crc_t10dif crct10dif_generic crct10dif_pclmul crct10dif_common scsi_common usb_common rtc_cmos dm_mod dax
mai 30 19:29:13 lanfeust kernel: CR2: 0000000000000068
mai 30 19:29:13 lanfeust kernel: ---[ end trace 0000000000000000 ]---
mai 30 19:29:13 lanfeust kernel: RIP: 0010:_ZN20AudioOutputInterface16startAudioStreamEP27BlackmagicAudioOutputStreamP32BlackmagicAudioOutputStartParams+0x32/0x310 [blackmagic_io]
mai 30 19:29:13 lanfeust kernel: Code: e5 41 57 41 56 41 55 41 54 53 48 83 ec 48 44 8b 2a 41 8d 4d fe 83 f9 3e 77 19 49 b9 41 40 00 40 00 00 00 40 49 0f a3 c9 73 09 <0f> b6 4f 68 41 39 cd 76 15 48 83 c4 48 5b 41 5c 41 5d 41 5e 41 5f
mai 30 19:29:13 lanfeust kernel: RSP: 0018:ffffa978c2fc3db8 EFLAGS: 00010293
mai 30 19:29:13 lanfeust kernel: RAX: 00000000000003ea RBX: ffff9487ce979200 RCX: 0000000000000000
mai 30 19:29:13 lanfeust kernel: RDX: ffffa978c2fc3e40 RSI: ffff9487ce979268 RDI: 0000000000000000
mai 30 19:29:13 lanfeust kernel: RBP: ffffa978c2fc3e28 R08: ffff9487d22df8c8 R09: 4000000040004041
mai 30 19:29:13 lanfeust kernel: R10: ffffa978c2fc3ee8 R11: 0000000000000000 R12: 0000000000000002
mai 30 19:29:13 lanfeust kernel: R13: 0000000000000002 R14: ffff9487c5736b01 R15: 0000000000000000
mai 30 19:29:13 lanfeust kernel: FS:  00007f083f44b880(0000) GS:ffff94971ec80000(0000) knlGS:0000000000000000
mai 30 19:29:13 lanfeust kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
mai 30 19:29:13 lanfeust kernel: CR2: 0000000000000068 CR3: 0000000112b44002 CR4: 00000000003706e0
mai 30 19:29:13 lanfeust kernel: DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
mai 30 19:29:13 lanfeust kernel: DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
mai 30 19:29:13 lanfeust kernel: note: pulseaudio[1707] exited with irqs disabled
mai 30 19:29:17 lanfeust dbus-daemon[1680]: [session uid=1000 pid=1680] Activating via systemd: service name='org.gtk.vfs.Daemon' unit='gvfs-daemon.service' requested by ':1.5' (uid=1000 pid=1759 comm="pavucontrol" label="kernel")
mai 30 19:29:17 lanfeust systemd[1655]: Starting Virtual filesystem service...
mai 30 19:29:17 lanfeust dbus-daemon[1680]: [session uid=1000 pid=1680] Successfully activated service 'org.gtk.vfs.Daemon'
dacr commented 3 months ago

Related post in a blackmagic forum

Naxdy commented 1 month ago

Heya, is this still an issue in current unstable? (version 14.0.1a2)

Naxdy commented 3 weeks ago

Closing because stale

dacr commented 3 weeks ago

Heya, is this still an issue in current unstable? (version 14.0.1a2)

Just checked with https://nixos.org/channels/nixos-unstable and the freeze is resolved both in obs and firefox :) but I still can't see the blackmagic device, I will investigate in the coming days

Naxdy commented 3 weeks ago

@dacr see if my steps from this comment solve the device not showing up in OBS for you: https://github.com/NixOS/nixpkgs/issues/328925#issuecomment-2241634622

dacr commented 3 weeks ago

Thank you very much for the link, it works ! image