From: Víctor Manuel Jáquez Leal Date: Thu, 11 Mar 2021 17:53:09 +0000 (+0100) Subject: va: postproc: update passthrough and reconfigure pads X-Git-Tag: 1.19.3~507^2~722 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0b2848fc32192ff2df951fb9e8ea4d853c29a3d0;p=platform%2Fupstream%2Fgstreamer.git va: postproc: update passthrough and reconfigure pads Added helper function _update_passthrough() which will define and set the pass-through mode of the filter, and it'll either reconfigure both pads or it will just mark the src pad for renegotiation or nothing at all. There are cases where both pads have to be reconfigured (direction changed, for example), other when just src pad has to (filters updated) or none (changing to ready state). The requirement of renegotiation depends on the need to enable/disable its VA buffer pools. This patch sets pass-through mode by default, so the buffer pools aren't allocated if no filtering/direction operations are defined, which is the correct behavior. Part-of: --- diff --git a/sys/va/gstvavpp.c b/sys/va/gstvavpp.c index cd2b627..76cea8d 100644 --- a/sys/va/gstvavpp.c +++ b/sys/va/gstvavpp.c @@ -198,6 +198,26 @@ gst_va_vpp_dispose (GObject * object) } static void +_update_passthrough (GstVaVpp * self, gboolean reconf) +{ + GstBaseTransform *trans = GST_BASE_TRANSFORM (self); + gboolean old, new; + + old = gst_base_transform_is_passthrough (trans); + + GST_OBJECT_LOCK (self); + new = (self->op_flags == 0); + GST_OBJECT_UNLOCK (self); + + if (old != new) { + GST_INFO_OBJECT (self, "%s passthrough", new ? "enabling" : "disabling"); + if (reconf) + gst_base_transform_reconfigure_src (trans); + gst_base_transform_set_passthrough (trans, new); + } +} + +static void _update_properties_unlocked (GstVaVpp * self) { if (!self->filter) @@ -290,6 +310,10 @@ gst_va_vpp_set_property (GObject * object, guint prop_id, _update_properties_unlocked (self); GST_OBJECT_UNLOCK (object); + + /* no reconfig here because it's done in + * _update_properties_unlocked() */ + _update_passthrough (self, FALSE); } static void @@ -360,6 +384,7 @@ gst_va_vpp_change_state (GstElement * element, GstStateChange transition) if (!gst_va_filter_open (self->filter)) goto open_failed; _update_properties_unlocked (self); + _update_passthrough (self, FALSE); break; default: break; @@ -776,6 +801,9 @@ gst_va_vpp_set_caps (GstBaseTransform * trans, GstCaps * incaps, self->negotiated = gst_va_filter_set_formats (self->filter, &self->in_info, &self->out_info); + if (self->negotiated) + _update_passthrough (self, FALSE); + return self->negotiated; /* ERRORS */ @@ -947,7 +975,7 @@ gst_va_vpp_before_transform (GstBaseTransform * trans, GstBuffer * inbuf) self->op_flags &= ~VPP_CONVERT_FILTERS; GST_OBJECT_UNLOCK (self); - gst_base_transform_set_passthrough (trans, self->op_flags == 0); + _update_passthrough (self, TRUE); } static inline gsize @@ -2182,6 +2210,11 @@ gst_va_vpp_sink_event (GstBaseTransform * trans, GstEvent * event) _update_properties_unlocked (self); GST_OBJECT_UNLOCK (self); + + /* no reconfig here because it's done in + * _update_properties_unlocked */ + _update_passthrough (self, FALSE); + break; default: break;