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.

ti81xxvin: get_user_pages failed

when I run this

gst-launch -v v4l2src ! \
'video/x-raw-yuv,width=1920,height=1080' ! \
fakesink

I get a get_user_pages failed in the ti81xxvin_uservirt_to_phys function of ti81xxvin_main.c

My bootargs are 

bootargs=console=ttyO2,115200 quiet mem=176M mem=324M@0x9F900000 vmalloc=500M vram=50M earlyprintk z3dram=1024M notifyk.vpssm3_sva=0xBF900000 noinitrd root=/dev /nfs nfsroot=17.16.0.2:/home/ubuntu/targetfs,nolock,udp rw rootdelay=4 ip=17.16.0.4:17.16.0.2:17.16.0.1:255.255.255.0:Z3-Netra::off

Any ideas?

  • Hi,

    How many buffers you are trying to allocate? Typically, it will be difficult to find 4MP continuous memory, so it fails. How about changing it to use vram for memory allocation?

    Thanks,

    Brijesh Jadav

  • Well, I think my problem was that I was allocating none. 

    This seems to work (note the omxbufferalloc)

    gst-launch -v v4l2src always-copy=false queue-size=12 num-buffers=500 ! \
    'video/x-raw-yuv-strided,format=(fourcc)NV12,width=1920,height=1080,framerate=(fraction)60/1' ! \
    omxbufferalloc numBuffers=12 ! \
    omx_scaler ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! omx_videosink sync=false

    But, if I rerun it I get this now...

    Assertion at Line no: 419 in /home/ubuntu/ti-ezsdk_dm816x-evm_5_04_00_11/compone
    nt-sources/syslink_2_10_03_20/packages/ti/syslink/utils/hlos/knl/Linux/../../../
    ../../../ti/syslink/ipc/hlos/knl/Linux/MessageQDrv.c: (cargs.args.create.handle
    != NULL) : failed
    gst-launch-0.10: OmxRpc.c:624: OmxRpc_Instance_init: Assertion `(OmxRpc_errorNon
    e == retVal)' failed.
    Aborted

    and have no clue what that means.

  • Brijesh,

    When you say to use vram for memory allocation, did you see my bootargs? Is this not sufficient? Is there something else I should be doing? Note I'm running load-hd-v4l2-firmware.sh

  • Hi,

    Specifying memory in bootargs just reserves that much memory, driver still needs to be modified to allocate memory from vram space. Could you look into the driver and replace get_free_pages with vram_alloc (or something like that) to allocate memory from vram?

    If memory allocation succeeds first time, it does not mean it will succeed second  since memory will get segmented and kernel may not find that much contiguous space, which is why i am suggesting to change the driver to allocate from vram..

    Thanks,

    Brijesh Jadav

  • This is TI provided code in the ti81xxvin_main.c file. Are you sure I should be messing with it? There is no get_free_pages...only get_user_pages

    In drivers/media/video/ti81xx I did a grep for vram and came up with nothing. This does not appear to be what you would expect?

    ---

    static inline u32 ti81xxvin_uservirt_to_phys(u32 virtp)
    {
    unsigned long physp = 0;
    struct mm_struct *mm = current->mm;
    struct vm_area_struct *vma;

    vma = find_vma(mm, virtp);

    /* For kernel direct-mapped memory, take the easy way */
    if (virtp >= PAGE_OFFSET)
    physp = virt_to_phys((void *)virtp);
    else if (vma && (vma->vm_flags & VM_IO) && (vma->vm_pgoff))
    /**
    * this will catch, kernel-allocated, mmaped-to-usermode
    * addresses
    */
    physp = (vma->vm_pgoff << PAGE_SHIFT) + (virtp - vma->vm_start);
    else {
    /* otherwise, use get_user_pages() for general userland pages */
    int res, nr_pages = 1;
    struct page *pages;

    down_read(&current->mm->mmap_sem);

    res = get_user_pages(current, current->mm,
    virtp, nr_pages, 1, 0, &pages, NULL);
    up_read(&current->mm->mmap_sem);

    if (res == nr_pages)
    physp = __pa(page_address(&pages[0]) +
    (virtp & ~PAGE_MASK));
    else {
    ti81xxvin_err("get_user_pages failed with res: %i and nr_pages %i\n",res,nr_pages);
    return 0;
    }
    }
    return physp;
    }

  • ok, there is one more way, can you change CONFIG_FORCE_MAX_ZONEORDER=14 OR 16 and try? Open .config file and change this option.

    Thanks,

    Brijesh Jadav

  • I can't seem to make this stick. Whenever I run make it just sets this back to 11.