This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Linux
Hi. we need various continuous memory of vivante(gc320) for GUI. total size is 80MB.
- 1280x720, 1920x1080, 1280x300, and so on. total size is 80MB.
As we trace gc320 drvier, we often notice allocating non-continuous memory for short continuous-memory as below it.
#define gcdDEFAULT_CONTIGUOUS_SIZE (4 << 20) at extra-drivers\ti-gc320-driver-5.0.11.p7\hal\os\linux\kernel\gc_hal_kernel_probe.c
If we increase gcdDEFAULT_CONTIGUOUS_SIZE -> 16MB or 32MB, we find decoding error(VPE memory). How do increase it ?
As other solution, we can consider TI OMAP or CMEM.
but, we have short memory for limiting TI OMAP memory(128MB), and then we don't use TI OMAP memory(it already three display, 3D GPU and IVA-HD).
If we CMEM ( we use CMEM_alloc2 API( internaly it return mmapd address(at cmem-mod-4.14.00.00+gitAUTOINC+b514a99ac4\src\cmem\api\cmem.c ) ) , this API is used VPE for deinterlace , it works very good ), vivante gc320 have error as below it.
status = gcoSURF_SetWindow(lpSurface->Surface, 0, 0, width, height); -> gckKERNEL_Dispatch ( gc_hal_kernel.c ) -> case gcvHAL_MAP_USER_MEMORY -> gckOS_MapUserMemory have error.
In order words, vivante gc320 driver don't support importing cmem when i use CMEM_alloc2 API .
I want to allocate continuous memory but non-continus memory at vivante gc320 . How can i work it ?
Hi Joonho,
Please check this example application on how to export CMEM allocated memory to Vivante driver -
Please check video_graphics_test.cpp, cmem_buf.cpp and gc320.cpp file. You will need enhanced QT eglfs_kms QPA to run this example application. The enhanced QPA along with this example application will be available in PLSDK 4.3 release scheduled end of 1Q, 2018.
Hi Joonho,
There should not be any issue using CMEM memory with GC320 as the video-graphics-test example application that I pointed out earlier runs well with GC320. I do not see any kernel error with gcoSURF_SetWindow() API. GC320 driver has some restriction on buffer alignment and sizes. You may want to print those requirement and compare with actual values of the buffer you are passing. Check the function Gc320Obj::configure_surface() in the gc320.cpp file in video-graphics-test example application. There's check in the code before setting the buffer and window.
gcmONERROR(gcoSURF_GetAlignedSize(surf_ctx[i].surf,
&width,
&height,
&stride));
if((width != bo->m_width) || (height != bo->m_height) || ((uint32_t) stride != bo->m_stride)){
ERROR("Allocated Surf buffer width %d, height %d and stride %d doesn't meet GC320 aligned requirement on width %d, height %d and stride %d\n",
bo->m_width, bo->m_height, bo->m_stride, width, height, stride);
}
uint32_t p_adr_al;
gcmONERROR(gcoSURF_GetAlignment(gcvSURF_BITMAP, surf_format,
&p_adr_al,
NULL, //&p_x_al,
NULL //&p_y_al)
));
if((uint32_t)bo->m_buf[i] % p_adr_al){
ERROR("Buffer passed to GC320 doesn't meet the alignment requirement, GC320 alignment need is %x, received buffer with %x aligned address\n",
p_adr_al, ((uint32_t)bo->m_buf[i]%p_adr_al));
}
Also check the BufObj::BufObj() function in the cmem_buf.cpp file. Buffer size needs to be adjusted to take care of the width and height alignment requirement.
/* Vivante HAL needs 16 pixel alignment in width and 4 pixel alignment in
* height and hence adjust the buffer size accrodingly.
*/
uint32_t size = m_stride * ((m_height + 3) & ~3);
Hi.
we attach full source(vivante_cmem.7z).
you can see #define OMK_CMEM_SUPPORT at galRunTest2.c
without OMK_CMEM_SUPPORT, it is work well with omap memory.
I compiled as make -f makefile.linux
our compile log is as following.
arm-linux-gnueabihf-gcc -c -march=armv7-a -marm -mfpu=neon -mfloat-abi=hard --sysroot=/home/jhlee/AM5728_4.0/ti-processor-sdk-linux-am57xx-evm-04.00.00.04/linux-devkit/sysroots/armv7ahf-neon-linux-gnueabi -I/home/jhlee/AM5728_4.0/omk/lib/coresystem/src/hal_include/GC320 -DLINUX -Wall -D_REENTRANT -fno-strict-aliasing -mtune=arm920 -O2 -DUSE_VDK=0 -DgcdUSE_OPENCL=0 -DgcdSTATIC_LINK=0 -DgcdREGISTER_ACCESS_FROM_USER=1 -DgcdFPGA_BUILD=0 -DgcdPAGED_MEMORY_CACHEABLE=0 -DGC_ENABLE_LOADTIME_OPT=1 -DVIVANTE_PROFILER=1 -DVIVANTE_PROFILER_CONTEXT=1 -I/home/jhlee/AM5728_4.0/omk/lib/coresystem/src/hal_include/GC320 -DLINUX -Wall -D_REENTRANT -fno-strict-aliasing -mtune=arm920 -O2 -DUSE_VDK=0 -DgcdUSE_OPENCL=0 -DgcdSTATIC_LINK=0 -DgcdREGISTER_ACCESS_FROM_USER=1 -DgcdFPGA_BUILD=0 -DgcdPAGED_MEMORY_CACHEABLE=0 -DGC_ENABLE_LOADTIME_OPT=1 -DVIVANTE_PROFILER=1 -DVIVANTE_PROFILER_CONTEXT=1 -I/home/jhlee/AM5728_4.0/omk/lib/coresystem/src/hal_include/GC320 -DLINUX -Wall -D_REENTRANT -fno-strict-aliasing -mtune=arm920 -O2 -DUSE_VDK=0 -DgcdUSE_OPENCL=0 -DgcdSTATIC_LINK=0 -DgcdREGISTER_ACCESS_FROM_USER=1 -DgcdFPGA_BUILD=0 -DgcdPAGED_MEMORY_CACHEABLE=0 -DGC_ENABLE_LOADTIME_OPT=1 -DVIVANTE_PROFILER=1 -DVIVANTE_PROFILER_CONTEXT=1 -I/home/jhlee/AM5728_4.0/unittest/vivante_cmem/build/sdk/include/HAL -I/home/jhlee/AM5728_4.0/unittest/vivante_cmem/sdk/inc -I/home/jhlee/AM5728_4.0/unittest/vivante_cmem/test/hal/common/UnitTest/inc -I/home/jhlee/AM5728_4.0/opensource/libdrm/libdrm-2.4.70/include/drm -I/home/jhlee/AM5728_4.0/opensource/libdrm/libdrm-2.4.70/omap -o bin_r/galRunTest2.o galRunTest2.c
our board have error as following.
root@am57xx-evm:~/gc320_cmem# ./galRunTest2 -dst A8R8G8B8 1024x124
-dst A8R8G8B8 1024x124
DBG : width(1024) height(124) at main
DBG : g_ContiguousSize(4194304) at Initialize
DBG : width(1024) stride1(1024) height(124) size(507904) at create_cmem_buffer
DBG : vaddr(0xb6854000) at create_cmem_buffer
DBG111 : g_Runtime.target(0x4d26c) sleep(5) at Initialize
[ 78.213337] Backtrace:
[ 78.215813] [<c021360c>] (dma_cache_maint_page) from [<c0213780>] (__dma_page_cpu_to_dev+0x30/0xb4)
[ 78.224902] r10:d36e0000 r9:00000000 r8:c1006184 r7:00001000 r6:00000000 r5:00000000
[ 78.232766] r4:d4a82400
[ 78.235317] [<c0213750>] (__dma_page_cpu_to_dev) from [<c0213850>] (arm_dma_sync_single_for_device+0x4c/0x50)
[ 78.245275] r7:bf0270c8 r6:c0213804 r5:00000000 r4:00000000
[ 78.251000] [<c0213804>] (arm_dma_sync_single_for_device) from [<bf02713c>] (platform_cache+0x74/0x5a8 [galcore])
[ 78.261307] r5:00000000 r4:00000000
[ 78.264958] [<bf0270c8>] (platform_cache [galcore]) from [<bf021a30>] (gckOS_MapUserMemory+0x250/0xb58 [galcore])
[ 78.275268] r10:d36e0000 r9:c107e904 r8:c1006184 r7:bf0270c8 r6:d235c000 r5:00000000
[ 78.283132] r4:b6854000
[ 78.285735] [<bf0217e0>] (gckOS_MapUserMemory [galcore]) from [<bf02a5d0>] (gckKERNEL_Dispatch+0xbb4/0x11a8 [galcore])
[ 78.296480] r10:00000000 r9:00000000 r8:ffffffff r7:00000001 r6:d3fc1d00 r5:00000000
[ 78.304344] r4:d235dd98
[ 78.306947] [<bf029a1c>] (gckKERNEL_Dispatch [galcore]) from [<bf0266ac>] (drv_ioctl+0x128/0x294 [galcore])
[ 78.316732] r9:d235c000 r8:d235dd78 r7:d235c000 r6:00007530 r5:d2749fc0 r4:d3020600
[ 78.324542] [<bf026584>] (drv_ioctl [galcore]) from [<c033eba8>] (do_vfs_ioctl+0xa8/0x7fc)
[ 78.332845] r9:d235c000 r8:becd68b8 r7:00000003 r6:d2605b40 r5:d37fcb58 r4:becd68b8
[ 78.340625] [<c033eb00>] (do_vfs_ioctl) from [<c033f338>] (SyS_ioctl+0x3c/0x64)
[ 78.347969] r10:00000000 r9:d235c000 r8:becd68b8 r7:00007530 r6:d2605b40 r5:00000003
[ 78.355832] r4:d2605b40
[ 78.358383] [<c033f2fc>] (SyS_ioctl) from [<c0207be0>] (ret_fast_syscall+0x0/0x34)
[ 78.365988] r9:d235c000 r8:c0207d84 r7:00000036 r6:00007530 r5:b6f64b3c r4:00002710
[ 78.373767] Code: e3a02004 e1a02312 e2423001 e1c00003 (ee070f3a)
/usb/lib
lrwxrwxrwx 1 root root 19 Oct 3 2016 /usr/lib/libGAL.so -> libGAL.so.5.0.11.p7
-rwxr-xr-x 1 1001 1001 229592 Jun 28 2017 /usr/lib/libGAL.so.5.0.11.p7
What mistake do I have ?
Thanks a lot.