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.

AM62A7-Q1: VPAC and Multiscaler: How to get a second path to use dmabuf-import as well

Part Number: AM62A7-Q1
Other Parts Discussed in Thread: AM62A7

Tool/software:

Hi and ,

I finally got the ability to test the pipeline on 10.1.0, and it's working mostly as expected.

When I switch one path to 1920x1080 with the multiscaler, I need to switch the encoder element to use dmabuf instead of dmabuf-import, and this still has an impact on the framerate (28.5 instead of 30, probably because of the extra copy). If I use dmabuf-import, my pipeline errors out because the encoder can't get memory. If I set the size for the second path to 3840x2160, this problem doesn't occur.

My current script:

#!/bin/bash

DCC_ISP_FILE=/opt/imaging/ar0823/linear/dcc_viss.bin
DCC_2A_FILE=/opt/imaging/ar0823/linear/dcc_2a.bin
LDC_DCC_FILE=/opt/imaging/ar0823/linear/dcc_ldc.bin

MULTICASTADDR1=224.1.1.1
MULTICASTADDR2=224.1.1.2
PORT=5004

if [ x$TEE == x ]; then
    TEE=tee
fi
HEVC_PROFILE="main"
HEVC_LEVEL="1"
VIDEO_BITRATE=6000000
ENC_EXTRA_CONTROLS="enc,prepend_sps_and_pps_to_idr=1,video_gop_size=5,frame_level_rate_control_enable=1,video_bitrate_mode=0,vbv_buffer_size=3000,video_bitrate=${VIDEO_BITRATE}"

TEMP=$(getopt -o 'p:l:b:h' --long 'profile:,level:,bitrate:,input:,output:,help,mc:,port:' -n '$0' -- "$@")

if [ $? -ne 0 ]; then
        echo 'Terminating...' >&2
        exit 1
fi

eval set -- "$TEMP"
unset TEMP

while true; do
        case "$1" in
                '-h'|'--help')
                        echo "$0 - H.265 compress a JPEG file into a one second stream"
                        echo "Parameters:"
                        echo "  -p main|main-still-picture|main-10 (HEVC Profile)"
                        echo "  -l 1|2|2.1|3|3.1|4|4.1|5|5.1 (HEVC Level)"
                        echo "  -b 0..700000000 (Video Bitrate)"
                        echo "  --mc <multicast ip address>"
                        echo "  --port <port number> (default 5000)"
                        echo "  -h This help"
                        exit 0
                        shift
                        continue
                ;;
                '-p'|'--profile')
                        case "$2" in
                                'main'|'Main'|'0')
                                        HEVC_PROFILE="main"
                                        ;;
                                'main-still-picture'|'1')
                                        HEVC_PROFILE="main-still-picture"
                                        ;;
                                'main-10'|'2')
                                        HEVC_PROFILE="main-10"
                                        ;;
                                *)
                                        HEVC_PROFILE="main"
                                        ;;
                        esac
                        echo "HEVC Profile: '$HEVC_PROFILE'"
                        shift 2
                        continue
                ;;
                '-l'|'--level')
                        case "$2" in
                                '1'|'2'|'2.1'|'3'|'3.1'|'4'|'4.1'|'5'|'5.1')
                                        HEVC_LEVEL="$2"
                                        ;;
                                *)
                                        HEVC_LEVEL="1"
                                        ;;
                        esac
                        echo "HEVC Level: '$HEVC_LEVEL'"
                        shift 2
                        continue
                ;;
                '-b'|'--bitrate')
                        echo "Video Bitrate: '$2'"
                        VIDEO_BITRATE=$2
                        shift 2
                        continue
                ;;
                'mc')
                        MULTICASTADDR=$2
                        shift 2
                        continue
                ;;
                'port')
                        PORT=$2
                        shift 2
                        continue
                ;;
                '--')
                        shift
                        break
                ;;
                *)
                        echo 'Internal error!' >&2
                        exit 1
                ;;
        esac
done

