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.

Linux/DRA746: where is unit test for TI VPE (V4L2-M2M) driver ?

Part Number: DRA746

Tool/software: Linux

I found gstvpe uses /dev/video for color conversion between YUY2/NV12. (Hardware accelerated video porst-processing using TI VPE (V4L2-M2M) driver on DRA7x SoC)

where is unit test to demonstrate how to use vpe?

does VPE support color conversion between RGB and NV12?

for example, I want to record framebuffer (RGB) to h264 stream.

  • HI Halley,
    In PSDKLA3.02 there existed an application "testvpe" and in PSDKLA3.03 it is renamed as "test-v4l2-m2m" , here support for RGB to NV12/YUYV conversion supported with dss-wb path since vpe can not take RGB as input
    This application reads raw file and dumps the converted/processed file.

    Get RGB file using vpe
    target$ test-v4l2-m2m /dev/video0 /usr/share/ti/video/airshow_p352x288.yuv 352 288 nv12 airshow_abgr32.yuv 720 480 abgr32 0 1 10

    Convert RGB to yuyv
    target $test-v4l2-m2m /dev/video10 airshow_abgr32.yuv 720 480 xbgr32 output_yuyv.yuv 720 480 yuyv 0 1 10

    There is no gstreamer plugin for DSS-WB (RGB to NV12) yet.

    Ramprasad
  • Source code of this application is here
    git.ti.com/.../test-v4l2-m2m.c
  • thanks, good example.

    the example runs is MMAP data mode; while for screen recording, source data exists as drm buffer, could I use it directly w/o copy?

    for example, does the driver support V4L2_MEMORY_USERPTR/V4L2_MEMORY_DMABUF data mode?

  • Hi Halley,

    There are no applications to demonstrate USE_PTR memory type but DMABUF memory-type usecases are available.

    Refer filevpedisplay application from omapdrmtest repo. This uses DMABUF memType for vpe's CPATRUE and OUTPUT planes.

    I have a HACK patch to support RGB to NV12 via DSS-WB path using filevpedisplay application. Hope this helps you.

    From 5eed3c4d98760c5c866fb31885946faf74a4d207 Mon Sep 17 00:00:00 2001
    From: Ramprasad N <x0038811@ti.com>
    Date: Wed, 11 Oct 2017 15:06:18 +0530
    Subject: [PATCH] vpe_dss-wb: HACK to support dss-wb with filevpedisplay
    
    Signed-off-by: Ramprasad N <x0038811@ti.com>
    ---
     util/display-kms.c | 18 +++++++++++++++++-
     util/vpe-common.c  | 12 +++++++++---
     2 files changed, 26 insertions(+), 4 deletions(-)
    
    diff --git a/util/display-kms.c b/util/display-kms.c
    index c5b3c50..135c1a9 100644
    --- a/util/display-kms.c
    +++ b/util/display-kms.c
    @@ -20,7 +20,7 @@
     #endif
     
     #include "util.h"
    -
    +#include <linux/videodev2.h>
     #include <xf86drmMode.h>
     
     
    @@ -120,6 +120,22 @@ alloc_buffer(struct display *disp, uint32_t fourcc, uint32_t w, uint32_t h)
     	}
     	buf = &buf_kms->base;
     
    +	switch(fourcc) {
    +	    case V4L2_PIX_FMT_RGB24:
    +	    case V4L2_PIX_FMT_BGR24:
    +	        fourcc = FOURCC('R','G','2','4');
    +	        break;
    +
    +	    case V4L2_PIX_FMT_BGR32:
    +	    case V4L2_PIX_FMT_RGB32:
    +	    case V4L2_PIX_FMT_XBGR32:
    +                fourcc = FOURCC('A','R','2','4');
    +	        break;
    +
    +	    default:
    +	        break;
    +	}
    +
     	buf->fourcc = fourcc;
     	buf->width = w;
     	buf->height = h;
    diff --git a/util/vpe-common.c b/util/vpe-common.c
    index d298da4..eac475f 100755
    --- a/util/vpe-common.c
    +++ b/util/vpe-common.c
    @@ -123,7 +123,7 @@ struct vpe {
     */
     struct vpe *vpe_open(void)
     {
    -	char devname[20] = "/dev/video0";
    +	char devname[20] = "/dev/video10"; /* Hardcoding device-node for DSS-WB */
     	struct vpe *vpe;
     
     	vpe = calloc(1, sizeof(*vpe));
    @@ -192,6 +192,12 @@ int describeFormat (char *format, struct image_params *image)
                     image->coplanar = 0;
                     image->colorspace = V4L2_COLORSPACE_SRGB;
     
    +        } else if (strcmp (format, "xbgr32") == 0) {
    +                image->fourcc = V4L2_PIX_FMT_XBGR32;
    +                image->size = image->height * image->width * 4;
    +                image->coplanar = 0;
    +                image->colorspace = V4L2_COLORSPACE_SRGB;
    +
             } else if (strcmp (format, "yuv444") == 0) {
                     image->fourcc = V4L2_PIX_FMT_YUV444;
                     image->size = image->height * image->width * 3;
    @@ -293,8 +299,8 @@ int vpe_input_init(struct vpe *vpe)
     	int ret;
     	struct v4l2_format fmt;
     	struct v4l2_requestbuffers rqbufs;
    -
    -	set_ctrl(vpe);
    +       /* set_ctrl to be called only for vpe and not for dss-wb */
    +//	set_ctrl(vpe);
     
     	memset(&fmt, 0, sizeof fmt);
     	fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
    -- 
    1.9.1
    
    

    Generate a RGB file using test-v4l2-m2m with /dev/video0(vpe)

    target$ test-v4l2-m2m /dev/video0 /usr/share/ti/video/airshow_p352x288.yuv 352 288 nv12 airshow_rgb.yuv 1280 720 abgr32 0 1 40

    Use modified filevpedisplay to convert RGB to NV12(along with scaling)

    target$ filevpedisplay airshow_rgb.yuv 1280 720 xbgr32 720 480 nv12 0 0 1280 720 0 1 -s 32:1920x1080

    I have similar patch on gstvpe to use vpe plugin as DSS-WB to convert RGB to NV12 for encoding, but there are no plugins to

    generate RGB in dmabuf io-mode.

    Ramprasad

  • appreciated. it is really helpful.

    I will try it. thanks.

  • Check on our system but there is no device node "/dev/video10" for DSS-WB. And check "/sys/dev/char", it looks like below, I suppose "/dev/video10" should refer to 81:10

    #ls /sys/dev/char

    81:0
    81:1
    81:2

    Is the DSS-WB v4l2 driver not build on our system? Any idea?
  • Hi Li,
    If you are on 3.14 based SDK(GLSDK 7.x), /dev/video10 node is not availble. I am not sure if this was supported with this version, will try to get some information.
    rootfilesystem with kernel 4.4 based SDK shows this device node.
  • Hi Ramprasad ,

    Our sdk version is TI-GLSDK7.04 and kernel version is 3.14, can you help to check rgb->nv12 function through vpe/DSS-WB?

    Best Regards,

        Li

  • Hi Li,
    I checked the source files in drivers/gpu/drm/omapdrm directory of 3.14 kernel from GLSDK7.04.
    I don't see omap_wb* files here, that means GLSDK7.04 did not have support for dss-wb driver.
    Not if latest 3.14k available has this support and is not tested also on 3.14 if exists.

    Thanks
    Ramprasad
  • Ramprasad,

    That's to say it's not feasible to use dss-wb for rgb->nv12 with k3.14.x, we will go for GPU solution.  Still thanks for the information provided. 

    Best Regards,

        Li