gtk2/gsk/gskdebug.c
Benjamin Otte 68b39a4727 gsk: Add GSK_RENDERING_MODE=full-redraw
Forces a full redraw every frame.
This is done generically, so it's supported on every renderer.

For widget-factory first page (with the spinner spinning and progressbar
pulsing), I get these numbers per frame:

action                  clipped         full redraw
snapshot                   0ms           7-10ms
cairo rendering            0ms          10-15ms
Vulkan rendering         3-5ms          18-20ms
Vulkan expected *          0ms            1-2ms
GL rendering            unsupported     55-62ms

* expected means disabling rendering of unsupported render nodes,
instead of doing fallback drawing. So it overestimates the performance,
because borders and box-shadows are disabled.
2016-12-27 00:48:00 +01:00

69 lines
1.9 KiB
C

#include "gskdebugprivate.h"
#ifdef G_ENABLE_DEBUG
static const GDebugKey gsk_debug_keys[] = {
{ "rendernode", GSK_DEBUG_RENDER_NODE },
{ "renderer", GSK_DEBUG_RENDERER },
{ "cairo", GSK_DEBUG_CAIRO },
{ "opengl", GSK_DEBUG_OPENGL },
{ "shaders", GSK_DEBUG_SHADERS },
{ "transforms", GSK_DEBUG_TRANSFORMS },
{ "surface", GSK_DEBUG_SURFACE },
{ "vulkan", GSK_DEBUG_VULKAN },
{ "fallback", GSK_DEBUG_FALLBACK }
};
#endif
static const GDebugKey gsk_rendering_keys[] = {
{ "geometry", GSK_RENDERING_MODE_GEOMETRY },
{ "shaders", GSK_RENDERING_MODE_SHADERS },
{ "sync", GSK_RENDERING_MODE_SYNC },
{ "full-redraw", GSK_RENDERING_MODE_FULL_REDRAW},
{ "staging-image", GSK_RENDERING_MODE_STAGING_IMAGE },
{ "staging-buffer", GSK_RENDERING_MODE_STAGING_BUFFER }
};
gboolean
gsk_check_debug_flags (GskDebugFlags flags)
{
#ifdef G_ENABLE_DEBUG
static volatile gsize gsk_debug_flags__set;
static guint gsk_debug_flags;
if (g_once_init_enter (&gsk_debug_flags__set))
{
const char *env = g_getenv ("GSK_DEBUG");
gsk_debug_flags = g_parse_debug_string (env,
(GDebugKey *) gsk_debug_keys,
G_N_ELEMENTS (gsk_debug_keys));
g_once_init_leave (&gsk_debug_flags__set, TRUE);
}
return (gsk_debug_flags & flags) != 0;
#else
return FALSE;
#endif
}
gboolean
gsk_check_rendering_flags (GskRenderingMode flags)
{
static volatile gsize gsk_rendering_flags__set;
static guint gsk_rendering_flags;
if (g_once_init_enter (&gsk_rendering_flags__set))
{
const char *env = g_getenv ("GSK_RENDERING_MODE");
gsk_rendering_flags = g_parse_debug_string (env,
(GDebugKey *) gsk_rendering_keys,
G_N_ELEMENTS (gsk_rendering_keys));
g_once_init_leave (&gsk_rendering_flags__set, TRUE);
}
return (gsk_rendering_flags & flags) != 0;
}