InterVideoSrc CPU Utilization

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

InterVideoSrc CPU Utilization

IgalKroyter
Hi,

I am using the InterVideoSrc and InterVideoSink elements. I run htop and saw
that the intervideosrc task utilizes ~50% CPU.
Is there a way to reduce this task's CPU utilization?
isn't supposed to copy pointers from one side to the other?



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: InterVideoSrc CPU Utilization

Nicolas Dufresne-5
Le mercredi 28 août 2019 à 07:18 -0500, IgalKroyter a écrit :
> Hi,
>
> I am using the InterVideoSrc and InterVideoSink elements. I run htop and saw
> that the intervideosrc task utilizes ~50% CPU.
> Is there a way to reduce this task's CPU utilization?
> isn't supposed to copy pointers from one side to the other?

It's bound to the input GstBuffer. If they are marked with NO_SHARE
flag, intervideosrc will endup copying it by simply reffing the memory.

>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (201 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: InterVideoSrc CPU Utilization

IgalKroyter
I guess that I need either configure the intervideosink somehow *or* change
(via an intervideosink or intervideosrc pad callback) each buffer's
properties?



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: InterVideoSrc CPU Utilization

Nicolas Dufresne-5
Le mercredi 28 août 2019 à 09:59 -0500, IgalKroyter a écrit :
> I guess that I need either configure the intervideosink somehow *or* change
> (via an intervideosink or intervideosrc pad callback) each buffer's
> properties?

I cannot comment without more details.

Nicolas

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (201 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: InterVideoSrc CPU Utilization

IgalKroyter
Nicolas, hi,

hereafter are the pipe I use:

v4l2src device = /dev/video0 ! interpipesink name="videoch1", format=3,
enable-sync=false, allow-renegotiation=true

alsasrc device="hw:tegrasndt186ref,0" ! tee ! queue
max-size-time=3000000000, max-size-bytes=0, max-size-buffers=0, leaky=2 !
interpipesink name="audioch1"

interpipesrc listen-to="videoch1" ! nvvidconv output-buffers=125 !
video/x-raw , width=(int)1280, height=(int)720, framerate=(fraction)60/1,
format=(string)UYVY ! omxh264enc profile=8, bitrate=32000000,
iframeinterval=15, control-rate=2 ! h264parse ! queue
max-size-time=3000000000, max-size-bytes=0, max-size-buffers=0, leaky=2 !
mpegpsmux ! queue max-size-time=3000000000, max-size-bytes=0,
max-size-buffers=0, leaky=2 ! filesink location=my.mpg

interpipesrc listen-to="audioch1", format=3, enable-sync=false,
allow-renegotiation=true ! video/x-raw , width=(int)1280, height=(int)720,
framerate=(fraction)60/1, format=(string)UYVY ! voaacenc ! queue
max-size-time=3000000000, max-size-bytes=0, max-size-buffers=0, leaky=2




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: InterVideoSrc CPU Utilization

Michael Gruner
Hi Igal

These are not intervideosrc and intervideosink. These are interpipe, which is a different project.

Similar to previous answer gave by Nicholas, if the memory is marked as “no share” it needs to be copied before sharing.

If you are certain you will not corrupt something, you may hack in the code to remove that check.

Michael

> On Aug 28, 2019, at 1:29 PM, IgalKroyter <[hidden email]> wrote:
>
> Nicolas, hi,
>
> hereafter are the pipe I use:
>
> v4l2src device = /dev/video0 ! interpipesink name="videoch1", format=3,
> enable-sync=false, allow-renegotiation=true
>
> alsasrc device="hw:tegrasndt186ref,0" ! tee ! queue
> max-size-time=3000000000, max-size-bytes=0, max-size-buffers=0, leaky=2 !
> interpipesink name="audioch1"
>
> interpipesrc listen-to="videoch1" ! nvvidconv output-buffers=125 !
> video/x-raw , width=(int)1280, height=(int)720, framerate=(fraction)60/1,
> format=(string)UYVY ! omxh264enc profile=8, bitrate=32000000,
> iframeinterval=15, control-rate=2 ! h264parse ! queue
> max-size-time=3000000000, max-size-bytes=0, max-size-buffers=0, leaky=2 !
> mpegpsmux ! queue max-size-time=3000000000, max-size-bytes=0,
> max-size-buffers=0, leaky=2 ! filesink location=my.mpg
>
> interpipesrc listen-to="audioch1", format=3, enable-sync=false,
> allow-renegotiation=true ! video/x-raw , width=(int)1280, height=(int)720,
> framerate=(fraction)60/1, format=(string)UYVY ! voaacenc ! queue
> max-size-time=3000000000, max-size-bytes=0, max-size-buffers=0, leaky=2
>
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: InterVideoSrc CPU Utilization

Nicolas Dufresne-5
Le mercredi 28 août 2019 à 13:37 -0600, Michael Gruner a écrit :
> Hi Igal
>
> These are not intervideosrc and intervideosink. These are interpipe, which is a different project.

Yes, so please ignore any of my previous comment, they no longer make
any sense.

>
> Similar to previous answer gave by Nicholas, if the memory is marked as “no share” it needs to be copied before sharing.
>
> If you are certain you will not corrupt something, you may hack in the code to remove that check.
>
> Michael
>
> > On Aug 28, 2019, at 1:29 PM, IgalKroyter <[hidden email]> wrote:
> >
> > Nicolas, hi,
> >
> > hereafter are the pipe I use:
> >
> > v4l2src device = /dev/video0 ! interpipesink name="videoch1", format=3,
> > enable-sync=false, allow-renegotiation=true
> >
> > alsasrc device="hw:tegrasndt186ref,0" ! tee ! queue
> > max-size-time=3000000000, max-size-bytes=0, max-size-buffers=0, leaky=2 !
> > interpipesink name="audioch1"
> >
> > interpipesrc listen-to="videoch1" ! nvvidconv output-buffers=125 !
> > video/x-raw , width=(int)1280, height=(int)720, framerate=(fraction)60/1,
> > format=(string)UYVY ! omxh264enc profile=8, bitrate=32000000,
> > iframeinterval=15, control-rate=2 ! h264parse ! queue
> > max-size-time=3000000000, max-size-bytes=0, max-size-buffers=0, leaky=2 !
> > mpegpsmux ! queue max-size-time=3000000000, max-size-bytes=0,
> > max-size-buffers=0, leaky=2 ! filesink location=my.mpg
> >
> > interpipesrc listen-to="audioch1", format=3, enable-sync=false,
> > allow-renegotiation=true ! video/x-raw , width=(int)1280, height=(int)720,
> > framerate=(fraction)60/1, format=(string)UYVY ! voaacenc ! queue
> > max-size-time=3000000000, max-size-bytes=0, max-size-buffers=0, leaky=2
> >
> >
> >
> >
> > --
> > Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> > _______________________________________________
> > gstreamer-devel mailing list
> > [hidden email]
> > https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (201 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: InterVideoSrc CPU Utilization

Nicolas Dufresne-5
In reply to this post by Michael Gruner
Le mercredi 28 août 2019 à 13:37 -0600, Michael Gruner a écrit :
> Hi Igal
>
> These are not intervideosrc and intervideosink. These are interpipe, which is a different project.
>
> Similar to previous answer gave by Nicholas, if the memory is marked as “no share” it needs to be copied before sharing.
>
> If you are certain you will not corrupt something, you may hack in the code to remove that check.

I can't remember which GStreamer version exactly, but I did remove the
NO_SHARE flag from v4l2src generated buffer. Do you happen to know
which version is being forked by NVidia ?

>
> Michael
>
> > On Aug 28, 2019, at 1:29 PM, IgalKroyter <[hidden email]> wrote:
> >
> > Nicolas, hi,
> >
> > hereafter are the pipe I use:
> >
> > v4l2src device = /dev/video0 ! interpipesink name="videoch1", format=3,
> > enable-sync=false, allow-renegotiation=true
> >
> > alsasrc device="hw:tegrasndt186ref,0" ! tee ! queue
> > max-size-time=3000000000, max-size-bytes=0, max-size-buffers=0, leaky=2 !
> > interpipesink name="audioch1"
> >
> > interpipesrc listen-to="videoch1" ! nvvidconv output-buffers=125 !
> > video/x-raw , width=(int)1280, height=(int)720, framerate=(fraction)60/1,
> > format=(string)UYVY ! omxh264enc profile=8, bitrate=32000000,
> > iframeinterval=15, control-rate=2 ! h264parse ! queue
> > max-size-time=3000000000, max-size-bytes=0, max-size-buffers=0, leaky=2 !
> > mpegpsmux ! queue max-size-time=3000000000, max-size-bytes=0,
> > max-size-buffers=0, leaky=2 ! filesink location=my.mpg
> >
> > interpipesrc listen-to="audioch1", format=3, enable-sync=false,
> > allow-renegotiation=true ! video/x-raw , width=(int)1280, height=(int)720,
> > framerate=(fraction)60/1, format=(string)UYVY ! voaacenc ! queue
> > max-size-time=3000000000, max-size-bytes=0, max-size-buffers=0, leaky=2
> >
> >
> >
> >
> > --
> > Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> > _______________________________________________
> > gstreamer-devel mailing list
> > [hidden email]
> > https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (201 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: InterVideoSrc CPU Utilization

IgalKroyter
Michael, Nicolas,

I have made a typo in the stream, these are actualy *intervideo*X and
*interaudio*X and not as I wrote interpipeX.
The version Nvidia has forked is 1.8.3.
What do you mean by hacking?



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: InterVideoSrc CPU Utilization

IgalKroyter
Has anyone have an idea how to solve this issue? or an example?



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: InterVideoSrc CPU Utilization

Nicolas Dufresne-5


Le ven. 30 août 2019 04 h 55, IgalKroyter <[hidden email]> a écrit :
Has anyone have an idea how to solve this issue? or an example?

It's mostly fixed upstream. If Nvidia was opening, the community could upgrade. So the main issue here is Nvidia. But you can always add some twisted hack to remove the no-share flag (OMX and v4l) and hope it works for your app.





--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: InterVideoSrc CPU Utilization

IgalKroyter
Nicolas, hi,

I'm trying to understand from NVidia what exactly they do, in the meanwhile
could you please help me with indicating the flags of the relevant memory.
I added a callback to the src pad of the intervideosrc. There I get a
GstBuffer, from which I obtain the GstMemory (gst_buffer_get_memory(buf, 0))
(I tried to get higher indeces but I got failure, so I guess there is only
one memory attached to one buffer). Then I printed
GST_MEMORY_IS_NO_SHARE(mem) and I got 0, meaning that the memory is shared.
1. Is it the correct method to obtain wether a memory of a buffer is shared?
2. If the memory is shared what else could utilize CPU?



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: InterVideoSrc CPU Utilization

Nicolas Dufresne-5


Le dim. 1 sept. 2019 10 h 56, IgalKroyter <[hidden email]> a écrit :
Nicolas, hi,

I'm trying to understand from NVidia what exactly they do, in the meanwhile
could you please help me with indicating the flags of the relevant memory.
I added a callback to the src pad of the intervideosrc. There I get a
GstBuffer, from which I obtain the GstMemory (gst_buffer_get_memory(buf, 0))
(I tried to get higher indeces but I got failure, so I guess there is only
one memory attached to one buffer). Then I printed
GST_MEMORY_IS_NO_SHARE(mem) and I got 0, meaning that the memory is shared.
1. Is it the correct method to obtain wether a memory of a buffer is shared?
2. If the memory is shared what else could utilize CPU?

No-share was just a suggestion. First step should be to locate the memory copy that causes the high cpu usage (assuming it's a memory copy and not a nvmemory <-> sysmemory roundtrip issue). On modern OS people would use generic profiler like perf or sysprof, you could also try just enabling GST_PERFORMANCE:7 debug category.

When the exact cause of cpu usage is found, then you will be able to debug further 




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: InterVideoSrc CPU Utilization

IgalKroyter
Nicolas, hi,

so NVidia suggested to use conversion to NV12 which improved the utilization
by 50% (I had to give-up the intervideoXXX).

Thanks for the support.



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel