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.

mmap problem

Other Parts Discussed in Thread: THS8200, TVP7002

I use dvr3.0.1 ti816x platform and I moved a test program named "saLoopBackFbdev"from EZSDk, When I run it,a problem happend for mmap.

The code as follows:

#define MAX_BUFFER 6

int mode = O_RDWR;

 /* Open display driver */
 fbdev.fd = open((const char *)FBDEV_DEVICE, mode);
 if (fbdev.fd == -1) {
  printf("failed to open fbdev device\n");
  return -1;
 }

.....

fbdev.buffer_addr[0] = (unsigned char *)mmap
       (0,fbdev.buffersize * MAX_BUFFER, //MAX_BUFFER
       (PROT_READ | PROT_WRITE),   MAP_SHARED, fbdev.fd, 0);

 

if ((int)fbdev.buffer_addr[0] == -1) {

                   printf("MMap Failed.\n");

if I change the max buffer (#define) to1,  the MMap Failed problem will not happen, but next code "ret = ioctl(capt.fd, VIDIOC_DQBUF, &capt.buf); " will err,because there should be more than 2 buffers to DQBuf...

I modified the bootargs "setenv bootargs 'mem=364M console=ttyO2,115200n8 noinitrd ip=192.168.2.109:192.168.2.107:192.168.2.1:255.255.255.0:talent:eth0:off eth=18:0e:99:02:b1:88 root=/dev/nfs rw nfsroot=192.168.2.107:/opt/DVR3.0/DVRRDK_03.00.00.00/target/rfs_816x vram=52M ti816xfb.vram=0:40M,1:8M,2:4M notifyk.vpssm3_sva=0xBEE00000 stdin=serial'      but not usefull for this issue,and modify the kernel drive fb_dev.c , it looks not efferctive now..

  • What is the value of FBDEV_DEVICE ? Also DVR RDK already has reference code for fbdev.ANy reason why you are using saLoopBackFbdev ?

    Also pls check the load.sh script. It is modifying the buffer size alloted to fbdev when doing insmod fbdev as below:

    insmod ./kermod/ti81xxfb.ko vram=0:8M,1:8M,2:4M

    You may have to change that to match your requirement

  •  

    /* device node to be used for fbdev */
    #define FBDEV_DEVICE  "/dev/fb0"

    saLoopBackFbdev in EZSDK have adv7002 capture and ths8200 Loopback...I refer it and want to move it to dvr_rdk

    I see the graphics in demo(dvr_rdk)  opened FBDEV_DEVICE  "/dev/fb0" and "/dev/fb1"...and mmap sucess...but i dont know if i want

    to apply memory from device FBDEV,how to do? where the probe of physAddress will set?

    i tried changed load.sh with :the insmod ./kermod/ti81xxfb.ko vram=0:40M,1:8M,2:4M but no use. I think it is the vram is not big enough for  My mmap, I printed the buffer size:

    and find the buffer length not bigger than Buffersize*6. It only bigger and 1 buffersize.

     

  • Hi,

     

    TVP7002 is already supported in DVR_RDK, you just need to add support for THS8002.

    For FBDev memory issue, can you please look into your bootargs? in the bootargs, we specify total memory to be allocated for vram allocator, by default it is 50M and you require 52M (40 + 8 + 4). You will need to increase vram memory in your bootargs..

     

    REgards.

    Brijesh

     

    Thanks,

    Brijesh Jadav

  • I modified bootargs as the first description in this issue,It seems no use...

    where are the codes supported for 7002,I didn't see it in dvr_rdk's mcfw...

    regards

    Away.liu

  • Hi,

     

    Lets first solve the first problem. Are you seeing mmap failed? are you able to open all FBDev devices?

     

    regards,

    brijesh jadav

  • yes.

    The print info index it:

    MMap Failed.
    Error in setting up of Display

    I open /dev/fb0 succes and use it mmap a big memory..

    And i think may be the vram of fb0 is not big enough for my Mmap...

    TKS for answered

  • Hi liu,

    Make sure the setting of  vram size  by the bootargs is successful.

    use  cat /sys/class/graphics/fb*/size to look into the size of vram and

    check the linux/drivers/video/ti81xx/ti81xxfb/ti81xxfb_main.c for details.

    Jack