Skip to content

Adding support for kernel version >= 6.5.0#22

Open
Darthbob wants to merge 2 commits into
stoth68000:masterfrom
Darthbob:master
Open

Adding support for kernel version >= 6.5.0#22
Darthbob wants to merge 2 commits into
stoth68000:masterfrom
Darthbob:master

Conversation

@Darthbob

Copy link
Copy Markdown

So I'm completely new to driver development and working with C. I added the old videobuf-api to this project. I was able to compile on kernel v6.5.0 and v6.8.0. I also had to make some adjustments to the timestamp conversion. Fortunately, there are some helper functions.
Compiling and adding the driver to the kernel works fine. When my Elgato card arrives, I can test whether it works.

@BlatrixFB

Copy link
Copy Markdown

Hey,

were you able to test it? Because it seems not to work for me. I can see the device in OBS but it seems that there is no output

@Darthbob

Darthbob commented Oct 7, 2024

Copy link
Copy Markdown
Author

Hi!
Yes, I was able to get it running. But as far as I know you're only able to get it work with software like ffmpeg. In the Makefile are some example commands to get an output. I think the driver is not including all needed api's of v4l2. So that's why software like OBS cannot work with it.
Sadly I was only getting a very low framerate with ffmpeg. The driver doesn't work for me as expected. Even after setting up a linux machine with the official supported kernel version, I had the same results.

@lightspeed3m

Copy link
Copy Markdown

Hi,
I am looking to spend time into this, is there anything I should be aware of other than HDR10 and V4L2?

@stoth68000

stoth68000 commented Sep 17, 2025 via email

Copy link
Copy Markdown
Owner

@lightspeed3m

Copy link
Copy Markdown

I haven't looked at a 6.x kernel, because most of my time is spent with RHEL kernels..... So I can't say for certain what you'll find. I haven't worked on the project for a long time, so I don't recall what the story is with HDR metadata (needed) and obtaining that from the underlying hardware (of possible). I'd expect it to be available in the HDMI chip register map by default. Don't break back compat with earlier kernels please, otherwise you're patches are welcome. - Steve

On Wed, Sep 17, 2025 at 12:53 PM Bassam @.> wrote: lightspeed3m left a comment (stoth68000/sc0710#22) <#22 (comment)> Hi, I am looking to spend time into this, is there anything I should be aware of other than HDR10 and V4L2? — Reply to this email directly, view it on GitHub <#22 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEEERBC6RFG345MWGOPKM633TGG2HAVCNFSM6AAAAACGY5RYPSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGMBTHAZTEMRZGY . You are receiving this because you are subscribed to this thread.Message ID: @.>
-- Steven Toth - Kernel Labs http://www.kernellabs.com

Thank you for your reply. I will keep in mind to account for the existing kernel calls.

@dusda

dusda commented Sep 25, 2025

Copy link
Copy Markdown

I'm unable to get this to build, at least on 6.16.

~/os/sc0710) make
make -C /lib/modules/6.16.8-arch3-1/build M=/home/dusda/os/sc0710 modules
make[1]: Entering directory '/usr/lib/modules/6.16.8-arch3-1/build'
make[2]: Entering directory '/home/dusda/os/sc0710'
  CC [M]  sc0710-cards.o
  CC [M]  sc0710-core.o
sc0710-core.c:75:6: warning: no previous prototype for ‘sc_andor’ [-Wmissing-prototypes]
   75 | void sc_andor(struct sc0710_dev *dev, int bar, u32 reg, u32 mask, u32 value)
      |      ^~~~~~~~
  CC [M]  sc0710-i2c.o
sc0710-i2c.c: In function ‘sc0710_i2c_read_hdmi_status’:
sc0710-i2c.c:177:13: warning: unused variable ‘i’ [-Wunused-variable]
  177 |         int i;
      |             ^
  CC [M]  sc0710-dma-channel.o
  CC [M]  sc0710-dma-channels.o
  CC [M]  sc0710-dma-chains.o
  CC [M]  sc0710-dma-chain.o
  CC [M]  sc0710-things-per-second.o
  CC [M]  sc0710-video.o
sc0710-video.c: In function ‘vidioc_streamoff’:
sc0710-video.c:498:9: error: implicit declaration of function ‘del_timer’; did you mean ‘add_timer’? [-Wimplicit-function-declaration]
  498 |         del_timer(&ch->timeout);
      |         ^~~~~~~~~
      |         add_timer
sc0710-video.c: At top level:
sc0710-video.c:512:6: warning: no previous prototype for ‘sc0710_dma_free’ [-Wmissing-prototypes]
  512 | void sc0710_dma_free(struct videobuf_queue *q, struct sc0710_dma_channel *ch, struct sc0710_buffer *buf)
      |      ^~~~~~~~~~~~~~~
