gldisplay: add some debugging about retrieving GL contexts

This commit is contained in:
Matthew Waters 2016-05-24 23:38:22 +10:00 committed by Tim-Philipp Müller
parent 0ea3706901
commit 537d1996e9

View file

@ -437,8 +437,11 @@ _get_gl_context_for_thread_unlocked (GstGLDisplay * display, GThread * thread)
continue; continue;
} }
if (thread == NULL) if (thread == NULL) {
GST_DEBUG_OBJECT (display, "Returning GL context %" GST_PTR_FORMAT " for "
"NULL thread", context);
return context; return context;
}
context_thread = gst_gl_context_get_thread (context); context_thread = gst_gl_context_get_thread (context);
if (thread != context_thread) { if (thread != context_thread) {
@ -451,9 +454,13 @@ _get_gl_context_for_thread_unlocked (GstGLDisplay * display, GThread * thread)
if (context_thread) if (context_thread)
g_thread_unref (context_thread); g_thread_unref (context_thread);
GST_DEBUG_OBJECT (display, "Returning GL context %" GST_PTR_FORMAT " for "
"thread %p", context, thread);
return context; return context;
} }
GST_DEBUG_OBJECT (display, "No GL context for thread %p", thread);
return NULL; return NULL;
} }
@ -549,11 +556,16 @@ gst_gl_display_add_context (GstGLDisplay * display, GstGLContext * context)
/* adding the same context is a no-op */ /* adding the same context is a no-op */
if (context == collision) { if (context == collision) {
GST_LOG_OBJECT (display, "Attempting to add the same GL context %"
GST_PTR_FORMAT ". Ignoring", context);
collision = NULL;
ret = TRUE; ret = TRUE;
goto out; goto out;
} }
if (_check_collision (context, collision)) { if (_check_collision (context, collision)) {
GST_DEBUG_OBJECT (display, "Collision detected adding GL context "
"%" GST_PTR_FORMAT, context);
ret = FALSE; ret = FALSE;
goto out; goto out;
} }
@ -562,6 +574,7 @@ gst_gl_display_add_context (GstGLDisplay * display, GstGLContext * context)
ref = g_new0 (GWeakRef, 1); ref = g_new0 (GWeakRef, 1);
g_weak_ref_init (ref, context); g_weak_ref_init (ref, context);
GST_DEBUG_OBJECT (display, "Adding GL context %" GST_PTR_FORMAT, context);
display->priv->contexts = g_list_prepend (display->priv->contexts, ref); display->priv->contexts = g_list_prepend (display->priv->contexts, ref);
out: out: