glmemorydma: wait for completion with gst_gl_sync_meta_wait_cpu

Required on Columbia. Its blitter is different from Enterprise and
uses a different code path under the hood. NOP on Enterprise.

Change-Id: I2738a20cc07b996f7f3da55d8f553c1c904583a6
diff --git a/gst-libs/gst/gl/gstglmemorydma.c b/gst-libs/gst/gl/gstglmemorydma.c
index 566d77b..79b109b 100644
--- a/gst-libs/gst/gl/gstglmemorydma.c
+++ b/gst-libs/gst/gl/gstglmemorydma.c
@@ -253,15 +253,18 @@
   GstBuffer *buf;
   GstGLMemoryDMA *glmem;
   GstGLSyncMeta *sync_meta;
+  GstClockTime ts;
 
   sync_meta = gst_buffer_get_gl_sync_meta (glbuf);
-  if (!sync_meta) {
-    GstClockTime ts = gst_util_get_timestamp ();
+  ts = gst_util_get_timestamp ();
+  if (sync_meta) {
+    gst_gl_sync_meta_wait_cpu (sync_meta, ctx);
+  } else {
     gst_gl_context_thread_add (ctx, (GstGLContextThreadFunc) _finish_texture, NULL);
-    ts = gst_util_get_timestamp () - ts;
-    GST_CAT_DEBUG (GST_CAT_GL_DMA_MEMORY,
-        "glFinish %.2g ms", (double) ts / GST_MSECOND);
   }
+  ts = gst_util_get_timestamp () - ts;
+  GST_CAT_DEBUG (GST_CAT_GL_DMA_MEMORY, "%s %.2g ms",
+      sync_meta ? "wait_cpu" : "glFinish", (double) ts / GST_MSECOND);
 
   glmem = gst_buffer_peek_memory (glbuf, 0);