Page 1 of 1

Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Mon Dec 26, 2022 3:18 pm
by pwrzec
In the 6.1 Kernel, the developers finally removed:

macro: snd_dma_continuous_data(GFP_KERNEL)
function: prandom_u32()

Therefore, the compilation of blackmagic-io -v 12.4.1a15 fails.

To correct this, edit from /var/lib/dkms/blackmagic-io/12.4.1a15/source directory the following files:

bm_util.c
bmio_audio.c


You need to edit as super user (su) or root. Before changing the contents of the files, copy them with the changed name.


Changes to the bm_util.c file:

Looking for line 902:

Code: Select all
//Random
uint32_t bm_random32(void)

From lines 905 to 913, there is a code:

#if KERNEL_VERSION_OR_LATER(3, 8, 0)
   return prandom_u32();
#elif KERNEL_VERSION_OR_LATER(2, 6, 19)
   return random32();
#else
   uint32_t num;
   get_random_bytes(&num, sizeof(uint32_t));
   return num;
#endif


It should be replaced with:

Code: Select all
#if KERNEL_VERSION_OR_LATER(6, 0, 0).
   return get_random_u32();
#elif KERNEL_VERSION_OR_LATER(3, 8, 0).
   return prandom_u32();
#elif KERNEL_VERSION_OR_LATER(2, 6, 19)
   return random32();
#else
   uint32_t num;
   get_random_bytes(&num, sizeof(uint32_t));
   return num;
#endif


Changes to the bmio_audio.c file:

From lines 433 to 437, there is code (function static int bmio_audio_init_pcm(bmio_audio_t* aud)):

Code: Select all
snd_pcm_lib_preallocate_pages_for_all(pcm,
      SNDRV_DMA_TYPE_CONTINUOUS,
      snd_dma_continuous_data(GFP_KERNEL),
      bmio_audio_hardware.buffer_size,
      bmio_audio_hardware.buffer_size);



It should be replaced with the code:

Code: Select all
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
   snd_pcm_lib_preallocate_pages_for_all(pcm,
      SNDRV_DMA_TYPE_CONTINUOUS,
      snd_dma_continuous_data(GFP_KERNEL,)
      bmio_audio_hardware.buffer_size,
      bmio_audio_hardware.buffer_size);
#else
   snd_pcm_lib_preallocate_pages_for_all(pcm,
      SNDRV_DMA_TYPE_CONTINUOUS,
      NULL,
      bmio_audio_hardware.buffer_size,
      bmio_audio_hardware.buffer_size);
#endif


Note: Regardless of the change, we must wait for an official update of Desktop Video. I tested the code on a PC: AMD Ryzen 7 3700 , 32 GB RAM, NVIDIA RTX 3050Ti, 2 TB SSD, DeckLink Mini Recorder and Intensity Pro 4K. OS: openSUSE Tumbleweed.

Re: Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Tue Jan 03, 2023 12:54 am
by leonewton253
I'm also using Opensuse tumbleweed with an AMD GPU. When I first installed it and installed the rocm-openl library davinci worked and all codecs where available to export. Now, after a system update, H265 and other codecs are not available. I'm using the studio version. How do I fix this? Thanks

Re: Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Mon Jan 09, 2023 11:24 pm
by nixit77
I too am experience this issue, but thought it was from moving to AMD gpu from nvidia gpu.

going to keep an eye on this, as I've noticed the same thing. I created a thread last night/this am.

Re: Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Mon Jan 16, 2023 10:53 am
by NVieville
Hello,

Thank you for this information.
Here is a transcription of pwrzec proposition into a patch.
Hope this will help.

Cordially,


--
NVieville

Re: Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Thu Feb 23, 2023 6:44 am
by Zornica
I tried the solution but it failed to build at first. Looks like there was a . too much after #if KERNEL_VERSION_OR_LATER(6, 0, 0). and #elif KERNEL_VERSION_OR_LATER(3, 8, 0).

after removing those it went through

Now the driver gets properly loaded.
Thank you all for your efforts!

Re: Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Fri Feb 24, 2023 8:45 pm
by bounce
hi all, I finally was able to get the two folders to finally compile. It appeared that I needed to update the GCC version and also update the Symbolic Links.

There also was a typo that the compiler caught. Here are the updates.

Code: Select all
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
   snd_pcm_lib_preallocate_pages_for_all(pcm,
      SNDRV_DMA_TYPE_CONTINUOUS,
      snd_dma_continuous_data(GFP_KERNEL),
      bmio_audio_hardware.buffer_size,
      bmio_audio_hardware.buffer_size);
#else
   snd_pcm_lib_preallocate_pages_for_all(pcm,
      SNDRV_DMA_TYPE_CONTINUOUS,
      NULL,
      bmio_audio_hardware.buffer_size,
      bmio_audio_hardware.buffer_size);
#endif


and

Code: Select all
#if KERNEL_VERSION_OR_LATER(6, 0, 0)
   return get_random_u32();
#elif KERNEL_VERSION_OR_LATER(3, 8, 0)
   return prandom_u32();
#elif KERNEL_VERSION_OR_LATER(2, 6, 19)
   return random32();
#else
   uint32_t num;
   get_random_bytes(&num, sizeof(uint32_t));
   return num;
#endif


Now my only problem is getting those drivers installed into my ubuntu system. I'm fairly novice to this next step, so any suggestions on how and where to copy the driver files would be greatly appreciated and able to help the next person... This has been something i've been already working 3 weeks on!

Re: Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Fri Feb 24, 2023 10:42 pm
by bounce
It appeared I had to to do a insmod and reload desktop video GUI and now it seems to work. Eventually I was able to use BlackMagic Firmware Updater and see all the devices.

Re: Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Tue Feb 28, 2023 5:36 pm
by Winston Hoy
Thanks, this worked for me on Pop!_OS 22.04.

Re: Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Tue Mar 07, 2023 9:24 am
by alatteri
Kernel is now on 6.2, with 6.3 in the wings. BMD, update please.

Re: Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Tue Mar 28, 2023 11:02 pm
by Jeff McGuire
Greetings,

I've been dealing with this issue on Pop!_OS 22.04 LTS x86_64.

I'm quite intermediate with Linux. I have no experience or have had the need to compile things. I've appended the files as shown, however when I compile them with either gcc or g++ it complains about missing Header files:

me@myworkstation:/var/lib/dkms/blackmagic-io/12.4.1a15/source$ gcc bm_util.c
bm_util.c:27:10: fatal error: linux/delay.h: No such file or directory
27 | #include <linux/delay.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
me@myworkstation:/var/lib/dkms/blackmagic-io/12.4.1a15/source$ gcc bmio_audio.c
bmio_audio.c:28:10: fatal error: linux/slab.h: No such file or directory
28 | #include <linux/slab.h>
| ^~~~~~~~~~~~~~
compilation terminated.


Searching for both missing Headers with the "locate -b 'slab.h' or 'delay.h' shows me they are in fact in: linux-headers-6.2.0-76060200

I'm missing a step that I can't figure out, any thoughts or guides would be much appreciated.

Thanks,
Jeff

Re: Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Wed Apr 05, 2023 8:47 pm
by Jeff McGuire
Finally solved this problem, should any other new or intermediate Linux user encounter this, here is what I did:

Navigate to: cd /var/lib/dkms/blackmagic-io/12.4.1a15/source

Follow the amended steps above to fix bm_util.c and bmio_audio.c with either VIM or NANO.

Once you return to Terminal (and still in aforementioned /source directory), type: sudo make

Enter your password and it should compile.

When it finishes, type: sudo insmod blackmagic-io.ko

If successful, your module should be inserted into the Linux Kernel and your Decklink Card will be accessible in both Desktop Video and DaVinci Resolve.

I'm starting to love Linux - Resolve, Nuke and Houdini run like a dream. But MAN it can sure be a pain in the ass from time to time.

Hope this helps someone!

-Jeff

Re: Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Wed Apr 12, 2023 5:25 am
by Cameron Nichols
Hi Jeff,

You should use dkms to rebuild/install the blackmagic-io module:
Code: Select all
sudo dkms build -m blackmagic-io -v 12.4.1a15 -k $(uname -r)
sudo dkms install -m blackmagic-io -v 12.4.1a15 -k $(uname -r)
After install, reboot your system.

