About nvosd.h

Hello,

/**
 * Overlays clock and given text at given location on a buffer.
 *
 * To overlay the clock, you must set clock params using
 * nvosd_set_clock_params().
 * You must ensure that the length of @a text_params_list is at least
 * @a num_strings.
 *
 * @note Currently only #MODE_CPU is supported. Specifying other modes wil have
 * no effect.
 *
 * @param[in] nvosd_ctx A pointer to NvOSD context.
 * @param[in] mode Mode selection to draw the text.
 * @param[in] fd DMABUF FD of buffer on which text is to be overlayed.
 * @param[in] num_strings Number of strings to be overlayed.
 * @param[in] text_params_list A pointer to an array of NvOSD_TextParams
 *            structure for the clock and text to be overlayed.
 *
 * @returns 0 for success, -1 for failure.
 */
int nvosd_put_text(void *nvosd_ctx, NvOSD_Mode mode, int fd, int num_strings,
        NvOSD_TextParams *text_params_list);

The meaning of only MODE_CPU support in the nvosd_put_text(.) function seems to use pitch linear memory.

I can’t see the part that calls the NvBufferMemSyncForCpu function.
Shouldn’t the NvBufferMemSyncForCpu() function be used?

Thank you.

Hello,

/**

  • List modes used to overlay boxes and text.

*/

typedef enum{

MODE_CPU, /**< Selects CPU for OSD processing.

            Works with RGBA data only */

**MODE_GPU**, /**< Selects GPU for OSD processing.

            Yet to be implemented */

MODE_HW   /**< Selects NV HW engine for rectangle draw and mask.

               This mode works with both YUV and RGB data.

               It does not consider alpha parameter.

               Not applicable for drawing text. */

} NvOSD_Mode;

When will MODE_GPU be implemented?

Thank you.

Hi,
Currently we don’t have plan to support MODE_GPU in nvosd_put_text(). Please call NvBufferMemSyncForCpu() and then set to MODE_CPU.

1 Like

Hello,

In the sample, there is no part that calls NvBufferMemSyncForCpu() before or after calling the nvosd function, where can I check?

Thank you.

Hi,
In 02_video_dec_cuda, we should need to call NvBufferMemSyncForCpu() before nvosd_put_text() to make sure the buffer is synchronized. The CUDA code in HandleEGLImage() is simple so it does not hit the potential issue. But if CUDA process is complicated and GPU is almost at full loading, probably we will see buffer is out of sync.