va: postproc, filter: add disable-passthrough property
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Fri, 26 Mar 2021 16:48:09 +0000 (17:48 +0100)
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Sat, 3 Apr 2021 13:47:18 +0000 (15:47 +0200)
vapostproc tries to be in passthrough mode as much as possible. But
they might be situations where the user might force to process the
frames. For example, when upstream sets the crop meta and the user
wants VA do that cropping, rather than downstream.

For those situations this property will disable the passthrough mode,
if it's enabled.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2058>

sys/va/gstvafilter.c
sys/va/gstvafilter.h
sys/va/gstvavpp.c

index d5cc080..4a14fdf 100644 (file)
@@ -664,6 +664,13 @@ gst_va_filter_install_properties (GstVaFilter * self, GObjectClass * klass)
             common_flags));
   }
 
+  g_object_class_install_property (klass,
+      GST_VA_FILTER_PROP_DISABLE_PASSTHROUGH,
+      g_param_spec_boolean ("disable-passthrough", "Disable Passthrough",
+          "Forces passing buffers through the postprocessor", FALSE,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS
+          | GST_PARAM_MUTABLE_READY));
+
   return TRUE;
 }
 
index da5130f..896694b 100644 (file)
@@ -43,6 +43,7 @@ enum {
   GST_VA_FILTER_PROP_AUTO_SATURATION,
   GST_VA_FILTER_PROP_AUTO_BRIGHTNESS,
   GST_VA_FILTER_PROP_AUTO_CONTRAST,
+  GST_VA_FILTER_PROP_DISABLE_PASSTHROUGH,
   GST_VA_FILTER_PROP_LAST
 };
 
index 2774c19..c1c9bca 100644 (file)
@@ -161,6 +161,7 @@ enum
   VPP_CONVERT_DIRECTION = 1 << 3,
   VPP_CONVERT_FEATURE = 1 << 4,
   VPP_CONVERT_CROP = 1 << 5,
+  VPP_CONVERT_DUMMY = 1 << 6,
 };
 
 extern GRecMutex GST_VA_SHARED_LOCK;
@@ -328,6 +329,14 @@ gst_va_vpp_set_property (GObject * object, guint prop_id,
       self->auto_contrast = g_value_get_boolean (value);
       g_atomic_int_set (&self->rebuild_filters, TRUE);
       break;
+    case GST_VA_FILTER_PROP_DISABLE_PASSTHROUGH:{
+      gboolean disable_passthrough = g_value_get_boolean (value);
+      if (disable_passthrough)
+        self->op_flags |= VPP_CONVERT_DUMMY;
+      else
+        self->op_flags &= ~VPP_CONVERT_DUMMY;
+      break;
+    }
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -385,6 +394,9 @@ gst_va_vpp_get_property (GObject * object, guint prop_id, GValue * value,
     case GST_VA_FILTER_PROP_AUTO_CONTRAST:
       g_value_set_boolean (value, self->auto_contrast);
       break;
+    case GST_VA_FILTER_PROP_DISABLE_PASSTHROUGH:
+      g_value_set_boolean (value, (self->op_flags & VPP_CONVERT_DUMMY));
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;