Hello Gst Community,
I'm trying to write a plugin that is based on the Video Filter as its base class. It works well for no-resizing, 1:1 pass through pipelines. gst-launch-1.0 videotestsrc ! xm2mvscaler device=/dev/xm2mvsc0 batch-size=1 buffer-mode=2 ! video/x-raw,format=RGB,width=1280,height=720,framerate=30/1 ! videoconvert ! fpsdisplaysink videosink="kmssink driver-name=xilinx_drm plane-id=26" text-overlay=false /(Working pipeline)/ When I try to scale it : gst-launch-1.0 videotestsrc ! video/x-raw,format=RGB,width=1280,height=720,framerate=30/1 ! xm2mvscaler device=/dev/xm2mvsc0 batch-size=1 buffer-mode=2 ! video/x-raw,format=RGB,width=1920,height=1080,framerate=30/1 ! videoconvert ! fpsdisplaysink videosink="kmssink driver-name=xilinx_drm plane-id=26" text-overlay=false WARNING: erroneous pipeline: could not link xm2mvscaler0 to videoconvert0 and it *errors out*. After reading a little more of the gstvideofilter.c source code, it appears basing off the VideoFilter class may not be the right thing as it maps the frames for you. * My question is what is the best way to map input buffers and output buffers for HW Accelerated scalers? And does a VideoFilter not support resizing at all ? I'd be glad to post more information, but a hint towards what's not working would be very helpful. * Looking at gst_video_filter_transform_size routine, I suspect it does not allow resizing. === Logs 0:00:04.053976831 2358 0x30b1c890 DEBUG capsfilter gstcapsfilter.c:295:gst_capsfilter_transform_caps:<capsfilter1> input: ANY 0:00:04.054003403 2358 0x30b1c890 DEBUG capsfilter gstcapsfilter.c:296:gst_capsfilter_transform_caps:<capsfilter1> filter: (NULL) 0:00:04.054028636 2358 0x30b1c890 DEBUG capsfilter gstcapsfilter.c:298:gst_capsfilter_transform_caps:<capsfilter1> caps filter: video/x-raw, format=(string)RGB, width=(int)1920, height=(int)1080, framerate=(fraction)30/1 0:00:04.054070900 2358 0x30b1c890 DEBUG capsfilter gstcapsfilter.c:299:gst_capsfilter_transform_caps:<capsfilter1> intersect: video/x-raw, format=(string)RGB, width=(int)1920, height=(int)1080, framerate=(fraction)30/1 0:00:04.054115894 2358 0x30b1c890 DEBUG GST_PADS gstpad.c:3938:gst_pad_query:<capsfilter1:sink> sent query 0x30c518a0 (caps), result 1 0:00:04.054153528 2358 0x30b1c890 INFO GST_PADS gstpad.c:2371:gst_pad_link_prepare: caps are incompatible 0:00:04.054178351 2358 0x30b1c890 INFO GST_PADS gstpad.c:2464:gst_pad_link_full: link between xm2mvscaler0:src and capsfilter1:sink failed: no common format === gst-inspect-1.0 output : root@peta_xm2m_vscaler:~# gst-inspect-1.0 xm2mvscaler Factory Details: Rank none (0) Long-name Xilinx M2M Video Scaler Klass Xilinx M2M Video Scaler Description Xilinx M2M Video Scaler Author Rohit Athavale <[hidden email]> Plugin Details: Name xm2mvscaler Description Xilinx M2M Scaler plugin Filename /usr/lib/gstreamer-1.0/libgstxm2mvscaler.so Version 0.6 License LGPL Source module xm2mvscaler Binary package GStreamer Origin URL http://gstreamer.net/ GObject +----GInitiallyUnowned +----GstObject +----GstElement +----GstBaseTransform +----GstVideoFilter +----GstXm2mVScaler Pad Templates: SINK template: 'sink' Availability: Always Capabilities: video/x-raw format: { RGB } width: [ 1, 3840 ] height: [ 1, 2160 ] framerate: [ 0/1, 2147483647/1 ] SRC template: 'src' Availability: Always Capabilities: video/x-raw format: { RGB } width: [ 1, 3840 ] height: [ 1, 2160 ] framerate: [ 0/1, 2147483647/1 ] Element Flags: no flags set Element Implementation: Has change_state() function: gst_element_change_state_func Element has no clocking capabilities. Element has no URI handling capabilities. Pads: SINK: 'sink' Pad Template: 'sink' SRC: 'src' Pad Template: 'src' Element Properties: name : The name of the object flags: readable, writable String. Default: "xm2mvscaler0" parent : The parent of the object flags: readable, writable Object of type "GstObject" qos : Handle Quality-of-Service events flags: readable, writable Boolean. Default: true buffer-mode : Buffer Mode flags: readable, writable Enum "GstXm2mVScalerBufferMode" Default: 0, "" (1): DMABUF - GST_XM2MVSC_BUF_DMABUF (2): Driver allocated contiguous memory - GST_XM2MVSC_BUF_KERNEL_DRV batch-size : Frame Batch Size flags: readable, writable Enum "GstXm2mVScalerBatchSize" Default: 0, "" (1): One - GST_XM2MVSCALER_BATCH_SIZE_ONE (2): Two - GST_XM2MVSCALER_BATCH_SIZE_TWO (8): Eight - GST_XM2MVSCALER_BATCH_SIZE_EIGHT device : Location of Device File being used flags: readable, writable String. Default: "/dev/xm2mvsc0" -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Le 26 févr. 2018 15:26, "rathaval" <[hidden email]> a écrit : Hello Gst Community, Have a look at GstV4l2Transform element in gst-plugins-good. It's doing this already, but using a standard Linux interface instead of custom set of ioctl. On the software size, have a look at videoscale code.
It does allow resizing if you implement it properly. But it seems a bit pointless to debug this element since I don't see any valid upstream argument for this scaler driver to use a custom ioctl interface, hence not use GstV4l2Transform. I have seen the staging submission on linux-media for this driver. === _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
In reply to this post by rathaval
Le lundi 26 février 2018 à 13:02 -0700, rathaval a écrit :
> Hello Gst Community, > > I'm trying to write a plugin that is based on the Video Filter as its base > class. It works well for no-resizing, > 1:1 pass through pipelines. > > gst-launch-1.0 videotestsrc ! xm2mvscaler device=/dev/xm2mvsc0 batch-size=1 > buffer-mode=2 ! video/x-raw,format=RGB,width=1280,height=720,framerate=30/1 > ! videoconvert ! fpsdisplaysink videosink="kmssink driver-name=xilinx_drm > plane-id=26" text-overlay=false > /(Working pipeline)/ > > When I try to scale it : > gst-launch-1.0 videotestsrc ! > video/x-raw,format=RGB,width=1280,height=720,framerate=30/1 ! xm2mvscaler > device=/dev/xm2mvsc0 batch-size=1 buffer-mode=2 ! > video/x-raw,format=RGB,width=1920,height=1080,framerate=30/1 ! videoconvert > ! fpsdisplaysink videosink="kmssink driver-name=xilinx_drm plane-id=26" > text-overlay=false > WARNING: erroneous pipeline: could not link xm2mvscaler0 to videoconvert0 > > and it *errors out*. After reading a little more of the gstvideofilter.c > source code, it appears basing off the VideoFilter class may not be the > right thing as it maps the frames for you. I forgot to mention, the error is unrelated to the fact that it's mapping the frames for you or not. Without code I could not comment on it, so I skipped. > > > * > My question is what is the best way to map input buffers and output buffers > for HW Accelerated scalers? And does a VideoFilter not support resizing at > all ? I'd be glad to post more information, but a hint towards what's not > working would be very helpful. * What I wanted to share (and I forgot) is why GstV4l2Transform is base on GstBaseTransform and not GstVideoFilter. As the goal was to support zero copy through DMABuf FD, it was important that we don't map the DMABuf FD while transforming, as due to cache management, that could have lead to bad sub-optimal performance. > > Looking at gst_video_filter_transform_size routine, I suspect it does not > allow resizing. > === > Logs > 0:00:04.053976831 2358 0x30b1c890 DEBUG capsfilter > gstcapsfilter.c:295:gst_capsfilter_transform_caps:<capsfilter1> input: > ANY > 0:00:04.054003403 2358 0x30b1c890 DEBUG capsfilter > gstcapsfilter.c:296:gst_capsfilter_transform_caps:<capsfilter1> filter: > (NULL) > 0:00:04.054028636 2358 0x30b1c890 DEBUG capsfilter > gstcapsfilter.c:298:gst_capsfilter_transform_caps:<capsfilter1> caps filter: > video/x-raw, format=(string)RGB, width=(int)1920, height=(int)1080, > framerate=(fraction)30/1 > 0:00:04.054070900 2358 0x30b1c890 DEBUG capsfilter > gstcapsfilter.c:299:gst_capsfilter_transform_caps:<capsfilter1> intersect: > video/x-raw, format=(string)RGB, width=(int)1920, height=(int)1080, > framerate=(fraction)30/1 > 0:00:04.054115894 2358 0x30b1c890 DEBUG GST_PADS > gstpad.c:3938:gst_pad_query:<capsfilter1:sink> sent query 0x30c518a0 (caps), > result 1 > 0:00:04.054153528 2358 0x30b1c890 INFO GST_PADS > gstpad.c:2371:gst_pad_link_prepare: caps are incompatible > 0:00:04.054178351 2358 0x30b1c890 INFO GST_PADS > gstpad.c:2464:gst_pad_link_full: link between xm2mvscaler0:src and > capsfilter1:sink failed: no common format transform_caps for scaler are not exactly trivial if you take into the account the pixel aspect ratio. But you can prototype by simply removing the width/height field form the caps when transforming. You are likely not doing this, or not doing this properly. You should also look at "basetransform:5" logs for debugging, it will be much more useful then looking at generic traces from pads. > === > gst-inspect-1.0 output : > root@peta_xm2m_vscaler:~# gst-inspect-1.0 xm2mvscaler > Factory Details: > Rank none (0) > Long-name Xilinx M2M Video Scaler > Klass Xilinx M2M Video Scaler This is invalid. A Klass should be something like "Filter/Converter/Video/Scaler" > Description Xilinx M2M Video Scaler > Author Rohit Athavale <[hidden email]> > > Plugin Details: > Name xm2mvscaler In general it's not recommended to have the plugin and the feature with the same name. > Description Xilinx M2M Scaler plugin > Filename /usr/lib/gstreamer-1.0/libgstxm2mvscaler.so > Version 0.6 > License LGPL > Source module xm2mvscaler > Binary package GStreamer > Origin URL http://gstreamer.net/ > > GObject > +----GInitiallyUnowned > +----GstObject > +----GstElement > +----GstBaseTransform > +----GstVideoFilter > +----GstXm2mVScaler > > Pad Templates: > SINK template: 'sink' > Availability: Always > Capabilities: > video/x-raw > format: { RGB } > width: [ 1, 3840 ] > height: [ 1, 2160 ] > framerate: [ 0/1, 2147483647/1 ] > > SRC template: 'src' > Availability: Always > Capabilities: > video/x-raw > format: { RGB } > width: [ 1, 3840 ] > height: [ 1, 2160 ] > framerate: [ 0/1, 2147483647/1 ] > > > Element Flags: > no flags set > > Element Implementation: > Has change_state() function: gst_element_change_state_func > > Element has no clocking capabilities. > Element has no URI handling capabilities. > > Pads: > SINK: 'sink' > Pad Template: 'sink' > SRC: 'src' > Pad Template: 'src' > > Element Properties: > name : The name of the object > flags: readable, writable > String. Default: "xm2mvscaler0" > parent : The parent of the object > flags: readable, writable > Object of type "GstObject" > qos : Handle Quality-of-Service events > flags: readable, writable > Boolean. Default: true > buffer-mode : Buffer Mode > flags: readable, writable > Enum "GstXm2mVScalerBufferMode" Default: 0, "" Is your default an invalid value ? > (1): DMABUF - GST_XM2MVSC_BUF_DMABUF > (2): Driver allocated contiguous memory - > GST_XM2MVSC_BUF_KERNEL_DRV > batch-size : Frame Batch Size > flags: readable, writable > Enum "GstXm2mVScalerBatchSize" Default: 0, "" > (1): One - > GST_XM2MVSCALER_BATCH_SIZE_ONE > (2): Two - > GST_XM2MVSCALER_BATCH_SIZE_TWO > (8): Eight - > GST_XM2MVSCALER_BATCH_SIZE_EIGHT > device : Location of Device File being used > flags: readable, writable > String. Default: "/dev/xm2mvsc0" > > > > > -- > 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 |
Free forum by Nabble | Edit this page |