Regards
Cameron

Re: Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Sat Apr 15, 2023 4:39 pm
by alatteri
Hi Cameron,

Do you have an ETA of official 6.1+ support?


Cameron Nichols wrote:Hi Jeff,

You should use dkms to rebuild/install the blackmagic-io module:
Code: Select all
sudo dkms build -m blackmagic-io -v 12.4.1a15 -k $(uname -r)
sudo dkms install -m blackmagic-io -v 12.4.1a15 -k $(uname -r)
After install, reboot your system.

Re: Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Sun May 07, 2023 4:01 am
by struktured
That patch didn't work for me on kubuntu 6.2.0-1003-lowlatency #3-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr 6 10:00:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux:

Code: Select all
 sudo dkms install -m blackmagic-io -v 12.4.1a15 -k $(uname -r) --force

Attempting to load driver
modprobe: ERROR: could not insert 'blackmagic_io': Invalid argument
ERR The new blackmagic-io driver was not able to be loaded
ERR Please check 'dmesg' for more information
depmod...


Code: Select all
sudo dmesg | grep blackmagic

[  427.025028] blackmagic_io: has both .ctors and .init_array.



Please fix this, BM devs!

Re: Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Mon May 29, 2023 10:54 am
by Julusian
I think this patch is no longer sufficient. The `5.19.0-42-generic #43~22.04.1-Ubuntu` kernel in ubuntu 22.04 failed to build the module. I had to change the patch for `bmio_audio.c` to also affect this version for it to compile.

The key bit here for blackmagic to take away from this, is that running a fully updated Ubuntu 22.04 will encounter this issue now.

Re: Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Sat Jun 03, 2023 3:39 pm
by stpaulsajaxcamera
Just confirming the 5.19 Kernel in Ubuntu 22.04 does not build and install without editing `bmio_audio.c`

My version string:
Code: Select all
camera@cameraControl:~$ uname -a
Linux cameraControl 5.19.0-43-generic #44~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon May 22 13:39:36 UTC 2 x86_64 x86_64 x86_64 GNU/Linux


I'll add details to the post I started:

FIXED: Problem with Declink MR driver under Ubuntu 22.04

Re: Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Sat Jun 17, 2023 4:46 pm
by kalaspuffar
Hi everyone, first post.

Thougth I add my 2 cents as I actually got my capture card to work. Maybe not the right solution but will work as a work around.

First follow the steps above to change the source code, then in the source directory run:

Code: Select all
sudo make KERNELRELEASE=$(uname -r)
./dkms-helper post-build blackmagic-io 12.4.1a15
sudo objcopy --rename-section .ctors=.init_array --rename-section .dtors=.fini_array snd_blackmagic-io.ko
sudo objcopy --rename-section .ctors=.init_array --rename-section .dtors=.fini_array blackmagic-io.ko
sudo insmod blackmagic-io.ko
sudo insmod snd_blackmagic-io.ko


The trick to rename the .ctors into .init_array was found at:

https://maskray.me/blog/2021-11-07-init ... init-array

Maybe not the right solution but the module loaded for me and now I can use the capture card for recordings again.

I hope this helps.

Best regards
Daniel

Re: Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Wed Jun 21, 2023 2:19 pm
by alatteri
It is wild that this issue has been going on for over 6 months, and we are now several addition kernel versions in, and BMD has not issued a new driver update.

Re: Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Tue Jun 27, 2023 1:50 pm
by santomet
EDIT: Guys released Desktop Video 12.5 in the meantime ;)

This issue is outrageous for two reasons:
1. Someone (probably in Canonical?) thought that cherry-picking this patch:
Code: Select all
https://lore.kernel.org/all/20220823115740.14123-5-tiwai@suse.de/
into older kernels would be a good idea.
2. Blackmagic is not able to provide a solution for 7+ months and counting...

So, for lazy people, I applied the abovementioned patch to a .deb package:
Code: Select all
https://mega.nz/file/tMxBzJjQ#I1_R6Bgkkz0-BZ2VU07Fm8GTY0qrUT1Lon2taJhecIs


Works on latest Ubuntu 22.04-hwe kernel 5.19 as well as mainline kernel 6.4

