Desktop Video 12 on Linux 5.x

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

Arun Gurung

  • Posts: 25
  • Joined: Wed May 24, 2017 12:31 pm

Desktop Video 12 on Linux 5.x

PostSun Feb 07, 2021 5:02 am

I can`t compile the module "blackmagic-io" on kernel 5.9. I can compile on kernel 5.4, but this has no Thunderbolt support. Kernel 5.9 has Thunderbolt support and also sees my Intensity Extreme. Please make it so I can compile "blackmagic-io".
Offline

Arun Gurung

  • Posts: 25
  • Joined: Wed May 24, 2017 12:31 pm

Re: Desktop Video 12 on Linux 5.x

PostSun Feb 07, 2021 5:31 am

Sorry, I was a bit quick. I had to load the thunderbolt module manually with kernel 5.4. Now, the system can see the Intensity Extreme:

02:00.0 PCI bridge: Intel Corporation DSL6540 Thunderbolt 3 Bridge [Alpine Ridge 4C 2015]
03:00.0 PCI bridge: Intel Corporation DSL6540 Thunderbolt 3 Bridge [Alpine Ridge 4C 2015]
03:01.0 PCI bridge: Intel Corporation DSL6540 Thunderbolt 3 Bridge [Alpine Ridge 4C 2015]
03:02.0 PCI bridge: Intel Corporation DSL6540 Thunderbolt 3 Bridge [Alpine Ridge 4C 2015]
03:04.0 PCI bridge: Intel Corporation DSL6540 Thunderbolt 3 Bridge [Alpine Ridge 4C 2015]
04:00.0 System peripheral: Intel Corporation DSL6540 Thunderbolt 3 NHI [Alpine Ridge 4C 2015]
05:00.0 PCI bridge: Intel Corporation DSL2310 Thunderbolt Controller [Eagle Ridge 2C 2011] (rev 01)
06:03.0 PCI bridge: Intel Corporation DSL2310 Thunderbolt Controller [Eagle Ridge 2C 2011] (rev 01)
07:00.0 Multimedia video controller: Blackmagic Design Intensity Extreme

And both Blackmagic modules are loaded:

> lsmod | grep black
blackmagic_io 1916928 0
blackmagic 569344 1


But the Desktop Video app can't find any devices. Anybody help? It works fine with Windows 10.
Offline

Arun Gurung

  • Posts: 25
  • Joined: Wed May 24, 2017 12:31 pm

Re: Desktop Video 12 on Linux 5.x

PostSun Feb 07, 2021 6:36 am

This shows also:

> DesktopVideoUpdateTool -l
Available Devices:
* Intensity Extreme (T360700)
Firmware is up to date
Offline

jiyunomegami

  • Posts: 3
  • Joined: Tue Feb 09, 2021 1:31 am
  • Real Name: Joseph Armitage

Re: Desktop Video 12 on Linux 5.x

PostTue Feb 09, 2021 1:46 am

My Intensity Pro works with OBS on Linux 5.9, with this patch:
Code: Select all
diff -ubr blackmagic-backup-12.0a14/blackmagic-12.0a14/blackmagic_core.c blackmagic-12.0a14/blackmagic_core.c
--- blackmagic-backup-12.0a14/blackmagic-12.0a14/blackmagic_core.c   2021-01-15 11:45:50.000000000 +0900
+++ blackmagic-12.0a14/blackmagic_core.c   2021-02-09 01:28:43.500274017 +0900
@@ -231,6 +231,10 @@
    return 0;
 }
 
+#if KERNEL_VERSION_OR_LATER(5, 9, 0)
+static long
+blackmagic_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
+#else
 #ifdef HAVE_UNLOCKED_IOCTL
 static long
 blackmagic_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
@@ -239,8 +243,12 @@
 blackmagic_ioctl(struct inode *inode, struct file *filp,
                unsigned int cmd, unsigned long arg)
 #endif
+#endif
 {
    struct blackmagic_device *ddev;
+#if KERNEL_VERSION_OR_LATER(5, 9, 0)
+   ddev = blackmagic_find_device_by_minor(iminor(file_inode(filp)));
+#else
 #if HAVE_UNLOCKED_IOCTL
 #if KERNEL_VERSION_OR_LATER(3, 9, 0)
    ddev = blackmagic_find_device_by_minor(iminor(file_inode(filp)));
@@ -250,6 +258,7 @@
 #else
    ddev = blackmagic_find_device_by_minor(iminor(inode));
 #endif
+#endif
    
    if (!ddev)
       return -ENODEV;
@@ -290,6 +299,10 @@
    .owner   = THIS_MODULE,
    .open = blackmagic_open,
    .release = blackmagic_release,
+#if KERNEL_VERSION_OR_LATER(5, 9, 0)
+   .unlocked_ioctl = blackmagic_ioctl,
+   .compat_ioctl = blackmagic_ioctl,
+#else
 #ifdef HAVE_UNLOCKED_IOCTL
    .unlocked_ioctl = blackmagic_ioctl,
 #else
@@ -298,6 +311,7 @@
 #ifdef HAVE_COMPAT_IOCTL
    .compat_ioctl = blackmagic_ioctl,
 #endif
+#endif
    .poll = blackmagic_poll,
    .mmap = blackmagic_mmap,
 };
diff -ubr blackmagic-backup-12.0a14/blackmagic-12.0a14/blackmagic_lib.c blackmagic-12.0a14/blackmagic_lib.c
--- blackmagic-backup-12.0a14/blackmagic-12.0a14/blackmagic_lib.c   2021-01-15 11:45:50.000000000 +0900
+++ blackmagic-12.0a14/blackmagic_lib.c   2021-02-09 01:20:20.063060427 +0900
@@ -676,7 +676,12 @@
 #else
    down_read(&current_task->mm->mmap_sem);
 #endif
-#if KERNEL_VERSION_OR_LATER(4, 10, 0)
+#if KERNEL_VERSION_OR_LATER(5, 9, 0)
+      if (current_task == current)
+         ret = get_user_pages((unsigned long)ptr & PAGE_MASK, *nr_pages, write ? FOLL_WRITE : 0, pages, NULL);
+      else
+         ret = get_user_pages_remote(current_task->mm, (unsigned long)ptr & PAGE_MASK, *nr_pages, write ? FOLL_WRITE : 0, pages, NULL, NULL);
+#elif KERNEL_VERSION_OR_LATER(4, 10, 0)
       if (current_task == current)
          ret = get_user_pages((unsigned long)ptr & PAGE_MASK, *nr_pages, write ? FOLL_WRITE : 0, pages, NULL);
       else
Last edited by jiyunomegami on Wed Feb 10, 2021 11:17 am, edited 1 time in total.
Offline

Arun Gurung

  • Posts: 25
  • Joined: Wed May 24, 2017 12:31 pm

Re: Desktop Video 12 on Linux 5.x

PostTue Feb 09, 2021 11:28 pm

jiyunomegami wrote:My Intensity Pro works with OBS on Linux 5.9, with this patch:



Thanks, but how do I apply the patch? I`m kind of green in this area.
Offline

