MGS-4155 glupload: fix directviv internal buffer pool is not used
GST_GL_HAVE_IONDMA can not indicate ion is unavailable,
we need try to obtain ion allocator to know whether ion
is enabled in kernel.
upstream status: imx specific
diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c
index 296f660..6cf6dcd 100644
--- a/gst-libs/gst/gl/gstglupload.c
+++ b/gst-libs/gst/gl/gstglupload.c
@@ -1703,7 +1703,7 @@
_directviv_upload_propose_allocation (gpointer impl, GstQuery * decide_query,
GstQuery * query)
{
-#if GST_GL_HAVE_PHYMEM == 1 && GST_GL_HAVE_IONDMA == 0
+#if GST_GL_HAVE_PHYMEM
struct DirectVIVUpload *directviv = impl;
GstBufferPool *pool = NULL;
GstAllocator *allocator = NULL;
@@ -1716,6 +1716,16 @@
if (fmt != GST_VIDEO_FORMAT_RGBA)
return;
+#if GST_GL_HAVE_IONDMA
+ /* physical memory buffer pool was only proposed
+ * when ion is not available to avoid allocator
+ * overwrite in allocation query, we need keep use
+ * ion when it is available */
+ allocator = gst_ion_allocator_obtain ();
+ if (allocator)
+ return;
+#endif
+
gst_query_parse_allocation (query, &caps, NULL);
if (!gst_video_info_from_caps (&info, caps))