Re: Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Mon Jul 03, 2023 9:34 pm
by Dwaine Maggart
What's new in Desktop Video 12.5
New features and fixes for DeckLink 8K Pro:

Improve compatibility with AMD EPYC processors.
Fix intermittent audio corruption when capturing high frame rate video modes.
Fix issue with chroma ordering when outputting high frame rate video modes.
Improve output video payload identifier for ST 425-5, ST 2081-12 Mode 3 and ST 2081-11 Mode 1/2.
Fix intermittent audio corruption during playback on HP Z2 systems
New features and fixes for all models:

Add support for Linux kernel 6.1 and later.
General performance and stability improvements for all models.

https://www.blackmagicdesign.com/suppor ... 396d/Linux

Re: Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Fri Aug 04, 2023 1:35 pm
by alatteri
The compilation is failing again with kernel 6.4.

Re: Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Mon Oct 02, 2023 3:14 pm
by Laurie Reeves
blackmagic-io (version 12.7a4) kernel module failing on latest Centos Stream 9 kernel. Kernel version is 5.14.0-368.el9.x86_64 (obviously heavily patched).

From /var/lib/dkms/blackmagic-io/12.7a4/build/make.log

Code: Select all
  CC [M]  /var/lib/dkms/blackmagic-io/12.7a4/build/bmio_audio.o
/var/lib/dkms/blackmagic-io/12.7a4/build/bmio_audio.c: In function ‘bmio_audio_init_pcm’:
/var/lib/dkms/blackmagic-io/12.7a4/build/bmio_audio.c:438:17: error: implicit declaration of function ‘snd_dma_continuous_data’ [-Werror=implicit-function-declaration]
  438 |                 snd_dma_continuous_data(GFP_KERNEL),
      |                 ^~~~~~~~~~~~~~~~~~~~~~~
/var/lib/dkms/blackmagic-io/12.7a4/build/bmio_audio.c:438:17: warning: passing argument 3 of ‘snd_pcm_lib_preallocate_pages_for_all’ makes pointer from integer without a cast [-Wint-conversion]
  438 |                 snd_dma_continuous_data(GFP_KERNEL),
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                 |
      |                 int
In file included from /var/lib/dkms/blackmagic-io/12.7a4/build/bmio_audio.c:38:
./include/sound/pcm.h:1272:59: note: expected ‘void *’ but argument is of type ‘int’
 1272 |                                           int type, void *data,
      |                                                     ~~~~~~^~~~


Same error as posted here: viewtopic.php?f=12&t=174911

But that post refers back to this post.

Re: Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Tue Nov 07, 2023 7:08 pm
by malatwork
This is happening on RHEL 9.3 which was just released...

Re: Linux Kernel 6.1 & Desktop Video 12.7.1

PostPosted: Tue Nov 07, 2023 10:32 pm
by malatwork
Grabbed the Desktop Video 12.7.1. uninstalled with rpm -e the desktopvideo/gui/mediaexpress and installed the new desktopvideo but it fails the build. From the resulting source directory....

To get this to work changed my /var/lib/dkms/blackmagic-io/17.1.1a1/source/bm_util.c (not sure I needed to)

Code: Select all
// Random
uint32_t bm_random32(void)
{
   // mal #if KERNEL_VERSION_OR_LATER(6, 1, 0) to #if KERNEL_VERSION_OR_LATER(5, 1, 0)
#if KERNEL_VERSION_OR_LATER(5, 1, 0)
   return get_random_u32();
#elif KERNEL_VERSION_OR_LATER(3, 8, 0)
   return prandom_u32();
#elif KERNEL_VERSION_OR_LATER(2, 6, 19)
   return random32();
#else
   uint32_t num;
   get_random_bytes(&num, sizeof(uint32_t));
   return num;
#endif
}


And the bmio_audio.c in the same place to
Code: Select all
/*   snd_pcm_lib_preallocate_pages_for_all(pcm,
      SNDRV_DMA_TYPE_CONTINUOUS,
#if KERNEL_VERSION_OR_LATER(5, 19, 0)
      NULL,
#else
      snd_dma_continuous_data(GFP_KERNEL),
#endif
      bmio_audio_hardware.buffer_size,
      bmio_audio_hardware.buffer_size);
*/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0))
   snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, snd_dma_continuous_data(GFP_KERNEL), bmio_audio_hardware.buffer_size, bmio_audio_hardware.buffer_size);