#media-ctl -V '"imx219 4-0010":0 [fmt:SRGGB10_1X10/1920x1080 field:none]'
#media-ctl -V '"ar0521 1-0036":0 [fmt:SGRBG8_1X8/3840x2160 field:none]'
media-ctl -V '"ar0823 1-0010":0 [fmt:SGRBG12_1X12/3840x2160 field:none]'
gst-launch-1.0 -v -e v4l2src device=/dev/video3 io-mode=dmabuf-import do-timestamp=true \
        ! video/x-bayer, width=3840, height=2160, framerate=30/1, format=grbg12 \
        ! tiovxisp sink_0::device=/dev/v4l-subdev2 sensor-name="SENSOR_ONSEMI_AR0823" \
                dcc-isp-file=${DCC_ISP_FILE} \
                sink_0::dcc-2a-file=${DCC_2A_FILE} format-msb=11 \
        ! queue max-size-buffers=1 leaky=0 \
        ! tiovxldc sensor-name="SENSOR_ONSEMI_AR0823" dcc-file=${LDC_DCC_FILE} \
        ! video/x-raw, format=NV12, width=3840, height=2160, framerate=30/1 \
        ! queue max-size-buffers=1 leaky=0 \
        ! ${TEE} name=multi \
        multi.src_0 \
        ! queue max-size-buffers=1 leaky=0 name=qstream1 \
        ! v4l2h265enc output-io-mode=dmabuf-import extra-controls=${ENC_EXTRA_CONTROLS} \
        ! "video/x-h265, profile=(string)${HEVC_PROFILE}, level=(string)${HEVC_LEVEL}" \
        ! rtph265pay config-interval=1 pt=96 mtu=1400 \
        ! udpsink host=${MULTICASTADDR1} auto-multicast=true port=${PORT} \
        multi.src_1 \
        ! queue max-size-buffers=1 leaky=0 name=qstream2 \
        ! tiovxmultiscaler target=0 \
                sink_0::pool-size=4 src::pool-size=4 \
        ! video/x-raw, format=NV12, width=1920, height=1080 \
        ! v4l2h265enc output-io-mode=dmabuf extra-controls=${ENC_EXTRA_CONTROLS} \
        ! "video/x-h265, profile=(string)${HEVC_PROFILE}, level=(string)${HEVC_LEVEL}" \
        ! rtph265pay config-interval=1 pt=96 mtu=1400 \
        ! udpsink host=${MULTICASTADDR2} auto-multicast=true port=${PORT}

Any ideas how to improve this?

Regards,