sc0710-video.c: In function ‘sc0710_vid_timeout’:
sc0710-video.c:826:41: error: implicit declaration of function ‘from_timer’; did you mean ‘mod_timer’? [-Wimplicit-function-declaration]
  826 |         struct sc0710_dma_channel *ch = from_timer(ch, t, timeout);
      |                                         ^~~~~~~~~~
      |                                         mod_timer
sc0710-video.c:826:59: error: ‘timeout’ undeclared (first use in this function); did you mean ‘timer_t’?
  826 |         struct sc0710_dma_channel *ch = from_timer(ch, t, timeout);
      |                                                           ^~~~~~~
      |                                                           timer_t
sc0710-video.c:826:59: note: each undeclared identifier is reported only once for each function it appears in
make[4]: *** [/usr/lib/modules/6.16.8-arch3-1/build/scripts/Makefile.build:287: sc0710-video.o] Error 1
make[3]: *** [/usr/lib/modules/6.16.8-arch3-1/build/Makefile:2003: .] Error 2
make[2]: *** [/usr/lib/modules/6.16.8-arch3-1/build/Makefile:248: __sub-make] Error 2
make[2]: Leaving directory '/home/dusda/os/sc0710'
make[1]: *** [Makefile:248: __sub-make] Error 2
make[1]: Leaving directory '/usr/lib/modules/6.16.8-arch3-1/build'
make: *** [Makefile:14: all] Error 2

@Archenoth

Copy link
Copy Markdown

@dusda On 6.17 I had to rename a few functions that had their names changed to get this compiled. Maybe if you do the same thing, it might work for you too?

diff --git a/sc0710-video.c b/sc0710-video.c
index 3f79cae..ff6768a 100644
--- a/sc0710-video.c
+++ b/sc0710-video.c
@@ -495,7 +495,7 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
                tm6200_capture_disconnect(chip->capture_pcm_substream);
 #endif
 
-       del_timer(&ch->timeout);
+       timer_delete(&ch->timeout);
 
        sc0710_dma_channels_stop(dev);
 
