Draw overlays to dma-bufs imported as EGLImage textures if supported

This significantly reduces texture upload times (typically < 1 ms).

Change-Id: I4ea6c8a5d2d5baae8d85dbd0905dc2ee57b57e48
diff --git a/plugins/gstglsvgoverlay.h b/plugins/gstglsvgoverlay.h
index 796107b..5e71d49 100644
--- a/plugins/gstglsvgoverlay.h
+++ b/plugins/gstglsvgoverlay.h
@@ -19,6 +19,8 @@
 
 #include <gst/gst.h>
 
+#include <gst/gl/egl/gstegl.h>
+#include "gst/gl/egl/gstgldisplay_egl.h"
 #include <gst/gl/gstglfilter.h>
 
 G_BEGIN_DECLS
@@ -33,6 +35,7 @@
 typedef struct _GstGLSvgOverlay GstGLSvgOverlay;
 typedef struct _GstGLSvgOverlayClass GstGLSvgOverlayClass;
 typedef struct _TaskData TaskData;
+typedef struct _EglImageTexture EglImageTexture;
 
 struct _GstGLSvgOverlay
 {
@@ -43,6 +46,9 @@
   GCond cond;
   GstGLShader *shader;
   GThreadPool *thread_pool;
+  GstBufferPool *buffer_pool;
+  GstAllocator *ion_allocator;
+  gboolean use_ion;
   GQueue *svg_queue;
   GQueue *gl_queue;
   GstClockTime next_pts;
@@ -50,9 +56,8 @@
   TaskData *current;
   gboolean sync;
   gboolean started;
-  guint width;
-  guint height;
-  guint stride;
+  gint internal_format;
+  GstVideoInfo info;
 };
 
 struct _GstGLSvgOverlayClass
@@ -69,6 +74,12 @@
   OP_READY,
 };
 
+struct _EglImageTexture {
+  GstGLSvgOverlay *overlay;
+  EGLImageKHR *image;
+  guint tex;
+};
+
 struct _TaskData {
   GstGLSvgOverlay *overlay;
   enum TaskOp op;
@@ -76,6 +87,7 @@
   GstClockTime pts;
   GstBuffer *buf;
   GstMapInfo map;
+  EglImageTexture *egl_tex;
   guint tex;
 };