-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
blackmagic decklink: init pkg and module at 12.2 #102512
Conversation
nixos/modules/hardware/decklink.nix
Outdated
boot.extraModulePackages = [ kernelPackages.decklink ]; | ||
|
||
# supporting service | ||
systemd.services."DecklinkVideoHelper" = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this run as non-root?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll have to check when testing on hardware.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the helper isn't needed at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correction, it actually is. I had it running from a previous test when writing that message. It also has to run as root.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really? What capabilities does it need? What files/devices does it access? I don't think a NixOS module should run some random proprietary binary as root service unless it absolutely has to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can run an strace on it next time I have access to the hardware. It is unclear what it actually does, but without it running the device does not initialize. I assume it sends a bitstream to onboard FPGAs or something like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've finally taken that strace, see https://gist.github.com/hexchen/cc39485001ba513e0cd9c970fd695f18
I am unsure on how to act on this though, as whatever it is doing only succeeds if run as root, and I am unable to figure out why from that strace.
Maybe changing the meta.maintainers attributes will fix OfBorg. Please also change this to have three commits, one for the module and one for each package, all of them with commit messages that fit the contribution guidelines. They could look like this: linuxPackages.decklink: init at 1.16 |
edbc279
to
8422185
Compare
Building a system with
|
9bf1aaf
to
70db49f
Compare
33f837b
to
9bceda6
Compare
d2e68be
to
1d848bd
Compare
@SuperSandro2000 I've updated the commit to use ${version} in all places appropriate and the major version ${major} everywhere else. @petabyteboy this has been tested on hardware and been verified to work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than my new comment on running the helper service as root, this looks good to me.
nixos/modules/hardware/decklink.nix
Outdated
boot.extraModulePackages = [ kernelPackages.decklink ]; | ||
|
||
# supporting service | ||
systemd.services."DecklinkVideoHelper" = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really? What capabilities does it need? What files/devices does it access? I don't think a NixOS module should run some random proprietary binary as root service unless it absolutely has to.
nixos/modules/hardware/decklink.nix
Outdated
boot.extraModulePackages = [ kernelPackages.decklink ]; | ||
|
||
# supporting service | ||
systemd.services."DecklinkVideoHelper" = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be great!
38f9b9b
to
d5314ef
Compare
I updated to a more current version of the driver, since I was able to finally test that on hardware as well. |
448b8b4
to
62aa4ff
Compare
I updated the driver to version 12.2, feel free to test it. I should be able to get it tested on a Blackmagic Quad HDMI next week. |
62aa4ff
to
aa691f0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from this one change, the module looks great 👍
I'll leave the rest of the review and merge to @davidak because I don't have this hardware or the context around the software.
Thanks!
config = mkIf cfg.enable { | ||
boot.kernelModules = [ "blackmagic" "blackmagic-io" "snd_blackmagic-io" ]; | ||
boot.extraModulePackages = [ kernelPackages.decklink ]; | ||
systemd.packages = [ pkgs.blackmagicDesktopVideo ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
systemd.packages = [ pkgs.blackmagicDesktopVideo ]; | |
systemd.packages = [ pkgs.blackmagicDesktopVideo ]; | |
systemd.services.DecklinkVideoHelper.wantedBy = [ "multi-user.target" ]; |
See #81138 for details.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seem not to work yet.
[root@gaming:~]# lspci | grep Blackmagic
05:00.0 Multimedia video controller: Blackmagic Design Intensity Pro 4K
(this did work without the driver)
[root@gaming:~]# lsmod | grep blackmagic
[root@gaming:~]# systemctl status DecklinkVideoHelper
Unit DecklinkVideoHelper.service could not be found.
I do not see DesktopVideoHelper.service
in /var/run/current-system/sw/lib/systemd/system
:
[root@gaming:~]# ll /var/run/current-system/sw/lib/systemd/system | grep DesktopVideoHelper
I see the kernel modules in /var/run/current-system/kernel-modules/lib/modules/5.10.81/extra/
:
[root@gaming:~]# ll /nix/store/x71rnsfknvga3hb7rhg3j889a0wc1cvn-nixos-system-gaming-22.05.git.aa691f07224/kernel-modules/lib/modules/5.10.81/extra/
total 1080
-r--r--r-- 1 root root 621372 Jan 1 1970 blackmagic-io.ko.xz
-r--r--r-- 1 root root 402860 Jan 1 1970 blackmagic.ko.xz
-r--r--r-- 1 root root 73992 Jan 1 1970 snd_blackmagic-io.ko.xz
src = requireFile { | ||
name = "Blackmagic_Desktop_Video_Linux_${major}.tar.gz"; | ||
url = "https://www.blackmagicdesign.com/support/download/33abc1034cd54cf99101f9acd2edd93d/Linux"; | ||
sha256 = "62954a18b60d9040aa4a959dff30ac9c260218ef78d6a63cbb243788f7abc05f"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sha256 = "62954a18b60d9040aa4a959dff30ac9c260218ef78d6a63cbb243788f7abc05f"; | |
sha256 = "62954a18b60d9040aa4a959dff30ac9c260218ef78d6a63cbb243788f7abc05f"; | |
message = '' | |
Please download the file manually from the developers website: | |
https://www.blackmagicdesign.com/support/download/33abc1034cd54cf99101f9acd2edd93d/Linux | |
They want you to register your product, but you can also download | |
the file without registration by clicking 'Download Only' in the | |
bottom left corner of the dialog. | |
Then add the downloaded file to the Nix store using: | |
nix-store --add-fixed sha256 Blackmagic_Desktop_Video_Linux_12.2.tar.gz | |
If you use Google Chrome or Chromium, you have to rename the | |
file to end with tar.gz first. | |
''; | |
# Chromium specific issue: https://bugs.chromium.org/p/chromium/issues/detail?id=1275694 | |
# Remove hint when fixed. |
Those instructions seem helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In https://github.com/NixOS/nixpkgs/pull/152113/files is a script to download files from blackmagicdesign.com. Maybe that would work here too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It indeed works. Thanks for the pointer, I was finally able to implement that 1.5 years later...
Please exclude |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not work. See comments.
@hexchen do you remember to check this? |
Sorry about the delay. I'm going to look into it this weekend. |
Awesome work! As I understand, the last issue is that Decklink doesn't support the newest Linux kernel? |
I just tried this with 14.2.1 and Linux 5.15 and the driver tripped over itself. :( My patches are here.
|
I wonder if this is related https://forum.blackmagicdesign.com/viewtopic.php?p=895848#p895848 To the crash we notice |
No, that's a different issue. |
Have you managed to get it working? Know what could be the reason for errors? |
Closing because this is stale for the last 1 or 2 years depending on how you count. |
Motivation for this change
There's currently no support for the Blackmagic Design Decklink hardware in nixos. The driver for these AV-interface cards is available from the manufacturer directly, but it only supports DEB and RPM-based distros natively. This PR adds in the required driver as well as one of the userspace services that are required to make the hardware work.
It does not include any of the userspace GUI tools that can be used to configure and monitor the capture cards, since those proprietary applications depend on QT and I have yet to repackage them for nix.
I'll leave the PR marked as a draft until I have tested the module on hardware with a Decklink card.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)