From 36a3da1477d9dd5c23b0c47fd45e61a8c0316600 Mon Sep 17 00:00:00 2001
From: Hugues Fruchet <hugues.fruchet@st.com>
Date: Thu, 6 Dec 2018 18:09:20 +0100
Subject: [PATCH 06/14] waylandsink: always select dmabuf buffer pool

Force usage of dmabuf buffer pool by default, ie
even if video/x-raw(memory:DMABuf) is not set in caps.
This allows 0-copy path with software downstream elements
(use of dmabuf buffers mmapped memory directly instead
of copying).

Change-Id: Icb6e8ff272c562e829bb3ff91150e7d77b25dfd1
Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
---
 ext/wayland/gstwaylandsink.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c
index 8b807da..40edff7 100644
--- a/ext/wayland/gstwaylandsink.c
+++ b/ext/wayland/gstwaylandsink.c
@@ -610,9 +610,17 @@ gst_wayland_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
   format = GST_VIDEO_INFO_FORMAT (&sink->video_info);
   sink->video_info_changed = TRUE;
 
-  use_dmabuf = gst_caps_features_contains (gst_caps_get_features (caps, 0),
-      GST_CAPS_FEATURE_MEMORY_DMABUF);
+  /* Force usage of dmabuf buffer pool by default, ie
+   * even if video/x-raw(memory:DMABuf) is not set in caps.
+   * This allows 0-copy path with software downstream elements
+   * (use of dmabuf buffers mmapped memory directly instead
+   * of copying)
+   */
+  /* use_dmabuf = gst_caps_features_contains (gst_caps_get_features (caps, 0),
+      GST_CAPS_FEATURE_MEMORY_DMABUF); */
+  use_dmabuf = TRUE;
 
+  /* validate the format base on the memory type */
   if (use_dmabuf) {
     if (!gst_wl_display_check_format_for_dmabuf (sink->display, format))
       goto unsupported_format;
-- 
2.25.1

