mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
glcontext: add a method to add a context to another share group
Intended for use with wrapped contexts that are created shared with gst's
gl contexts in order to manage the internal sharegroup state correctly.
e.g. with caopengllayer (which is used in glimagesink and caopengllayersink
on OS X), we create a CGL context from the gst context and the sharing state
was not being correctly set on either GL context and gst_gl_context_is_shared()
was always returning FALSE.
With 11fb4fff80
only flushing with multiple
shared contexts, the required flush was not occuring causing screen
corruption or stuttering.
Note: this didn't affect GST_GL_API=opengl pipelines
https://bugzilla.gnome.org/show_bug.cgi?id=762620
This commit is contained in:
parent
a50e4bcadf
commit
abec124f69
3 changed files with 30 additions and 1 deletions
|
@ -126,6 +126,7 @@ _context_ready (gpointer data)
|
|||
}
|
||||
|
||||
gst_gl_context_activate (self->draw_context, TRUE);
|
||||
gst_gl_context_set_shared_with (self->draw_context, self->gst_gl_context);
|
||||
if (!gst_gl_context_fill_info (self->draw_context, &error)) {
|
||||
GST_ERROR ("failed to fill wrapped context information: %s", error->message);
|
||||
return NULL;
|
||||
|
|
|
@ -1617,11 +1617,38 @@ gboolean
|
|||
gst_gl_context_is_shared (GstGLContext * context)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_GL_CONTEXT (context), FALSE);
|
||||
g_return_val_if_fail (context->priv->alive, FALSE);
|
||||
if (GST_IS_GL_WRAPPED_CONTEXT (context))
|
||||
g_return_val_if_fail (context->priv->active_thread, FALSE);
|
||||
else
|
||||
g_return_val_if_fail (context->priv->alive, FALSE);
|
||||
|
||||
return _context_share_group_is_shared (context->priv->sharegroup);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_gl_context_set_shared_with:
|
||||
* @context: a wrapped #GstGLContext
|
||||
* @share: another #GstGLContext
|
||||
*
|
||||
* Will internally set @context as shared with @share
|
||||
*
|
||||
* Since: 1.8
|
||||
*/
|
||||
void
|
||||
gst_gl_context_set_shared_with (GstGLContext * context, GstGLContext * share)
|
||||
{
|
||||
g_return_if_fail (GST_IS_GL_CONTEXT (context));
|
||||
g_return_if_fail (GST_IS_GL_CONTEXT (share));
|
||||
g_return_if_fail (!gst_gl_context_is_shared (context));
|
||||
/* XXX: may be a little too strict */
|
||||
g_return_if_fail (GST_IS_GL_WRAPPED_CONTEXT (context));
|
||||
|
||||
if (context->priv->sharegroup)
|
||||
_context_share_group_unref (context->priv->sharegroup);
|
||||
context->priv->sharegroup =
|
||||
_context_share_group_ref (share->priv->sharegroup);
|
||||
}
|
||||
|
||||
static GstGLAPI
|
||||
gst_gl_wrapped_context_get_gl_api (GstGLContext * context)
|
||||
{
|
||||
|
|
|
@ -149,6 +149,7 @@ guintptr gst_gl_context_get_current_gl_context (GstGLPlatform platform)
|
|||
GstGLAPI gst_gl_context_get_current_gl_api (GstGLPlatform platform, guint *major, guint *minor);
|
||||
|
||||
gboolean gst_gl_context_is_shared (GstGLContext * context);
|
||||
void gst_gl_context_set_shared_with (GstGLContext * context, GstGLContext * share);
|
||||
|
||||
gboolean gst_gl_context_fill_info (GstGLContext * context, GError ** error);
|
||||
|
||||
|
|
Loading…
Reference in a new issue