Vivante imx-gpu-viv Userspace Memory Leak

cancel
Showing results for 
Search instead for 
Did you mean: 

Vivante imx-gpu-viv Userspace Memory Leak

156 Views
Contributor II

I have a long-standing memory leak issue with video playback on the i.MX6 Dual where our QT application (GStreamer's gst-play-1.0 also) slowly leaks memory and eventually runs out of memory after approximately 8,000 videos have been played.  The length of the video does not appear to affect the size of the memory leak, so this seems to be more of a playback initialization issue.  The kernel CMA does not show any leaks and restarting the userspace application releases the leaked memory, but this is unfortunately not a viable solution for our product.

I see these leaks with the Vivante imx-gpu-viv drivers version 5.0.11.p4.5 in Yoto 1.7 (Dizzy), version 5.0.11.p7.4 in Yocto 2.0 (Jethro), and Yocto 2.6 (Thud).

The following trace with version 5.0.11.p4.5 of the Vivante drivers (Yocto imx-gpu-viv recipe) shows one of the leaks.  gst-play-1.0 also shows the same memory leaks if it is given multiple videos to play.

potential leak 0x77f94718 28 (27 s old) - bt 6 items
 0x76e07b78 libmemtrail.so /home/erich/tools/apps/memtrail/memtrail.cpp:493 malloc()
 0x72bfd44c libGAL.so /home/jenkins/workspace/graphics-3.14-packaging-build/temp_build_dir/build-imx6qsabresd/tmp/work/cortexa9hf-vfp-neon-mx6qdl-poky-linux-gnueabi/imx-gpu-viv/1_git-r0/git/driver/hal/os/linux/user/gc_hal_user_os.c:1925 gcoOS_AllocateMemory()
 0x72bfd518 libGAL.so /home/jenkins/workspace/graphics-3.14-packaging-build/temp_build_dir/build-imx6qsabresd/tmp/work/cortexa9hf-vfp-neon-mx6qdl-poky-linux-gnueabi/imx-gpu-viv/1_git-r0/git/driver/hal/os/linux/user/gc_hal_user_os.c:1722 gcoOS_Allocate()
 0x72bfdbe8 libGAL.so /home/jenkins/workspace/graphics-3.14-packaging-build/temp_build_dir/build-imx6qsabresd/tmp/work/cortexa9hf-vfp-neon-mx6qdl-poky-linux-gnueabi/imx-gpu-viv/1_git-r0/git/driver/hal/os/linux/user/gc_hal_user_os.c:3748 gcoOS_CreateMutex()
 0x73b334c4 libEGL.so.1.0 /home/jenkins/workspace/graphics-3.14-packaging-build/temp_build_dir/build-imx6qsabresd/tmp/work/cortexa9hf-vfp-neon-mx6qdl-poky-linux-gnueabi/imx-gpu-viv/1_git-r0/git/driver/driver/khronos/libEGL/source/gc_egl_init.c:665 eglGetDisplay()

potential leak 0x77f19608 28 (27 s old) - bt 6 items
 0x76e07b78 libmemtrail.so /home/erich/tools/apps/memtrail/memtrail.cpp:493 malloc()
 0x72bfd44c libGAL.so /home/jenkins/workspace/graphics-3.14-packaging-build/temp_build_dir/build-imx6qsabresd/tmp/work/cortexa9hf-vfp-neon-mx6qdl-poky-linux-gnueabi/imx-gpu-viv/1_git-r0/git/driver/hal/os/linux/user/gc_hal_user_os.c:1925 gcoOS_AllocateMemory()
 0x72bfd518 libGAL.so /home/jenkins/workspace/graphics-3.14-packaging-build/temp_build_dir/build-imx6qsabresd/tmp/work/cortexa9hf-vfp-neon-mx6qdl-poky-linux-gnueabi/imx-gpu-viv/1_git-r0/git/driver/hal/os/linux/user/gc_hal_user_os.c:1722 gcoOS_Allocate()
 0x72bfdbe8 libGAL.so /home/jenkins/workspace/graphics-3.14-packaging-build/temp_build_dir/build-imx6qsabresd/tmp/work/cortexa9hf-vfp-neon-mx6qdl-poky-linux-gnueabi/imx-gpu-viv/1_git-r0/git/driver/hal/os/linux/user/gc_hal_user_os.c:3748 gcoOS_CreateMutex()
 0x73b334b8 libEGL.so.1.0 /home/jenkins/workspace/graphics-3.14-packaging-build/temp_build_dir/build-imx6qsabresd/tmp/work/cortexa9hf-vfp-neon-mx6qdl-poky-linux-gnueabi/imx-gpu-viv/1_git-r0/git/driver/driver/khronos/libEGL/source/gc_egl_init.c:663 eglGetDisplay()

potential leak 0x77dcc9a0 316 (27 s old) - bt 5 items
 0x76e07b78 libmemtrail.so /home/erich/tools/apps/memtrail/memtrail.cpp:493 malloc()
 0x72bfd44c libGAL.so /home/jenkins/workspace/graphics-3.14-packaging-build/temp_build_dir/build-imx6qsabresd/tmp/work/cortexa9hf-vfp-neon-mx6qdl-poky-linux-gnueabi/imx-gpu-viv/1_git-r0/git/driver/hal/os/linux/user/gc_hal_user_os.c:1925 gcoOS_AllocateMemory()
 0x72bfd518 libGAL.so /home/jenkins/workspace/graphics-3.14-packaging-build/temp_build_dir/build-imx6qsabresd/tmp/work/cortexa9hf-vfp-neon-mx6qdl-poky-linux-gnueabi/imx-gpu-viv/1_git-r0/git/driver/hal/os/linux/user/gc_hal_user_os.c:1722 gcoOS_Allocate()
 0x73b33440 libEGL.so.1.0 /home/jenkins/workspace/graphics-3.14-packaging-build/temp_build_dir/build-imx6qsabresd/tmp/work/cortexa9hf-vfp-neon-mx6qdl-poky-linux-gnueabi/imx-gpu-viv/1_git-r0/git/driver/driver/khronos/libEGL/source/gc_egl_init.c:624 eglGetDisplay()

Is there a solution to these memory leaks other than switching to the Etnaviv library?  There are several memory-leak fixes mentioned in the change log for Vivante v6.2 used in Yocto 3.0 (Zeus), but I have yet to confirm if any of those leaks are what we are seeing and in reality and upgrading the platform would require a large amount of work that would need to be justified.

Tags (2)
3 Replies

32 Views
Contributor II

Hi Ruben,

I tried the latest Yocto Zeus distribution and I'm still seeing memory leaks when using gst-play-1.0.  The libGAL.so has been stripped, so I can't determine where the leak is coming from.  Each video played results in approximately 8KB of memory leaked in userspace regardless of the length which matches the VPU memory leak pattern found in previous releases.

I'll open up an engineering services ticket to see if we can get the source code for the Vivante driver to track down the cause and I'll look at the Etnaviv driver to see if that is a viable option.

Regards,

Eric

0 Kudos

32 Views
NXP TechSupport
NXP TechSupport

Hello ericholmberg‌,

Just an update to this thread; I have inquired this issue with our graphic experts and come back with a more proper answer as soon as possible.

Regards, 

Ruben

32 Views
NXP TechSupport
NXP TechSupport

ericholmberg‌,

Since the GPU drivers that you are using are no longer supported, you might want to contact  NXP Professional Engineering Services in order to receive proper assistance with your application. Also, I was advised that you can try on the latest BSP  which has the recent GPU Drivers; here, the leaks has been fixed and our hardware experts are not aware of new ones.

My apologies for any inconvenience caused. 

Regards,

Ruben

0 Kudos