@@ -823,7 +823,7 @@ static void sc0710_vid_timeout(unsigned long data)
 #else
 static void sc0710_vid_timeout(struct timer_list *t)
 {
-       struct sc0710_dma_channel *ch = from_timer(ch, t, timeout);
+       struct sc0710_dma_channel *ch = timer_container_of(ch, t, timeout);
 #endif
        struct sc0710_dev *dev = ch->dev;
        struct sc0710_buffer *buf;

@VixiKitsune

Copy link
Copy Markdown

@dusda On 6.17 I had to rename a few functions that had their names changed to get this compiled. Maybe if you do the same thing, it might work for you too?

diff --git a/sc0710-video.c b/sc0710-video.c
index 3f79cae..ff6768a 100644
--- a/sc0710-video.c
+++ b/sc0710-video.c
@@ -495,7 +495,7 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
                tm6200_capture_disconnect(chip->capture_pcm_substream);
 #endif
 
-       del_timer(&ch->timeout);
+       timer_delete(&ch->timeout);
 
        sc0710_dma_channels_stop(dev);
 
@@ -823,7 +823,7 @@ static void sc0710_vid_timeout(unsigned long data)
 #else
 static void sc0710_vid_timeout(struct timer_list *t)
 {
-       struct sc0710_dma_channel *ch = from_timer(ch, t, timeout);
+       struct sc0710_dma_channel *ch = timer_container_of(ch, t, timeout);
 #endif
        struct sc0710_dev *dev = ch->dev;
        struct sc0710_buffer *buf;

Is it fully working with this?

@Archenoth

Copy link
Copy Markdown

@VixiKitsune Honestly, I'm not sure?

I was able to compile and load the module fine! (Since those two functions in my diff were just renames)

But I had to manually specify what my card was in my insmod (which indicates to me that the driver didn't really recognize my card)
Your board isn't known (yet) to the driver.
Try to pick one of the existing card configs via card=n insmod option. 
Updating to the latest version might help as well.
Here is a list of valid choices for the card=n insmod option:
card=0: UNKNOWN/GENERIC
card=1: Elgato 4k60 Pro mk.2

And even after doing that, I haven't managed to get it to work!

But according to my box, my 4k pro was made in 2024, which was after the last commit in this repo, so I'm not sure if there's something broken in the code, or if there was another hardware revision and I just got unlucky (I notice the "mk.2" in the output above, but I don't see any indication of a revision on either the card or my box; lshw not giving any hints either)

tl;dr - this all could be a "me" problem

That all said, it you wanted to try it out yourself, the Makefile has the steps to load the module! (And some example ffmpeg commands to test with; which you can do while watching journalctl -f)

@SaahilNZ

Copy link
Copy Markdown

Hi @Archenoth
I'm in more or less the same boat as you. Can get it compiling, but not working.
Some things of note - this driver is for the 4K60 Pro Mk. 2, but judging from the subsystem info (lcfa:0012), we both have the 4K Pro, which while confusingly named, is the successor to the 4K60 Pro Mk. 2.
The 4K Pro could very well use different data structures to the 4K60 Pro Mk. 2, though being new to the Linux ecosystem I wouldn't even know where or how to start investigating this.

@VixiKitsune

Copy link
Copy Markdown

The driver is for the Mk2. The Mk1 is a different chip.

@VixiKitsune

Copy link
Copy Markdown

I've got it compiled, but haven't figured out how to view video from it.
If I add a Pipewire Video Capture source in OBS it shows up as a device, but that's it.

@VixiKitsune

Copy link
Copy Markdown

I haven't looked at a 6.x kernel, because most of my time is spent with RHEL kernels..... So I can't say for certain what you'll find. I haven't worked on the project for a long time, so I don't recall what the story is with HDR metadata (needed) and obtaining that from the underlying hardware (of possible). I'd expect it to be available in the HDMI chip register map by default. Don't break back compat with earlier kernels please, otherwise you're patches are welcome. - Steve

On Wed, Sep 17, 2025 at 12:53 PM Bassam @.> wrote: lightspeed3m left a comment (stoth68000/sc0710#22) <#22 (comment)> Hi, I am looking to spend time into this, is there anything I should be aware of other than HDR10 and V4L2? — Reply to this email directly, view it on GitHub <#22 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEEERBC6RFG345MWGOPKM633TGG2HAVCNFSM6AAAAACGY5RYPSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGMBTHAZTEMRZGY . You are receiving this because you are subscribed to this thread.Message ID: _@**.**_>
-- Steven Toth - Kernel Labs http://www.kernellabs.com

Thank you for your reply. I will keep in mind to account for the existing kernel calls.

Have you make any progress? I would be interested in collaborating.

@VixiKitsune

Copy link
Copy Markdown

I've got it compiled, but haven't figured out how to view video from it. If I add a Pipewire Video Capture source in OBS it shows up as a device, but that's it.

using make encode I managed to get a clip of my Switch 2's home menu

encoder0.mp4

@VixiKitsune

VixiKitsune commented Dec 11, 2025

Copy link
Copy Markdown

Hi! Yes, I was able to get it running. But as far as I know you're only able to get it work with software like ffmpeg. In the Makefile are some example commands to get an output. I think the driver is not including all needed api's of v4l2. So that's why software like OBS cannot work with it. Sadly I was only getting a very low framerate with ffmpeg. The driver doesn't work for me as expected. Even after setting up a linux machine with the official supported kernel version, I had the same results.

Did you use hardware encoding?
I found with libx264 i get low framerates, but with hevc_vaapi I get 60fps at 4k

I'm finding the image randomly gets chopped up and rearranged sometimes though. didn't happen once on windows.

output2.mp4

@stoth68000

stoth68000 commented Dec 11, 2025 via email

Copy link
Copy Markdown
Owner

@VixiKitsune

Copy link
Copy Markdown

That's what I was experiencing.
The other 3 issues I've found are:

  • Not working in OBS
  • HDR is completely cursed
  • FFMPEG stream randomly crashing

I'm hopefully free next week to take a look at fixing it

@VixiKitsune

VixiKitsune commented Dec 22, 2025

Copy link
Copy Markdown

For some reason I am getting these errors when trying to make, when it was able to build 2 weeks ago.
image

EDIT: 'make LLVM=1' Solves this.

@VixiKitsune

Copy link
Copy Markdown

After tinkering I've managed to make 2 2min videos without the the video frame misalignment bug appearing. Might have also fixed the crashing along with it.
https://peertube.vixikitsune.moe/w/vfeWJ8SwALKjjtH4eNDQak
https://peertube.vixikitsune.moe/w/aM4nS83Nsrm7EgAxcSXHQR

I will need to test more to see if these issues are truly gone.

I added a little bit of code for HDR support, but it still isn't working. I'll come back to HDR after I get it working with OBS.

@lightspeed3m

Copy link
Copy Markdown

Wow! you all made a lot of progress while I am still struggling to get it working. What boards are you all using? Is it the same Mk.2?
Also, I have the 4k pro which I am trying to figure out how to include.

@VixiKitsune

Copy link
Copy Markdown

Wow! you all made a lot of progress while I am still struggling to get it working. What boards are you all using? Is it the same Mk.2? Also, I have the 4k pro which I am trying to figure out how to include.

This driver is for the 4k60pro mk2 (and other cards with the same chip, presumably)
4kpro is a newer card with a different chip, so it isn't compatible with this driver.
I might get one in 2026 to have a go at releasing a driver for it.

@lightspeed3m

Copy link
Copy Markdown

Wow! you all made a lot of progress while I am still struggling to get it working. What boards are you all using? Is it the same Mk.2? Also, I have the 4k pro which I am trying to figure out how to include.

This driver is for the 4k60pro mk2 (and other cards with the same chip, presumably) 4kpro is a newer card with a different chip, so it isn't compatible with this driver. I might get one in 2026 to have a go at releasing a driver for it.

Happy new year!!
I’d be glad to host mine remotely for driver development purposes before you buy one. Let me know if you prefer this approach and potentially work together on it.

@VixiKitsune

VixiKitsune commented Jan 2, 2026 via email

Copy link
Copy Markdown

@Nakildias

Nakildias commented Jan 7, 2026

Copy link
Copy Markdown

I've made this in the last few days, and some of you guys might like it. I've rigorously tested it on Arch, Debian, and Fedora using their latest kernels (up to 6.18+).

What I’ve done and why:

  • Full Modern Kernel Support: Instead of just patching individual errors, I've re-engineered the codebase to ensure seamless compilation on bleeding-edge kernels, far beyond the 6.5.0/6.8.0 attempts here.
  • DKMS Integration: I've added a fully automated DKMS lifecycle, so the driver will automatically recompile and link against new kernel headers during system updates. You won't have to manually patch it every time your distro updates.
  • Multi-Client Architecture: I've unlocked concurrent access, meaning you can now have multiple applications (like OBS and Discord) accessing the capture card simultaneously.
  • Signal Stability: I implemented Atomic Signal Restoration and Fail-Safe Signal Generation (color bars). This prevents image tearing and keeps the V4L2 buffer alive during signal loss, which stops applications like OBS from crashing or desyncing.
  • Simplified Installation: I've included a one-line install script that handles all dependencies and compilation for you.

Moving Forward:

I intend to maintain this hard fork for the foreseeable future to keep up with upcoming kernel changes. If you encounter any bugs or compatibility issues, please open an issue on my repository so I can address them directly:

Repo: https://github.com/Nakildias/sc0710

@lightspeed3m

lightspeed3m commented Jan 7, 2026

Copy link
Copy Markdown

I've made this in the last few days, and some of you guys might like it. I've rigorously tested it on Arch, Debian, and Fedora using their latest kernels (up to 6.18+).

What I’ve done and why:

  • Full Modern Kernel Support: Instead of just patching individual errors, I've re-engineered the codebase to ensure seamless compilation on bleeding-edge kernels, far beyond the 6.5.0/6.8.0 attempts here.
  • DKMS Integration: I've added a fully automated DKMS lifecycle, so the driver will automatically recompile and link against new kernel headers during system updates. You won't have to manually patch it every time your distro updates.
  • Multi-Client Architecture: I've unlocked concurrent access, meaning you can now have multiple applications (like OBS and Discord) accessing the capture card simultaneously.
  • Signal Stability: I implemented Atomic Signal Restoration and Fail-Safe Signal Generation (color bars). This prevents image tearing and keeps the V4L2 buffer alive during signal loss, which stops applications like OBS from crashing or desyncing.
  • Simplified Installation: I've included a one-line install script that handles all dependencies and compilation for you.

Moving Forward:

I intend to maintain this hard fork for the foreseeable future to keep up with upcoming kernel changes. If you encounter any bugs or compatibility issues, please open an issue on my repository so I can address them directly:

Repo: https://github.com/Nakildias/sc0710

Thank you for your work!! It would also be great to include other cards such as the 4K Pro. While it is an entirely different chip than sc0710, I’d like to know if there are similarities between them as knowing this could potentially lead to less code changes required. What do you think?

@stoth68000

stoth68000 commented Jan 7, 2026 via email

Copy link
Copy Markdown
Owner

@VixiKitsune

Copy link
Copy Markdown

Thank you for your work!! It would also be great to include other cards such as the 4K Pro. While it is an entirely different chip than sc0710, I’d like to know if there are similarities between them as knowing this could potentially lead to less code changes required. What do you think?

Should be possible by making the driver check which card it is and read the corresponding hardware addresses.
I believe the 4K pro and 4K60 pro mk2 have the same capture resolution support, so nothing separate should need to be added beyond finding the video on the device (unless down-scaling to 1080p120 from a 4k120 source is a driver feature, not a firmware feature).

I think it would be cool to also include the HD60 pro (my brother has one I could see if he'll let me test) and 4K60 Pro mk1, for people with those cards. Some if functions would need to be added to the video format list for those two.

Perhaps we should move discussion about hardware/feature support to Nakildias' repo where development is progressing.

@lightspeed3m

Copy link
Copy Markdown

For anyone who’s stumbled upon this pull request and would like to continue the different cards discussion, I’ve opened a separate issue in @Nakildias' repo to keep the discussion going: Nakildias/sc0710#3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants