• 1
  • 2
  • 3
  • 4(current)
  • 5
  • 6
  • 8
Solved RPi3 and RPi4 hardware decoding expectations for version 19
#46
I am pleased to share some good news, and an apparently solution to this!

1) I did have to use the modified linux-api-headers which might require that Arch ARM modify our package or supply a new one at least for building.
2) I did have to add three (perhaps less but I haven't tried removing them) cmake lines suggested by @popcornmix 
Code:
...
-DCMAKE_EXE_LINKER_FLAGS_INIT="-L/opt/vc/lib -lvcsm" \
-DCMAKE_EXE_LINKER_FLAGS="-L/opt/vc/lib -lvcsm" \
-DCMAKE_CXX_FLAGS="-Wl,-L/opt/vc/lib -Wl,-lvcsm" \
...
3) I did not need to modify tools/depends/target/ffmpeg/CMakeLists.txt to disable ffmpeg at all.

BIG THANK YOUS to both @asavah and @popcornmix!

For completeness, here is my entire cmake stanza is below:
Code:
  cmake -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_EXE_LINKER_FLAGS_INIT="-L/opt/vc/lib -lvcsm" \
    -DCMAKE_EXE_LINKER_FLAGS="-L/opt/vc/lib -lvcsm" \
    -DCMAKE_CXX_FLAGS="-Wl,-L/opt/vc/lib -Wl,-lvcsm" \
    -DCMAKE_INSTALL_LIBDIR=/usr/lib \
    -DENABLE_EVENTCLIENTS=ON \
    -DENABLE_INTERNAL_FFMPEG=ON \
    -DENABLE_INTERNAL_FMT=ON \
    -DENABLE_INTERNAL_CROSSGUID=ON \
    -DENABLE_INTERNAL_FSTRCMP=ON \
    -DENABLE_INTERNAL_FLATBUFFERS=ON \
    -DENABLE_INTERNAL_SPDLOG=ON \
    -DENABLE_EVENTCLIENTS=ON \
    -DENABLE_VAAPI=OFF \
    -DENABLE_VDPAU=OFF \
    -DENABLE_OPENGL=OFF \
    -DENABLE_MYSQLCLIENT=ON \
    -Dlibdvdcss_URL="/libdvdcss-1.4.2-Leia-Beta-5.tar.gz" \
    -Dlibdvdnav_URL="/libdvdnav-6.0.0-Leia-Alpha-3.tar.gz" \
    -Dlibdvdread_URL="/libdvdread-6.0.0-Leia-Alpha-3.tar.gz" \
    -DFFMPEG_URL="/ffmpeg-4.3-Matrix-Alpha1.tar.gz" \
    -DFMT_URL="/fmt-6.1.2.tar.gz" \
    -DCROSSGUID_URL="/crossguid-8f399e8bd4.tar.gz" \
    -DFSTRCMP_URL="/fstrcmp-0.7.D001.tar.gz" \
    -DFLATBUFFERS_URL="/flatbuffers-1.11.0.tar.gz" \
    -DSPDLOG_URL="/spdlog-1.5.0.tar.gz" \
    -DCORE_PLATFORM_NAME=gbm \
    -DGBM_RENDER_SYSTEM=gles \
    ../"xbmc-6f38814228daabeac63a9724cc72485a2b368689"
  make
Need help programming a Streamzap remote?
Reply
#47
If it helps, here it is my git diff of popcornmix Kodi's gbm branch:
http://paste.ubuntu.com/p/3dqfcbQ5vf/

The cmake flags that I use are almost the same as popcornmix.
Reply
#48
(2020-07-21, 16:51)rascas Wrote: If it helps, here it is my git diff of popcornmix Kodi's gbm branch:
http://paste.ubuntu.com/p/3dqfcbQ5vf/

The cmake flags that I use are almost the same as popcornmix.

