From 80b599c81b2e85928ece76d300c2a3075e0f842c Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Fri, 8 Nov 2019 18:00:46 -0500 Subject: kmssink: Do not drain if imported buffer are from KMS This adds a check to avoid draining when the imported buffers are in fact own by kmssink. This happens since we export our kms buffer as DMABuf. They are not really imported back as we pre-fill the cache, but uses the same format as if they were external. This fixes performance issues seen with videocrop2-test (found in -good). --- sys/kms/gstkmssink.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'sys/kms/gstkmssink.c') diff --git a/sys/kms/gstkmssink.c b/sys/kms/gstkmssink.c index 4f6ed26eb..cf1e3daf3 100644 --- a/sys/kms/gstkmssink.c +++ b/sys/kms/gstkmssink.c @@ -1717,8 +1717,6 @@ gst_kms_sink_drain (GstKMSSink * self) { GstParentBufferMeta *parent_meta; - GST_DEBUG_OBJECT (self, "draining"); - if (!self->last_buffer) return; @@ -1728,6 +1726,14 @@ gst_kms_sink_drain (GstKMSSink * self) if (parent_meta) { GstBuffer *dumb_buf, *last_buf; + /* If this was imported from our dumb buffer pool we can safely skip the + * drain */ + if (parent_meta->buffer->pool && + GST_IS_KMS_BUFFER_POOL (parent_meta->buffer->pool)) + return; + + GST_DEBUG_OBJECT (self, "draining"); + dumb_buf = gst_kms_sink_copy_to_dumb_buffer (self, &self->last_vinfo, parent_meta->buffer); last_buf = self->last_buffer; -- cgit v1.2.1