The vvas_xfilter is an infrastructure plug-in that extends the functionality of GstBaseTransform. This plug-in includes one input pad and one output pad, and it can efficiently operate with various types of acceleration software libraries, including the hard-kernel and software (user-space) acceleration libraries. The following figure illustrates this capability.
This plug-in can operate in the following three modes:
Passthrough: Useful when the acceleration software library does not need to alter the input buffer.
In-place: Useful when the acceleration software library needs to alter the input buffer.
Transform: In this mode, for each input buffer, a new output buffer is produced.
You must set the mode using the JSON file. For information related to the kernels-config property, refer to JSON File Schema.
The vvas_xfilter plug-in can receive a configuration file as an input through the plug-in property named kernel-config. This configuration file, written in a JSON format, includes kernel-specific information required for the plug-in to function. Upon initialization, the vvas_xfilter plug-in parses the JSON file and completes the following actions:
Locates the VVAS acceleration software library within the designated path and loads the shared library.
Determines the acceleration software library type and prepares the acceleration software library handle (VVASKernel) to be used by the core APIs.
Input and Output
The vvas_xfilter accepts the buffers with the following color formats on input GstPad and output GstPad.
GRAY8
NV12
BGR
RGB
YUY2
r210
v308
GRAY10_LE32
ABGR
ARGB
The formats listed are the AMD IP supported color formats. To add other color formats, update the vvas_xfilter: <vvas>/vvas-gst-plugins/sys/filter/gstvvas_xfilter.c plugin as per the supported video formats of vvas_kernel.h : <vvas>/vvas-utils/utils/vvas/vvas_kernel.h#L76.
Control Parameters and Plug-in Properties
The following table lists the GObject properties exposed by the vvas_xfilter.
Property Name |
Type |
Range |
Default |
Description |
|---|---|---|---|---|
dynamic-config |
String |
N/A |
NULL |
JSON formatted string contains kernel specific configuration for runtime changes. |
kernels-config |
String |
N/A |
NULL |
JSON configuration file path based on the VVAS acceleration software library requirements. Refer to JSON File Schema. |
Signals
Signal Name |
Description |
|---|---|
vvas-kernel-done |
Notifies when the kernel execution is completed. |
JSON Format for vvas_xfilter Plug-in
The following table provides the JSON keys accepted by the GStreamer vvas_xfilter plug-in.
JSON Key |
Item |
Item Description |
|---|---|---|
xclbin-location |
Description |
The location of the xclbin that is used to program the FPGA device. |
Value type |
String |
|
Mandatory or optional |
Conditionally mandatory:
|
|
Default value |
NULL |
|
vvas-library-repo |
Description |
This is the VVAS libraries repository path to look for acceleration software libraries by the VVAS GStreamer plug-in. |
Value type |
String |
|
Mandatory or optional |
Optional |
|
Default value |
/usr/lib |
|
element-mode |
Description |
GStreamer element mode to operate.
Based on your requirement, choose one of the following modes:
|
Value type |
String |
|
Mandatory or optional |
Mandatory |
kernel |
Description |
A Kernel JSON object provides information about a VVAS acceleration software library configuration. |
Value type |
Kernel JSON Object |
|
Mandatory or optional |
Mandatory |
|
Default value |
None |
|
Object members |
Refer to Kernel JSON Object. |
The information in the following table is specific to the kernel chosen.
JSON Key |
Item |
Item Description |
|---|---|---|
library-name |
Description |
The name of the VVAS acceleration software library to VVAS GStreamer plug-ins. The absolute path of the kernel library is formed by the pre-pending the vvas-library-repo path. |
Value type |
String |
|
Mandatory or optional |
Mandatory |
|
Default value |
None |
|
kernel-name |
Description |
The name of the IP/kernel in the form of <kernel name>:<instance name>. |
Value type |
String |
|
Mandatory or optional |
Optional |
|
Default value |
None |
|
kernel-access-mode |
Description |
Mode in which the IP/kernel is to be accessed.
“shared” or “exclusive”.
|
Value type |
String |
|
Mandatory or optional |
Optional |
|
Default value |
“shared” |
|
config |
Description |
Holds the configuration specific to the VVAS acceleration software library. VVAS GStreamer plug-ins do not parse this JSON object, instead it is sent to the acceleration software library. |
Value type |
Object |
|
Mandatory or optional |
Optional |
|
Default value |
None |
For insight into the implementation details, refer to the vvas_xfilter source code located at <vvas>/vvas-gst-plugins/sys/filter/.
Example JSON Configuration Files
JSON File for a Soft Library
The following JSON file is an example JSON file that can used with vvas_xfilter to control the xstub Soft kernel (software-kernel). The acceleration software library, libvvas_xstub.so, has three operation modes inplace, passthrough and transform and can be configured accordingly using json.
{
"xclbin-location":"/run/media/mmcblk0p1/x_plus_ml.xclbin",
"vvas-library-repo": "/usr/lib",
"element-mode":"inplace",
"kernel" :
{
"library-name":"libvvas_xstub.so",
"config": {
"kernel-lib-type" : "soft-lib",
"element-mode" : "inplace",
"src-stride-align" : 1,
"src-height-align" : 1,
"sink-stride-align" : 1,
"sink-height-align" : 1,
"debug-level" : 4
}
}
}
For how to develop acceleration software libraries that can be invoked through the vvas_xfilter plugin, refer to Acceleration-Software-Library-Development.
Dynamic Configuration of the Kernel
If you want to update the kernel configuration in runtime, make use of the dynamic-config property of vvas_xfilter. Set the configuration as a JSON format string to the dynamic-config property from a Gstreamer application in runtime as follows. Modify this JSON string as per your kernels and acceleration software library.
CONFIG_JSON_STRING = "{\"crop-x\": 20, \"crop-y\": 20, \"height\": 200, \"width\": 200 }"
g_object_set (vvas_xfilter, "dynamic-config", <CONFIG_JSON_STRING> ,NULL);
The current user configuration string is passed to the acceleration library in the JSON format without any modification, where you can access it and update the kernel configuration in runtime.