Are the two tweaks in the 3rd hunk really needed?
Code:
@@ -108,6 +108,7 @@ externalproject_add(ffmpeg
                     CONFIGURE_COMMAND ${pkgconf} ${pkgconf_path} <SOURCE_DIR>/configure
                       --prefix=${CMAKE_INSTALL_PREFIX}
                       --extra-version="kodi-${FFMPEG_VER}"
+                      --disable-mmal
                       --disable-doc
                       --disable-ffplay
                       --enable-ffmpeg
@@ -126,6 +127,7 @@ externalproject_add(ffmpeg
                       --enable-protocol=http
                       --enable-encoder=png
                       --enable-encoder=mjpeg
+                      --enable-hwaccels
                       ${ffmpeg_conf})
 
 install(CODE "Message(Done)")
Need help programming a Streamzap remote?
Reply
#49
Probably not.
Reply
#50
disable_mmal is probably desirable as we don't use mmal on pi4. It may mean that the vcsm dependency is no longer required.
I don't think enable-hwaccels is needed.
Reply
#51
(2020-07-18, 19:06)asavah Wrote: @graysky that build failure is because of a diference between uapi headers in raspberry tree and vanilla kernel trees.

The missing defines are here https://github.com/raspberrypi/linux/blo...ev2.h#L747

Which as you can see here https://git.kernel.org/pub/scm/linux/ker...?h=v5.4.52 are missing from stable 5.4 vanilla tree.

Those defines should be in /usr/include/linux/videodev2.h

Apparently arch uses vanilla or outdated kernel sources to bootstrap linux-api-headers thus the required bits are missing.

@asavah  or @popcornmix - Is there a way to redefine the path to these for the build?  For example, I could locate them in /foo/uapi/linux/ and avoid needing a separate package all together.

EDIT: It seems that all the magic is done in https://github.com/popcornmix/xbmc/blob/gbm/tools/depends/target/ffmpeg/0001-rpi-Add-hevc-acceleration.patch... perhaps it would require hacking that to hard-code in the prepaths I want or is there simply a variable I pass to CMAKE that will do it?
Need help programming a Streamzap remote?
Reply
#52
What is the issue? Only one symbol is needed that is missing from drm_fourcc.h (it will appear there in a future update)

So for now I've added:
Code:
#ifndef DRM_FORMAT_P030
#define DRM_FORMAT_P030 fourcc_code('P', '0', '3', '0')
#endif
to the file that needs it. So as long an an old libdrm is installed, it should just work with no custom header changes.
Reply
#53
@popcornmix - The Arch ARM's linux-api-headers are built from the vanilla kernel source not the rpi kernel source.  The linux-raspberry-pi4-headers package does provide these but they are located in a different directory, specifically /usr/lib/modules/5.4.51-1-ARCH/build/include/uapi/linux/. Note that if I build your latest commit as-is, the build fails due to differences between the vanilla and rpi headers.

I can circumvent this by rebuilding the linux-api-headers but that cannot be automated by the build system.  Pointing the build at that alternative dir would be a quick win.
Code:
CC    libavcodec/vble.o
CC    libavcodec/vc1.o
src/libavcodec/v4l2_request.c:209:5: error: ‘V4L2_PIX_FMT_NV12_COL128’ undeclared here (not in a function); did you mean ‘V4L2_PIX_FMT_NV21M’?
  209 |     V4L2_PIX_FMT_NV12_COL128,
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
      |     V4L2_PIX_FMT_NV21M
CC    libavcodec/vc1_block.o
src/libavcodec/v4l2_request.c:210:5: error: ‘V4L2_PIX_FMT_NV12_10_COL128’ undeclared here (not in a function); did you mean ‘V4L2_PIX_FMT_NV12MT_16X16’?
  210 |     V4L2_PIX_FMT_NV12_10_COL128,
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |     V4L2_PIX_FMT_NV12MT_16X16
CC    libavcodec/vc1_loopfilter.o
src/libavcodec/v4l2_request.c: In function ‘v4l2_request_set_drm_descriptor’:
src/libavcodec/v4l2_request.c:260:21: warning: comparison between pointer and integer
  260 |     if (pixelformat == V4L2_PIX_FMT_NV12_COL128) {
      |                     ^~
src/libavcodec/v4l2_request.c:266:26: warning: comparison between pointer and integer
  266 |     else if (pixelformat == V4L2_PIX_FMT_NV12_10_COL128) {
      |                          ^~
src/libavcodec/v4l2_request.c: In function ‘ff_v4l2_request_frame_params’:
src/libavcodec/v4l2_request.c:1023:45: warning: comparison between pointer and integer
 1023 |         if (ctx->format.fmt.pix.pixelformat == V4L2_PIX_FMT_NV12_COL128) {
      |                                             ^~
src/libavcodec/v4l2_request.c:1026:50: warning: comparison between pointer and integer
 1026 |         else if (ctx->format.fmt.pix.pixelformat == V4L2_PIX_FMT_NV12_10_COL128) {
      |                                                  ^~
distcc[30834] ERROR: compile src/libavcodec/v4l2_request.c on localhost failed
make[6]: *** [/build/kodi-rbp-git/src/kodi-build/build/ffmpeg/src/ffmpeg/ffbuild/common.mak:59: libavcodec/v4l2_request.o] Error 1
make[6]: *** Waiting for unfinished jobs....
CC    libavcodec/vc1_mc.o
make[5]: *** [CMakeFiles/ffmpeg.dir/build.make:132: ffmpeg-prefix/src/ffmpeg-stamp/ffmpeg-build] Error 2
make[4]: *** [CMakeFiles/Makefile2:95: CMakeFiles/ffmpeg.dir/all] Error 2
make[3]: *** [Makefile:149: all] Error 2
make[2]: *** [CMakeFiles/ffmpeg.dir/build.make:134: build/ffmpeg/src/ffmpeg-stamp/ffmpeg-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:4534: CMakeFiles/ffmpeg.dir/all] Error 2
make: *** [Makefile:160: all] Error 2
Need help programming a Streamzap remote?
Reply
#54
I guess we could do this ifndef trick with V4L2_PIX_FMT_NV12_COL128 and V4L2_PIX_FMT_NV12_10_COL128 inside ffmpeg (again until the defines have trickled to upstream kernel and its uapi directory).
I'm not sure if anything else is needed from headers.
Reply
#55
(2020-07-23, 15:33)popcornmix Wrote: I guess we could do this ifndef trick with V4L2_PIX_FMT_NV12_COL128 and V4L2_PIX_FMT_NV12_10_COL128 inside ffmpeg (again until the defines have trickled to upstream kernel and its uapi directory).
I'm not sure if anything else is needed from headers.

I am happy to test if you can make that change/commit.  As to what else is needed, I would have to try it and see.
Need help programming a Streamzap remote?
Reply
#56
My gbm branch now adds defines for DRM_FORMAT_P030, V4L2_PIX_FMT_NV12_COL128 and V4L2_PIX_FMT_NV12_10_COL128 if not otherwise defined, so should be easier to build with current headers.

It also uses --disable_mmal so shouldn't need linking with /opt/vc/libs libraries.
Reply
#57
(2020-07-23, 19:40)popcornmix Wrote: My gbm branch now adds defines for DRM_FORMAT_P030, V4L2_PIX_FMT_NV12_COL128 and V4L2_PIX_FMT_NV12_10_COL128 if not otherwise defined, so should be easier to build with current headers.

It also uses --disable_mmal so shouldn't need linking with /opt/vc/libs libraries.

Thanks @popcornmix - It appears that there is an missing header.  Is it easy to continue tweaking?

Complete build log: https://gist.github.com/graysky2/f84cbd8...0adf854803
Code:
...
src/libavutil/hwcontext_drm.c:24:10: fatal error: drm/drm_fourcc.h: No such file or directory
   24 | #include <drm/drm_fourcc.h>
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.
src/libavutil/hwcontext_drm.c:24:10: fatal error: drm/drm_fourcc.h: No such file or directory
   24 | #include <drm/drm_fourcc.h>
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.
make[6]: *** [/build/kodi-rbp-git/src/kodi-build/build/ffmpeg/src/ffmpeg/ffbuild/common.mak:59: libavutil/hwcontext_drm.o] Error 1
make[6]: *** Waiting for unfinished jobs....
In file included from src/libavutil/cpu.c:44:
/usr/include/sys/sysctl.h:21:2: warning: #warning "The <sys/sysctl.h> header is deprecated and will be removed." [-Wcpp]
   21 | #warning "The <sys/sysctl.h> header is deprecated and will be removed."
      |  ^~~~~~~
make[5]: *** [CMakeFiles/ffmpeg.dir/build.make:132: ffmpeg-prefix/src/ffmpeg-stamp/ffmpeg-build] Error 2
make[4]: *** [CMakeFiles/Makefile2:95: CMakeFiles/ffmpeg.dir/all] Error 2
make[3]: *** [Makefile:149: all] Error 2
make[2]: *** [CMakeFiles/ffmpeg.dir/build.make:134: build/ffmpeg/src/ffmpeg-stamp/ffmpeg-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:4534: CMakeFiles/ffmpeg.dir/all] Error 2
make: *** [Makefile:160: all] Error 2
Need help programming a Streamzap remote?
Reply
#58
If I manually copy /usr/lib/modules/5.4.51-1-ARCH/build/include/uapi/drm/drm_fourcc.h provided by linux-raspberrypi4-headers into the build root's /usr/include/drm/ the build finishes without error.  I think we can modify our linux-raspberrypi4-headers package to just supply that via a symlink to make the build work.

Again, THANK YOU very much for your engagement on this, @popcornmix!  With these changes, Arch ARM can offer your HEVC decoding mods in v19 to our users.

As an aside, I still need the vcsm lines in the cmake call or else it errors out when trying to link kodi-gbm.
Code:
...
    -DCMAKE_EXE_LINKER_FLAGS_INIT="-L/opt/vc/lib -lvcsm" \
    -DCMAKE_EXE_LINKER_FLAGS="-L/opt/vc/lib -lvcsm" \
    -DCMAKE_CXX_FLAGS="-Wl,-L/opt/vc/lib -Wl,-lvcsm" \
...
Need help programming a Streamzap remote?
Reply
#59
Do you have libdrm-dev installed? That should provide a drm_fourcc.h header file.
Reply
#60
@popcornmix - Arch ARM has a libdrm package which supplies /usr/include/libdrm/drm_fourcc.h which is installed on the buildroot.  The build system expects to have drm_fourcc.h in /usr/include/drm/drm_fourcc.h so it errors out.  I think the symlink work around will be fine.
Need help programming a Streamzap remote?
Reply
  • 1
  • 2
  • 3
  • 4(current)
  • 5
  • 6
  • 8

Logout Mark Read Team Forum Stats Members Help
RPi3 and RPi4 hardware decoding expectations for version 190