AM62P-Q1: encode error

Part Number: AM62P-Q1
Other Parts Discussed in Thread: AM62P,

hi experts ,

SDK version: 11.01

we use V4l2 interface to encode, sometimes,   when  call 

xioctl(handle->fd, VIDIOC_QBUF, &buf)) function, report "contiguous chunk is too small 212992/2119680" error. when this error occours, need to restart system, then the encode function may work normally. 
Meanwhile, we found that the remaining CMA is sufficient.
 
  •   our encode image size is 1920*736

  • Hi,

    Can you help us reproduce this issue on our EVM?

    Best Regards,

    Suren

  • Hi, 

    Is the memory allocated by the 

    gbm_bo_create() function physically contiguous?
    Best Regards,
    linz
  • Please share your pipeline or parameters you are setting for the encoder?

    How can we reproduce the issue?

    Best Regards,

    Suren

  • Hi, 

    our pipeline is camera->GPU->encode(H.264).

    Previous we use

    V4L2_MEMORY_DMABUF memory to encode(the buffer use gbm_bo_create() functiion allocated),  power on, power off system  sometime will reproduce this issue,  
    The probability is 1%. you can check why use V4L2_MEMORY_DMABUF memory cause this issue

    now we use

    V4L2_MEMORY_MMAP memory,  don't reproduce this issue.
  • https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/4118.0001_2D00_Fixes_2D00_for_2D00_memory_2D00_leak_2D00_v4l2.patch

    Hi,

    Can you please add the above patch and give it a try. Add the patch to gst-plugins-good and build the Gstreamer package. 

    Let us know how it goes.

    Best Regards,

    Suren

  • Hi,

    we didn't  obtain Gstreamer sourcecode, so we can't build it.

    Best Regards,

    linz

  • Gstreamer package is part of the yocto build. Are you using yocto to build the wic image?

    Best Regards

    Suren

  • Hi,

    NO, we didn't use yocto build. can you provie a patch of v4l2, we build the kernel, then we will try to test it.

    Best Regards

    linz

  • So how do you build the entire SDK image? The SDK has Gstreamer included?

    Best Regards,

    Suren

  • The sdk include a default image, it's included Gstreamer.

    Best Regards,

    linz

  • Hi,

    Please let me know with whom you are working in the China Field team, to better support you.

    Best Regards

    Suren

  • hi linz.

    which version of TI SDK you are using? 

    and please follow the guidline to set up the environment to build yocto project.

    https://software-dl.ti.com/processor-sdk-linux/esd/AM62PX/11_01_16_13/exports/docs/linux/Overview_Building_the_SDK.html

    hi Suren.

    may I ask how to proceed this?

    what is the command to apply the patch?

    what is the command to build Gstreamer package? which receipt?

    or anything else?

    Add the patch to gst-plugins-good and build the Gstreamer package. 

    thanks a lot!

    yong

  • Hi Yong,

    SDK version: 11.01

    Best Regards,

    linz

  • Hi Yong, 

    Do you have a yocto setup environment, to create the wic image?

    Best Regards

    Suren

  • Hi Linz.

    may I ask which one? there is two versions of 11.01.

    and please also help prepare Yocto environment on your side.

    https://software-dl.ti.com/processor-sdk-linux/esd/AM62PX/11_01_16_13/exports/docs/linux/Overview_Building_the_SDK.html

    Hi Suren. 

    let me check that in field. and would you please provide the commands to apply the patch, rebuild code and the path to contain wic image?

    Can you please add the above patch and give it a try. Add the patch to gst-plugins-good and build the Gstreamer package. 

    thanks a lot!

    yong

  • Hi Linz.

    here is one brief note to prepare yocto environment on PC w/ one SSD disck, 500GB volume is necessary.

    for more detail, please check this link, especially that you need proxy.
    https://software-dl.ti.com/processor-sdk-linux/esd/AM62PX/11_01_16_13/exports/docs/linux/Overview_Building_the_SDK.html
    Working Behind a Network Proxy - Yocto Project

    #1
    a0224068local@a0224068local-HP-EkiteBook-830-G7:~$ sudo apt-get update
    a0224068local@a0224068local-HP-EkiteBook-830-G7:~$ sudo apt-get -f -y install git build-essential diffstat texinfo gawk chrpath socat doxygen dos2unix python3 bison flex libssl-dev u-boot-tools mono-devel mono-complete curl python3-distutils repo pseudo python3-sphinx g++-multilib libc6-dev-i386 jq git-lfs pigz zstd liblz4-tool cpio file lz4 debianutils iputils-ping python3-git python3-jinja2 python3-subunit locales libacl1 unzip gcc python3-pip python3-pexpect xz-utils wget
    a0224068local@a0224068local-HP-EkiteBook-830-G7:~$ sudo locale-gen en_US.UTF-8
    a0224068local@a0224068local-HP-EkiteBook-830-G7:~$ sudo dpkg-reconfigure dash
    Be sure to select "No" when you are asked to use dash as the default system shell.

    #2
    a0224068local@a0224068local-HP-EkiteBook-830-G7:~$ mkdir swap
    a0224068local@a0224068local-HP-EkiteBook-830-G7:~$ cd swap/
    a0224068local@a0224068local-HP-EkiteBook-830-G7:~/swap$ sudo dd if=/dev/zero of=swapfile bs=32M count=1k
    a0224068local@a0224068local-HP-EkiteBook-830-G7:~/swap$ sudo chmod 600 swapfile
    a0224068local@a0224068local-HP-EkiteBook-830-G7:~/swap$ sudo swapon swapfile
    a0224068local@a0224068local-HP-EkiteBook-830-G7:~/swap$ free -m

    #3
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/tisdk/tisdk_am62p_11011613/build$ sudo vim /etc/fstab
    # /etc/fstab: static file system information.
    #
    # Use 'blkid' to print the universally unique identifier for a
    # device; this may be used with UUID= as a more robust way to name devices
    # that works even if disks are added and removed. See fstab(5).
    #
    # <file system> <mount point> <type> <options> <dump> <pass>
    # / was on /dev/nvme0n1p2 during installation
    UUID=846781b3-6e79-443d-9270-0912955101e5 / ext4 errors=remount-ro 0 1
    # /boot/efi was on /dev/nvme0n1p1 during installation
    UUID=BB7A-5DE3 /boot/efi vfat umask=0077 0 1
    # /swapfile none swap sw 0 0
    UUID=e7e9b57a-5738-494d-b3b4-80ba417ef71b /opt/1Twork/tisdk ext4 defaults 0 2
    /home/a0224068local/swap/swapfile none swap sw 0 0

    note, UUID is the disk to build yotco.
    restart PC

    #4
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/tisdk$ git clone git.ti.com/.../oe-layersetup.git tisdk_am62p_11011613
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/tisdk$ cd tisdk_am62p_11011613/
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/tisdk/tisdk_am62p_11011613$ ./oe-layertool-setup.sh -f configs/processor-sdk/processor-sdk-scarthgap-chromium-11.01.16.13-config.txt
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/tisdk/tisdk_am62p_11011613$ cd build/
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/tisdk/tisdk_am62p_11011613/build$ . conf/setenv
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/tisdk/tisdk_am62p_11011613/build$ MACHINE=am62pxx-evm bitbake tisdk-default-image

    thanks a lot!

    yong

  • Please find below the Migration to Gstreamer 1.24.13 and Latest kernel steps using Yocto Scarthgap.

    The Folder contains two  things:

    A WIC mage that can be tested with AM62P EVM.

    Yocto build files latest ZIP file. 

    https://tidrive.ext.ti.com/u/jYKWQsWClhyfgpZQ/de3f3067-fc1a-439a-844b-4a4ac9bf9310?l

    Accesscode: L45YZe`a

    Steps to replicate the build on your end with these changes on AM62P EVM assuming you are using the oe layer config to setup the environment using 

    processor-sdk-scarthgap-chromium-11.01.16.13-config.txt

    1.

    Unzip the yocto-build-files-latest.zip file. You should see three folders (oe-core, arago, ti) each containing the patches to be applied.

    2.

    Copy respective patches in sources/oe-core, sources/meta-arago and sources/meta-ti directory of your yocto setup.

    3.

    cd into sources/oe-core and run git am 0001-move-oe-core-to-1.24.13.patch
    cd into sources/meta-arago and run git am 0001-meta-arago-patches-to-migrate-to-1.24.13.patch
    cd into source/meta-ti and run git am 0001-meta-ti-meta-ti-bsp-update-to-latest-kernel.patch

    4.

    remove qt6 and chromium from config to speed up the time and remove the qt6 dependency error
    - this will be in the build/conf/bblayers.conf


    5.

    add lines to bottom of local.conf to remove additional dependencies that require qt6
    IMAGE_INSTALL:remove = "ti-apps-launcher qmltermwidget"
    DEMOS:remove = "ti-apps-launcher"


    6.

    update file in meta-ti-sdk layer to change PV for the gstreamer file
    - found in sources/meta-tisdk/meta-ti-foundational/recipes-multimedia/gstreamer/

    mv  gstreamer1.0-plugins-good_1.22.%.bbappend gstreamer1.0-plugins-good_1.24.%.bbappend

    7.  Go to build directory and issue the build.

    build> . conf/setenv

    build> MACHINE=am62pxx-evm bitbake -k tisdk-default-image

    Hope this helps

    Best Regards

    Suren

  • Hi Suren.

    Tried on my side, the new image generated like this.

    Please let us know if the image is enough for customer to verify the issue. 

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/tisdk_2D00_default_2D00_image_2D00_am62pxx_2D00_evm.rootfs_2D00_20260316042543.wic.xz

    Hi Linz.

    Please let us know if also prepare the environment to be ready.

    And you can have a try w/ above new image.

    and please also help prepare Yocto environment on your side.

    here is the note to apply the patch.
    1.
    download yocto and build all.

    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/tisdk$ git clone git.ti.com/.../oe-layersetup.git tisdk_am62p_11011613
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/tisdk$ cd tisdk_am62p_11011613/
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/tisdk/tisdk_am62p_11011613$ ./oe-layertool-setup.sh -f configs/processor-sdk/processor-sdk-scarthgap-chromium-11.01.16.13-config.txt
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/tisdk/tisdk_am62p_11011613$ cd build/
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/tisdk/tisdk_am62p_11011613/build$ . conf/setenv
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/tisdk/tisdk_am62p_11011613/build$ MACHINE=am62pxx-evm bitbake tisdk-default-image

    2.
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/tisdk/tisdk_am62p_11011613/sources/oe-core$ git branch -l
    * (HEAD detached at 4cf131ebd1)
    master
    scarthgap
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/tisdk/tisdk_am62p_11011613/sources/oe-core$ git log
    commit 4cf131ebd157b79226533b5a5074691dd0e1a4ab (HEAD)
    Author: Haixiao Yan <haixiao.yan.cn@windriver.com>
    Date: Tue Sep 16 21:19:18 2025 +0800
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/tisdk/tisdk_am62p_11011613/sources/oe-core$ git am /home/a0224068local/Desktop/temp/AM62P-Q1_encode_error_1601775/yocto-build-files-latest/yocto-build-files/oe-core/0001-move-oe-core-to-1.24.13.patch
    Applying: move oe-core to 1.24.13

    3.
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/tisdk/tisdk_am62p_11011613/sources/meta-arago$ git branch -l
    * (HEAD detached at 11.01.16)
    master
    scarthgap
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/tisdk/tisdk_am62p_11011613/sources/meta-arago$ git log
    commit 51f6bfa0b61c07dd1542e4aafc83747623355f82 (HEAD, tag: cicd.scarthgap.202509260858, tag: 11.01.16)
    Author: LCPD Automation Script <lcpdbld@list.ti.com>
    Date: Fri Sep 26 08:58:27 2025 -0500
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/tisdk/tisdk_am62p_11011613/sources/meta-arago$ git am /home/a0224068local/Desktop/temp/AM62P-Q1_encode_error_1601775/yocto-build-files-latest/yocto-build-files/arago/0001-meta-arago-patches-to-migrate-to-1.24.13.patch
    Applying: meta-arago patches to migrate to 1.24.13
    .git/rebase-apply/patch:165: trailing whitespace.

    .git/rebase-apply/patch:169: trailing whitespace.

    .git/rebase-apply/patch:178: trailing whitespace.

    .git/rebase-apply/patch:187: trailing whitespace.

    .git/rebase-apply/patch:195: trailing whitespace.

    warning: squelched 36 whitespace errors
    warning: 41 lines add whitespace errors.


    4.
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/tisdk/tisdk_am62p_11011613/sources/meta-ti$ git branch -l
    * (HEAD detached at 11.01.16)
    master
    scarthgap
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/tisdk/tisdk_am62p_11011613/sources/meta-ti$ git log
    commit 9a30c7b97a979fa66cb22b2c2ce1d3b7d466ee24 (HEAD, tag: cicd.scarthgap.202509260858, tag: 11.01.16)
    Author: LCPD Automation Script <lcpdbld@list.ti.com>
    Date: Fri Sep 26 08:58:28 2025 -0500
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/tisdk/tisdk_am62p_11011613/sources/meta-ti$ git am /home/a0224068local/Desktop/temp/AM62P-Q1_encode_error_1601775/yocto-build-files-latest/yocto-build-files/ti/0001-meta-ti-meta-ti-bsp-update-to-latest-kernel.patch
    Applying: meta-ti: meta-ti-bsp: update to latest kernel

    5.
    //remove qt6 and chromium from config to speed up the time and remove the qt6 dependency error
    /opt/1Twork/tisdk/tisdk_am62p_11011613/build/conf/bblayers.conf
    /opt/1Twork/tisdk/tisdk_am62p_11011613/sources/meta-browser/meta-chromium \
    /opt/1Twork/tisdk/tisdk_am62p_11011613/sources/meta-qt6 \

    6.
    //add lines to bottom of local.conf to remove additional dependencies that require qt6
    /opt/1Twork/tisdk/tisdk_am62p_11011613/build/conf/local.conf
    IMAGE_INSTALL:remove = "ti-apps-launcher qmltermwidget"
    DEMOS:remove = "ti-apps-launcher"

    7.
    //update file in meta-ti-sdk layer to change PV for the gstreamer file
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/tisdk/tisdk_am62p_11011613/sources/meta-ti$ cd /opt/1Twork/tisdk/tisdk_am62p_11011613/sources/meta-tisdk/meta-ti-foundational/recipes-multimedia/gstreamer/
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/tisdk/tisdk_am62p_11011613/sources/meta-tisdk/meta-ti-foundational/recipes-multimedia/gstreamer$ ls -l
    total 4
    -rw-rw-r-- 1 a0224068local a0224068local 554 3月 11 14:23 gstreamer1.0-plugins-good_1.22.%.bbappend
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/tisdk/tisdk_am62p_11011613/sources/meta-tisdk/meta-ti-foundational/recipes-multimedia/gstreamer$ mv gstreamer1.0-plugins-good_1.22.%.bbappend gstreamer1.0-plugins-good_1.24.%.bbappend


    8.
    //rebuild
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/ti-processor-sdk-linux-edgeai-am62a-evm-11.01.07.05/tisdk$ cd build/
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/ti-processor-sdk-linux-edgeai-am62a-evm-11.01.07.05/tisdk/build$ . conf/setenv
    a0224068local@a0224068local-HP-EkiteBook-830-G7:/opt/1Twork/ti-processor-sdk-linux-edgeai-am62a-evm-11.01.07.05/tisdk/build$ MACHINE=am62axx-evm bitbake -k tisdk-edgeai-image

    thanks a lot!

    yong

  • Dear Linz.

    any update?

    thanks a lot!

    yong

  • Dear Yong,

    we still didn't have  yocto environment.

     yocto environment

    linz

  • Dear Linz.

    1. Has shared the steps to prepare Yocto environment. Please let us know if you have a try.

    2. Did you try the image as below?

    Please let us know if also prepare the environment to be ready.

    And you can have a try w/ above new image.

    and please also help prepare Yocto environment on your side.

    here is the note to apply the patch.

    thanks a lot!

    yong

  • Dear Linz.

    please let us know the update, may I ask if you need still need locate the problem for the production? and let us know your time plan.

    Or we will close this in this week.

    thanks a lot!

    yong

  • Dear Linz.

    Close this ticket as pending for long time, please submit new ticket if there is still problem

    thanks a lot!

    yong