mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-15 22:01:27 +00:00
vapostproc: optimization for va memory to system memory only
When the conversion is only caps feature from memory:VAMemory to system memory, it's possible to optimize by doing a pseudo pass-through since the va-backed buffers are the same for system memory buffers. This change will also mitigates #2940 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6174>
This commit is contained in:
parent
06dc931b52
commit
9567f8f444
1 changed files with 28 additions and 0 deletions
|
@ -125,6 +125,8 @@ struct _GstVaVpp
|
||||||
gboolean has_hdr_meta;
|
gboolean has_hdr_meta;
|
||||||
VAHdrMetaDataHDR10 hdr_meta;
|
VAHdrMetaDataHDR10 hdr_meta;
|
||||||
|
|
||||||
|
gboolean pseudo_passthrough;
|
||||||
|
|
||||||
GList *channels;
|
GList *channels;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -818,6 +820,26 @@ gst_va_vpp_before_transform (GstBaseTransform * trans, GstBuffer * inbuf)
|
||||||
GST_OBJECT_UNLOCK (self);
|
GST_OBJECT_UNLOCK (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GstFlowReturn
|
||||||
|
gst_va_vpp_prepare_output_buffer (GstBaseTransform * trans, GstBuffer * inbuf,
|
||||||
|
GstBuffer ** outbuf)
|
||||||
|
{
|
||||||
|
GstVaVpp *self = GST_VA_VPP (trans);
|
||||||
|
GstVaBaseTransform *btrans = GST_VA_BASE_TRANSFORM (self);
|
||||||
|
|
||||||
|
if (((self->op_flags & VPP_CONVERT_FEATURE) == self->op_flags)
|
||||||
|
&& gst_caps_is_vamemory (btrans->in_caps)
|
||||||
|
&& gst_caps_is_raw (btrans->out_caps)) {
|
||||||
|
self->pseudo_passthrough = TRUE;
|
||||||
|
*outbuf = inbuf;
|
||||||
|
return GST_FLOW_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
self->pseudo_passthrough = FALSE;
|
||||||
|
return GST_BASE_TRANSFORM_CLASS (parent_class)->prepare_output_buffer (trans,
|
||||||
|
inbuf, outbuf);
|
||||||
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_va_vpp_transform (GstBaseTransform * trans, GstBuffer * inbuf,
|
gst_va_vpp_transform (GstBaseTransform * trans, GstBuffer * inbuf,
|
||||||
GstBuffer * outbuf)
|
GstBuffer * outbuf)
|
||||||
|
@ -835,6 +857,9 @@ gst_va_vpp_transform (GstBaseTransform * trans, GstBuffer * inbuf,
|
||||||
if (res != GST_FLOW_OK)
|
if (res != GST_FLOW_OK)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
if (self->pseudo_passthrough && (inbuf == buf))
|
||||||
|
goto bail;
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
src = (GstVaSample) {
|
src = (GstVaSample) {
|
||||||
.buffer = buf,
|
.buffer = buf,
|
||||||
|
@ -854,6 +879,7 @@ gst_va_vpp_transform (GstBaseTransform * trans, GstBuffer * inbuf,
|
||||||
res = GST_BASE_TRANSFORM_FLOW_DROPPED;
|
res = GST_BASE_TRANSFORM_FLOW_DROPPED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bail:
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
@ -2257,6 +2283,8 @@ gst_va_vpp_class_init (gpointer g_class, gpointer class_data)
|
||||||
trans_class->transform_meta = GST_DEBUG_FUNCPTR (gst_va_vpp_transform_meta);
|
trans_class->transform_meta = GST_DEBUG_FUNCPTR (gst_va_vpp_transform_meta);
|
||||||
trans_class->src_event = GST_DEBUG_FUNCPTR (gst_va_vpp_src_event);
|
trans_class->src_event = GST_DEBUG_FUNCPTR (gst_va_vpp_src_event);
|
||||||
trans_class->sink_event = GST_DEBUG_FUNCPTR (gst_va_vpp_sink_event);
|
trans_class->sink_event = GST_DEBUG_FUNCPTR (gst_va_vpp_sink_event);
|
||||||
|
trans_class->prepare_output_buffer =
|
||||||
|
GST_DEBUG_FUNCPTR (gst_va_vpp_prepare_output_buffer);
|
||||||
|
|
||||||
trans_class->transform_ip_on_passthrough = FALSE;
|
trans_class->transform_ip_on_passthrough = FALSE;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue