VIM3 mainline can not compile encoder_libs_aml

OS : Ubuntu 20.04
Kernel : Mainline 6.0

I must use h264 hardware encoder for encode camera stream.

I tried to compile encoder_libs_aml but not success.

~/encoder_libs_aml$ make
make -C aml_libion
make[1]: Entering directory ‘/home/encoder_libs_aml/aml_libion’
aarch64-linux-gnu-gcc -c -fPIC -I ./include/ -I ./kernel-headers/ ion.c -o ion.o
aarch64-linux-gnu-gcc -c -fPIC -I ./include/ -I ./kernel-headers/ IONmem.c -o IONmem.o
IONmem.c: In function ‘ion_mem_init’:
IONmem.c:31:34: warning: format ‘%s’ expects a matching ‘char *’ argument [-Wformat=]
31 | #define __E(fmt, args…) printf(“ionmem error: " fmt, ## args)
| ^~~~~~~~~~~~~~~~
IONmem.c:39:9: note: in expansion of macro ‘__E’
39 | __E(”%s failed: ‘%s’\n", strerror(errno));
| ^~~
IONmem.c:39:27: note: format string is defined here
39 | __E("%s failed: ‘%s’\n", strerror(errno));
| ~^
| |
| char *
IONmem.c: In function ‘ion_mem_exit’:
IONmem.c:31:34: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat=]
31 | #define __E(fmt, args…) printf(“ionmem error: " fmt, ## args)
| ^~~~~~~~~~~~~~~~

172 | __E(”%s err (%s)! ion_fd=%d\n", strerror(errno), ion_fd);
| ~~~~~~
| |
| int
IONmem.c:172:9: note: in expansion of macro ‘__E’
172 | __E("%s err (%s)! ion_fd=%d\n", strerror(errno), ion_fd);
| ^~~
IONmem.c:172:23: note: format string is defined here
172 | __E("%s err (%s)! ion_fd=%d\n", strerror(errno), ion_fd);
| ~^
| |
| char *
| %d
IONmem.c:31:34: warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat=]
31 | #define __E(fmt, args…) printf(“ionmem error: " fmt, ## args)
| ^~~~~~~~~~~~~~~~
IONmem.c:172:9: note: in expansion of macro ‘__E’
172 | __E(”%s err (%s)! ion_fd=%d\n", strerror(errno), ion_fd);
| ^~~
IONmem.c:172:35: note: format string is defined here
172 | __E("%s err (%s)! ion_fd=%d\n", strerror(errno), ion_fd);
| ~^
| |
| int
aarch64-linux-gnu-gcc -shared -fPIC -I ./include/ -I ./kernel-headers/ ion.o IONmem.o -o libion.so
aarch64-linux-gnu-gcc -c -fPIC -I ./include/ -I ./kernel-headers/ ion_test.c -o ion_test.o
aarch64-linux-gnu-gcc ion_test.o libion.so -I ./include/ -I ./kernel-headers/ -o iontest
make[1]: Leaving directory ‘/home/encoder_libs_aml/aml_libion’
make -C aml_libge2d
make[1]: Entering directory ‘/home/encoder_libs_aml/aml_libge2d’
make -C ./libge2d
make[2]: Entering directory ‘/home/encoder_libs_aml/aml_libge2d/libge2d’
aarch64-linux-gnu-gcc -c -fPIC -o aml_ge2d.o aml_ge2d.c -I./include/ -I…/…/aml_libion/include/ion/
aarch64-linux-gnu-gcc -c -fPIC -o dmabuf.o dmabuf.c -I./include/ -I…/…/aml_libion/include/ion/
aarch64-linux-gnu-gcc -c -fPIC -o ge2d_port.o ge2d_port.c -I./include/ -I…/…/aml_libion/include/ion/
aarch64-linux-gnu-gcc -I./include/ -I…/…/aml_libion/include/ion/ -shared -fPIC -L…/…/aml_libion/ -lion -o libge2d.so aml_ge2d.o dmabuf.o ge2d_port.o
make[2]: Leaving directory ‘/home/drone/encoder_libs_aml/aml_libge2d/libge2d’
aarch64-linux-gnu-gcc -I./libge2d/include/ -I./libge2d/kernel-headers/linux/ -L./libge2d -L…/aml_libion/ -lion -lpthread -lge2d ge2d_feature_test.c -o ge2d_feature_test
/usr/bin/ld: /tmp/cc706raw.o: in function do_cmd': ge2d_feature_test.c:(.text+0x21f0): undefined reference to aml_ge2d_attach_dma_fd’
/usr/bin/ld: ge2d_feature_test.c:(.text+0x2214): undefined reference to aml_ge2d_attach_dma_fd' /usr/bin/ld: ge2d_feature_test.c:(.text+0x2238): undefined reference to aml_ge2d_attach_dma_fd’
/usr/bin/ld: ge2d_feature_test.c:(.text+0x2258): undefined reference to aml_ge2d_config' /usr/bin/ld: ge2d_feature_test.c:(.text+0x2288): undefined reference to aml_ge2d_execute’
/usr/bin/ld: ge2d_feature_test.c:(.text+0x22e8): undefined reference to aml_ge2d_detach_dma_fd' /usr/bin/ld: ge2d_feature_test.c:(.text+0x22f4): undefined reference to aml_ge2d_detach_dma_fd’
/usr/bin/ld: ge2d_feature_test.c:(.text+0x2300): undefined reference to aml_ge2d_detach_dma_fd' /usr/bin/ld: ge2d_feature_test.c:(.text+0x231c): undefined reference to aml_ge2d_process’
/usr/bin/ld: /tmp/cc706raw.o: in function do_blend': ge2d_feature_test.c:(.text+0x291c): undefined reference to aml_ge2d_process’
/usr/bin/ld: ge2d_feature_test.c:(.text+0x2b70): undefined reference to aml_ge2d_process' /usr/bin/ld: ge2d_feature_test.c:(.text+0x2d64): undefined reference to aml_ge2d_process’
/usr/bin/ld: ge2d_feature_test.c:(.text+0x2fa8): undefined reference to aml_ge2d_process' /usr/bin/ld: /tmp/cc706raw.o:ge2d_feature_test.c:(.text+0x31f4): more undefined references to aml_ge2d_process’ follow
/usr/bin/ld: /tmp/cc706raw.o: in function main_run': ge2d_feature_test.c:(.text+0x4070): undefined reference to aml_ge2d_init’
/usr/bin/ld: ge2d_feature_test.c:(.text+0x4090): undefined reference to aml_ge2d_mem_alloc' /usr/bin/ld: ge2d_feature_test.c:(.text+0x4148): undefined reference to aml_ge2d_invalid_cache’
/usr/bin/ld: ge2d_feature_test.c:(.text+0x42e8): undefined reference to aml_ge2d_mem_free' /usr/bin/ld: ge2d_feature_test.c:(.text+0x42f0): undefined reference to aml_ge2d_exit’
/usr/bin/ld: /tmp/cc706raw.o: in function main': ge2d_feature_test.c:(.text+0x4438): undefined reference to pthread_create’
/usr/bin/ld: ge2d_feature_test.c:(.text+0x44a4): undefined reference to `pthread_join’
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:16: all] Error 1

Please Advise.

Thank you.

The libraries don’t support mainline image, please compile on the 4.9 image.

Do you have plan to make this lib support on mainline ?

Now our product planed to run on Mainline and h264 hardware encode is necessary.

Thank you.

Mainline doesn’t support hardware encoder and this libraries are also not compatible.

@numbqq Can kernel 5.x support H264 hardware encoder ?

No, only 4.9 kernel supports hardware encoder.

@numbqq Could you please clarify more details, Why other kernels are not compatible ?

eg. linux dts not set or other reasons …

Thank you very much.

Because there is no hardware encoder driver for mainline kernel (5.x 6.x).

@numbqq Thank you.
If we want to develop my own driver, is it possible ?
Do you have suggestion? Where do I start from ?

It maybe not possiable.

@numbqq

I try to learn h264 hardware encode on Kernel 4.9 from this repo.

Are you implemented h264 hardware encoder as gstreamer plugin?

$ gst-launch-1.0 v4l2src name=vsrc device=/dev/video1 ! video/x-raw,width=1920,height=1080,framerate=30/1,format=RGB ! amlvenc gop=60 bitrate=2500 framerate=30 ! video/x-h264,profile=high ! h264parse ! rtph264pay config-interval=1 mtu=1208 ! "application/x-rtp, payload=(int)96, ssrc=(uint)555555" ! udpsink host=127.0.0.1 port=5600

Setting pipeline to PAUSED …
Pipeline is live and does not need PREROLL …
Setting pipeline to PLAYING …
New clock: GstSystemClock

(gst-launch-1.0:4173): GStreamer-CRITICAL **: 14:26:15.375: gst_mini_object_unref: assertion ‘mini_object != NULL’ failed

(gst-launch-1.0:4173): GStreamer-CRITICAL **: 14:26:15.375: gst_mini_object_ref: assertion ‘mini_object != NULL’ failed
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:vsrc: Internal data stream error.
Additional debug info:
gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:vsrc:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:00.137397163
Setting pipeline to NULL …
Freeing pipeline …

No gstreamer plugin support.