glframebuffer: Don't do expensive checks with low gst debug levels
Framebuffer checks can be very expensive, taking up to 3-5% of the total CPU consumed by the application.
This commit is contained in:
parent
c71dd72b21
commit
21bc1040d4
@ -1851,3 +1851,22 @@ static void
|
|||||||
gst_gl_wrapped_context_init (GstGLWrappedContext * context)
|
gst_gl_wrapped_context_init (GstGLWrappedContext * context)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
G_GNUC_INTERNAL gboolean
|
||||||
|
_gst_gl_context_debug_is_enabled (GstGLContext * context)
|
||||||
|
{
|
||||||
|
#if !defined(GST_DISABLE_GST_DEBUG)
|
||||||
|
GstDebugLevel level;
|
||||||
|
|
||||||
|
level = gst_debug_category_get_threshold (gst_gl_debug);
|
||||||
|
|
||||||
|
if (level < GST_LEVEL_WARNING) {
|
||||||
|
GST_CAT_INFO_OBJECT (gst_gl_context_debug, context, "Disabling GL context "
|
||||||
|
"debugging (gldebug category debug level < warning)");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
#else
|
||||||
|
return FALSE;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
@ -26,6 +26,9 @@ G_BEGIN_DECLS
|
|||||||
|
|
||||||
G_GNUC_INTERNAL extern GstDebugCategory *gst_gl_context_debug;
|
G_GNUC_INTERNAL extern GstDebugCategory *gst_gl_context_debug;
|
||||||
|
|
||||||
|
G_GNUC_INTERNAL
|
||||||
|
gboolean _gst_gl_context_debug_is_enabled (GstGLContext * context);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GST_GL_CONTEXT_PRIVATE_H__ */
|
#endif /* __GST_GL_CONTEXT_PRIVATE_H__ */
|
||||||
|
@ -340,17 +340,14 @@ _gst_gl_debug_enable (GstGLContext * context)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
level = gst_debug_category_get_threshold (gst_gl_debug);
|
if (!_gst_gl_context_debug_is_enabled (context))
|
||||||
|
|
||||||
if (level < GST_LEVEL_ERROR) {
|
|
||||||
GST_CAT_INFO_OBJECT (gst_gl_context_debug, context,
|
|
||||||
"Disabling GL context debugging (gldebug category debug level < error)");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
GST_CAT_INFO_OBJECT (gst_gl_context_debug, context,
|
GST_CAT_INFO_OBJECT (gst_gl_context_debug, context,
|
||||||
"Enabling GL context debugging");
|
"Enabling GL context debugging");
|
||||||
|
|
||||||
|
level = gst_debug_category_get_threshold (gst_gl_debug);
|
||||||
|
|
||||||
gl->DebugMessageCallback (_gst_gl_debug_callback, context);
|
gl->DebugMessageCallback (_gst_gl_debug_callback, context);
|
||||||
if (level >= GST_LEVEL_DEBUG) {
|
if (level >= GST_LEVEL_DEBUG) {
|
||||||
/* enable them all */
|
/* enable them all */
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#include "gstglframebuffer.h"
|
#include "gstglframebuffer.h"
|
||||||
|
|
||||||
#include "gstglcontext.h"
|
#include "gstglcontext.h"
|
||||||
|
#include "gstglcontext_private.h"
|
||||||
#include "gstglfuncs.h"
|
#include "gstglfuncs.h"
|
||||||
#include "gstglmemory.h"
|
#include "gstglmemory.h"
|
||||||
#include "gstglrenderbuffer.h"
|
#include "gstglrenderbuffer.h"
|
||||||
@ -523,6 +524,10 @@ gst_gl_context_check_framebuffer_status (GstGLContext * context,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Don't do expensive framebuffer checks when debugging is disabled */
|
||||||
|
if (!_gst_gl_context_debug_is_enabled (context))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
switch (context->gl_vtable->CheckFramebufferStatus (fbo_target)) {
|
switch (context->gl_vtable->CheckFramebufferStatus (fbo_target)) {
|
||||||
case GL_FRAMEBUFFER_COMPLETE:
|
case GL_FRAMEBUFFER_COMPLETE:
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user