#else
   snd_pcm_lib_preallocate_pages_for_all(pcm,
      SNDRV_DMA_TYPE_CONTINUOUS,
      NULL,
      bmio_audio_hardware.buffer_size,
      bmio_audio_hardware.buffer_size);
#endif


so basically passed in NULL for the third parameter as it was choking on the snd_dma_continuous_data(GFP_KERNEL) parameter saying it was expecting a void * but gettin an int or something. Then I had to

Code: Select all
dkms build -m blackmagic-io -v 12.7.1a1 --rpm_safe_upgrade
or (i forget)
sudo dkms build -m blackmagic-io -v 12.7.1a1
sudo dkms install -m blackmagic-io -v 12.7.1a1

Re: Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Tue Dec 05, 2023 4:03 am
by Daniel Leary
malatwork wrote:Grabbed the Desktop Video 12.7.1. uninstalled with rpm -e the desktopvideo/gui/mediaexpress and installed the new desktopvideo but it fails the build. From the resulting source directory....

To get this to work changed my /var/lib/dkms/blackmagic-io/17.1.1a1/source/bm_util.c (not sure I needed to)

Code: Select all
// Random
uint32_t bm_random32(void)
{
   // mal #if KERNEL_VERSION_OR_LATER(6, 1, 0) to #if KERNEL_VERSION_OR_LATER(5, 1, 0)
#if KERNEL_VERSION_OR_LATER(5, 1, 0)
   return get_random_u32();
#elif KERNEL_VERSION_OR_LATER(3, 8, 0)
   return prandom_u32();
#elif KERNEL_VERSION_OR_LATER(2, 6, 19)
   return random32();
#else
   uint32_t num;
   get_random_bytes(&num, sizeof(uint32_t));
   return num;
#endif
}


And the bmio_audio.c in the same place to
Code: Select all
/*   snd_pcm_lib_preallocate_pages_for_all(pcm,
      SNDRV_DMA_TYPE_CONTINUOUS,
#if KERNEL_VERSION_OR_LATER(5, 19, 0)
      NULL,
#else
      snd_dma_continuous_data(GFP_KERNEL),
#endif
      bmio_audio_hardware.buffer_size,
      bmio_audio_hardware.buffer_size);
*/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0))
   snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, snd_dma_continuous_data(GFP_KERNEL), bmio_audio_hardware.buffer_size, bmio_audio_hardware.buffer_size);
#else
   snd_pcm_lib_preallocate_pages_for_all(pcm,
      SNDRV_DMA_TYPE_CONTINUOUS,
      NULL,
      bmio_audio_hardware.buffer_size,
      bmio_audio_hardware.buffer_size);
#endif


so basically passed in NULL for the third parameter as it was choking on the snd_dma_continuous_data(GFP_KERNEL) parameter saying it was expecting a void * but gettin an int or something. Then I had to

Code: Select all
dkms build -m blackmagic-io -v 12.7.1a1 --rpm_safe_upgrade
or (i forget)
sudo dkms build -m blackmagic-io -v 12.7.1a1
sudo dkms install -m blackmagic-io -v 12.7.1a1


The solution by malatwork seems like it fixed the issue! (at least for me). dkms status now shows blackmagic-io/12.7.1a1 successfully installed.
I am running on a system with Rocky 9.3

Re: Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Mon Mar 04, 2024 9:17 pm
by PainComper
Annyone know if there has been an oficial patch yet ?

Re: Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Fri Apr 19, 2024 3:22 pm
by PainComper
I can`t find a blackmagic-io folder annywhere on my system after unstalling resolve

Re: Linux Kernel 6.1 & Desktop Video 12.4.1

PostPosted: Tue Apr 23, 2024 4:56 am
by Jonesvideo
I'm also having some trouble with this issue, originally I thought it was because I was moving from a NVIDA GPU to a AMD GPU.

Will be keeping my eyes peeled on any further developments here