Skip to content

add libpostproc patch and DRM PRIME support for v4l2m2#1

Open
royka1 wants to merge 1 commit into
Sky1-Linux:sky1from
royka1:sky1
Open

add libpostproc patch and DRM PRIME support for v4l2m2#1
royka1 wants to merge 1 commit into
Sky1-Linux:sky1from
royka1:sky1

Conversation

@royka1
Copy link
Copy Markdown

@royka1 royka1 commented Jan 18, 2026

This commit applies the libpostproc patch from Kodi, ensuring that Kodi can be built.

In addition, DRM PRIME support is added for v4l2m2 to allow hardware-accelerated video decoding with Kodi.

@avafinger
Copy link
Copy Markdown

avafinger commented Jan 23, 2026

I've tried your patch but it breaks the build process. You make references to libpostproc which does not exist in version 8 .
Your patch cannot be applied cleanly to 6.1 as well.

*note: I'm not building with Kodi

update: --disable-postproc fix that.

@royka1
Copy link
Copy Markdown
Author

royka1 commented Jan 23, 2026

Oops, forgot to add all files. The purpose was to add postproc which Kodi needs.
Now it should compile well with postproc enabled. _But with drm-prime it has issues with seeking, so that's what I'm working on now. Thanks for letting me know.

Seeking issue is fixed

@avafinger
Copy link
Copy Markdown

avafinger commented Jan 23, 2026

Thanks, that fixed libpostproc, now the build is successful.

FYI, built and tested on kernel 6.1. Kodi is on my test list.
I wonder how your Kodi performs using this test file here:
wget http://download.opencontent.netflix.com.s3.amazonaws.com/AV1/Sparks/Sparks-5994fps-AV1-10bit-1920x1080-2194kbps.mp4

Testing this file with your patch (not DRM_PRIME) i get CPU usage ~98% , with a flush error below:

  libavutil      60.  8.100 / 60.  8.100
  libavcodec     62. 11.100 / 62. 11.100
  libavformat    62.  3.100 / 62.  3.100
  libavdevice    62.  1.100 / 62.  1.100
  libavfilter    11.  4.100 / 11.  4.100
  libswscale      9.  1.100 /  9.  1.100
  libswresample   6.  1.100 /  6.  1.100
  libpostproc    59.  1.100 / 59.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/orangepi/test_videos/Sparks-5994fps-AV1-10bit-1920x1080-2194kbps.mp4':
  Metadata:
    major_brand     : iso4
    minor_version   : 1
    compatible_brands: iso4av01
    creation_time   : 2022-06-09T03:25:48.000000Z
    encoder         : GPAC-2.1-DEV-rev199-g8e29f6e8b-github_master
  Duration: 00:09:11.00, start: 0.000000, bitrate: 915 kb/s
  Stream #0:0[0x1](und): Video: av1 (libdav1d) (Main) (av01 / 0x31307661), yuv420p10le(tv), 1920x1080, 914 kb/s, 25 fps, 25 tbr, 25k tbn (default)
    Metadata:
      creation_time   : 2022-06-09T03:25:48.000000Z
      handler_name    : obu@GPAC2.1-DEV-rev199-g8e29f6e8b-github_master
      vendor_id       : [0][0][0][0]
[av1_v4l2m2m @ 0xffff5c001e80] Using device /dev/video4
[av1_v4l2m2m @ 0xffff5c001e80] driver 'mvx' on card 'Linlon Video device' in mplane mode
[av1_v4l2m2m @ 0xffff5c001e80] requesting formats: output=AV01/none capture=NV12/yuv420p10le
[av1_v4l2m2m @ 0xffff5c001e80] Flush: VIDIOC_STREAMOFF failed

using 6.1 (without you patch) i get CPU usage around 10~11

  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
DSP API version: DSP Wrapper Build On May 29 2025 20:06:50 1b06388
[libdav1d @ 0xffff5c001e00] libdav1d 1.0.0    0KB sq=    0B f=0/0   
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/orangepi/test_videos/Sparks-5994fps-AV1-10bit-1920x1080-2194kbps.mp4':
  Metadata:
    major_brand     : iso4
    minor_version   : 1
    compatible_brands: iso4av01
    creation_time   : 2022-06-09T03:25:48.000000Z
    encoder         : GPAC-2.1-DEV-rev199-g8e29f6e8b-github_master
  Duration: 00:09:11.00, start: 0.000000, bitrate: 915 kb/s
  Stream #0:0[0x1](und): Video: av1 (Main) (av01 / 0x31307661), yuv420p10le(tv), 1920x1080, 914 kb/s, 25 fps, 25 tbr, 25k tbn (default)
    Metadata:
      creation_time   : 2022-06-09T03:25:48.000000Z
      handler_name    : obu@GPAC2.1-DEV-rev199-g8e29f6e8b-github_master
      vendor_id       : [0][0][0][0]
[av1_v4l2m2m @ 0xffff5c005660] Using device /dev/video4
[av1_v4l2m2m @ 0xffff5c005660] driver 'mvx' on card 'Linlon Video device' in mplane mode
[av1_v4l2m2m @ 0xffff5c005660] requesting formats: output=AV01 capture=NV12

Obs: i had to change v4l2_fmt back to AV01, my current setup complains there is no support for AV1F (V4L2_PIX_AV1_FRAME), i supose it is used by Kodi

@royka1
Copy link
Copy Markdown
Author

royka1 commented Jan 24, 2026

The order was incorrect so it tried a format that the vpu doesn't know. Now in Kodi it shows in "top" 8-10% of cpu usage of 1200%. With ffplay it shows 100% of 1200%. This is the usage you hadvewith 6.1?

@avafinger
Copy link
Copy Markdown

avafinger commented Jan 24, 2026

With ffplay it shows 100% of 1200%. This is the usage you hadvewith 6.1?

Yes, similar results. But with ffplay (radxa) built on board i get close to you Kodi results. You most likely are using Orion 6 with slower memory speed.

I'm curious about this:
ffplay 5.1.6 pre-installed:
[av1_v4l2m2m @ 0xffff34005020] requesting formats: output=AV01 capture=P010

ffplay 5.1.6 built onboard
[av1_v4l2m2m @ 0xffff5c005660] requesting formats: output=AV01 capture=NV12

ffplay v8 (44acea2) built onboard (with your patches)
[av1_v4l2m2m @ 0xffff5c001e80] requesting formats: output=AV01/none capture=NV12/yuv420p10le

Would you know the part of the code that ask decoder for these formats?

Regarding seek issues, did you fix that in Kodi or ffmpeg?
Forward is Okay, Backward is broken on my tests.

@avafinger
Copy link
Copy Markdown

avafinger commented Jan 24, 2026

@royka1
Today I tested your DRM_PRIME patch with SDL3 and it worked! I only noticed a constant memory leak (112 MBytes/sec), I couldn't figure out where it was (ffmpeg or SDL3).
CPU usage dropped to 3~6%

*update:
FYI,tested ffmpeg drm_prime without SDL3, no leak. so the problem is in SDL3.

This commit applies the libpostproc patch from Kodi, ensuring that Kodi
can be built correctly.

In addition, DRM PRIME support is added for v4l2m2 to allow
hardware-accelerated video decoding with Kodi.
@royka1
Copy link
Copy Markdown
Author

royka1 commented Jan 26, 2026

@avafinger Thanks for testing, the seeking issue should now be fixed.

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.

2 participants