diff options
author | Matthew Waters <matthew@centricular.com> | 2016-10-21 13:10:47 +1100 |
---|---|---|
committer | Matthew Waters <matthew@centricular.com> | 2016-10-21 15:54:37 +1100 |
commit | cbaee81f9c7c6af8dcddfba0e87c524a4baf2ac2 (patch) | |
tree | e1639df210618857bccee6158a75b6a6e3eb1af6 | |
parent | a94eef935733497baf11b55c604dd24ef7c7d299 (diff) | |
download | gstreamer-plugins-bad-cbaee81f9c7c6af8dcddfba0e87c524a4baf2ac2.tar.gz |
glsyncmeta: don't glFinish() everytime a sync point is set
At minimum, we only need to glFlush() if we are in a shared GL context
environment. Move the glFinish() to when the actual wait is requested
which may be never. Improves the throughput on older GL systems without
GL3/GLES3 and/or fence sync objects.
-rw-r--r-- | gst-libs/gst/gl/gstglsyncmeta.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/gst-libs/gst/gl/gstglsyncmeta.c b/gst-libs/gst/gl/gstglsyncmeta.c index b4061d344..582784c94 100644 --- a/gst-libs/gst/gl/gstglsyncmeta.c +++ b/gst-libs/gst/gl/gstglsyncmeta.c @@ -53,16 +53,11 @@ _default_set_sync_gl (GstGLSyncMeta * sync_meta, GstGLContext * context) } sync_meta->data = (gpointer) gl->FenceSync (GL_SYNC_GPU_COMMANDS_COMPLETE, 0); - - if (gst_gl_context_is_shared (context)) - /* if we only have a single context, the wait will flush for us */ - gl->Flush (); GST_LOG ("setting sync object %p", sync_meta->data); - } else { - /* XXX: this a little over the top if the CPU is never going to - * access the data, however this is the legacy path, so... */ - gl->Finish (); } + + if (gst_gl_context_is_shared (context)) + gl->Flush (); } static void @@ -89,6 +84,8 @@ _default_wait_cpu_gl (GstGLSyncMeta * sync_meta, GstGLContext * context) gl->ClientWaitSync ((GLsync) sync_meta->data, GL_SYNC_FLUSH_COMMANDS_BIT, 1000000000 /* 1s */ ); } while (res == GL_TIMEOUT_EXPIRED); + } else { + gl->Finish (); } } |