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.

VPORT DM642 compatibility mode on DM648 EVM

Hi

The DM648 Video Port Driver FVID API Document states that FVID_alloc() is valid only in DM642 compatibility mode. I am confused as to how one sets this mode (couldn't find anything in the manuals).

I am using the sd_loopback example and changed

        status = FVID_alloc(capChInfo.chanHandle, &(capChInfo.frame));

to
        status = FVID_dequeue(capChInfo.chanHandle, &(capChInfo.frame));

But the status is now -9 and the frame buffer pointers are set to NULL. But I noticed the sd_composite example uses FVID_dequeue.

To change modes, do you have to change these defines in _vport.h? If so, how can the sd_compositor example work because the settings are set to LEGACY mode on the dvsdk disk? It uses dequeue so dequeue should fail with NORMAL_MODE (0)

On the flip side, how can the sd_loopback example work if I change to NORMAL mode? It uses FVID_alloc and should fail if I set LEGACY_MODE (0)

/** \brief Flag for legacy (DM642) mode */
#define LEGACY_MODE                     (1)
/** \brief Flag for normal operation mode */
#define NORMAL_MODE                     (0)

Are these defines mutually exclusive?

Thx

  • Hi

    I changed the defines

    /** \brief Flag for legacy (DM642) mode */
    #define LEGACY_MODE                     (0)
    /** \brief Flag for normal operation mode */
    #define NORMAL_MODE                     (1)

    And recompiled the vport_bios_drv.lib library (checked the date and even renamed it to make sure the sd_loopback was using it). To my surprise, the video loopback worked and did not return an error (status returned was IOM_COMPLETED).

    Is the manual wrong?

    This API is valid only in Legacy mode (DM642 compatibility mode). In the Normal
    mode FVID_dequeue should be used
    instead of this API and the DM648 driver will
    return error for this API call
    .

    Did I change the defines above as they should be to get normal mode?

    When I replaced the sd_loopback FVID_alloc with FVID_dequeue, the dequeue returns a -9 (Operation not implemented or supported).

    So next I put a breakpoint in mdSubmitChan(). Since I set LEGACY_MODE = 0, reVal is being set to IOM_ENOTIMPL since chan->driverMode is also zero.

     

                case FVID_DEQUEUE:
                    /* This command is not supported in LEGACY MODE */
                    if (LEGACY_MODE == chan->driverMode)
                    {
                        retVal = IOM_ENOTIMPL;
                    }

    So now what is setting driverMode. Seems to be a VPORT_ChanObj paramtere. Back to mdSubmitChan and I find its set by

                    /* Set driver mode as per numFrmBufs passed from application */
                    if (0 == numFrmBufs)
                    {
                        chan->driverMode = NORMAL_MODE;  /* normal mode */
                    }
                    else
                    {
                        chan->driverMode = LEGACY_MODE;  /* legacy(DM642) mode */
                    }

    Next, find out what sets numFrmBufs

                /* Assign EDMA handle passed to global channel structure variable */
                if (chan->mode & _VPORT_MASK_RAW)
                {
                    chan->hEdma = ((VPORTCAP_ParamsRaw *)chanParams)->hEdma;
                    numFrmBufs = ((VPORTCAP_ParamsRaw *)chanParams)->numFrmBufs;
                }
                else
                {
                    chan->hEdma = ((VPORTCAP_Params *)chanParams)->hEdma;
                    numFrmBufs = ((VPORTCAP_Params *)chanParams)->numFrmBufs;
                }

    Now back to the sd_loopback code because it sets numFrmBufs (at least thats what I remember). And I find it set to 3

        3,                                  /* numFrmBufs   */              \

    So how does sd_compositor use FVID_dequeue? I see in its params.h file its also using numFrmBufs = 3. Ah, but further deep in the code I find

        /*
         * Assign number of frame buffers as 0 for using NEW FVID APIs
         */
        vCapParamsChan.numFrmBufs = 0;
        vDisParamsChan.numFrmBufs = 0;

    At last, I think I understand. Going back to the user guide I find the answer (too bad I didn't study the heck out of the user guide)

    Number of frame buffers that the driver allocates. If this is 0,
    then the driver operates in Normal mode.
    When this value is
    other than 0, then driver operates in Legacy mode. In both
    cases, minimum of 3 buffers are recommended for proper
    driver operation

    But then I'm confused by the statement "In both cases, minimum of 3 buffers...". So what up with that! They say use 0 for normal mode but then say you need 3? Further down I find that the buffers have to be created using

    In Normal mode (where the ‘numFrmBufs’ in the channel parameters is 0), the driver
    will not allocate frame buffers for FVID exchange and other APIs. Applications have
    to create buffers for this purpose. It is suggested that applications should use the
    APIs FVID_allocBuffer and FVID_freeBuffer provided with driver for frame buffer
    allocation purpose.

    But sd_compositor doesn't use FVID_allocBuffer and FVID_freeBuffer, it uses FVID_allovBuffer and FVID_queue. I think they mean

    Applications have to create and delete buffers for this purpose

    Very confusing.[:S]

    At least I have figured out that the LEGACY and NORMAL defines should NOT be changed.

    /** \brief Flag for legacy (DM642) mode */
    #define LEGACY_MODE                     (1)
    /** \brief Flag for normal operation mode */
    #define NORMAL_MODE                     (0)

     

     

    I am using bios 5.31.02, dvsdk_1_10_00_26_DM648, CCS 3.3.82 and Code Gen 6.08

  • As you have figured out, you have to set the 'numFrmBufs' member of create params to 0 to work in normal mode or set it to any other number to work in DM642 compatibility mode.

    You should not the change anything in the driver files.

    You have normal operation without any frame drop, you should at least queue 3 buffers to the driver.

    In normal mode, application owns the buffer allocation and freeing. Hence it has to allocate buffers and queue to the driver.

    The alloc buffer and free buffer functions are just helper functions just like malloc/free provided for this purpose.

    In DM642 mode, the driver allocates and owns the buffer. Hence it uses the 'numFrmBufs' to know how much buffers it has to allocate at the time of channel creation.