Bas Vermeulen

  • Hi Bas,

    We're looking into this and will get back to you as soon as we can.

    Regards,

    Jianzhong

  • Hi Bas,

    Can you please try below pipeline

    gst-launch-1.0 -v -e v4l2src device=/dev/video3 io-mode=dmabuf-import do-timestamp=true \
    ! video/x-bayer, width=3840, height=2160, framerate=30/1, format=grbg12 \
    ! tiovxisp sink_0::device=/dev/v4l-subdev2 sensor-name="SENSOR_ONSEMI_AR0823" \
    dcc-isp-file=${DCC_ISP_FILE} \
    sink_0::dcc-2a-file=${DCC_2A_FILE} format-msb=11 \
    ! queue max-size-buffers=1 leaky=0 \
    ! tiovxldc sensor-name="SENSOR_ONSEMI_AR0823" dcc-file=${LDC_DCC_FILE} \
    ! video/x-raw, format=NV12, width=3840, height=2160, framerate=30/1 \
    ! queue max-size-buffers=1 leaky=0 \
    ! ${TEE} name=multi \
    multi.src_0 \
    ! queue max-size-buffers=1 leaky=0 name=qstream1 \
    ! v4l2h265enc output-io-mode=dmabuf-import extra-controls=${ENC_EXTRA_CONTROLS} \
    ! "video/x-h265, profile=(string)${HEVC_PROFILE}, level=(string)${HEVC_LEVEL}" \
    ! rtph265pay config-interval=1 pt=96 mtu=1400 \
    ! udpsink host=${MULTICASTADDR1} auto-multicast=true port=${PORT} \
    multi.src_1 \
    ! queue max-size-buffers=1 leaky=0 name=qstream2 \
    ! tiovxmultiscaler target=0 \
    sink_0::pool-size=4 src::pool-size=4 \
    ! video/x-raw, format=NV12, width=1920, height=1080, stride-y-align=16 \
    ! v4l2h265enc output-io-mode=dmabuf-import extra-controls=${ENC_EXTRA_CONTROLS} \
    ! "video/x-h265, profile=(string)${HEVC_PROFILE}, level=(string)${HEVC_LEVEL}" \
    ! rtph265pay config-interval=1 pt=96 mtu=1400 \
    ! udpsink host=${MULTICASTADDR2} auto-multicast=true port=${PORT}

    Encoder needs height to be aligned to 16

    Regrads
    Rahul T R

  • Hi Rahul,

    Adding stride-y-align=16 to the capabilities doesn't make a difference for the dual pipeline. I still get 28 to 28.5 fps.

    +-----------------------------------------------------------------------------------+
    |element                       latency      out-latancy      out-fps     frames     |
    +-----------------------------------------------------------------------------------+
    |capsfilter0                   0.40         35.01            28          3879       |
    |tiovxisp0                     62.85        35.00            28          3877       |
    |queue0                        10.90        35.00            28          3878       |
    |tiovxldc0                     34.29        35.00            28          3877       |
    |capsfilter1                   0.34         35.00            28          3877       |
    |queue1                        0.20         35.00            28          3877       |
    |multi                         0.36         17.50            57          7754       |
    |qstream1                      0.28         35.00            28          3877       |
    |hdqueue                       0.77         35.00            28          3877       |
    |tiovxmultiscaler0             23.36        35.00            28          3876       |
    |capsfilter3                   0.43         35.00            28          3876       |
    |v4l2h265enc0                  43.91        34.99            28          3875       |
    |capsfilter2                   0.36         34.99            28          3875       |
    |v4l2src0                      159.91       17.50            57          7750       |
    |rtph265pay0                   0.67         34.99            28          3875       |
    |v4l2h265enc1                  30.31        34.99            28          3875       |
    |capsfilter4                   0.45         34.99            28          3875       |
    |rtph265pay1                   0.60         34.99            28          3875       |
    +-----------------------------------------------------------------------------------+

    I've tried removing the main (3840x2160) stream, and if I do that, I get 30 fps (which includes the multiscaler)

    +-----------------------------------------------------------------------------------+
    |element                       latency      out-latancy      out-fps     frames     |
    +-----------------------------------------------------------------------------------+
    |capsfilter0                   0.28         33.30            30          1164       |
    |tiovxisp0                     24.84        33.26            30          1164       |
    |queue0                        0.56         33.26            30          1164       |
    |tiovxldc0                     24.02        33.26            30          1163       |
    |capsfilter1                   0.36         33.26            30          1163       |
    |queue1                        0.21         33.26            30          1163       |
    |multi                         0.33         16.63            60          2326       |
    |qstream1                      0.23         33.26            30          1163       |
    |v4l2src0                      73.80        16.64            60          2324       |
    |capsfilter2                   0.19         33.26            30          1163       |
    |hdqueue                       2.82         33.26            30          1163       |
    |tiovxmultiscaler0             23.50        33.25            30          1162       |
    |capsfilter3                   0.45         33.26            30          1162       |
    |v4l2h265enc0                  18.47        33.23            30          1161       |
    |capsfilter4                   0.29         33.23            30          1161       |
    |rtph265pay0                   0.51         33.23            30          1161       |
    +-----------------------------------------------------------------------------------+

    The bottleneck seems to be having the two streams running at the same time, I suspect the copying the second stream to it's own dmabuffer.

    Bas

  • Hi Bas,

    I believe encoding both 3840x2160@30fps and 1920x1080@30fps simultaneously is beyond the encoder capability. 

    I'll let comment on this.

    Regards,

    Jianzhong

  • Hi Bas,

    On AM62A7 max we could do is 4K@30fps encode/decode.  In your use-case, have you increased the CMA memory in order to run 4K+ FHD stream? 

    What error are you seeing when you make dmabuf-import. Can you attach the log?

    Best Regards,

    Suren

  • Hi Suren,

    The technical reference manual (7.4 Video Accellerator) mentions that the WAVE5 can do 8 bit 3840x2160@60 fps (I believe running at 500 MHz). My codec is running at 400 MHz, which would mean it ought to be able to get 48 fps decoding or encoding. When encoding 3840x2160 @ 30 fps, I should be using about 250 MHz, leaving 150 MHz for the encoding of the 1920x1080 @ 30 fps (which should only take 125 MHz).

    Reading all that made me think of something, and if I clock the VPU at 500 MHz, I get 30 fps with a 4K stream and a Full HD stream at the same time.

    What would be the correct way to change the clocks for the VPU in the device tree?

    Regards,

    Bas Vermeulen

  • Hi Bas,

    Yes we should be able to do 4K@30 and FHD@30 with 400MHz clock. 

    Also, were you able to run the below pipeline that Rahul suggested as it shows dmabuf-import on both the encoders in the pipeline?

    gst-launch-1.0 -v -e v4l2src device=/dev/video3 io-mode=dmabuf-import do-timestamp=true \
    ! video/x-bayer, width=3840, height=2160, framerate=30/1, format=grbg12 \
    ! tiovxisp sink_0::device=/dev/v4l-subdev2 sensor-name="SENSOR_ONSEMI_AR0823" \
    dcc-isp-file=${DCC_ISP_FILE} \
    sink_0::dcc-2a-file=${DCC_2A_FILE} format-msb=11 \
    ! queue max-size-buffers=1 leaky=0 \
    ! tiovxldc sensor-name="SENSOR_ONSEMI_AR0823" dcc-file=${LDC_DCC_FILE} \
    ! video/x-raw, format=NV12, width=3840, height=2160, framerate=30/1 \
    ! queue max-size-buffers=1 leaky=0 \
    ! ${TEE} name=multi \
    multi.src_0 \
    ! queue max-size-buffers=1 leaky=0 name=qstream1 \
    ! v4l2h265enc output-io-mode=dmabuf-import extra-controls=${ENC_EXTRA_CONTROLS} \
    ! "video/x-h265, profile=(string)${HEVC_PROFILE}, level=(string)${HEVC_LEVEL}" \
    ! rtph265pay config-interval=1 pt=96 mtu=1400 \
    ! udpsink host=${MULTICASTADDR1} auto-multicast=true port=${PORT} \
    multi.src_1 \
    ! queue max-size-buffers=1 leaky=0 name=qstream2 \
    ! tiovxmultiscaler target=0 \
    sink_0::pool-size=4 src::pool-size=4 \
    ! video/x-raw, format=NV12, width=1920, height=1080, stride-y-align=16 \
    ! v4l2h265enc output-io-mode=dmabuf-import extra-controls=${ENC_EXTRA_CONTROLS} \
    ! "video/x-h265, profile=(string)${HEVC_PROFILE}, level=(string)${HEVC_LEVEL}" \
    ! rtph265pay config-interval=1 pt=96 mtu=1400 \
    ! udpsink host=${MULTICASTADDR2} auto-multicast=true port=${PORT}

    I did some experiments with videotestsrc and 4K +FHD encoding pipelines with dmabuf and it worked, but the FPS was low. 

    We are going to validate few things on our end with 8MP camera connected tomorrow and respond back. 

    Appreciate your patience.

    Best Regards,

    Suren

  • Hi Suren,

    I added the stride-y-align=16 to my pipeline, where the second v4l2h265enc is using output-io-mode=dmabuf.

    I get the following output when I use dmabuf-import on the second encoder instance:

    APP: Init ... !!!
    1113518.145733 s: MEM: Init ... !!!
    1113518.145762 s: MEM: Initialized DMA HEAP (fd=8) !!!
    1113518.145890 s: MEM: Init ... Done !!!
    1113518.145896 s: IPC: Init ... !!!
    1113518.162739 s: IPC: Init ... Done !!!
    REMOTE_SERVICE: Init ... !!!
    REMOTE_SERVICE: Init ... Done !!!
    1113518.166767 s: GTC Frequency = 200 MHz
    APP: Init ... Done !!!
    1113518.166855 s:  VX_ZONE_INFO: Globally Enabled VX_ZONE_ERROR
    1113518.166860 s:  VX_ZONE_INFO: Globally Enabled VX_ZONE_WARNING
    1113518.166864 s:  VX_ZONE_INFO: Globally Enabled VX_ZONE_INFO
    1113518.167820 s:  VX_ZONE_INFO: [tivxPlatformCreateTargetId:134] Added target MPU-0
    1113518.168049 s:  VX_ZONE_INFO: [tivxPlatformCreateTargetId:134] Added target MPU-1
    1113518.168264 s:  VX_ZONE_INFO: [tivxPlatformCreateTargetId:134] Added target MPU-2
    1113518.168406 s:  VX_ZONE_INFO: [tivxPlatformCreateTargetId:134] Added target MPU-3
    1113518.168412 s:  VX_ZONE_INFO: [tivxInitLocal:126] Initialization Done !!!
    1113518.168418 s:  VX_ZONE_INFO: Globally Disabled VX_ZONE_INFO
    Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    Pipeline is PREROLLED ...
    Setting pipeline to PLAYING ...
    /GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-bayer, width=(int)3840, height=(int)2160, framerate=(fraction)30/1, format=(string)grbg12, interlace-mode=(string)progressive
    /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-bayer, width=(int)3840, height=(int)2160, framerate=(fraction)30/1, format=(string)grbg12, interlace-mode=(string)progressive
    New clock: GstSystemClock
    /GstPipeline:pipeline0/GstTIOVXISP:tiovxisp0.GstTIOVXIspPad:sink_0: caps = video/x-bayer, width=(int)3840, height=(int)2160, framerate=(fraction)30/1, format=(string)grbg12, interlace-mode=(string)progressive
    /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-bayer, width=(int)3840, height=(int)2160, framerate=(fraction)30/1, format=(string)grbg12, interlace-mode=(string)progressive
    /GstPipeline:pipeline0/GstTIOVXISP:tiovxisp0.GstTIOVXMisoPad:src: caps = video/x-raw, format=(string)NV12, width=(int)3840, height=(int)2160, stride-y-align=(int)16, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstQueue:queue0.GstPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)3840, height=(int)2160, stride-y-align=(int)16, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstQueue:queue0.GstPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)3840, height=(int)2160, stride-y-align=(int)16, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstTIOVXLDC:tiovxldc0.GstTIOVXPad:src_0: caps = video/x-raw, format=(string)NV12, width=(int)3840, height=(int)2160, stride-y-align=(int)16, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstCapsFilter:capsfilter1.GstPad:src: caps = video/x-raw, format=(string)NV12, width=(int)3840, height=(int)2160, stride-y-align=(int)16, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstQueue:queue1.GstPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)3840, height=(int)2160, stride-y-align=(int)16, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstQueue:queue1.GstPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)3840, height=(int)2160, stride-y-align=(int)16, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstCapsFilter:capsfilter1.GstPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)3840, height=(int)2160, stride-y-align=(int)16, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstTee:multi.GstTeePad:src_0: caps = video/x-raw, format=(string)NV12, width=(int)3840, height=(int)2160, stride-y-align=(int)16, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstQueue:qstream1.GstPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)3840, height=(int)2160, stride-y-align=(int)16, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstQueue:qstream1.GstPad:src: caps = video/x-raw, format=(string)NV12, width=(int)3840, height=(int)2160, stride-y-align=(int)16, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstQueue:qstream1.GstPad:src: caps = video/x-raw, format=(string)NV12, width=(int)3840, height=(int)2160, stride-y-align=(int)16, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstCapsFilter:capsfilter2.GstPad:src: caps = video/x-raw, format=(string)NV12, width=(int)3840, height=(int)2160, stride-y-align=(int)16, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstQueue:hdqueue.GstPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)3840, height=(int)2160, stride-y-align=(int)16, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstTee:multi.GstPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)3840, height=(int)2160, stride-y-align=(int)16, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstTee:multi.GstPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)3840, height=(int)2160, stride-y-align=(int)16, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/v4l2h265enc:v4l2h265enc0.GstPad:src: caps = video/x-h265, stream-format=(string)byte-stream, alignment=(string)au, level=(string)1, profile=(string)main, width=(int)3840, height=(int)2160, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstCapsFilter:capsfilter3.GstPad:src: caps = video/x-h265, stream-format=(string)byte-stream, alignment=(string)au, level=(string)1, profile=(string)main, width=(int)3840, height=(int)2160, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstRtpH265Pay:rtph265pay0.GstPad:sink: caps = video/x-h265, stream-format=(string)byte-stream, alignment=(string)au, level=(string)1, profile=(string)main, width=(int)3840, height=(int)2160, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstCapsFilter:capsfilter3.GstPad:sink: caps = video/x-h265, stream-format=(string)byte-stream, alignment=(string)au, level=(string)1, profile=(string)main, width=(int)3840, height=(int)2160, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    Redistribute latency...
    /GstPipeline:pipeline0/v4l2h265enc:v4l2h265enc0.GstPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)3840, height=(int)2160, stride-y-align=(int)16, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstCapsFilter:capsfilter2.GstPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)3840, height=(int)2160, stride-y-align=(int)16, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstTIOVXMultiScaler:tiovxmultiscaler0.GstTIOVXMultiScalerPad:src_0: caps = video/x-raw, width=(int)1920, height=(int)1080, stride-y-align=(int)16, format=(string)NV12, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstCapsFilter:capsfilter4.GstPad:src: caps = video/x-raw, width=(int)1920, height=(int)1080, stride-y-align=(int)16, format=(string)NV12, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/v4l2h265enc:v4l2h265enc1.GstPad:src: caps = video/x-h265, stream-format=(string)byte-stream, alignment=(string)au, level=(string)1, profile=(string)main, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstCapsFilter:capsfilter5.GstPad:src: caps = video/x-h265, stream-format=(string)byte-stream, alignment=(string)au, level=(string)1, profile=(string)main, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstRtpH265Pay:rtph265pay1.GstPad:sink: caps = video/x-h265, stream-format=(string)byte-stream, alignment=(string)au, level=(string)1, profile=(string)main, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstCapsFilter:capsfilter5.GstPad:sink: caps = video/x-h265, stream-format=(string)byte-stream, alignment=(string)au, level=(string)1, profile=(string)main, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    Redistribute latency...
    /GstPipeline:pipeline0/v4l2h265enc:v4l2h265enc1.GstPad:sink: caps = video/x-raw, width=(int)1920, height=(int)1080, stride-y-align=(int)16, format=(string)NV12, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstCapsFilter:capsfilter4.GstPad:sink: caps = video/x-raw, width=(int)1920, height=(int)1080, stride-y-align=(int)16, format=(string)NV12, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstTIOVXMultiScaler:tiovxmultiscaler0.GstTIOVXMultiScalerPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)3840, height=(int)2160, stride-y-align=(int)16, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    /GstPipeline:pipeline0/GstTIOVXLDC:tiovxldc0.GstTIOVXPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)3840, height=(int)2160, stride-y-align=(int)16,framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
    ERROR: from element /GstPipeline:pipeline0/v4l2h265enc:v4l2h265enc1: Failed to process frame.
    Additional debug info:
    /usr/src/debug/gstreamer1.0-plugins-good/1.22.12/sys/v4l2/gstv4l2videoenc.c(901): gst_v4l2_video_enc_handle_frame (): /GstPipeline:pipeline0/v4l2h265enc:v4l2h265enc1: Maybe be due to not enough memory or failing driver
    Execution ended after 0:00:00.771676644
    Setting pipeline to NULL ...
    Freeing pipeline ...
    1113519.189283 s:  VX_ZONE_WARNING: [vxReleaseContext:1275] Found a reference 0xffff950fee80 of type 0000080f at external count 1, internal count 0, releasing it
    1113519.189298 s:  VX_ZONE_WARNING: [vxReleaseContext:1277] Releasing reference (name=image_107) now as a part of garbage collection
    1113519.189321 s:  VX_ZONE_WARNING: [vxReleaseContext:1275] Found a reference 0xffff9517c710 of type 00000813 at external count 1, internal count 0, releasing it
    1113519.189329 s:  VX_ZONE_WARNING: [vxReleaseContext:1277] Releasing reference (name=object_array_118) now as a part of garbage collection
    1113519.190032 s:  VX_ZONE_WARNING: [vxReleaseContext:1275] Found a reference 0xffff9517c8c0 of type 00000813 at external count 1, internal count 0, releasing it
    1113519.190042 s:  VX_ZONE_WARNING: [vxReleaseContext:1277] Releasing reference (name=object_array_120) now as a part of garbage collection
    APP: Deinit ... !!!
    REMOTE_SERVICE: Deinit ... !!!
    REMOTE_SERVICE: Deinit ... Done !!!
    1113519.196076 s: IPC: Deinit ... !!!
    1113519.196859 s: IPC: DeInit ... Done !!!
    1113519.196874 s: MEM: Deinit ... !!!
    1113519.196974 s: DDR_SHARED_MEM: Alloc's: 38 alloc's of 217140844 bytes
    1113519.196983 s: DDR_SHARED_MEM: Free's : 38 free's  of 217140844 bytes
    1113519.196988 s: DDR_SHARED_MEM: Open's : 0 allocs  of 0 bytes
    1113519.196999 s: MEM: Deinit ... Done !!!
    APP: Deinit ... Done !!!

    If I use dmabuf, the pipeline runs as expected (and at 30 fps when running the VPU at 500 MHz).

    When I increase the clock speed for the VPU to 500 MHz, I can run everything at the desired framerate.

    Is this a supported configuration, or is there something else I need to do if I want to run the VPU at 500 MHz?

    Regards,

    Bas Vermeulen

  • Hi Bas,

    Can you apply this patch and see if you are able to use dmabuf-import with 1920x1080 pipeline.

    From 0eafe1d30b608debca4b7120f6f2fbbaa89b9c22 Mon Sep 17 00:00:00 2001
    From: Brandon Brnich <b-brnich@ti.com>
    Date: Tue, 13 Aug 2024 17:44:33 -0500
    Subject: [PATCH] TEMP: media: chips-media: wave5: change bytes per line calc
     for NV12
    
    Change back how driver calculates sizes for output buffers.
    
    Signed-off-by: Brandon Brnich <b-brnich@ti.com>
    ---
     .../platform/chips-media/wave5/wave5-vpu-enc.c   | 16 ++++++++++++----
     1 file changed, 12 insertions(+), 4 deletions(-)
    
    diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
    index de575afa79ea..c1822927448b 100644
    --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
    +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
    @@ -561,10 +561,16 @@ static int wave5_vpu_enc_try_fmt_out(struct file *file, void *fh, struct v4l2_fo
     		frmsize = vpu_fmt->v4l2_frmsize;
     	}
     
    -	wave5_update_pix_fmt(&f->fmt.pix_mp, VPU_FMT_TYPE_RAW,
    -					     width,
    -					     height,
    -					     frmsize);
    +	if (f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_NV12) {
    +		f->fmt.pix_mp.width = width;
    +		f->fmt.pix_mp.height = height;
    +		f->fmt.pix_mp.plane_fmt[0].bytesperline = round_up(width, 32);
    +		f->fmt.pix_mp.plane_fmt[0].sizeimage = round_up(width, 32) * height * 3 / 2;
    +	} else
    +		wave5_update_pix_fmt(&f->fmt.pix_mp, VPU_FMT_TYPE_RAW,
    +						width,
    +						height,
    +						frmsize);
     
     	return 0;
     }
    @@ -580,12 +586,14 @@ static int wave5_vpu_enc_s_fmt_out(struct file *file, void *fh, struct v4l2_form
     		__func__, f->fmt.pix_mp.pixelformat, f->fmt.pix_mp.width, f->fmt.pix_mp.height,
     		f->fmt.pix_mp.num_planes, f->fmt.pix_mp.field);
     
    +	pr_info("before %u x %u\n", f->fmt.pix_mp.width, f->fmt.pix_mp.height);
     	ret = wave5_vpu_enc_try_fmt_out(file, fh, f);
     	if (ret)
     		return ret;
     
     	inst->src_fmt.width = f->fmt.pix_mp.width;
     	inst->src_fmt.height = f->fmt.pix_mp.height;
    +	pr_info("after %u x %u\n", inst->src_fmt.width, inst->src_fmt.height);
     	inst->src_fmt.pixelformat = f->fmt.pix_mp.pixelformat;
     	inst->src_fmt.field = f->fmt.pix_mp.field;
     	inst->src_fmt.flags = f->fmt.pix_mp.flags;
    -- 
    2.34.1

    Let us know how it goes with this patch applied.

    Best Regards,

    Suren