gdk: Add GDK_DEBUG=dmabuf-disable
I chose the name for consistency with gl-disable and vulkan-disable.
This commit is contained in:
@@ -133,6 +133,7 @@ static const GdkDebugKey gdk_debug_keys[] = {
|
||||
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings", TRUE },
|
||||
{ "high-depth", GDK_DEBUG_HIGH_DEPTH, "Use high bit depth rendering if possible", TRUE },
|
||||
{ "no-vsync", GDK_DEBUG_NO_VSYNC, "Repaint instantly (uses 100% CPU with animations)", TRUE },
|
||||
{ "dmabuf-disable", GDK_DEBUG_DMABUF_DISABLE, "Disable dmabuf support", TRUE },
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ typedef enum {
|
||||
GDK_DEBUG_DEFAULT_SETTINGS= 1 << 24,
|
||||
GDK_DEBUG_HIGH_DEPTH = 1 << 25,
|
||||
GDK_DEBUG_NO_VSYNC = 1 << 26,
|
||||
GDK_DEBUG_DMABUF_DISABLE = 1 << 27,
|
||||
} GdkDebugFlags;
|
||||
|
||||
extern guint _gdk_debug_flags;
|
||||
|
||||
@@ -1851,11 +1851,14 @@ init_dmabuf_formats (GdkDisplay *display)
|
||||
if (display->dmabuf_formats != NULL)
|
||||
return;
|
||||
|
||||
gdk_display_prepare_gl (display, NULL);
|
||||
|
||||
builder = gdk_dmabuf_formats_builder_new ();
|
||||
|
||||
gdk_dmabuf_texture_add_supported_formats (builder);
|
||||
if (!GDK_DEBUG_CHECK (DMABUF_DISABLE))
|
||||
{
|
||||
gdk_display_prepare_gl (display, NULL);
|
||||
|
||||
gdk_dmabuf_texture_add_supported_formats (builder);
|
||||
}
|
||||
|
||||
display->dmabuf_formats = gdk_dmabuf_formats_builder_free_to_formats (builder);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "gdkdmabuftexturebuilder.h"
|
||||
|
||||
#include "gdkdebugprivate.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkenumtypes.h"
|
||||
#include "gdkdmabuftextureprivate.h"
|
||||
@@ -975,6 +976,13 @@ gdk_dmabuf_texture_builder_build (GdkDmabufTextureBuilder *self,
|
||||
for (int i = 0; i < self->n_planes; i++)
|
||||
g_return_val_if_fail (self->fds[i] != -1 || self->offsets[i] != 0, NULL);
|
||||
|
||||
if (GDK_DEBUG_CHECK (DMABUF_DISABLE))
|
||||
{
|
||||
g_set_error_literal (error, GDK_DMABUF_ERROR, GDK_DMABUF_ERROR_NOT_AVAILABLE,
|
||||
"dmabuf support disabled via GDK_DEBUG environment variable");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return gdk_dmabuf_texture_new_from_builder (self, destroy, data, error);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user