jiyunomegami

  • Posts: 3
  • Joined: Tue Feb 09, 2021 1:31 am
  • Real Name: Joseph Armitage

Re: Desktop Video 12 on Linux 5.x

PostWed Feb 10, 2021 11:14 am

I am not sure if this will actually help you with your Intensity Extreme, but at least you should be able to compile the blackmagic module on 5.9.

When I installed the deb package here, the blackmagic_io module build succeeded, but the blackmagic module build failed.
The kernel module source was left in /usr/src
For the blackmagic module, the full path is /usr/src/blackmagic-12.0a14

So, if you put the contents of the patch in the file /usr/src/blackmagic-12.0a14-Linux5.9patch.diff
you should be able to compile the module with the following 3 commands.

cd /usr/src/blackmagic-12.0a14/
patch -p1 <../blackmagic-12.0a14-Linux5.9patch.diff
sudo dkms install blackmagic/12.0a14
Offline

Arun Gurung

  • Posts: 25
  • Joined: Wed May 24, 2017 12:31 pm

Re: Desktop Video 12 on Linux 5.x

PostWed Feb 10, 2021 10:06 pm

I believe I followed your instructions correctly, but here´s what I get:

Code: Select all
> patch -p1 < ../blackmagic-12.0a14-Linux5.9patch.diff
patching file blackmagic_core.c
Hunk #1 succeeded at 231 with fuzz 1.
Hunk #2 FAILED at 243.
Hunk #3 FAILED at 254.
Hunk #4 FAILED at 294.
Hunk #5 FAILED at 302.
4 out of 5 hunks FAILED -- saving rejects to file blackmagic_core.c.rej
patching file blackmagic_lib.c
Hunk #1 FAILED at 676.
1 out of 1 hunk FAILED -- saving rejects to file blackmagic_lib.c.rej
Offline

jiyunomegami

  • Posts: 3
  • Joined: Tue Feb 09, 2021 1:31 am
  • Real Name: Joseph Armitage

Re: Desktop Video 12 on Linux 5.x

PostThu Feb 11, 2021 5:48 pm

Maybe you have a slightly different version of the kernel module, or have edited the files.
I just downloaded the 12.0 drivers a few days ago. Maybe they change the drivers without adding a minor version number?
If you are in a hurry, you can try patching it by hand.
Go through each line in the patch.
Lines starting with --- or +++ contain file names.
Lines starting with @@ contain a line number that is near where you must make changes.
Delete the lines starting with -, and add lines starting with +.
Offline

Arun Gurung

  • Posts: 25
  • Joined: Wed May 24, 2017 12:31 pm

Re: Desktop Video 12 on Linux 5.x

PostFri Feb 12, 2021 10:01 am

Thanks, again. I was able to compile the modules. But alas, the Desktop Video Setup app can´ t find any device, even if everything looks OK, elsewhere.
Offline

Arun Gurung

  • Posts: 25
  • Joined: Wed May 24, 2017 12:31 pm

Re: Desktop Video 12 on Linux 5.x, can`t find any devices

PostFri Feb 12, 2021 11:15 am

Because it worked with Windows 10 on my PC, I assumed the device is not the fault. Now I reinstalled on my MacBook Air and even if installation was a breeze, I get the same result as on my regular PC. It used to work before. Therefore, I assume there´s nothing wrong with the Thunderbolt on neither the laptop or the PC.

Image
Offline

Lexridge

  • Posts: 11
  • Joined: Tue Nov 13, 2012 8:39 pm
  • Real Name: Jim Hines

Re: Desktop Video 12 on Linux 5.x

PostSat Feb 13, 2021 10:48 pm

Does there exist a .diff file for 5.10 kernels?
Offline

Arun Gurung

  • Posts: 25
  • Joined: Wed May 24, 2017 12:31 pm

Re: Desktop Video 12 on Linux 5.x

PostMon Feb 15, 2021 2:03 am

Lexridge wrote:Does there exist a .diff file for 5.10 kernels?


The brilliant patch from jiyunomegami works with the 5.10 kernel.

But the topic is supposed to be why Desktop Video app can´t find my device, even if it looks like everything else is well.
Offline

Arun Gurung

  • Posts: 25
  • Joined: Wed May 24, 2017 12:31 pm

Re: Desktop Video 12 on Linux 5.x

PostSun Feb 21, 2021 12:02 pm

I give up and go back to Windows 10.

Image

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 16 guests