Compare commits
126 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 64a708559a | |||
| cc2d3fa7d6 | |||
| a9e4993184 | |||
| 33703bfe01 | |||
| 7ba5cf5309 | |||
| bb890f6004 | |||
| 1c7a0e7a15 | |||
| cd7e1c1387 | |||
| a2e1e727c5 | |||
| 61207f81c3 | |||
| f624586a75 | |||
| 1a93967e1f | |||
| 310ab7b531 | |||
| d55801c8ba | |||
| b1809bfd88 | |||
| deb8a35ea0 | |||
| c5ce24c82c | |||
| 54815e4771 | |||
| 5a99790a87 | |||
| 8aa7174bfb | |||
| 9df5e3cbd6 | |||
| 8b5194c016 | |||
| 9a63172cf5 | |||
| 3ade9ae184 | |||
| 76349ff6e5 | |||
| dd530b45e2 | |||
| 00ce51472c | |||
| b6bcbeae23 | |||
| cf86cc1184 | |||
| b503b60a49 | |||
| 5850055b68 | |||
| b224e66a9f | |||
| 8aef682079 | |||
| fe4b7a5159 | |||
| 7ba4ba05e1 | |||
| 85e1088171 | |||
| c1ed034367 | |||
| cc3e25b163 | |||
| bdb3e345c8 | |||
| a30e9dcfeb | |||
| 76007c4d09 | |||
| 020ef51cb0 | |||
| 1914adc344 | |||
| 6e236b9459 | |||
| 11715760f9 | |||
| f19c08ffda | |||
| d0f76b6ab4 | |||
| 4c7206343a | |||
| dfae2cb3a5 | |||
| de74d38039 | |||
| fb20542fcc | |||
| a26e289d5c | |||
| 892d3b9530 | |||
| 8477dcfeff | |||
| 25835afd9c | |||
| 06dda4e12b | |||
| 26edfe6d18 | |||
| 4a749aee6e | |||
| 99a8417142 | |||
| 20e2075a10 | |||
| d8c649b57f | |||
| bb2b8bf2c3 | |||
| eb048c91be | |||
| 358779dfb2 | |||
| 8f90ddb906 | |||
| ed54aa8acf | |||
| a90ffb117f | |||
| 29681717ed | |||
| e0cd2b756f | |||
| 2c85060b5f | |||
| 864c5b4608 | |||
| 1ab501649e | |||
| 2d874e601c | |||
| c9b83dfa1d | |||
| dd7a38069f | |||
| 51a181af7a | |||
| 8fcd9bc0c4 | |||
| e2edf693f5 | |||
| 323300e92a | |||
| e688be1cff | |||
| 611d5cf844 | |||
| 677e78bdce | |||
| 51cb1aeb4e | |||
| 625eb508e8 | |||
| 2718e1715d | |||
| 6ddcad6b33 | |||
| 0c23997f70 | |||
| 4d1ef63009 | |||
| 30e14f73fa | |||
| 39e205aa78 | |||
| f0ec1660c1 | |||
| 79f98f3a13 | |||
| 5f0557027d | |||
| a579e3bc6d | |||
| 8f70f4b85e | |||
| 911198cddd | |||
| ca5247a995 | |||
| 004a881521 | |||
| 65993ed0e0 | |||
| a4d0a5bda5 | |||
| 33bc276639 | |||
| 06822581f7 | |||
| 976143fbe9 | |||
| 9fd4feef0c | |||
| 5eed13bd07 | |||
| d02d45dd8d | |||
| 13d0e311b7 | |||
| 52254f755f | |||
| 494154beb6 | |||
| adde188eca | |||
| 8fb0ab2b43 | |||
| b8b5835fc6 | |||
| 463307655c | |||
| d17d8e04a6 | |||
| d8d1dfd8f3 | |||
| f581280811 | |||
| 3a9aea44df | |||
| e05764806a | |||
| 5ca65f04fe | |||
| 32ba1e389c | |||
| beb9e0c906 | |||
| 98f02f6221 | |||
| 13848969f4 | |||
| 0817dfe67f | |||
| 8367411785 | |||
| 17e37dc42a |
@@ -1,6 +1,34 @@
|
||||
Overview of Changes in 4.13.2, xx-xx-xxxx
|
||||
Overview of Changes in 4.13.3, xx-xx-xxxx
|
||||
=========================================
|
||||
|
||||
Overview of Changes in 4.13.2, 22-10-2023
|
||||
=========================================
|
||||
|
||||
* GtkPrintdialog:
|
||||
- New async-style api to replace GtkPrintOperation
|
||||
|
||||
* GtkEmojiChooser:
|
||||
- Add more languages: Bengali, Hindi, Japanese, Finnish,
|
||||
Thai and Norwegian bokmål
|
||||
|
||||
* Accessibility:
|
||||
- Fix some utf8 handling issues
|
||||
|
||||
* GDK:
|
||||
- Add support for dmabuf textures, with GdkDmabufTextureBuilder
|
||||
- Add a few more supported memory formats for textures
|
||||
|
||||
* GSK:
|
||||
- Add a fast-path for masking color
|
||||
- Add support for importing dmabuf textures
|
||||
- Handle GLES better by using some extensions
|
||||
|
||||
* Translation updates:
|
||||
Catalan
|
||||
Russian
|
||||
Turkish
|
||||
|
||||
|
||||
Overview of Changes in 4.13.1, 28-09-2023
|
||||
=========================================
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
#ifndef _MSC_VER
|
||||
#pragma error "This header is for Microsoft VC or clang-cl only."
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/* Make MSVC more pedantic, this is a recommended pragma list
|
||||
* from _Win32_Programming_ by Rector and Newcomer.
|
||||
*/
|
||||
#ifndef __clang__
|
||||
#pragma warning(error:4002) /* too many actual parameters for macro */
|
||||
#pragma warning(error:4003) /* not enough actual parameters for macro */
|
||||
#pragma warning(1:4010) /* single-line comment contains line-continuation character */
|
||||
#pragma warning(error:4013) /* 'function' undefined; assuming extern returning int */
|
||||
#pragma warning(1:4016) /* no function return type; using int as default */
|
||||
#pragma warning(error:4020) /* too many actual parameters */
|
||||
#pragma warning(error:4021) /* too few actual parameters */
|
||||
#pragma warning(error:4027) /* function declared without formal parameter list */
|
||||
#pragma warning(error:4029) /* declared formal parameter list different from definition */
|
||||
#pragma warning(error:4033) /* 'function' must return a value */
|
||||
#pragma warning(error:4035) /* 'function' : no return value */
|
||||
#pragma warning(error:4045) /* array bounds overflow */
|
||||
#pragma warning(error:4047) /* different levels of indirection */
|
||||
#pragma warning(error:4049) /* terminating line number emission */
|
||||
#pragma warning(error:4053) /* An expression of type void was used as an operand */
|
||||
#pragma warning(error:4071) /* no function prototype given */
|
||||
#pragma warning(disable:4101) /* unreferenced local variable */
|
||||
#pragma warning(error:4150)
|
||||
|
||||
/* G_NORETURN */
|
||||
#pragma warning(error:4646) /* function declared with __declspec(noreturn) has non-void return type */
|
||||
#pragma warning(error:4715) /* 'function': not all control paths return a value */
|
||||
#pragma warning(error:4098) /* 'void' function returning a value */
|
||||
|
||||
#pragma warning(disable:4244) /* No possible loss of data warnings */
|
||||
#pragma warning(disable:4305) /* No truncation from int to char warnings */
|
||||
|
||||
#pragma warning(error:4819) /* The file contains a character that cannot be represented in the current code page */
|
||||
#endif /* __clang__ */
|
||||
|
||||
/* work around Microsoft's premature attempt to deprecate the C-Library */
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _CRT_NONSTDC_NO_WARNINGS
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 533 B |
Binary file not shown.
|
Before Width: | Height: | Size: 127 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M3.384 3h3.231c.213 0 .385.224.385.502v2.996C7 6.776 6.828 7 6.615 7h-3.23C3.17 7 3 6.776 3 6.498V3.502C3 3.224 3.17 3 3.384 3zm6 0h3.231c.213 0 .385.224.385.502v2.996c0 .278-.172.502-.385.502h-3.23C9.17 7 9 6.776 9 6.498V3.502C9 3.224 9.17 3 9.384 3zm-6 6h3.231c.213 0 .385.224.385.502v2.996c0 .278-.172.502-.385.502h-3.23C3.17 13 3 12.776 3 12.498V9.502C3 9.224 3.17 9 3.384 9zm6 0h3.231c.213 0 .385.224.385.502v2.996c0 .278-.172.502-.385.502h-3.23C9.17 13 9 12.776 9 12.498V9.502C9 9.224 9.17 9 9.384 9z" style="marker:none" overflow="visible" color="#000" fill="#474747"/></svg>
|
||||
|
Before Width: | Height: | Size: 654 B |
@@ -25,14 +25,12 @@
|
||||
<file>icons/16x16/actions/format-justify-fill-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/actions/format-justify-left-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/actions/format-justify-right-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/actions/insert-image.png</file>
|
||||
<file>icons/16x16/actions/insert-link-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/actions/send-to-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/actions/star-new-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/actions/view-continuous-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/actions/view-dual-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/actions/view-fullscreen-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/actions/view-grid-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/actions/view-paged-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/actions/zoom-in-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/actions/zoom-in.png</file>
|
||||
@@ -88,7 +86,6 @@
|
||||
<file>icons/scalable/actions/view-dual-symbolic.svg</file>
|
||||
<file>icons/scalable/actions/view-paged-symbolic.svg</file>
|
||||
<file>icons/scalable/actions/view-fullscreen-symbolic.svg</file>
|
||||
<file>icons/scalable/actions/view-grid-symbolic.svg</file>
|
||||
<file>icons/scalable/actions/zoom-in-symbolic.svg</file>
|
||||
<file>icons/scalable/actions/zoom-original-symbolic.svg</file>
|
||||
<file>icons/scalable/actions/zoom-out-symbolic.svg</file>
|
||||
|
||||
@@ -41,7 +41,7 @@ activate (GtkApplication* app,
|
||||
window = gtk_application_window_new (app);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Window");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
|
||||
gtk_widget_show (window);
|
||||
gtk_window_present (GTK_WINDOW (window));
|
||||
}
|
||||
|
||||
int
|
||||
@@ -183,7 +183,7 @@ activate (GtkApplication *app,
|
||||
|
||||
gtk_box_append (GTK_BOX (box), button);
|
||||
|
||||
gtk_widget_show (window);
|
||||
gtk_window_present (GTK_WINDOW (window));
|
||||
}
|
||||
|
||||
int
|
||||
@@ -331,8 +331,7 @@ activate (GtkApplication *app,
|
||||
*/
|
||||
gtk_grid_attach (GTK_GRID (grid), button, 0, 1, 2, 1);
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
||||
gtk_window_present (GTK_WINDOW (window));
|
||||
}
|
||||
|
||||
int
|
||||
@@ -554,7 +553,7 @@ activate (GtkApplication *app,
|
||||
|
||||
g_signal_connect (press, "pressed", G_CALLBACK (pressed), drawing_area);
|
||||
|
||||
gtk_widget_show (window);
|
||||
gtk_window_present (GTK_WINDOW (window));
|
||||
}
|
||||
|
||||
int
|
||||
@@ -631,7 +630,7 @@ activate (GtkApplication *app,
|
||||
button = gtk_builder_get_object (builder, "quit");
|
||||
g_signal_connect_swapped (button, "clicked", G_CALLBACK (quit_cb), window);
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (window));
|
||||
gtk_widget_set_visible (GTK_WIDGET (window), TRUE);
|
||||
|
||||
/* We do not need the builder any more */
|
||||
g_object_unref (builder);
|
||||
|
||||
@@ -35,6 +35,11 @@ Showing
|
||||
|
||||
The ``show`` command displays the rendernode.
|
||||
|
||||
``--undecorated``
|
||||
|
||||
Removes window decorations. This is meant for rendering of exactly the rendernode
|
||||
without any titlebar.
|
||||
|
||||
Rendering
|
||||
^^^^^^^^^
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ main (int argc, char **argv)
|
||||
// ...
|
||||
|
||||
// Show the application window
|
||||
gtk_widget_show (window);
|
||||
gtk_window_present (GTK_WINDOW (window));
|
||||
|
||||
// Enter the main event loop, and wait for user interaction
|
||||
while (!done)
|
||||
|
||||
@@ -209,13 +209,11 @@ _gdk_broadway_roundtrip_notify (GdkSurface *surface,
|
||||
timings->complete = TRUE;
|
||||
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if ((_gdk_debug_flags & GDK_DEBUG_FRAMES) != 0)
|
||||
_gdk_frame_clock_debug_print_timings (clock, timings);
|
||||
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
_gdk_frame_clock_add_timings_to_profiler (clock, timings);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -369,14 +369,12 @@ portal_file_serializer (GdkContentSerializer *serializer)
|
||||
GDK_DEBUG (DND, "file transfer portal: Adding %s", g_file_peek_path (file));
|
||||
g_ptr_array_add (files, g_file_get_path (file));
|
||||
}
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
else if (GDK_DEBUG_CHECK (DND))
|
||||
{
|
||||
char *uri = g_file_get_uri (file);
|
||||
gdk_debug_message ("file transfer portal: %s has no path, dropping\n", uri);
|
||||
g_free (uri);
|
||||
}
|
||||
#endif
|
||||
|
||||
g_ptr_array_add (files, NULL);
|
||||
}
|
||||
@@ -426,14 +424,12 @@ portal_finish (GObject *object,
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DEBUG_CHECK (DND))
|
||||
{
|
||||
char *s = g_strjoinv (", ", files);
|
||||
gdk_debug_message ("file transfer portal: Receiving files: %s", s);
|
||||
g_free (s);
|
||||
}
|
||||
#endif
|
||||
|
||||
value = gdk_content_deserializer_get_value (deserializer);
|
||||
if (G_VALUE_HOLDS (value, G_TYPE_FILE))
|
||||
|
||||
@@ -119,23 +119,23 @@ static const GdkDebugKey gdk_debug_keys[] = {
|
||||
{ "clipboard", GDK_DEBUG_CLIPBOARD, "Information about clipboards" },
|
||||
{ "dmabuf", GDK_DEBUG_DMABUF, "Information about dmabuf buffers" },
|
||||
|
||||
{ "nograbs", GDK_DEBUG_NOGRABS, "Disable pointer and keyboard grabs (X11)", TRUE },
|
||||
{ "portals", GDK_DEBUG_PORTALS, "Force use of portals", TRUE },
|
||||
{ "no-portals", GDK_DEBUG_NO_PORTALS, "Disable use of portals", TRUE },
|
||||
{ "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support", TRUE },
|
||||
{ "gl-fractional", GDK_DEBUG_GL_FRACTIONAL, "Enable fractional scaling for OpenGL (experimental)", TRUE },
|
||||
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL", TRUE },
|
||||
{ "gl-legacy", GDK_DEBUG_GL_LEGACY, "Use a legacy OpenGL context", TRUE },
|
||||
{ "gl-gles", GDK_DEBUG_GL_GLES, "Only allow OpenGL GLES API", TRUE },
|
||||
{ "gl-egl", GDK_DEBUG_GL_EGL, "Use EGL on X11 or Windows", TRUE },
|
||||
{ "gl-glx", GDK_DEBUG_GL_GLX, "Use GLX on X11", TRUE },
|
||||
{ "gl-wgl", GDK_DEBUG_GL_WGL, "Use WGL on Windows", TRUE },
|
||||
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support", TRUE },
|
||||
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer", TRUE },
|
||||
{ "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 },
|
||||
{ "nograbs", GDK_DEBUG_NOGRABS, "Disable pointer and keyboard grabs (X11)" },
|
||||
{ "portals", GDK_DEBUG_PORTALS, "Force use of portals" },
|
||||
{ "no-portals", GDK_DEBUG_NO_PORTALS, "Disable use of portals" },
|
||||
{ "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support" },
|
||||
{ "gl-fractional", GDK_DEBUG_GL_FRACTIONAL, "Enable fractional scaling for OpenGL (experimental)" },
|
||||
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" },
|
||||
{ "gl-legacy", GDK_DEBUG_GL_LEGACY, "Use a legacy OpenGL context" },
|
||||
{ "gl-gles", GDK_DEBUG_GL_GLES, "Only allow OpenGL GLES API" },
|
||||
{ "gl-egl", GDK_DEBUG_GL_EGL, "Use EGL on X11 or Windows" },
|
||||
{ "gl-glx", GDK_DEBUG_GL_GLX, "Use GLX on X11" },
|
||||
{ "gl-wgl", GDK_DEBUG_GL_WGL, "Use WGL on Windows" },
|
||||
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support" },
|
||||
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer" },
|
||||
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings" },
|
||||
{ "high-depth", GDK_DEBUG_HIGH_DEPTH, "Use high bit depth rendering if possible" },
|
||||
{ "no-vsync", GDK_DEBUG_NO_VSYNC, "Repaint instantly (uses 100% CPU with animations)" },
|
||||
{ "dmabuf-disable", GDK_DEBUG_DMABUF_DISABLE, "Disable dmabuf support" },
|
||||
};
|
||||
|
||||
|
||||
@@ -196,13 +196,6 @@ gdk_parse_debug_var (const char *variable,
|
||||
const char *q;
|
||||
gboolean invert;
|
||||
gboolean help;
|
||||
gboolean debug_enabled;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
debug_enabled = TRUE;
|
||||
#else
|
||||
debug_enabled = FALSE;
|
||||
#endif
|
||||
|
||||
string = g_getenv (variable);
|
||||
if (string == NULL)
|
||||
@@ -234,12 +227,6 @@ gdk_parse_debug_var (const char *variable,
|
||||
if (strlen (keys[i].key) == q - p &&
|
||||
g_ascii_strncasecmp (keys[i].key, p, q - p) == 0)
|
||||
{
|
||||
if (!debug_enabled && !keys[i].always_enabled)
|
||||
{
|
||||
fprintf (stderr, "\"%s\" is only available when building GTK with G_ENABLE_DEBUG. See %s=help\n",
|
||||
val, variable);
|
||||
break;
|
||||
}
|
||||
result |= keys[i].value;
|
||||
break;
|
||||
}
|
||||
@@ -263,8 +250,7 @@ gdk_parse_debug_var (const char *variable,
|
||||
|
||||
fprintf (stderr, "Supported %s values:\n", variable);
|
||||
for (i = 0; i < nkeys; i++) {
|
||||
if (debug_enabled || keys[i].always_enabled)
|
||||
fprintf (stderr, " %s%*s%s\n", keys[i].key, (int)(max_width - strlen (keys[i].key)), " ", keys[i].help);
|
||||
fprintf (stderr, " %s%*s%s\n", keys[i].key, (int)(max_width - strlen (keys[i].key)), " ", keys[i].help);
|
||||
}
|
||||
fprintf (stderr, " %s%*s%s\n", "all", max_width - 3, " ", "Enable all values. Other given values are subtracted");
|
||||
fprintf (stderr, " %s%*s%s\n", "help", max_width - 4, " ", "Print this help");
|
||||
@@ -277,8 +263,7 @@ gdk_parse_debug_var (const char *variable,
|
||||
|
||||
for (i = 0; i < nkeys; i++)
|
||||
{
|
||||
if (debug_enabled || keys[i].always_enabled)
|
||||
all_flags |= keys[i].value;
|
||||
all_flags |= keys[i].value;
|
||||
}
|
||||
|
||||
result = all_flags & (~result);
|
||||
|
||||
+17
-14
@@ -64,13 +64,24 @@ GdkDebugFlags gdk_display_get_debug_flags (GdkDisplay *display);
|
||||
void gdk_display_set_debug_flags (GdkDisplay *display,
|
||||
GdkDebugFlags flags);
|
||||
|
||||
#ifdef GLIB_USING_SYSTEM_PRINTF
|
||||
#define gdk_debug_message(format, ...) fprintf (stderr, format "\n", ##__VA_ARGS__)
|
||||
#else
|
||||
#define gdk_debug_message(format, ...) g_fprintf (stderr, format "\n", ##__VA_ARGS__)
|
||||
#endif
|
||||
static inline void
|
||||
gdk_debug_message (const char *format, ...) G_GNUC_PRINTF(1, 2);
|
||||
static inline void
|
||||
gdk_debug_message (const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
char *s;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
va_start (args, format);
|
||||
s = g_strdup_vprintf (format, args);
|
||||
va_end (args);
|
||||
#ifdef GLIB_USING_SYSTEM_PRINTF
|
||||
fprintf (stderr, "%s\n", s);
|
||||
#else
|
||||
g_fprintf (stderr, "%s\n", s);
|
||||
#endif
|
||||
g_free (s);
|
||||
}
|
||||
|
||||
#define GDK_DISPLAY_DEBUG_CHECK(display,type) \
|
||||
G_UNLIKELY (gdk_display_get_debug_flags (display) & GDK_DEBUG_##type)
|
||||
@@ -81,13 +92,6 @@ void gdk_display_set_debug_flags (GdkDisplay *display,
|
||||
gdk_debug_message (__VA_ARGS__); \
|
||||
} G_STMT_END
|
||||
|
||||
#else /* !G_ENABLE_DEBUG */
|
||||
|
||||
#define GDK_DISPLAY_DEBUG_CHECK(display,type) 0
|
||||
#define GDK_DISPLAY_DEBUG(display,type,...)
|
||||
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
#define GDK_DEBUG_CHECK(type) GDK_DISPLAY_DEBUG_CHECK (NULL,type)
|
||||
#define GDK_DEBUG(type,...) GDK_DISPLAY_DEBUG (NULL,type,__VA_ARGS__)
|
||||
|
||||
@@ -96,7 +100,6 @@ typedef struct
|
||||
const char *key;
|
||||
guint value;
|
||||
const char *help;
|
||||
gboolean always_enabled;
|
||||
} GdkDebugKey;
|
||||
|
||||
guint gdk_parse_debug_var (const char *variable,
|
||||
|
||||
+30
-8
@@ -391,6 +391,10 @@ gdk_display_dispose (GObject *object)
|
||||
|
||||
g_queue_clear (&display->queued_events);
|
||||
|
||||
g_clear_object (&display->egl_gsk_renderer);
|
||||
g_clear_pointer (&display->egl_dmabuf_formats, gdk_dmabuf_formats_unref);
|
||||
g_clear_pointer (&display->egl_external_formats, gdk_dmabuf_formats_unref);
|
||||
|
||||
g_clear_object (&priv->gl_context);
|
||||
#ifdef HAVE_EGL
|
||||
g_clear_pointer (&priv->egl_display, eglTerminate);
|
||||
@@ -1424,7 +1428,6 @@ gdk_display_get_gl_context (GdkDisplay *self)
|
||||
}
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
static int
|
||||
strvcmp (gconstpointer p1,
|
||||
gconstpointer p2)
|
||||
@@ -1481,7 +1484,6 @@ describe_egl_config (EGLDisplay egl_display,
|
||||
|
||||
return g_strdup_printf ("R%dG%dB%dA%d%s", red, green, blue, alpha, type == EGL_COLOR_COMPONENT_TYPE_FIXED_EXT ? "" : " float");
|
||||
}
|
||||
#endif
|
||||
|
||||
gpointer
|
||||
gdk_display_get_egl_config (GdkDisplay *self)
|
||||
@@ -1770,6 +1772,10 @@ gdk_display_init_egl (GdkDisplay *self,
|
||||
epoxy_has_egl_extension (priv->egl_display, "EGL_KHR_no_config_context");
|
||||
self->have_egl_pixel_format_float =
|
||||
epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_pixel_format_float");
|
||||
self->have_egl_dma_buf_import =
|
||||
epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_image_dma_buf_import_modifiers");
|
||||
self->have_egl_dma_buf_export =
|
||||
epoxy_has_egl_extension (priv->egl_display, "EGL_MESA_image_dma_buf_export");
|
||||
|
||||
if (self->have_egl_no_config_context)
|
||||
priv->egl_config_high_depth = gdk_display_create_egl_config (self,
|
||||
@@ -1778,7 +1784,6 @@ gdk_display_init_egl (GdkDisplay *self,
|
||||
if (priv->egl_config_high_depth == NULL)
|
||||
priv->egl_config_high_depth = priv->egl_config;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (self, OPENGL))
|
||||
{
|
||||
char *ext = describe_extensions (priv->egl_display);
|
||||
@@ -1802,7 +1807,6 @@ gdk_display_init_egl (GdkDisplay *self,
|
||||
g_free (std_cfg);
|
||||
g_free (ext);
|
||||
}
|
||||
#endif
|
||||
|
||||
gdk_profiler_end_mark (start_time, "init EGL", NULL);
|
||||
|
||||
@@ -1839,7 +1843,7 @@ gdk_display_get_egl_display (GdkDisplay *self)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_LINUX_DMA_BUF_H
|
||||
#ifdef HAVE_DMABUF
|
||||
static void
|
||||
gdk_display_add_dmabuf_downloader (GdkDisplay *display,
|
||||
const GdkDmabufDownloader *downloader,
|
||||
@@ -1847,7 +1851,8 @@ gdk_display_add_dmabuf_downloader (GdkDisplay *display,
|
||||
{
|
||||
gsize i;
|
||||
|
||||
downloader->add_formats (downloader, display, builder);
|
||||
if (!downloader->add_formats (downloader, display, builder))
|
||||
return;
|
||||
|
||||
/* dmabuf_downloaders is NULL-terminated */
|
||||
for (i = 0; i < G_N_ELEMENTS (display->dmabuf_downloaders) - 1; i++)
|
||||
@@ -1874,19 +1879,31 @@ gdk_display_init_dmabuf (GdkDisplay *self)
|
||||
if (self->dmabuf_formats != NULL)
|
||||
return;
|
||||
|
||||
GDK_DISPLAY_DEBUG (self, DMABUF,
|
||||
"Beginning initialization of dmabuf support");
|
||||
|
||||
builder = gdk_dmabuf_formats_builder_new ();
|
||||
|
||||
#ifdef HAVE_LINUX_DMA_BUF_H
|
||||
#ifdef HAVE_DMABUF
|
||||
if (!GDK_DEBUG_CHECK (DMABUF_DISABLE))
|
||||
{
|
||||
gdk_display_prepare_gl (self, NULL);
|
||||
|
||||
gdk_display_add_dmabuf_downloader (self, gdk_dmabuf_get_direct_downloader (), builder);
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
if (gdk_display_prepare_gl (self, NULL))
|
||||
gdk_display_add_dmabuf_downloader (self, gdk_dmabuf_get_egl_downloader (), builder);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
self->dmabuf_formats = gdk_dmabuf_formats_builder_free_to_formats (builder);
|
||||
}
|
||||
|
||||
GDK_DISPLAY_DEBUG (self, DMABUF,
|
||||
"Initialized support for %zu dmabuf formats",
|
||||
gdk_dmabuf_formats_get_n_formats (self->dmabuf_formats));
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_display_get_dmabuf_formats:
|
||||
@@ -1897,6 +1914,11 @@ gdk_display_init_dmabuf (GdkDisplay *self)
|
||||
* GTK may use OpenGL or Vulkan to support some formats.
|
||||
* Calling this function will then initialize them if they aren't yet.
|
||||
*
|
||||
* The formats returned by this function can be used for negotiating
|
||||
* buffer formats with producers such as v4l, pipewire or GStreamer.
|
||||
*
|
||||
* To learn more about dma-bufs, see [class@Gdk.DmabufTextureBuilder].
|
||||
*
|
||||
* Returns: (transfer none): a `GdkDmabufFormats` object
|
||||
*
|
||||
* Since: 4.14
|
||||
|
||||
@@ -114,9 +114,16 @@ struct _GdkDisplay
|
||||
guint have_egl_buffer_age : 1;
|
||||
guint have_egl_no_config_context : 1;
|
||||
guint have_egl_pixel_format_float : 1;
|
||||
guint have_egl_dma_buf_import : 1;
|
||||
guint have_egl_dma_buf_export : 1;
|
||||
|
||||
GdkDmabufFormats *dmabuf_formats;
|
||||
const GdkDmabufDownloader *dmabuf_downloaders[4];
|
||||
|
||||
/* Cached data the EGL dmabuf downloader */
|
||||
gpointer egl_gsk_renderer;
|
||||
GdkDmabufFormats *egl_dmabuf_formats;
|
||||
GdkDmabufFormats *egl_external_formats;
|
||||
};
|
||||
|
||||
struct _GdkDisplayClass
|
||||
|
||||
+254
-38
@@ -24,11 +24,11 @@
|
||||
#include "gdkdmabuftextureprivate.h"
|
||||
#include "gdkmemoryformatprivate.h"
|
||||
|
||||
#ifdef HAVE_LINUX_DMA_BUF_H
|
||||
#ifdef HAVE_DMABUF
|
||||
#include <sys/mman.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/dma-buf.h>
|
||||
#include <drm/drm_fourcc.h>
|
||||
#include <drm_fourcc.h>
|
||||
#include <epoxy/egl.h>
|
||||
|
||||
typedef struct _GdkDrmFormatInfo GdkDrmFormatInfo;
|
||||
@@ -133,15 +133,31 @@ download_nv12 (guchar *dst_data,
|
||||
{
|
||||
const guchar *y_data, *uv_data;
|
||||
gsize x, y, y_stride, uv_stride;
|
||||
gsize U, V;
|
||||
gsize U, V, X_SUB, Y_SUB;
|
||||
|
||||
if (dmabuf->fourcc == DRM_FORMAT_NV21)
|
||||
switch (dmabuf->fourcc)
|
||||
{
|
||||
U = 1; V = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
U = 0; V = 1;
|
||||
case DRM_FORMAT_NV12:
|
||||
U = 0; V = 1; X_SUB = 2; Y_SUB = 2;
|
||||
break;
|
||||
case DRM_FORMAT_NV21:
|
||||
U = 1; V = 0; X_SUB = 2; Y_SUB = 2;
|
||||
break;
|
||||
case DRM_FORMAT_NV16:
|
||||
U = 0; V = 1; X_SUB = 2; Y_SUB = 1;
|
||||
break;
|
||||
case DRM_FORMAT_NV61:
|
||||
U = 1; V = 0; X_SUB = 2; Y_SUB = 1;
|
||||
break;
|
||||
case DRM_FORMAT_NV24:
|
||||
U = 0; V = 1; X_SUB = 1; Y_SUB = 1;
|
||||
break;
|
||||
case DRM_FORMAT_NV42:
|
||||
U = 1; V = 0; X_SUB = 1; Y_SUB = 1;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
return;
|
||||
}
|
||||
|
||||
y_stride = dmabuf->planes[0].stride;
|
||||
@@ -149,35 +165,108 @@ download_nv12 (guchar *dst_data,
|
||||
g_return_if_fail (sizes[0] >= dmabuf->planes[0].offset + height * y_stride);
|
||||
uv_stride = dmabuf->planes[1].stride;
|
||||
uv_data = src_data[1] + dmabuf->planes[1].offset;
|
||||
g_return_if_fail (sizes[1] >= dmabuf->planes[1].offset + (height + 1) / 2 * uv_stride);
|
||||
g_return_if_fail (sizes[1] >= dmabuf->planes[1].offset + (height + Y_SUB - 1) / Y_SUB * uv_stride);
|
||||
|
||||
for (y = 0; y < height; y += 2)
|
||||
for (y = 0; y < height; y += Y_SUB)
|
||||
{
|
||||
guchar *dst2_data = dst_data + dst_stride;
|
||||
const guchar *y2_data = y_data + y_stride;
|
||||
|
||||
for (x = 0; x < width; x += 2)
|
||||
for (x = 0; x < width; x += X_SUB)
|
||||
{
|
||||
int r, g, b;
|
||||
gsize xs, ys;
|
||||
|
||||
get_uv_values (&itu601_wide, uv_data[x + U], uv_data[x + V], &r, &g, &b);
|
||||
get_uv_values (&itu601_wide, uv_data[x / X_SUB * 2 + U], uv_data[x / X_SUB * 2 + V], &r, &g, &b);
|
||||
|
||||
set_rgb_values (&dst_data[3 * x], y_data[x], r, g, b);
|
||||
if (x + 1 < width)
|
||||
set_rgb_values (&dst_data[3 * (x + 1)], y_data[x], r, g, b);
|
||||
if (y + 1 < height)
|
||||
{
|
||||
set_rgb_values (&dst2_data[3 * x], y2_data[x], r, g, b);
|
||||
if (x + 1 < width)
|
||||
set_rgb_values (&dst2_data[3 * (x + 1)], y2_data[x], r, g, b);
|
||||
}
|
||||
for (ys = 0; ys < Y_SUB && y + ys < height; ys++)
|
||||
for (xs = 0; xs < X_SUB && x + xs < width; xs++)
|
||||
set_rgb_values (&dst_data[3 * (x + xs) + dst_stride * ys], y_data[x + xs + y_stride * ys], r, g, b);
|
||||
}
|
||||
dst_data += 2 * dst_stride;
|
||||
y_data += 2 * y_stride;
|
||||
dst_data += Y_SUB * dst_stride;
|
||||
y_data += Y_SUB * y_stride;
|
||||
uv_data += uv_stride;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
download_yuv_3 (guchar *dst_data,
|
||||
gsize dst_stride,
|
||||
GdkMemoryFormat dst_format,
|
||||
gsize width,
|
||||
gsize height,
|
||||
const GdkDmabuf *dmabuf,
|
||||
const guchar *src_data[GDK_DMABUF_MAX_PLANES],
|
||||
gsize sizes[GDK_DMABUF_MAX_PLANES])
|
||||
{
|
||||
const guchar *y_data, *u_data, *v_data;
|
||||
gsize x, y, y_stride, u_stride, v_stride;
|
||||
gsize U, V, X_SUB, Y_SUB;
|
||||
|
||||
switch (dmabuf->fourcc)
|
||||
{
|
||||
case DRM_FORMAT_YUV410:
|
||||
U = 1; V = 2; X_SUB = 4; Y_SUB = 4;
|
||||
break;
|
||||
case DRM_FORMAT_YVU410:
|
||||
U = 2; V = 1; X_SUB = 4; Y_SUB = 4;
|
||||
break;
|
||||
case DRM_FORMAT_YUV411:
|
||||
U = 1; V = 2; X_SUB = 4; Y_SUB = 1;
|
||||
break;
|
||||
case DRM_FORMAT_YVU411:
|
||||
U = 2; V = 1; X_SUB = 4; Y_SUB = 1;
|
||||
break;
|
||||
case DRM_FORMAT_YUV420:
|
||||
U = 1; V = 2; X_SUB = 2; Y_SUB = 2;
|
||||
break;
|
||||
case DRM_FORMAT_YVU420:
|
||||
U = 2; V = 1; X_SUB = 2; Y_SUB = 2;
|
||||
break;
|
||||
case DRM_FORMAT_YUV422:
|
||||
U = 1; V = 2; X_SUB = 2; Y_SUB = 1;
|
||||
break;
|
||||
case DRM_FORMAT_YVU422:
|
||||
U = 2; V = 1; X_SUB = 2; Y_SUB = 1;
|
||||
break;
|
||||
case DRM_FORMAT_YUV444:
|
||||
U = 1; V = 2; X_SUB = 1; Y_SUB = 1;
|
||||
break;
|
||||
case DRM_FORMAT_YVU444:
|
||||
U = 2; V = 1; X_SUB = 1; Y_SUB = 1;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
return;
|
||||
}
|
||||
|
||||
y_stride = dmabuf->planes[0].stride;
|
||||
y_data = src_data[0] + dmabuf->planes[0].offset;
|
||||
g_return_if_fail (sizes[0] >= dmabuf->planes[0].offset + height * y_stride);
|
||||
u_stride = dmabuf->planes[U].stride;
|
||||
u_data = src_data[U] + dmabuf->planes[U].offset;
|
||||
g_return_if_fail (sizes[U] >= dmabuf->planes[U].offset + (height + Y_SUB - 1) / Y_SUB * u_stride);
|
||||
v_stride = dmabuf->planes[V].stride;
|
||||
v_data = src_data[V] + dmabuf->planes[V].offset;
|
||||
g_return_if_fail (sizes[V] >= dmabuf->planes[V].offset + (height + Y_SUB - 1) / Y_SUB * v_stride);
|
||||
|
||||
for (y = 0; y < height; y += Y_SUB)
|
||||
{
|
||||
for (x = 0; x < width; x += X_SUB)
|
||||
{
|
||||
int r, g, b;
|
||||
gsize xs, ys;
|
||||
|
||||
get_uv_values (&itu601_wide, u_data[x / X_SUB], v_data[x / X_SUB], &r, &g, &b);
|
||||
|
||||
for (ys = 0; ys < Y_SUB && y + ys < height; ys++)
|
||||
for (xs = 0; xs < X_SUB && x + xs < width; xs++)
|
||||
set_rgb_values (&dst_data[3 * (x + xs) + dst_stride * ys], y_data[x + xs + y_stride * ys], r, g, b);
|
||||
}
|
||||
dst_data += Y_SUB * dst_stride;
|
||||
y_data += Y_SUB * y_stride;
|
||||
u_data += u_stride;
|
||||
v_data += v_stride;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
download_yuyv (guchar *dst_data,
|
||||
gsize dst_stride,
|
||||
@@ -246,10 +335,24 @@ static const GdkDrmFormatInfo supported_formats[] = {
|
||||
/* YUV formats */
|
||||
{ DRM_FORMAT_NV12, GDK_MEMORY_R8G8B8, GDK_MEMORY_R8G8B8, download_nv12 },
|
||||
{ DRM_FORMAT_NV21, GDK_MEMORY_R8G8B8, GDK_MEMORY_R8G8B8, download_nv12 },
|
||||
{ DRM_FORMAT_NV16, GDK_MEMORY_R8G8B8, GDK_MEMORY_R8G8B8, download_nv12 },
|
||||
{ DRM_FORMAT_NV61, GDK_MEMORY_R8G8B8, GDK_MEMORY_R8G8B8, download_nv12 },
|
||||
{ DRM_FORMAT_NV24, GDK_MEMORY_R8G8B8, GDK_MEMORY_R8G8B8, download_nv12 },
|
||||
{ DRM_FORMAT_NV42, GDK_MEMORY_R8G8B8, GDK_MEMORY_R8G8B8, download_nv12 },
|
||||
{ DRM_FORMAT_YUYV, GDK_MEMORY_R8G8B8, GDK_MEMORY_R8G8B8, download_yuyv },
|
||||
{ DRM_FORMAT_YVYU, GDK_MEMORY_R8G8B8, GDK_MEMORY_R8G8B8, download_yuyv },
|
||||
{ DRM_FORMAT_VYUY, GDK_MEMORY_R8G8B8, GDK_MEMORY_R8G8B8, download_yuyv },
|
||||
{ DRM_FORMAT_UYVY, GDK_MEMORY_R8G8B8, GDK_MEMORY_R8G8B8, download_yuyv },
|
||||
{ DRM_FORMAT_YUV410, GDK_MEMORY_R8G8B8, GDK_MEMORY_R8G8B8, download_yuv_3 },
|
||||
{ DRM_FORMAT_YVU410, GDK_MEMORY_R8G8B8, GDK_MEMORY_R8G8B8, download_yuv_3 },
|
||||
{ DRM_FORMAT_YUV411, GDK_MEMORY_R8G8B8, GDK_MEMORY_R8G8B8, download_yuv_3 },
|
||||
{ DRM_FORMAT_YVU411, GDK_MEMORY_R8G8B8, GDK_MEMORY_R8G8B8, download_yuv_3 },
|
||||
{ DRM_FORMAT_YUV420, GDK_MEMORY_R8G8B8, GDK_MEMORY_R8G8B8, download_yuv_3 },
|
||||
{ DRM_FORMAT_YVU420, GDK_MEMORY_R8G8B8, GDK_MEMORY_R8G8B8, download_yuv_3 },
|
||||
{ DRM_FORMAT_YUV422, GDK_MEMORY_R8G8B8, GDK_MEMORY_R8G8B8, download_yuv_3 },
|
||||
{ DRM_FORMAT_YVU422, GDK_MEMORY_R8G8B8, GDK_MEMORY_R8G8B8, download_yuv_3 },
|
||||
{ DRM_FORMAT_YUV444, GDK_MEMORY_R8G8B8, GDK_MEMORY_R8G8B8, download_yuv_3 },
|
||||
{ DRM_FORMAT_YVU444, GDK_MEMORY_R8G8B8, GDK_MEMORY_R8G8B8, download_yuv_3 },
|
||||
};
|
||||
|
||||
static const GdkDrmFormatInfo *
|
||||
@@ -264,7 +367,7 @@ get_drm_format_info (guint32 fourcc)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
gdk_dmabuf_direct_downloader_add_formats (const GdkDmabufDownloader *downloader,
|
||||
GdkDisplay *display,
|
||||
GdkDmabufFormatsBuilder *builder)
|
||||
@@ -273,10 +376,16 @@ gdk_dmabuf_direct_downloader_add_formats (const GdkDmabufDownloader *downloader,
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (supported_formats); i++)
|
||||
{
|
||||
GDK_DEBUG (DMABUF, "%s dmabuf format %.4s:%#" G_GINT64_MODIFIER "x",
|
||||
downloader->name,
|
||||
(char *) &supported_formats[i].fourcc, (guint64) DRM_FORMAT_MOD_LINEAR);
|
||||
|
||||
gdk_dmabuf_formats_builder_add_format (builder,
|
||||
supported_formats[i].fourcc,
|
||||
DRM_FORMAT_MOD_LINEAR);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -331,8 +440,8 @@ gdk_dmabuf_direct_downloader_do_download (GdkTexture *texture,
|
||||
info = get_drm_format_info (dmabuf->fourcc);
|
||||
|
||||
GDK_DEBUG (DMABUF,
|
||||
"Using mmap() and memcpy() for downloading a dmabuf (format %.4s:%#lx)",
|
||||
(char *)&dmabuf->fourcc, dmabuf->modifier);
|
||||
"Using mmap() and memcpy() for downloading a dmabuf (format %.4s::%016llx)",
|
||||
(char *)&dmabuf->fourcc, (long long unsigned) dmabuf->modifier);
|
||||
|
||||
for (i = 0; i < dmabuf->n_planes; i++)
|
||||
{
|
||||
@@ -354,6 +463,8 @@ gdk_dmabuf_direct_downloader_do_download (GdkTexture *texture,
|
||||
g_warning ("Failed to seek dmabuf: %s", g_strerror (errno));
|
||||
goto out;
|
||||
}
|
||||
/* be a good citizen and seek back to the start, as the dos recommend */
|
||||
lseek (dmabuf->planes[i].fd, 0, SEEK_SET);
|
||||
|
||||
if (ioctl (dmabuf->planes[i].fd, DMA_BUF_IOCTL_SYNC, &(struct dma_buf_sync) { DMA_BUF_SYNC_START|DMA_BUF_SYNC_READ }) < 0)
|
||||
g_warning ("Failed to sync dmabuf: %s", g_strerror (errno));
|
||||
@@ -445,15 +556,13 @@ gdk_dmabuf_get_direct_downloader (void)
|
||||
* controlled by the callers.
|
||||
*
|
||||
* Things we do here:
|
||||
*
|
||||
*
|
||||
* 1. Disallow any dmabuf format that we do not know.
|
||||
*
|
||||
* 1. Treat the INVALID modifier the same as LINEAR.
|
||||
* 2. Ignore non-linear modifiers.
|
||||
*
|
||||
* 2. Ignore all other modifiers.
|
||||
*
|
||||
* 3. Try and fix various inconsistencies between V4L and Mesa,
|
||||
* like NV12.
|
||||
* 3. Try and fix various inconsistencies between V4L and Mesa
|
||||
* for linear modifiers, like the e.g. single-plane NV12.
|
||||
*
|
||||
* *** WARNING ***
|
||||
*
|
||||
@@ -495,12 +604,15 @@ gdk_dmabuf_sanitize (GdkDmabuf *dest,
|
||||
|
||||
*dest = *src;
|
||||
|
||||
if (src->modifier && src->modifier != DRM_FORMAT_MOD_INVALID)
|
||||
if (src->modifier)
|
||||
return TRUE;
|
||||
|
||||
switch (dest->fourcc)
|
||||
{
|
||||
case DRM_FORMAT_NV12:
|
||||
case DRM_FORMAT_NV21:
|
||||
case DRM_FORMAT_NV16:
|
||||
case DRM_FORMAT_NV61:
|
||||
if (dest->n_planes == 1)
|
||||
{
|
||||
dest->n_planes = 2;
|
||||
@@ -510,6 +622,87 @@ gdk_dmabuf_sanitize (GdkDmabuf *dest,
|
||||
}
|
||||
break;
|
||||
|
||||
case DRM_FORMAT_NV24:
|
||||
case DRM_FORMAT_NV42:
|
||||
if (dest->n_planes == 1)
|
||||
{
|
||||
dest->n_planes = 2;
|
||||
dest->planes[1].fd = dest->planes[0].fd;
|
||||
dest->planes[1].stride = dest->planes[0].stride * 2;
|
||||
dest->planes[1].offset = dest->planes[0].offset + dest->planes[0].stride * height;
|
||||
}
|
||||
break;
|
||||
|
||||
case DRM_FORMAT_YUV410:
|
||||
case DRM_FORMAT_YVU410:
|
||||
if (dest->n_planes == 1)
|
||||
{
|
||||
dest->n_planes = 3;
|
||||
dest->planes[1].fd = dest->planes[0].fd;
|
||||
dest->planes[1].stride = (dest->planes[0].stride + 3) / 4;
|
||||
dest->planes[1].offset = dest->planes[0].offset + dest->planes[0].stride * height;
|
||||
dest->planes[2].fd = dest->planes[1].fd;
|
||||
dest->planes[2].stride = dest->planes[1].stride;
|
||||
dest->planes[2].offset = dest->planes[1].offset + dest->planes[1].stride * ((height + 3) / 4);
|
||||
}
|
||||
break;
|
||||
|
||||
case DRM_FORMAT_YUV411:
|
||||
case DRM_FORMAT_YVU411:
|
||||
if (dest->n_planes == 1)
|
||||
{
|
||||
dest->n_planes = 3;
|
||||
dest->planes[1].fd = dest->planes[0].fd;
|
||||
dest->planes[1].stride = (dest->planes[0].stride + 3) / 4;
|
||||
dest->planes[1].offset = dest->planes[0].offset + dest->planes[0].stride * height;
|
||||
dest->planes[2].fd = dest->planes[1].fd;
|
||||
dest->planes[2].stride = dest->planes[1].stride;
|
||||
dest->planes[2].offset = dest->planes[1].offset + dest->planes[1].stride * height;
|
||||
}
|
||||
break;
|
||||
|
||||
case DRM_FORMAT_YUV420:
|
||||
case DRM_FORMAT_YVU420:
|
||||
if (dest->n_planes == 1)
|
||||
{
|
||||
dest->n_planes = 3;
|
||||
dest->planes[1].fd = dest->planes[0].fd;
|
||||
dest->planes[1].stride = (dest->planes[0].stride + 1) / 2;
|
||||
dest->planes[1].offset = dest->planes[0].offset + dest->planes[0].stride * height;
|
||||
dest->planes[2].fd = dest->planes[1].fd;
|
||||
dest->planes[2].stride = dest->planes[1].stride;
|
||||
dest->planes[2].offset = dest->planes[1].offset + dest->planes[1].stride * ((height + 1) / 2);
|
||||
}
|
||||
break;
|
||||
|
||||
case DRM_FORMAT_YUV422:
|
||||
case DRM_FORMAT_YVU422:
|
||||
if (dest->n_planes == 1)
|
||||
{
|
||||
dest->n_planes = 3;
|
||||
dest->planes[1].fd = dest->planes[0].fd;
|
||||
dest->planes[1].stride = (dest->planes[0].stride + 1) / 2;
|
||||
dest->planes[1].offset = dest->planes[0].offset + dest->planes[0].stride * height;
|
||||
dest->planes[2].fd = dest->planes[1].fd;
|
||||
dest->planes[2].stride = dest->planes[1].stride;
|
||||
dest->planes[2].offset = dest->planes[1].offset + dest->planes[1].stride * height;
|
||||
}
|
||||
break;
|
||||
|
||||
case DRM_FORMAT_YUV444:
|
||||
case DRM_FORMAT_YVU444:
|
||||
if (dest->n_planes == 1)
|
||||
{
|
||||
dest->n_planes = 3;
|
||||
dest->planes[1].fd = dest->planes[0].fd;
|
||||
dest->planes[1].stride = dest->planes[0].stride;
|
||||
dest->planes[1].offset = dest->planes[0].offset + dest->planes[0].stride * height;
|
||||
dest->planes[2].fd = dest->planes[1].fd;
|
||||
dest->planes[2].stride = dest->planes[1].stride;
|
||||
dest->planes[2].offset = dest->planes[1].offset + dest->planes[1].stride * height;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -517,4 +710,27 @@ gdk_dmabuf_sanitize (GdkDmabuf *dest,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif /* HAVE_LINUX_DMA_BUF_H */
|
||||
/*
|
||||
* gdk_dmabuf_is_disjoint:
|
||||
* @dmabuf: a sanitized GdkDmabuf
|
||||
*
|
||||
* A dmabuf is considered disjoint if it uses more than
|
||||
* 1 file descriptor.
|
||||
*
|
||||
* Returns: %TRUE if the dmabuf is disjoint
|
||||
**/
|
||||
gboolean
|
||||
gdk_dmabuf_is_disjoint (const GdkDmabuf *dmabuf)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 1; i < dmabuf->n_planes; i++)
|
||||
{
|
||||
if (dmabuf->planes[0].fd != dmabuf->planes[i].fd)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#endif /* HAVE_DMABUF */
|
||||
|
||||
@@ -0,0 +1,405 @@
|
||||
/* gdkdmabufegl.c
|
||||
*
|
||||
* Copyright 2023 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if defined(HAVE_DMABUF) && defined (HAVE_EGL)
|
||||
#include "gdkdmabufprivate.h"
|
||||
|
||||
#include "gdkdmabufformatsbuilderprivate.h"
|
||||
#include "gdkdebugprivate.h"
|
||||
#include "gdkdmabuftextureprivate.h"
|
||||
#include "gdkmemoryformatprivate.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkglcontextprivate.h"
|
||||
#include "gdktexturedownloader.h"
|
||||
|
||||
#include <graphene.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/dma-buf.h>
|
||||
#include <drm_fourcc.h>
|
||||
#include <epoxy/egl.h>
|
||||
|
||||
/* A dmabuf downloader implementation that downloads buffers via
|
||||
* gsk_renderer_render_texture + GL texture download.
|
||||
*/
|
||||
|
||||
static gboolean
|
||||
gdk_dmabuf_egl_downloader_collect_formats (const GdkDmabufDownloader *downloader,
|
||||
GdkDisplay *display,
|
||||
GdkDmabufFormatsBuilder *formats,
|
||||
GdkDmabufFormatsBuilder *external)
|
||||
{
|
||||
GdkGLContext *context = gdk_display_get_gl_context (display);
|
||||
EGLDisplay egl_display = gdk_display_get_egl_display (display);
|
||||
int num_fourccs;
|
||||
int *fourccs;
|
||||
guint64 *modifiers;
|
||||
unsigned int *external_only;
|
||||
int n_mods;
|
||||
|
||||
if (egl_display == EGL_NO_DISPLAY ||
|
||||
!display->have_egl_dma_buf_import)
|
||||
return FALSE;
|
||||
|
||||
gdk_gl_context_make_current (context);
|
||||
|
||||
eglQueryDmaBufFormatsEXT (egl_display, 0, NULL, &num_fourccs);
|
||||
fourccs = g_new (int, num_fourccs);
|
||||
eglQueryDmaBufFormatsEXT (egl_display, num_fourccs, fourccs, &num_fourccs);
|
||||
|
||||
n_mods = 80;
|
||||
modifiers = g_new (guint64, n_mods);
|
||||
external_only = g_new (unsigned int, n_mods);
|
||||
|
||||
for (int i = 0; i < num_fourccs; i++)
|
||||
{
|
||||
int num_modifiers;
|
||||
gboolean all_external;
|
||||
|
||||
eglQueryDmaBufModifiersEXT (egl_display,
|
||||
fourccs[i],
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
&num_modifiers);
|
||||
|
||||
if (num_modifiers > n_mods)
|
||||
{
|
||||
n_mods = num_modifiers;
|
||||
modifiers = g_renew (guint64, modifiers, n_mods);
|
||||
external_only = g_renew (unsigned int, external_only, n_mods);
|
||||
}
|
||||
|
||||
eglQueryDmaBufModifiersEXT (egl_display,
|
||||
fourccs[i],
|
||||
num_modifiers,
|
||||
modifiers,
|
||||
external_only,
|
||||
&num_modifiers);
|
||||
|
||||
all_external = TRUE;
|
||||
|
||||
for (int j = 0; j < num_modifiers; j++)
|
||||
{
|
||||
/* All linear formats we support are already added my the mmap downloader.
|
||||
* We don't add external formats, unless we can use them (via GLES)
|
||||
*/
|
||||
if (modifiers[j] != DRM_FORMAT_MOD_LINEAR &&
|
||||
(!external_only[j] || gdk_gl_context_get_use_es (context)))
|
||||
{
|
||||
GDK_DEBUG (DMABUF, "%s%s dmabuf format %.4s:%#" G_GINT64_MODIFIER "x",
|
||||
external_only[j] ? "external " : "",
|
||||
downloader->name,
|
||||
(char *) &fourccs[i],
|
||||
modifiers[j]);
|
||||
|
||||
gdk_dmabuf_formats_builder_add_format (formats, fourccs[i], modifiers[j]);
|
||||
}
|
||||
if (external_only[j])
|
||||
gdk_dmabuf_formats_builder_add_format (external, fourccs[i], modifiers[j]);
|
||||
else
|
||||
all_external = FALSE;
|
||||
}
|
||||
|
||||
/* Accept implicit modifiers as long as we accept the format at all.
|
||||
* This is a bit of a crapshot, but unfortunately needed for a bunch
|
||||
* of drivers.
|
||||
*
|
||||
* As an extra wrinkle, treat the implicit modifier as 'external only'
|
||||
* if all formats with the same fourcc are 'external only'.
|
||||
*/
|
||||
if (!all_external || gdk_gl_context_get_use_es (context))
|
||||
gdk_dmabuf_formats_builder_add_format (formats, fourccs[i], DRM_FORMAT_MOD_INVALID);
|
||||
if (all_external)
|
||||
gdk_dmabuf_formats_builder_add_format (external, fourccs[i], DRM_FORMAT_MOD_INVALID);
|
||||
}
|
||||
|
||||
g_free (modifiers);
|
||||
g_free (external_only);
|
||||
g_free (fourccs);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_dmabuf_egl_downloader_add_formats (const GdkDmabufDownloader *downloader,
|
||||
GdkDisplay *display,
|
||||
GdkDmabufFormatsBuilder *builder)
|
||||
{
|
||||
GdkDmabufFormatsBuilder *formats;
|
||||
GdkDmabufFormatsBuilder *external;
|
||||
gboolean retval = FALSE;
|
||||
|
||||
g_assert (display->egl_dmabuf_formats == NULL);
|
||||
g_assert (display->egl_external_formats == NULL);
|
||||
|
||||
formats = gdk_dmabuf_formats_builder_new ();
|
||||
external = gdk_dmabuf_formats_builder_new ();
|
||||
|
||||
retval = gdk_dmabuf_egl_downloader_collect_formats (downloader, display, formats, external);
|
||||
|
||||
display->egl_dmabuf_formats = gdk_dmabuf_formats_builder_free_to_formats (formats);
|
||||
display->egl_external_formats = gdk_dmabuf_formats_builder_free_to_formats (external);
|
||||
|
||||
gdk_dmabuf_formats_builder_add_formats (builder, display->egl_dmabuf_formats);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static GdkMemoryFormat
|
||||
get_memory_format (guint32 fourcc,
|
||||
gboolean premultiplied)
|
||||
{
|
||||
switch (fourcc)
|
||||
{
|
||||
case DRM_FORMAT_ARGB8888:
|
||||
case DRM_FORMAT_ABGR8888:
|
||||
case DRM_FORMAT_XRGB8888_A8:
|
||||
case DRM_FORMAT_XBGR8888_A8:
|
||||
return premultiplied ? GDK_MEMORY_A8R8G8B8_PREMULTIPLIED : GDK_MEMORY_A8R8G8B8;
|
||||
|
||||
case DRM_FORMAT_RGBA8888:
|
||||
case DRM_FORMAT_RGBX8888_A8:
|
||||
return premultiplied ? GDK_MEMORY_R8G8B8A8_PREMULTIPLIED : GDK_MEMORY_R8G8B8A8;
|
||||
|
||||
case DRM_FORMAT_BGRA8888:
|
||||
return premultiplied ? GDK_MEMORY_B8G8R8A8_PREMULTIPLIED : GDK_MEMORY_B8G8R8A8;
|
||||
|
||||
case DRM_FORMAT_RGB888:
|
||||
case DRM_FORMAT_XRGB8888:
|
||||
case DRM_FORMAT_XBGR8888:
|
||||
case DRM_FORMAT_RGBX8888:
|
||||
case DRM_FORMAT_BGRX8888:
|
||||
return GDK_MEMORY_R8G8B8;
|
||||
|
||||
case DRM_FORMAT_BGR888:
|
||||
return GDK_MEMORY_B8G8R8;
|
||||
|
||||
case DRM_FORMAT_XRGB2101010:
|
||||
case DRM_FORMAT_XBGR2101010:
|
||||
case DRM_FORMAT_RGBX1010102:
|
||||
case DRM_FORMAT_BGRX1010102:
|
||||
case DRM_FORMAT_XRGB16161616:
|
||||
case DRM_FORMAT_XBGR16161616:
|
||||
return GDK_MEMORY_R16G16B16;
|
||||
|
||||
case DRM_FORMAT_ARGB2101010:
|
||||
case DRM_FORMAT_ABGR2101010:
|
||||
case DRM_FORMAT_RGBA1010102:
|
||||
case DRM_FORMAT_BGRA1010102:
|
||||
case DRM_FORMAT_ARGB16161616:
|
||||
case DRM_FORMAT_ABGR16161616:
|
||||
return premultiplied ? GDK_MEMORY_R16G16B16A16_PREMULTIPLIED : GDK_MEMORY_R16G16B16A16;
|
||||
|
||||
case DRM_FORMAT_ARGB16161616F:
|
||||
case DRM_FORMAT_ABGR16161616F:
|
||||
return premultiplied ? GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED : GDK_MEMORY_R16G16B16A16_FLOAT;
|
||||
|
||||
case DRM_FORMAT_XRGB16161616F:
|
||||
case DRM_FORMAT_XBGR16161616F:
|
||||
return GDK_MEMORY_R16G16B16_FLOAT;
|
||||
|
||||
case DRM_FORMAT_YUYV:
|
||||
case DRM_FORMAT_YVYU:
|
||||
case DRM_FORMAT_UYVY:
|
||||
case DRM_FORMAT_VYUY:
|
||||
case DRM_FORMAT_XYUV8888:
|
||||
#ifdef DRM_FORMAT_XVUY8888
|
||||
case DRM_FORMAT_XVUY8888:
|
||||
#endif
|
||||
case DRM_FORMAT_VUY888:
|
||||
return GDK_MEMORY_R8G8B8;
|
||||
|
||||
/* Add more formats here */
|
||||
default:
|
||||
return premultiplied ? GDK_MEMORY_A8R8G8B8_PREMULTIPLIED : GDK_MEMORY_A8R8G8B8;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_dmabuf_egl_downloader_supports (const GdkDmabufDownloader *downloader,
|
||||
GdkDisplay *display,
|
||||
const GdkDmabuf *dmabuf,
|
||||
gboolean premultiplied,
|
||||
GdkMemoryFormat *out_format,
|
||||
GError **error)
|
||||
{
|
||||
if (gdk_dmabuf_formats_contains (display->egl_dmabuf_formats, dmabuf->fourcc, dmabuf->modifier))
|
||||
{
|
||||
*out_format = get_memory_format (dmabuf->fourcc, premultiplied);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
g_set_error (error,
|
||||
GDK_DMABUF_ERROR, GDK_DMABUF_ERROR_UNSUPPORTED_FORMAT,
|
||||
"Unsupported dmabuf format: %.4s:%#" G_GINT64_MODIFIER "x",
|
||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Hack. We don't include gsk/gsk.h here to avoid a build order problem
|
||||
* with the generated header gskenumtypes.h, so we need to hack around
|
||||
* a bit to access the gsk api we need.
|
||||
*/
|
||||
|
||||
typedef gpointer GskRenderer;
|
||||
|
||||
extern GskRenderer * gsk_gl_renderer_new (void);
|
||||
extern gboolean gsk_renderer_realize (GskRenderer *renderer,
|
||||
GdkSurface *surface,
|
||||
GError **error);
|
||||
extern GdkTexture * gsk_renderer_convert_texture (GskRenderer *renderer,
|
||||
GdkTexture *texture);
|
||||
|
||||
typedef void (* InvokeFunc) (gpointer data);
|
||||
|
||||
typedef struct _InvokeData
|
||||
{
|
||||
volatile int spinlock;
|
||||
InvokeFunc func;
|
||||
gpointer data;
|
||||
} InvokeData;
|
||||
|
||||
static gboolean
|
||||
gdk_dmabuf_egl_downloader_invoke_callback (gpointer data)
|
||||
{
|
||||
InvokeData *invoke = data;
|
||||
GdkGLContext *previous;
|
||||
|
||||
previous = gdk_gl_context_get_current ();
|
||||
|
||||
invoke->func (invoke->data);
|
||||
|
||||
if (previous)
|
||||
gdk_gl_context_make_current (previous);
|
||||
else
|
||||
gdk_gl_context_clear_current ();
|
||||
|
||||
g_atomic_int_set (&invoke->spinlock, 1);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Run func in the main thread, taking care not to disturb
|
||||
* the current GL context of the caller.
|
||||
*/
|
||||
static void
|
||||
gdk_dmabuf_egl_downloader_run (InvokeFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
InvokeData invoke = { 0, func, data };
|
||||
|
||||
g_main_context_invoke (NULL, gdk_dmabuf_egl_downloader_invoke_callback, &invoke);
|
||||
|
||||
while (g_atomic_int_get (&invoke.spinlock) == 0) ;
|
||||
}
|
||||
|
||||
typedef struct _Download Download;
|
||||
|
||||
struct _Download
|
||||
{
|
||||
GdkDmabufTexture *texture;
|
||||
GdkMemoryFormat format;
|
||||
guchar *data;
|
||||
gsize stride;
|
||||
};
|
||||
|
||||
static GskRenderer *
|
||||
get_gsk_renderer (GdkDisplay *display)
|
||||
{
|
||||
if (!display->egl_gsk_renderer)
|
||||
{
|
||||
GskRenderer *renderer;
|
||||
GError *error = NULL;
|
||||
|
||||
renderer = gsk_gl_renderer_new ();
|
||||
|
||||
if (!gsk_renderer_realize (renderer, NULL, &error))
|
||||
{
|
||||
g_warning ("Failed to realize GL renderer: %s", error->message);
|
||||
g_error_free (error);
|
||||
g_object_unref (renderer);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
display->egl_gsk_renderer = renderer;
|
||||
}
|
||||
|
||||
return display->egl_gsk_renderer;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_dmabuf_egl_downloader_do_download (gpointer data)
|
||||
{
|
||||
Download *download = data;
|
||||
GdkDisplay *display;
|
||||
GskRenderer *renderer;
|
||||
GdkTexture *native;
|
||||
GdkTextureDownloader *downloader;
|
||||
|
||||
display = gdk_dmabuf_texture_get_display (download->texture);
|
||||
|
||||
renderer = get_gsk_renderer (display);
|
||||
|
||||
native = gsk_renderer_convert_texture (renderer, GDK_TEXTURE (download->texture));
|
||||
|
||||
downloader = gdk_texture_downloader_new (native);
|
||||
gdk_texture_downloader_set_format (downloader, download->format);
|
||||
gdk_texture_downloader_download_into (downloader, download->data, download->stride);
|
||||
gdk_texture_downloader_free (downloader);
|
||||
|
||||
g_object_unref (native);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_dmabuf_egl_downloader_download (const GdkDmabufDownloader *downloader,
|
||||
GdkTexture *texture,
|
||||
GdkMemoryFormat format,
|
||||
guchar *data,
|
||||
gsize stride)
|
||||
{
|
||||
Download download;
|
||||
|
||||
GDK_DEBUG (DMABUF, "Using %s for downloading a dmabuf", downloader->name);
|
||||
|
||||
download.texture = GDK_DMABUF_TEXTURE (texture);
|
||||
download.format = format;
|
||||
download.data = data;
|
||||
download.stride = stride;
|
||||
|
||||
gdk_dmabuf_egl_downloader_run (gdk_dmabuf_egl_downloader_do_download, &download);
|
||||
}
|
||||
|
||||
const GdkDmabufDownloader *
|
||||
gdk_dmabuf_get_egl_downloader (void)
|
||||
{
|
||||
static const GdkDmabufDownloader downloader = {
|
||||
"egl",
|
||||
gdk_dmabuf_egl_downloader_add_formats,
|
||||
gdk_dmabuf_egl_downloader_supports,
|
||||
gdk_dmabuf_egl_downloader_download,
|
||||
};
|
||||
|
||||
return &downloader;
|
||||
}
|
||||
|
||||
#endif /* HAVE_DMABUF && HAVE_EGL */
|
||||
@@ -37,6 +37,10 @@
|
||||
* The list of supported formats is sorted by preference,
|
||||
* with the best formats coming first.
|
||||
*
|
||||
* The list may contains (format, modfier) pairs where the modifier
|
||||
* is `DMA_FORMAT_MOD_INVALID`, indicating that **_implicit modifiers_**
|
||||
* may be used with this format.
|
||||
*
|
||||
* See [class@Gdk.DmabufTextureBuilder] for more information
|
||||
* about DMA buffers.
|
||||
*
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "gdkdmabufformatsprivate.h"
|
||||
|
||||
|
||||
#define GDK_ARRAY_NAME gdk_dmabuf_formats_builder
|
||||
#define GDK_ARRAY_TYPE_NAME GdkDmabufFormatsBuilder
|
||||
#define GDK_ARRAY_ELEMENT_TYPE GdkDmabufFormat
|
||||
|
||||
@@ -22,10 +22,9 @@ struct _GdkDmabuf
|
||||
struct _GdkDmabufDownloader
|
||||
{
|
||||
const char *name;
|
||||
void (* add_formats) (const GdkDmabufDownloader *downloader,
|
||||
gboolean (* add_formats) (const GdkDmabufDownloader *downloader,
|
||||
GdkDisplay *display,
|
||||
GdkDmabufFormatsBuilder *builder);
|
||||
|
||||
gboolean (* supports) (const GdkDmabufDownloader *downloader,
|
||||
GdkDisplay *display,
|
||||
const GdkDmabuf *dmabuf,
|
||||
@@ -39,13 +38,17 @@ struct _GdkDmabufDownloader
|
||||
gsize stride);
|
||||
};
|
||||
|
||||
#ifdef HAVE_LINUX_DMA_BUF_H
|
||||
const GdkDmabufDownloader *
|
||||
gdk_dmabuf_get_direct_downloader (void) G_GNUC_CONST;
|
||||
#ifdef HAVE_DMABUF
|
||||
|
||||
gboolean gdk_dmabuf_sanitize (GdkDmabuf *dest,
|
||||
const GdkDmabufDownloader * gdk_dmabuf_get_direct_downloader (void) G_GNUC_CONST;
|
||||
const GdkDmabufDownloader * gdk_dmabuf_get_egl_downloader (void) G_GNUC_CONST;
|
||||
|
||||
gboolean gdk_dmabuf_sanitize (GdkDmabuf *dest,
|
||||
gsize width,
|
||||
gsize height,
|
||||
const GdkDmabuf *src,
|
||||
GError **error);
|
||||
|
||||
gboolean gdk_dmabuf_is_disjoint (const GdkDmabuf *dmabuf);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,11 +28,11 @@
|
||||
#include <gdk/gdkgltexturebuilder.h>
|
||||
#include <gdk/gdktexturedownloader.h>
|
||||
|
||||
#ifdef HAVE_LINUX_DMA_BUF_H
|
||||
#ifdef HAVE_DMABUF
|
||||
#include <sys/mman.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/dma-buf.h>
|
||||
#include <drm/drm_fourcc.h>
|
||||
#include <drm_fourcc.h>
|
||||
#include <epoxy/egl.h>
|
||||
#endif
|
||||
|
||||
@@ -129,7 +129,7 @@ gdk_dmabuf_texture_new_from_builder (GdkDmabufTextureBuilder *builder,
|
||||
gpointer data,
|
||||
GError **error)
|
||||
{
|
||||
#ifdef HAVE_LINUX_DMA_BUF_H
|
||||
#ifdef HAVE_DMABUF
|
||||
GdkDmabufTexture *self;
|
||||
GdkTexture *update_texture;
|
||||
GdkDisplay *display;
|
||||
@@ -210,7 +210,7 @@ gdk_dmabuf_texture_new_from_builder (GdkDmabufTextureBuilder *builder,
|
||||
|
||||
return GDK_TEXTURE (self);
|
||||
|
||||
#else /* !HAVE_LINUX_DMA_BUF_H */
|
||||
#else /* !HAVE_DMABUF */
|
||||
g_set_error_literal (error, GDK_DMABUF_ERROR, GDK_DMABUF_ERROR_NOT_AVAILABLE,
|
||||
"dmabuf support disabled at compile-time.");
|
||||
return NULL;
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
#include "gdkdmabuftextureprivate.h"
|
||||
|
||||
#include <cairo-gobject.h>
|
||||
#ifdef HAVE_DMABUF
|
||||
#include <drm_fourcc.h>
|
||||
#endif
|
||||
|
||||
|
||||
struct _GdkDmabufTextureBuilder
|
||||
@@ -80,24 +83,36 @@ struct _GdkDmabufTextureBuilderClass
|
||||
* descriptor per plane.
|
||||
*
|
||||
* The format of the data (for graphics data, essentially its colorspace) is described
|
||||
* by a 32-bit integer. These format identifiers are defined in the header file
|
||||
* [drm/drm_fourcc.h](https://github.com/torvalds/linux/blob/master/include/uapi/drm/drm_fourcc.h)
|
||||
* by a 32-bit integer. These format identifiers are defined in the header file `drm_fourcc.h`
|
||||
* and commonly referred to as **_fourcc_** values, since they are identified by 4 ASCII
|
||||
* characters. Additionally, each DMA buffer has a **_modifier_**, which is a 64-bit integer
|
||||
* that describes driver-specific details of the memory layout, such as tiling or compression.
|
||||
*
|
||||
* For historical reasons, some producers of dma-bufs don't provide an explicit modifier, but
|
||||
* instead return `DMA_FORMAT_MOD_INVALID` to indicate that their modifier is **_impliict_**.
|
||||
* GTK tries to accomodate this situation by accepting `DMA_FORMAT_MOD_INVALID` as modifier.
|
||||
*
|
||||
* The operation of `GdkDmabufTextureBuilder` is quite simple: Create a texture builder,
|
||||
* set all the necessary properties, and then call [method@Gdk.DmabufTextureBuilder.build]
|
||||
* to create the new texture.
|
||||
*
|
||||
* The required properties for a dma-buf texture are
|
||||
* - The width and height in pixels
|
||||
* - The `fourcc` code and `modifier` which identify the format and memory layout of the dma-buf
|
||||
* - The file descriptor, offset and stride for each of the planes
|
||||
*
|
||||
* * The width and height in pixels
|
||||
*
|
||||
* * The `fourcc` code and `modifier` which identify the format and memory layout of the dma-buf
|
||||
*
|
||||
* * The file descriptor, offset and stride for each of the planes
|
||||
*
|
||||
* `GdkDmabufTextureBuilder` can be used for quick one-shot construction of
|
||||
* textures as well as kept around and reused to construct multiple textures.
|
||||
*
|
||||
* For further information, see
|
||||
*
|
||||
* * The Linux kernel [documentation](https://docs.kernel.org/driver-api/dma-buf.html)
|
||||
*
|
||||
* * The header file [drm_fourcc.h](https://gitlab.freedesktop.org/mesa/drm/-/blob/main/include/drm/drm_fourcc.h)
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
|
||||
@@ -246,7 +261,7 @@ gdk_dmabuf_texture_builder_class_init (GdkDmabufTextureBuilderClass *klass)
|
||||
gobject_class->set_property = gdk_dmabuf_texture_builder_set_property;
|
||||
|
||||
/**
|
||||
* GdkDmabufTextureBuilder:display: (attributes org.gdk.Property.get=gdk_dmabuf_texture_builder_get_display org.gdk.Property.set=gdk_dmabuf_texture_builder_set_display)
|
||||
* GdkDmabufTextureBuilder:display: (attributes org.gtk.Property.get=gdk_dmabuf_texture_builder_get_display org.gtk.Property.set=gdk_dmabuf_texture_builder_set_display)
|
||||
*
|
||||
* The display that this texture will be used on.
|
||||
*
|
||||
@@ -258,7 +273,7 @@ gdk_dmabuf_texture_builder_class_init (GdkDmabufTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDmabufTextureBuilder:width: (attributes org.gdk.Property.get=gdk_dmabuf_texture_builder_get_width org.gdk.Property.set=gdk_dmabuf_texture_builder_set_width)
|
||||
* GdkDmabufTextureBuilder:width: (attributes org.gtk.Property.get=gdk_dmabuf_texture_builder_get_width org.gtk.Property.set=gdk_dmabuf_texture_builder_set_width)
|
||||
*
|
||||
* The width of the texture.
|
||||
*
|
||||
@@ -270,7 +285,7 @@ gdk_dmabuf_texture_builder_class_init (GdkDmabufTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDmabufTextureBuilder:height: (attributes org.gdk.Property.get=gdk_dmabuf_texture_builder_get_height org.gdk.Property.set=gdk_dmabuf_texture_builder_set_height)
|
||||
* GdkDmabufTextureBuilder:height: (attributes org.gtk.Property.get=gdk_dmabuf_texture_builder_get_height org.gtk.Property.set=gdk_dmabuf_texture_builder_set_height)
|
||||
*
|
||||
* The height of the texture.
|
||||
*
|
||||
@@ -282,7 +297,7 @@ gdk_dmabuf_texture_builder_class_init (GdkDmabufTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDmabufTextureBuilder:fourcc: (attributes org.gdk.Property.get=gdk_dmabuf_texture_builder_get_fourcc org.gdk.Property.set=gdk_dmabuf_texture_builder_set_fourcc)
|
||||
* GdkDmabufTextureBuilder:fourcc: (attributes org.gtk.Property.get=gdk_dmabuf_texture_builder_get_fourcc org.gtk.Property.set=gdk_dmabuf_texture_builder_set_fourcc)
|
||||
*
|
||||
* The format of the texture, as a fourcc value.
|
||||
*
|
||||
@@ -320,7 +335,7 @@ gdk_dmabuf_texture_builder_class_init (GdkDmabufTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDmabufTextureBuilder:n-planes: (attributes org.gdk.Property.get=gdk_dmabuf_texture_builder_get_n_planes org.gdk.Property.set=gdk_dmabuf_texture_builder_set_n_planes)
|
||||
* GdkDmabufTextureBuilder:n-planes: (attributes org.gtk.Property.get=gdk_dmabuf_texture_builder_get_n_planes org.gtk.Property.set=gdk_dmabuf_texture_builder_set_n_planes)
|
||||
*
|
||||
* The number of planes of the texture.
|
||||
*
|
||||
@@ -335,7 +350,7 @@ gdk_dmabuf_texture_builder_class_init (GdkDmabufTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDmabufTextureBuilder:update-region: (attributes org.gdk.Property.get=gdk_dmabuf_texture_builder_get_update_region org.gdk.Property.set=gdk_dmabuf_texture_builder_set_update_region)
|
||||
* GdkDmabufTextureBuilder:update-region: (attributes org.gtk.Property.get=gdk_dmabuf_texture_builder_get_update_region org.gtk.Property.set=gdk_dmabuf_texture_builder_set_update_region)
|
||||
*
|
||||
* The update region for [property@Gdk.GLTextureBuilder:update-texture].
|
||||
*
|
||||
@@ -347,9 +362,9 @@ gdk_dmabuf_texture_builder_class_init (GdkDmabufTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDmabufTextureBuilder:update-texture: (attributes org.gdk.Property.get=gdk_dmabuf_texture_builder_get_update_texture org.gdk.Property.set=gdk_dmabuf_texture_builder_set_update_texture)
|
||||
* GdkDmabufTextureBuilder:update-texture: (attributes org.gtk.Property.get=gdk_dmabuf_texture_builder_get_update_texture org.gtk.Property.set=gdk_dmabuf_texture_builder_set_update_texture)
|
||||
*
|
||||
* The texture [property@Gdk.GLTextureBuilder:update-region] is an update for.
|
||||
* The texture [property@Gdk.DmabufTextureBuilder:update-region] is an update for.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
@@ -431,7 +446,7 @@ gdk_dmabuf_texture_builder_set_display (GdkDmabufTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_get_width: (attributes org.gdk.Method.get_property=width)
|
||||
* gdk_dmabuf_texture_builder_get_width: (attributes org.gtk.Method.get_property=width)
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
*
|
||||
* Gets the width previously set via gdk_dmabuf_texture_builder_set_width() or
|
||||
@@ -450,7 +465,7 @@ gdk_dmabuf_texture_builder_get_width (GdkDmabufTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_set_width: (attributes org.gdk.Method.set_property=width)
|
||||
* gdk_dmabuf_texture_builder_set_width: (attributes org.gtk.Method.set_property=width)
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
* @width: The texture's width or 0 to unset
|
||||
*
|
||||
@@ -475,7 +490,7 @@ gdk_dmabuf_texture_builder_set_width (GdkDmabufTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_get_height: (attributes org.gdk.Method.get_property=height)
|
||||
* gdk_dmabuf_texture_builder_get_height: (attributes org.gtk.Method.get_property=height)
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
*
|
||||
* Gets the height previously set via gdk_dmabuf_texture_builder_set_height() or
|
||||
@@ -494,7 +509,7 @@ gdk_dmabuf_texture_builder_get_height (GdkDmabufTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_set_height: (attributes org.gdk.Method.set_property=height)
|
||||
* gdk_dmabuf_texture_builder_set_height: (attributes org.gtk.Method.set_property=height)
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
* @height: the texture's height or 0 to unset
|
||||
*
|
||||
@@ -519,7 +534,7 @@ gdk_dmabuf_texture_builder_set_height (GdkDmabufTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_get_fourcc: (attributes org.gdk.Method.get_property=fourcc)
|
||||
* gdk_dmabuf_texture_builder_get_fourcc: (attributes org.gtk.Method.get_property=fourcc)
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
*
|
||||
* Gets the format previously set via gdk_dmabuf_texture_builder_set_fourcc()
|
||||
@@ -540,7 +555,7 @@ gdk_dmabuf_texture_builder_get_fourcc (GdkDmabufTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_set_fourcc: (attributes org.gdk.Method.set_property=fourcc)
|
||||
* gdk_dmabuf_texture_builder_set_fourcc: (attributes org.gtk.Method.set_property=fourcc)
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
* @fourcc: the texture's format or 0 to unset
|
||||
*
|
||||
@@ -608,7 +623,7 @@ gdk_dmabuf_texture_builder_set_modifier (GdkDmabufTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_get_n_planes: (attributes org.gdk.Method.get_property=n-planes)
|
||||
* gdk_dmabuf_texture_builder_get_n_planes: (attributes org.gtk.Method.get_property=n-planes)
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
*
|
||||
* Gets the number of planes.
|
||||
@@ -670,7 +685,7 @@ gdk_dmabuf_texture_builder_set_premultiplied (GdkDmabufTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_set_n_planes: (attributes org.gdk.Method.set_property=n-planes)
|
||||
* gdk_dmabuf_texture_builder_set_n_planes: (attributes org.gtk.Method.set_property=n-planes)
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
* @n_planes: the number of planes
|
||||
*
|
||||
@@ -831,7 +846,7 @@ gdk_dmabuf_texture_builder_set_offset (GdkDmabufTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_get_update_texture: (attributes org.gdk.Method.get_property=update_texture)
|
||||
* gdk_dmabuf_texture_builder_get_update_texture: (attributes org.gtk.Method.get_property=update-texture)
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
*
|
||||
* Gets the texture previously set via gdk_dmabuf_texture_builder_set_update_texture() or
|
||||
@@ -850,7 +865,7 @@ gdk_dmabuf_texture_builder_get_update_texture (GdkDmabufTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_set_update_texture: (attributes org.gdk.Method.set_property=update_texture)
|
||||
* gdk_dmabuf_texture_builder_set_update_texture: (attributes org.gtk.Method.set_property=update-texture)
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
* @texture: (nullable): the texture to update
|
||||
*
|
||||
@@ -873,7 +888,7 @@ gdk_dmabuf_texture_builder_set_update_texture (GdkDmabufTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_get_update_region: (attributes org.gdk.Method.get_property=update_region)
|
||||
* gdk_dmabuf_texture_builder_get_update_region: (attributes org.gtk.Method.get_property=update-region)
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
*
|
||||
* Gets the region previously set via gdk_dmabuf_texture_builder_set_update_region() or
|
||||
@@ -892,7 +907,7 @@ gdk_dmabuf_texture_builder_get_update_region (GdkDmabufTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_set_update_region: (attributes org.gdk.Method.set_property=update_region)
|
||||
* gdk_dmabuf_texture_builder_set_update_region: (attributes org.gtk.Method.set_property=update-region)
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
* @region: (nullable): the region to update
|
||||
*
|
||||
|
||||
@@ -402,7 +402,6 @@ gdk_event_alloc (GdkEventType event_type,
|
||||
|
||||
GdkEvent *event = (GdkEvent *) g_type_create_instance (gdk_event_types[event_type]);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DEBUG_CHECK (EVENTS))
|
||||
{
|
||||
char *str = g_enum_to_string (GDK_TYPE_EVENT_TYPE, event_type);
|
||||
@@ -410,7 +409,6 @@ gdk_event_alloc (GdkEventType event_type,
|
||||
g_type_name (gdk_event_types[event_type]), str);
|
||||
g_free (str);
|
||||
}
|
||||
#endif
|
||||
|
||||
event->event_type = event_type;
|
||||
event->surface = surface != NULL ? g_object_ref (surface) : NULL;
|
||||
|
||||
@@ -531,8 +531,6 @@ gdk_frame_clock_get_current_timings (GdkFrameClock *frame_clock)
|
||||
return gdk_frame_clock_get_timings (frame_clock, priv->frame_counter);
|
||||
}
|
||||
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
void
|
||||
_gdk_frame_clock_debug_print_timings (GdkFrameClock *clock,
|
||||
GdkFrameTimings *timings)
|
||||
@@ -579,7 +577,6 @@ _gdk_frame_clock_debug_print_timings (GdkFrameClock *clock,
|
||||
g_message ("%s", str->str);
|
||||
g_string_free (str, TRUE);
|
||||
}
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
#define DEFAULT_REFRESH_INTERVAL 16667 /* 16.7ms (1/60th second) */
|
||||
#define MAX_HISTORY_AGE 150000 /* 150ms */
|
||||
|
||||
@@ -585,14 +585,12 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
|
||||
{
|
||||
int iter;
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DEBUG_CHECK (FRAMES))
|
||||
{
|
||||
if (priv->phase != GDK_FRAME_CLOCK_PHASE_LAYOUT &&
|
||||
(priv->requested & GDK_FRAME_CLOCK_PHASE_LAYOUT))
|
||||
timings->layout_start_time = g_get_monotonic_time ();
|
||||
}
|
||||
#endif
|
||||
|
||||
priv->phase = GDK_FRAME_CLOCK_PHASE_LAYOUT;
|
||||
/* We loop in the layout phase, because we don't want to progress
|
||||
@@ -616,14 +614,12 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
case GDK_FRAME_CLOCK_PHASE_PAINT:
|
||||
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DEBUG_CHECK (FRAMES))
|
||||
{
|
||||
if (priv->phase != GDK_FRAME_CLOCK_PHASE_PAINT &&
|
||||
(priv->requested & GDK_FRAME_CLOCK_PHASE_PAINT))
|
||||
timings->paint_start_time = g_get_monotonic_time ();
|
||||
}
|
||||
#endif
|
||||
|
||||
priv->phase = GDK_FRAME_CLOCK_PHASE_PAINT;
|
||||
if (priv->requested & GDK_FRAME_CLOCK_PHASE_PAINT)
|
||||
@@ -643,13 +639,11 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
*/
|
||||
priv->phase = GDK_FRAME_CLOCK_PHASE_NONE;
|
||||
}
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DEBUG_CHECK (FRAMES))
|
||||
{
|
||||
if (timings)
|
||||
timings->frame_end_time = g_get_monotonic_time ();
|
||||
}
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
G_GNUC_FALLTHROUGH;
|
||||
|
||||
case GDK_FRAME_CLOCK_PHASE_RESUME_EVENTS:
|
||||
|
||||
@@ -95,11 +95,9 @@ struct _GdkFrameTimings
|
||||
gint64 refresh_interval;
|
||||
gint64 predicted_presentation_time;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
gint64 layout_start_time;
|
||||
gint64 paint_start_time;
|
||||
gint64 frame_end_time;
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
guint complete : 1;
|
||||
guint slept_before : 1;
|
||||
|
||||
+266
-2
@@ -83,6 +83,7 @@
|
||||
#include "gdkmemorytextureprivate.h"
|
||||
#include "gdkprofilerprivate.h"
|
||||
#include "gdkglversionprivate.h"
|
||||
#include "gdkdmabufformatsprivate.h"
|
||||
|
||||
#include "gdkprivate.h"
|
||||
|
||||
@@ -95,6 +96,10 @@
|
||||
#include <epoxy/egl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DMABUF
|
||||
#include <drm_fourcc.h>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#define DEFAULT_ALLOWED_APIS GDK_GL_API_GL | GDK_GL_API_GLES
|
||||
@@ -1558,7 +1563,6 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
|
||||
epoxy_has_gl_extension ("GL_ARB_sync") ||
|
||||
epoxy_has_gl_extension ("GL_APPLE_sync");
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
{
|
||||
int max_texture_size;
|
||||
glGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_texture_size);
|
||||
@@ -1583,7 +1587,6 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
|
||||
priv->has_sync ? "yes" : "no",
|
||||
priv->has_bgra ? "yes" : "no");
|
||||
}
|
||||
#endif
|
||||
|
||||
priv->extensions_checked = TRUE;
|
||||
}
|
||||
@@ -1977,3 +1980,264 @@ gdk_gl_backend_use (GdkGLBackend backend_type)
|
||||
|
||||
g_assert (the_gl_backend_type == backend_type);
|
||||
}
|
||||
|
||||
static guint
|
||||
gdk_gl_context_import_dmabuf_for_target (GdkGLContext *self,
|
||||
int width,
|
||||
int height,
|
||||
const GdkDmabuf *dmabuf,
|
||||
int target)
|
||||
{
|
||||
#if defined(HAVE_EGL) && defined(HAVE_DMABUF)
|
||||
GdkDisplay *display = gdk_gl_context_get_display (self);
|
||||
EGLDisplay egl_display = gdk_display_get_egl_display (display);
|
||||
EGLint attribs[64];
|
||||
int i;
|
||||
EGLImage image;
|
||||
guint texture_id;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_GL_CONTEXT (self), 0);
|
||||
g_return_val_if_fail (width > 0, 0);
|
||||
g_return_val_if_fail (height > 0, 0);
|
||||
g_return_val_if_fail (1 <= dmabuf->n_planes && dmabuf->n_planes <= 4, 0);
|
||||
g_return_val_if_fail (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES, 0);
|
||||
|
||||
if (egl_display == EGL_NO_DISPLAY || !display->have_egl_dma_buf_import)
|
||||
return 0;
|
||||
|
||||
GDK_DEBUG (DMABUF,
|
||||
"Importing dmabuf (format: %.4s:%#" G_GINT64_MODIFIER "x, planes: %u) into GL",
|
||||
(char *) &dmabuf->fourcc, dmabuf->modifier, dmabuf->n_planes);
|
||||
|
||||
i = 0;
|
||||
attribs[i++] = EGL_IMAGE_PRESERVED_KHR;
|
||||
attribs[i++] = EGL_TRUE;
|
||||
attribs[i++] = EGL_WIDTH;
|
||||
attribs[i++] = width;
|
||||
attribs[i++] = EGL_HEIGHT;
|
||||
attribs[i++] = height;
|
||||
attribs[i++] = EGL_LINUX_DRM_FOURCC_EXT;
|
||||
attribs[i++] = dmabuf->fourcc;
|
||||
attribs[i++] = EGL_YUV_COLOR_SPACE_HINT_EXT;
|
||||
attribs[i++] = EGL_ITU_REC601_EXT;
|
||||
attribs[i++] = EGL_SAMPLE_RANGE_HINT_EXT;
|
||||
attribs[i++] = EGL_YUV_FULL_RANGE_EXT;
|
||||
|
||||
#define ADD_PLANE(plane) \
|
||||
{ \
|
||||
if (dmabuf->modifier != DRM_FORMAT_MOD_INVALID) \
|
||||
{ \
|
||||
attribs[i++] = EGL_DMA_BUF_PLANE## plane ##_MODIFIER_LO_EXT; \
|
||||
attribs[i++] = dmabuf->modifier & 0xFFFFFFFF; \
|
||||
attribs[i++] = EGL_DMA_BUF_PLANE## plane ## _MODIFIER_HI_EXT; \
|
||||
attribs[i++] = dmabuf->modifier >> 32; \
|
||||
} \
|
||||
attribs[i++] = EGL_DMA_BUF_PLANE## plane ##_FD_EXT; \
|
||||
attribs[i++] = dmabuf->planes[plane].fd; \
|
||||
attribs[i++] = EGL_DMA_BUF_PLANE## plane ##_PITCH_EXT; \
|
||||
attribs[i++] = dmabuf->planes[plane].stride; \
|
||||
attribs[i++] = EGL_DMA_BUF_PLANE## plane ##_OFFSET_EXT; \
|
||||
attribs[i++] = dmabuf->planes[plane].offset; \
|
||||
}
|
||||
|
||||
ADD_PLANE (0);
|
||||
|
||||
if (dmabuf->n_planes > 1) ADD_PLANE (1);
|
||||
if (dmabuf->n_planes > 2) ADD_PLANE (2);
|
||||
if (dmabuf->n_planes > 3) ADD_PLANE (3);
|
||||
|
||||
attribs[i++] = EGL_NONE;
|
||||
|
||||
image = eglCreateImageKHR (egl_display,
|
||||
EGL_NO_CONTEXT,
|
||||
EGL_LINUX_DMA_BUF_EXT,
|
||||
(EGLClientBuffer)NULL,
|
||||
attribs);
|
||||
|
||||
if (image == EGL_NO_IMAGE)
|
||||
{
|
||||
GDK_DEBUG (DMABUF, "Creating EGLImage for dmabuf failed: %#x", eglGetError ());
|
||||
return 0;
|
||||
}
|
||||
|
||||
glGenTextures (1, &texture_id);
|
||||
glBindTexture (target, texture_id);
|
||||
glEGLImageTargetTexture2DOES (target, image);
|
||||
glTexParameteri (target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri (target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
||||
eglDestroyImageKHR (egl_display, image);
|
||||
|
||||
return texture_id;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
guint
|
||||
gdk_gl_context_import_dmabuf (GdkGLContext *self,
|
||||
int width,
|
||||
int height,
|
||||
const GdkDmabuf *dmabuf,
|
||||
gboolean *external)
|
||||
{
|
||||
GdkDisplay *display = gdk_gl_context_get_display (self);
|
||||
guint texture_id;
|
||||
|
||||
gdk_display_init_dmabuf (display);
|
||||
|
||||
if (!gdk_dmabuf_formats_contains (display->egl_external_formats, dmabuf->fourcc, dmabuf->modifier))
|
||||
{
|
||||
texture_id = gdk_gl_context_import_dmabuf_for_target (self,
|
||||
width, height,
|
||||
dmabuf,
|
||||
GL_TEXTURE_2D);
|
||||
if (texture_id == 0)
|
||||
{
|
||||
GDK_DEBUG (DMABUF, "Failed import of %dx%d %.4s::%016llx",
|
||||
width, height,
|
||||
(char *) &dmabuf->fourcc, (long long unsigned) dmabuf->modifier);
|
||||
return 0;
|
||||
}
|
||||
|
||||
GDK_DEBUG (DMABUF, "Imported %dx%d %.4s::%016llx dmabuf as GL_TEXTURE_2D texture",
|
||||
width, height,
|
||||
(char *) &dmabuf->fourcc, (long long unsigned) dmabuf->modifier);
|
||||
*external = FALSE;
|
||||
return texture_id;
|
||||
}
|
||||
|
||||
if (!gdk_gl_context_get_use_es (self))
|
||||
{
|
||||
GDK_DEBUG (DMABUF, "Can't import external_only %.4s::%016llx outside of GLES",
|
||||
(char *) &dmabuf->fourcc, (long long unsigned) dmabuf->modifier);
|
||||
return 0;
|
||||
}
|
||||
|
||||
texture_id = gdk_gl_context_import_dmabuf_for_target (self,
|
||||
width, height,
|
||||
dmabuf,
|
||||
GL_TEXTURE_EXTERNAL_OES);
|
||||
if (texture_id == 0)
|
||||
{
|
||||
GDK_DEBUG (DMABUF, "Failed import of external_only %dx%d %.4s::%016llx dmabuf",
|
||||
width, height,
|
||||
(char *) &dmabuf->fourcc, (long long unsigned) dmabuf->modifier);
|
||||
return 0;
|
||||
}
|
||||
|
||||
GDK_DEBUG (DMABUF, "Imported %dx%d %.4s::%016llx dmabuf as GL_TEXTURE_EXTERNAL_OES texture",
|
||||
width, height,
|
||||
(char *) &dmabuf->fourcc, (long long unsigned) dmabuf->modifier);
|
||||
*external = TRUE;
|
||||
return texture_id;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_gl_context_export_dmabuf (GdkGLContext *self,
|
||||
unsigned int texture_id,
|
||||
GdkDmabuf *dmabuf)
|
||||
{
|
||||
#if defined(HAVE_EGL) && defined(HAVE_DMABUF)
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
|
||||
GdkDisplay *display = gdk_gl_context_get_display (self);
|
||||
EGLDisplay egl_display = gdk_display_get_egl_display (display);
|
||||
EGLContext egl_context = priv->egl_context;
|
||||
EGLint attribs[10];
|
||||
EGLImage image;
|
||||
gboolean result = FALSE;
|
||||
int i;
|
||||
int fourcc;
|
||||
int n_planes;
|
||||
guint64 modifier;
|
||||
int fds[GDK_DMABUF_MAX_PLANES];
|
||||
int strides[GDK_DMABUF_MAX_PLANES];
|
||||
int offsets[GDK_DMABUF_MAX_PLANES];
|
||||
|
||||
g_return_val_if_fail (GDK_IS_GL_CONTEXT (self), FALSE);
|
||||
g_return_val_if_fail (texture_id > 0, FALSE);
|
||||
g_return_val_if_fail (dmabuf != NULL, FALSE);
|
||||
|
||||
if (egl_display == EGL_NO_DISPLAY || !display->have_egl_dma_buf_export)
|
||||
return 0;
|
||||
|
||||
GDK_DEBUG (DMABUF, "Exporting GL texture to dmabuf");
|
||||
|
||||
i = 0;
|
||||
attribs[i++] = EGL_IMAGE_PRESERVED_KHR;
|
||||
attribs[i++] = EGL_TRUE;
|
||||
|
||||
attribs[i++] = EGL_NONE;
|
||||
|
||||
image = eglCreateImageKHR (egl_display,
|
||||
egl_context,
|
||||
EGL_GL_TEXTURE_2D_KHR,
|
||||
(EGLClientBuffer)GUINT_TO_POINTER (texture_id),
|
||||
attribs);
|
||||
|
||||
if (image == EGL_NO_IMAGE)
|
||||
{
|
||||
GDK_DEBUG (DMABUF, "Creating EGLImage for dmabuf failed: %#x", eglGetError ());
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!eglExportDMABUFImageQueryMESA (egl_display,
|
||||
image,
|
||||
&fourcc,
|
||||
&n_planes,
|
||||
&modifier))
|
||||
{
|
||||
GDK_DEBUG (DMABUF, "eglExportDMABUFImageQueryMESA failed: %#x", eglGetError ());
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (n_planes < 1 || n_planes > GDK_DMABUF_MAX_PLANES)
|
||||
{
|
||||
GDK_DEBUG (DMABUF, "dmabufs with %d planes are not supported", n_planes);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!eglExportDMABUFImageMESA (egl_display,
|
||||
image,
|
||||
fds,
|
||||
strides,
|
||||
offsets))
|
||||
{
|
||||
g_warning ("eglExportDMABUFImage failed: %#x", eglGetError ());
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (i = 0; i < n_planes; i++)
|
||||
{
|
||||
if (fds[i] == -1)
|
||||
{
|
||||
g_warning ("dmabuf plane %d has no file descriptor", i);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
dmabuf->fourcc = (guint32)fourcc;
|
||||
dmabuf->modifier = modifier;
|
||||
dmabuf->n_planes = n_planes;
|
||||
|
||||
for (i = 0; i < n_planes; i++)
|
||||
{
|
||||
dmabuf->planes[i].fd = fds[i];
|
||||
dmabuf->planes[i].stride = (int) strides[i];
|
||||
dmabuf->planes[i].offset = (int) offsets[i];
|
||||
}
|
||||
|
||||
GDK_DEBUG (DMABUF,
|
||||
"Exported GL texture to dmabuf (format: %.4s:%#" G_GINT64_MODIFIER "x, planes: %d)",
|
||||
(char *)&fourcc, modifier, n_planes);
|
||||
|
||||
result = TRUE;
|
||||
|
||||
out:
|
||||
eglDestroyImageKHR (egl_display, image);
|
||||
|
||||
return result;
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "gdkglcontext.h"
|
||||
#include "gdkdrawcontextprivate.h"
|
||||
#include "gdkglversionprivate.h"
|
||||
#include "gdkdmabufprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -163,5 +164,14 @@ gboolean gdk_gl_context_has_vertex_arrays (GdkGLContext
|
||||
|
||||
double gdk_gl_context_get_scale (GdkGLContext *self);
|
||||
|
||||
G_END_DECLS
|
||||
guint gdk_gl_context_import_dmabuf (GdkGLContext *self,
|
||||
int width,
|
||||
int height,
|
||||
const GdkDmabuf *dmabuf,
|
||||
gboolean *external);
|
||||
|
||||
gboolean gdk_gl_context_export_dmabuf (GdkGLContext *self,
|
||||
unsigned int texture_id,
|
||||
GdkDmabuf *dmabuf);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
+27
-27
@@ -213,7 +213,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
gobject_class->set_property = gdk_gl_texture_builder_set_property;
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:context: (attributes org.gdk.Property.get=gdk_gl_texture_builder_get_context org.gdk.Property.set=gdk_gl_texture_builder_set_context)
|
||||
* GdkGLTextureBuilder:context: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_context org.gtk.Property.set=gdk_gl_texture_builder_set_context)
|
||||
*
|
||||
* The context owning the texture.
|
||||
*
|
||||
@@ -225,7 +225,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:format: (attributes org.gdk.Property.get=gdk_gl_texture_builder_get_format org.gdk.Property.set=gdk_gl_texture_builder_set_format)
|
||||
* GdkGLTextureBuilder:format: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_format org.gtk.Property.set=gdk_gl_texture_builder_set_format)
|
||||
*
|
||||
* The format when downloading the texture.
|
||||
*
|
||||
@@ -238,7 +238,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:has-mipmap: (attributes org.gdk.Property.get=gdk_gl_texture_builder_get_has_mipmap org.gdk.Property.set=gdk_gl_texture_builder_set_has_mipmap)
|
||||
* GdkGLTextureBuilder:has-mipmap: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_has_mipmap org.gtk.Property.set=gdk_gl_texture_builder_set_has_mipmap)
|
||||
*
|
||||
* If the texture has a mipmap.
|
||||
*
|
||||
@@ -250,7 +250,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:height: (attributes org.gdk.Property.get=gdk_gl_texture_builder_get_height org.gdk.Property.set=gdk_gl_texture_builder_set_height)
|
||||
* GdkGLTextureBuilder:height: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_height org.gtk.Property.set=gdk_gl_texture_builder_set_height)
|
||||
*
|
||||
* The height of the texture.
|
||||
*
|
||||
@@ -262,7 +262,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:id: (attributes org.gdk.Property.get=gdk_gl_texture_builder_get_id org.gdk.Property.set=gdk_gl_texture_builder_set_id)
|
||||
* GdkGLTextureBuilder:id: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_id org.gtk.Property.set=gdk_gl_texture_builder_set_id)
|
||||
*
|
||||
* The texture ID to use.
|
||||
*
|
||||
@@ -274,7 +274,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:sync: (attributes org.gdk.Property.get=gdk_gl_texture_builder_get_sync org.gdk.Property.set=gdk_gl_texture_builder_set_sync)
|
||||
* GdkGLTextureBuilder:sync: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_sync org.gtk.Property.set=gdk_gl_texture_builder_set_sync)
|
||||
*
|
||||
* An optional `GLSync` object.
|
||||
*
|
||||
@@ -287,7 +287,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:update-region: (attributes org.gdk.Property.get=gdk_gl_texture_builder_get_update_region org.gdk.Property.set=gdk_gl_texture_builder_set_update_region)
|
||||
* GdkGLTextureBuilder:update-region: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_update_region org.gtk.Property.set=gdk_gl_texture_builder_set_update_region)
|
||||
*
|
||||
* The update region for [property@Gdk.GLTextureBuilder:update-texture].
|
||||
*
|
||||
@@ -299,7 +299,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:update-texture: (attributes org.gdk.Property.get=gdk_gl_texture_builder_get_update_texture org.gdk.Property.set=gdk_gl_texture_builder_set_update_texture)
|
||||
* GdkGLTextureBuilder:update-texture: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_update_texture org.gtk.Property.set=gdk_gl_texture_builder_set_update_texture)
|
||||
*
|
||||
* The texture [property@Gdk.GLTextureBuilder:update-region] is an update for.
|
||||
*
|
||||
@@ -311,7 +311,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:width: (attributes org.gdk.Property.get=gdk_gl_texture_builder_get_width org.gdk.Property.set=gdk_gl_texture_builder_set_width)
|
||||
* GdkGLTextureBuilder:width: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_width org.gtk.Property.set=gdk_gl_texture_builder_set_width)
|
||||
*
|
||||
* The width of the texture.
|
||||
*
|
||||
@@ -347,7 +347,7 @@ gdk_gl_texture_builder_new (void)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_context: (attributes org.gdk.Method.get_property=context)
|
||||
* gdk_gl_texture_builder_get_context: (attributes org.gtk.Method.get_property=context)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets the context previously set via gdk_gl_texture_builder_set_context() or
|
||||
@@ -366,7 +366,7 @@ gdk_gl_texture_builder_get_context (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_context: (attributes org.gdk.Method.set_property=context)
|
||||
* gdk_gl_texture_builder_set_context: (attributes org.gtk.Method.set_property=context)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @context: (nullable): The context the texture beongs to or %NULL to unset
|
||||
*
|
||||
@@ -391,7 +391,7 @@ gdk_gl_texture_builder_set_context (GdkGLTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_height: (attributes org.gdk.Method.get_property=height)
|
||||
* gdk_gl_texture_builder_get_height: (attributes org.gtk.Method.get_property=height)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets the height previously set via gdk_gl_texture_builder_set_height() or
|
||||
@@ -410,7 +410,7 @@ gdk_gl_texture_builder_get_height (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_height: (attributes org.gdk.Method.set_property=height)
|
||||
* gdk_gl_texture_builder_set_height: (attributes org.gtk.Method.set_property=height)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @height: The texture's height or 0 to unset
|
||||
*
|
||||
@@ -435,7 +435,7 @@ gdk_gl_texture_builder_set_height (GdkGLTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_id: (attributes org.gdk.Method.get_property=id)
|
||||
* gdk_gl_texture_builder_get_id: (attributes org.gtk.Method.get_property=id)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets the texture id previously set via gdk_gl_texture_builder_set_id() or
|
||||
@@ -454,7 +454,7 @@ gdk_gl_texture_builder_get_id (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_id: (attributes org.gdk.Method.set_property=id)
|
||||
* gdk_gl_texture_builder_set_id: (attributes org.gtk.Method.set_property=id)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @id: The texture id to be used for creating the texture
|
||||
*
|
||||
@@ -481,7 +481,7 @@ gdk_gl_texture_builder_set_id (GdkGLTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_width: (attributes org.gdk.Method.get_property=width)
|
||||
* gdk_gl_texture_builder_get_width: (attributes org.gtk.Method.get_property=width)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets the width previously set via gdk_gl_texture_builder_set_width() or
|
||||
@@ -500,7 +500,7 @@ gdk_gl_texture_builder_get_width (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_width: (attributes org.gdk.Method.set_property=width)
|
||||
* gdk_gl_texture_builder_set_width: (attributes org.gtk.Method.set_property=width)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @width: The texture's width or 0 to unset
|
||||
*
|
||||
@@ -525,7 +525,7 @@ gdk_gl_texture_builder_set_width (GdkGLTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_has_mipmap: (attributes org.gdk.Method.get_property=has-mipmap)
|
||||
* gdk_gl_texture_builder_get_has_mipmap: (attributes org.gtk.Method.get_property=has-mipmap)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets whether the texture has a mipmap.
|
||||
@@ -543,7 +543,7 @@ gdk_gl_texture_builder_get_has_mipmap (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_has_mipmap: (attributes org.gdk.Method.set_property=has-mipmap)
|
||||
* gdk_gl_texture_builder_set_has_mipmap: (attributes org.gtk.Method.set_property=has-mipmap)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @has_mipmap: Whether the texture has a mipmap
|
||||
*
|
||||
@@ -569,7 +569,7 @@ gdk_gl_texture_builder_set_has_mipmap (GdkGLTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_sync: (attributes org.gdk.Method.get_property=sync)
|
||||
* gdk_gl_texture_builder_get_sync: (attributes org.gtk.Method.get_property=sync)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets the `GLsync` previously set via gdk_gl_texture_builder_set_sync().
|
||||
@@ -587,7 +587,7 @@ gdk_gl_texture_builder_get_sync (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_sync: (attributes org.gdk.Method.set_property=sync)
|
||||
* gdk_gl_texture_builder_set_sync: (attributes org.gtk.Method.set_property=sync)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @sync: (nullable): the GLSync object
|
||||
*
|
||||
@@ -617,7 +617,7 @@ gdk_gl_texture_builder_set_sync (GdkGLTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_format: (attributes org.gdk.Method.get_property=format)
|
||||
* gdk_gl_texture_builder_get_format: (attributes org.gtk.Method.get_property=format)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets the format previously set via gdk_gl_texture_builder_set_format().
|
||||
@@ -635,7 +635,7 @@ gdk_gl_texture_builder_get_format (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_format: (attributes org.gdk.Method.set_property=format)
|
||||
* gdk_gl_texture_builder_set_format: (attributes org.gtk.Method.set_property=format)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @format: The texture's format
|
||||
*
|
||||
@@ -673,7 +673,7 @@ gdk_gl_texture_builder_set_format (GdkGLTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_update_texture: (attributes org.gdk.Method.get_property=update_texture)
|
||||
* gdk_gl_texture_builder_get_update_texture: (attributes org.gtk.Method.get_property=update-texture)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets the texture previously set via gdk_gl_texture_builder_set_update_texture() or
|
||||
@@ -692,7 +692,7 @@ gdk_gl_texture_builder_get_update_texture (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_update_texture: (attributes org.gdk.Method.set_property=update_texture)
|
||||
* gdk_gl_texture_builder_set_update_texture: (attributes org.gtk.Method.set_property=update-texture)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @texture: (nullable): the texture to update
|
||||
*
|
||||
@@ -715,7 +715,7 @@ gdk_gl_texture_builder_set_update_texture (GdkGLTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_update_region: (attributes org.gdk.Method.get_property=update_region)
|
||||
* gdk_gl_texture_builder_get_update_region: (attributes org.gtk.Method.get_property=update-region)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets the region previously set via gdk_gl_texture_builder_set_update_region() or
|
||||
@@ -734,7 +734,7 @@ gdk_gl_texture_builder_get_update_region (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_update_region: (attributes org.gdk.Method.set_property=update_region)
|
||||
* gdk_gl_texture_builder_set_update_region: (attributes org.gtk.Method.set_property=update-region)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @region: (nullable): the region to update
|
||||
*
|
||||
|
||||
@@ -481,7 +481,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
G_ALIGNOF (guchar),
|
||||
GDK_MEMORY_U8,
|
||||
{ 0, 0, 0, 0 },
|
||||
{ GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
|
||||
{ GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||
r8g8b8_to_float,
|
||||
r8g8b8_from_float,
|
||||
},
|
||||
@@ -491,7 +491,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
G_ALIGNOF (guchar),
|
||||
GDK_MEMORY_U8,
|
||||
{ 0, 0, G_MAXUINT, G_MAXUINT },
|
||||
{ GL_RGB8, GL_BGR, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
|
||||
{ GL_RGB8, GL_BGR, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||
b8g8r8_to_float,
|
||||
b8g8r8_from_float,
|
||||
},
|
||||
@@ -501,7 +501,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
G_ALIGNOF (guint16),
|
||||
GDK_MEMORY_U16,
|
||||
{ 0, 0, 3, 0 },
|
||||
{ GL_RGB16, GL_RGB, GL_UNSIGNED_SHORT, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
|
||||
{ GL_RGB16, GL_RGB, GL_UNSIGNED_SHORT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||
r16g16b16_to_float,
|
||||
r16g16b16_from_float,
|
||||
},
|
||||
@@ -531,7 +531,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
G_ALIGNOF (guint16),
|
||||
GDK_MEMORY_FLOAT16,
|
||||
{ 0, 0, 3, 0 },
|
||||
{ GL_RGB16F, GL_RGB, GL_HALF_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
|
||||
{ GL_RGB16F, GL_RGB, GL_HALF_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||
r16g16b16_float_to_float,
|
||||
r16g16b16_float_from_float,
|
||||
},
|
||||
@@ -561,7 +561,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
G_ALIGNOF (float),
|
||||
GDK_MEMORY_FLOAT32,
|
||||
{ 0, 0, 3, 0 },
|
||||
{ GL_RGB32F, GL_RGB, GL_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
|
||||
{ GL_RGB32F, GL_RGB, GL_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||
r32g32b32_float_to_float,
|
||||
r32g32b32_float_from_float,
|
||||
},
|
||||
@@ -569,7 +569,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
16,
|
||||
G_ALIGNOF (float),
|
||||
TRUE,
|
||||
GDK_MEMORY_FLOAT32,
|
||||
{ 0, 0, 3, 0 },
|
||||
{ GL_RGBA32F, GL_RGBA, GL_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
|
||||
r32g32b32a32_float_to_float,
|
||||
|
||||
@@ -252,7 +252,6 @@ gdk_vulkan_strerror (VkResult result)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
static const char *
|
||||
surface_present_mode_to_string (VkPresentModeKHR present_mode)
|
||||
{
|
||||
@@ -275,7 +274,6 @@ surface_present_mode_to_string (VkPresentModeKHR present_mode)
|
||||
|
||||
return "(unknown)";
|
||||
}
|
||||
#endif
|
||||
|
||||
static const VkPresentModeKHR preferred_present_modes[] = {
|
||||
VK_PRESENT_MODE_MAILBOX_KHR,
|
||||
|
||||
@@ -180,7 +180,6 @@ typedef enum {
|
||||
POLLING_DESCRIPTORS,
|
||||
} SelectThreadState;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
static const char *const state_names[] = {
|
||||
"BEFORE_START",
|
||||
"WAITING",
|
||||
@@ -188,7 +187,6 @@ static const char *const state_names[] = {
|
||||
"POLLING_RESTART",
|
||||
"POLLING_DESCRIPTORS"
|
||||
};
|
||||
#endif
|
||||
|
||||
static SelectThreadState select_thread_state = BEFORE_START;
|
||||
|
||||
@@ -374,7 +372,6 @@ select_thread_start (void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
static void
|
||||
dump_poll_result (GPollFD *ufds,
|
||||
guint nfds)
|
||||
@@ -400,7 +397,6 @@ dump_poll_result (GPollFD *ufds,
|
||||
gdk_debug_message ("%s", s->str);
|
||||
g_string_free (s, TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
static gboolean
|
||||
pollfds_equal (GPollFD *old_pollfds,
|
||||
@@ -468,13 +464,11 @@ select_thread_start_poll (GPollFD *ufds,
|
||||
n_ready = old_poll_func (ufds, nfds, 0);
|
||||
if (n_ready > 0 || timeout == 0)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if ((_gdk_debug_flags & GDK_DEBUG_EVENTLOOP) && n_ready > 0)
|
||||
if (GDK_DEBUG_CHECK (EVENTLOOP) && n_ready > 0)
|
||||
{
|
||||
gdk_debug_message ("EventLoop: Found ready file descriptors before waiting");
|
||||
dump_poll_result (ufds, nfds);
|
||||
}
|
||||
#endif
|
||||
|
||||
return n_ready;
|
||||
}
|
||||
@@ -612,13 +606,11 @@ select_thread_collect_poll (GPollFD *ufds, guint nfds)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (_gdk_debug_flags & GDK_DEBUG_EVENTLOOP)
|
||||
if (GDK_DEBUG_CHECK (EVENTLOOP))
|
||||
{
|
||||
gdk_debug_message ("EventLoop: Found ready file descriptors after waiting");
|
||||
dump_poll_result (ufds, nfds);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
SELECT_THREAD_UNLOCK ();
|
||||
|
||||
@@ -18,6 +18,7 @@ gdk_public_sources = files([
|
||||
'gdkdisplay.c',
|
||||
'gdkdisplaymanager.c',
|
||||
'gdkdmabuf.c',
|
||||
'gdkdmabufegl.c',
|
||||
'gdkdmabufformats.c',
|
||||
'gdkdmabufformatsbuilder.c',
|
||||
'gdkdmabuftexture.c',
|
||||
@@ -216,6 +217,7 @@ gdk_deps = [
|
||||
platform_gio_dep,
|
||||
pangocairo_dep,
|
||||
vulkan_dep,
|
||||
dmabuf_dep,
|
||||
png_dep,
|
||||
tiff_dep,
|
||||
jpeg_dep,
|
||||
|
||||
@@ -225,14 +225,12 @@ gdk_wayland_clipboard_read_async (GdkClipboard *clipboard,
|
||||
g_task_set_priority (task, io_priority);
|
||||
g_task_set_source_tag (task, gdk_wayland_clipboard_read_async);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD))
|
||||
{
|
||||
char *s = gdk_content_formats_to_string (formats);
|
||||
gdk_debug_message ("%p: read for %s", cb, s);
|
||||
g_free (s);
|
||||
}
|
||||
#endif
|
||||
mime_type = gdk_content_formats_match_mime_type (formats, cb->offer_formats);
|
||||
if (mime_type == NULL)
|
||||
{
|
||||
@@ -322,14 +320,12 @@ gdk_wayland_clipboard_claim_remote (GdkWaylandClipboard *cb,
|
||||
|
||||
gdk_wayland_clipboard_discard_offer (cb);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD))
|
||||
{
|
||||
char *s = gdk_content_formats_to_string (formats);
|
||||
gdk_debug_message ("%p: remote clipboard claim for %s", cb, s);
|
||||
g_free (s);
|
||||
}
|
||||
#endif
|
||||
cb->offer_formats = formats;
|
||||
cb->offer = offer;
|
||||
|
||||
|
||||
@@ -267,8 +267,6 @@ postpone_on_globals_closure (GdkWaylandDisplay *display_wayland,
|
||||
g_list_append (display_wayland->on_has_globals_closures, closure);
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
|
||||
static const char *
|
||||
get_format_name (uint32_t format,
|
||||
char name[10])
|
||||
@@ -287,16 +285,13 @@ get_format_name (uint32_t format,
|
||||
return name;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
wl_shm_format (void *data,
|
||||
struct wl_shm *wl_shm,
|
||||
uint32_t format)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
char buf[10];
|
||||
#endif
|
||||
|
||||
GDK_DEBUG (MISC, "supported pixel format %s (0x%X)",
|
||||
get_format_name (format, buf), (guint) format);
|
||||
@@ -312,13 +307,11 @@ server_decoration_manager_default_mode (void
|
||||
uint32_t mode)
|
||||
{
|
||||
g_assert (mode <= ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_SERVER);
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
const char *modes[] = {
|
||||
[ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_NONE] = "none",
|
||||
[ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_CLIENT] = "client",
|
||||
[ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_SERVER] = "server",
|
||||
};
|
||||
#endif
|
||||
GdkWaylandDisplay *display_wayland = data;
|
||||
GDK_DISPLAY_DEBUG (GDK_DISPLAY (data), MISC, "Compositor prefers decoration mode '%s'", modes[mode]);
|
||||
display_wayland->server_decoration_mode = mode;
|
||||
@@ -2243,8 +2236,6 @@ gdk_wayland_display_get_setting (GdkDisplay *display,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
|
||||
static const char *
|
||||
subpixel_to_string (int layout)
|
||||
{
|
||||
@@ -2291,8 +2282,6 @@ transform_to_string (int transform)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
update_scale (GdkDisplay *display)
|
||||
{
|
||||
|
||||
@@ -340,14 +340,12 @@ gdk_wayland_drag_create_data_source (GdkDrag *drag)
|
||||
|
||||
mimetypes = gdk_content_formats_get_mime_types (formats, &n_mimetypes);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (gdk_drag_get_display (drag), EVENTS))
|
||||
{
|
||||
char *s = g_strjoinv (" ", (char **)mimetypes);
|
||||
gdk_debug_message ("create data source, mime types=%s", s);
|
||||
g_free (s);
|
||||
}
|
||||
#endif
|
||||
|
||||
wl_data_source_offer (drag_wayland->data_source, GDK_WAYLAND_LOCAL_DND_MIME_TYPE);
|
||||
for (i = 0; i < n_mimetypes; i++)
|
||||
|
||||
@@ -191,14 +191,12 @@ gdk_wayland_drop_read_async (GdkDrop *drop,
|
||||
g_task_set_priority (task, io_priority);
|
||||
g_task_set_source_tag (task, gdk_wayland_drop_read_async);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (gdk_drop_get_display (drop), DND))
|
||||
{
|
||||
char *s = gdk_content_formats_to_string (formats);
|
||||
gdk_debug_message ("%p: read for %s", drop, s);
|
||||
g_free (s);
|
||||
}
|
||||
#endif
|
||||
mime_type = gdk_content_formats_match_mime_type (formats,
|
||||
gdk_drop_get_formats (drop));
|
||||
if (mime_type == NULL)
|
||||
|
||||
@@ -75,7 +75,7 @@ gdk_wayland_gl_context_end_frame (GdkDrawContext *draw_context,
|
||||
WL_SURFACE_OFFSET_SINCE_VERSION)
|
||||
wl_surface_offset (impl->display_server.wl_surface, dx, dy);
|
||||
|
||||
/* We should do ths when setting up the EGLSurface, but we don't make_current then */
|
||||
/* We should do this when setting up the EGLSurface, but we don't make_current then */
|
||||
eglSwapInterval (gdk_display_get_egl_display (gdk_draw_context_get_display (draw_context)), 0);
|
||||
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_wayland_gl_context_parent_class)->end_frame (draw_context, painted);
|
||||
|
||||
@@ -495,7 +495,6 @@ static void
|
||||
print_modifiers (GdkDisplay *display,
|
||||
struct xkb_keymap *keymap)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
int i, j;
|
||||
uint32_t real;
|
||||
struct xkb_state *state;
|
||||
@@ -538,7 +537,6 @@ print_modifiers (GdkDisplay *display,
|
||||
g_string_free (str, TRUE);
|
||||
|
||||
xkb_state_unref (state);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -107,14 +107,12 @@ gdk_wayland_primary_claim_remote (GdkWaylandPrimary *cb,
|
||||
|
||||
gdk_wayland_primary_discard_offer (cb);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (gdk_clipboard_get_display (GDK_CLIPBOARD (cb)), CLIPBOARD))
|
||||
{
|
||||
char *s = gdk_content_formats_to_string (formats);
|
||||
gdk_debug_message ("%p: remote primary claim for %s", cb, s);
|
||||
g_free (s);
|
||||
}
|
||||
#endif
|
||||
|
||||
cb->offer_formats = formats;
|
||||
cb->offer = offer;
|
||||
@@ -270,14 +268,12 @@ gdk_wayland_primary_claim (GdkClipboard *clipboard,
|
||||
{
|
||||
GdkWaylandPrimary *cb = GDK_WAYLAND_PRIMARY (clipboard);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (gdk_clipboard_get_display (clipboard), CLIPBOARD))
|
||||
{
|
||||
char *s = gdk_content_formats_to_string (formats);
|
||||
gdk_debug_message ("%p: claim primary (%s) for %s", cb, local ? "local" : "remote", s);
|
||||
g_free (s);
|
||||
}
|
||||
#endif
|
||||
if (local)
|
||||
{
|
||||
GdkWaylandDisplay *wdisplay = GDK_WAYLAND_DISPLAY (gdk_clipboard_get_display (clipboard));
|
||||
@@ -328,14 +324,12 @@ gdk_wayland_primary_read_async (GdkClipboard *clipboard,
|
||||
g_task_set_priority (task, io_priority);
|
||||
g_task_set_source_tag (task, gdk_wayland_primary_read_async);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (gdk_clipboard_get_display (clipboard), CLIPBOARD))
|
||||
{
|
||||
char *s = gdk_content_formats_to_string (formats);
|
||||
gdk_debug_message ("%p: read for %s", cb, s);
|
||||
g_free (s);
|
||||
}
|
||||
#endif
|
||||
mime_type = gdk_content_formats_match_mime_type (formats, cb->offer_formats);
|
||||
if (mime_type == NULL)
|
||||
{
|
||||
|
||||
@@ -877,8 +877,6 @@ pointer_handle_button (void *data,
|
||||
gdk_wayland_seat_flush_frame_event (seat);
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
|
||||
static const char *
|
||||
get_axis_name (uint32_t axis)
|
||||
{
|
||||
@@ -893,8 +891,6 @@ get_axis_name (uint32_t axis)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
pointer_handle_axis (void *data,
|
||||
struct wl_pointer *pointer,
|
||||
@@ -943,8 +939,6 @@ pointer_handle_frame (void *data,
|
||||
gdk_wayland_seat_flush_frame_event (seat);
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
|
||||
static const char *
|
||||
get_axis_source_name (enum wl_pointer_axis_source source)
|
||||
{
|
||||
@@ -963,8 +957,6 @@ get_axis_source_name (enum wl_pointer_axis_source source)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
pointer_handle_axis_source (void *data,
|
||||
struct wl_pointer *pointer,
|
||||
@@ -1090,7 +1082,6 @@ get_active_layout (GdkKeymap *keymap)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
static const char *
|
||||
get_active_layout_name (GdkKeymap *keymap)
|
||||
{
|
||||
@@ -1100,7 +1091,6 @@ get_active_layout_name (GdkKeymap *keymap)
|
||||
|
||||
return xkb_keymap_layout_get_name (xkb_keymap, get_active_layout (keymap));
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
keyboard_handle_keymap (void *data,
|
||||
@@ -1126,7 +1116,6 @@ keyboard_handle_keymap (void *data,
|
||||
|
||||
_gdk_wayland_keymap_update_from_fd (seat->keymap, format, fd, size);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (seat->keymap->display, INPUT))
|
||||
{
|
||||
GString *s = g_string_new ("");
|
||||
@@ -1143,7 +1132,6 @@ keyboard_handle_keymap (void *data,
|
||||
gdk_debug_message ("layouts: %s", s->str);
|
||||
g_string_free (s, TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
g_signal_emit_by_name (seat->keymap, "keys-changed");
|
||||
g_signal_emit_by_name (seat->keymap, "state-changed");
|
||||
@@ -3435,9 +3423,7 @@ static void
|
||||
tablet_pad_group_handle_done (void *data,
|
||||
struct zwp_tablet_pad_group_v2 *wp_tablet_pad_group)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
GdkWaylandTabletPadGroupData *group = data;
|
||||
#endif
|
||||
|
||||
GDK_SEAT_DEBUG (group->pad->seat, EVENTS,
|
||||
"tablet pad group handle done, pad group = %p",
|
||||
|
||||
@@ -193,7 +193,7 @@ get_egl_window_size (GdkSurface *surface,
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
|
||||
if (gdk_display_get_debug_flags (display) & GDK_DEBUG_GL_FRACTIONAL)
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display, GL_FRACTIONAL))
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, OPENGL, "Using fractional scale %g for EGL window", gdk_fractional_scale_to_double (&impl->scale));
|
||||
|
||||
@@ -308,10 +308,8 @@ frame_callback (void *data,
|
||||
|
||||
timings->complete = TRUE;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if ((_gdk_debug_flags & GDK_DEBUG_FRAMES) != 0)
|
||||
_gdk_frame_clock_debug_print_timings (clock, timings);
|
||||
#endif
|
||||
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
_gdk_frame_clock_add_timings_to_profiler (clock, timings);
|
||||
|
||||
@@ -1228,8 +1228,7 @@ inner_clipboard_window_procedure (HWND hwnd,
|
||||
|
||||
GDK_NOTE (DND, g_print (" drawclipboard owner: %p; opener %p ", hwnd_owner, hwnd_opener));
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (_gdk_debug_flags & GDK_DEBUG_DND)
|
||||
if (GDK_DEBUG_CHECK (DND))
|
||||
{
|
||||
/* FIXME: grab and print clipboard formats without opening the clipboard
|
||||
if (clipboard_thread_data->clipboard_opened_for != INVALID_HANDLE_VALUE ||
|
||||
@@ -1249,7 +1248,6 @@ inner_clipboard_window_procedure (HWND hwnd,
|
||||
}
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
|
||||
GDK_NOTE (DND, g_print (" \n"));
|
||||
|
||||
|
||||
@@ -714,8 +714,6 @@ build_pointer_event_state (MSG *msg)
|
||||
return state;
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
|
||||
static void
|
||||
print_event_state (guint state)
|
||||
{
|
||||
@@ -860,8 +858,6 @@ decode_key_lparam (LPARAM lParam)
|
||||
return buf;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
fixup_event (GdkEvent *event)
|
||||
{
|
||||
@@ -2936,7 +2932,6 @@ gdk_event_translate (MSG *msg,
|
||||
break;
|
||||
|
||||
case WM_WINDOWPOSCHANGING:
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
{
|
||||
char buf[256];
|
||||
GDK_NOTE (EVENTS, (windowpos = (WINDOWPOS *) msg->lParam,
|
||||
@@ -2951,7 +2946,6 @@ gdk_event_translate (MSG *msg,
|
||||
windowpos->cx, windowpos->cy, windowpos->x, windowpos->y,
|
||||
GetNextWindow (msg->hwnd, GW_HWNDPREV))));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (GDK_SURFACE_IS_MAPPED (window))
|
||||
{
|
||||
@@ -2986,7 +2980,6 @@ gdk_event_translate (MSG *msg,
|
||||
case WM_WINDOWPOSCHANGED:
|
||||
windowpos = (WINDOWPOS *) msg->lParam;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
{
|
||||
char buf[256];
|
||||
GDK_NOTE (EVENTS, g_print (" %s %s %dx%d@%+d%+d",
|
||||
@@ -2999,7 +2992,6 @@ gdk_event_translate (MSG *msg,
|
||||
buf))))),
|
||||
windowpos->cx, windowpos->cy, windowpos->x, windowpos->y));
|
||||
}
|
||||
#endif
|
||||
|
||||
impl = GDK_WIN32_SURFACE (window);
|
||||
|
||||
|
||||
@@ -339,7 +339,6 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if G_ENABLE_DEBUG
|
||||
{
|
||||
int major, minor;
|
||||
gdk_gl_context_get_version (context, &major, &minor);
|
||||
@@ -357,7 +356,6 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
|
||||
display_win32->hasWglEXTSwapControl ? "yes" : "no",
|
||||
display_win32->hasWglOMLSyncControl ? "yes" : "no"));
|
||||
}
|
||||
#endif
|
||||
|
||||
wglMakeCurrent (NULL, NULL);
|
||||
|
||||
|
||||
@@ -125,8 +125,6 @@ _gdk_other_api_failed (const char *where,
|
||||
}
|
||||
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
|
||||
/*
|
||||
* Like g_strdup_printf, but to a static buffer. Return value does not
|
||||
* have to be g_free()d. The buffer is of bounded size and reused
|
||||
@@ -796,5 +794,3 @@ _gdk_win32_rect_to_string (const RECT *rect)
|
||||
(rect->right - rect->left), (rect->bottom - rect->top),
|
||||
rect->left, rect->top);
|
||||
}
|
||||
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
@@ -31,20 +31,12 @@
|
||||
|
||||
/* Old debug macros */
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
|
||||
#define GDK_NOTE(type,action) \
|
||||
G_STMT_START { \
|
||||
if (GDK_DEBUG_CHECK (type)) \
|
||||
{ action; }; \
|
||||
} G_STMT_END
|
||||
|
||||
#else
|
||||
|
||||
#define GDK_NOTE(type,action)
|
||||
|
||||
#endif
|
||||
|
||||
/* According to
|
||||
* http://blog.airesoft.co.uk/2009/11/wm_messages/
|
||||
* this is the actual internal name MS uses for this undocumented message.
|
||||
@@ -102,7 +94,6 @@ gboolean _gdk_modal_blocked (GdkSurface *window);
|
||||
gboolean gdk_win32_ensure_com (void);
|
||||
gboolean gdk_win32_ensure_ole (void);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
void _gdk_win32_print_dc (HDC hdc);
|
||||
|
||||
char *_gdk_win32_surface_state_to_string (GdkToplevelState state);
|
||||
@@ -117,7 +108,6 @@ char *_gdk_win32_cf_to_string (UINT format);
|
||||
char *_gdk_win32_rect_to_string (const RECT *rect);
|
||||
|
||||
void _gdk_win32_print_event (GdkEvent *event);
|
||||
#endif
|
||||
|
||||
void _gdk_win32_api_failed (const char *where,
|
||||
const char *api);
|
||||
|
||||
@@ -65,7 +65,6 @@ print_atoms (GdkX11Clipboard *cb,
|
||||
const Atom *atoms,
|
||||
gsize n_atoms)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
GdkDisplay *display = gdk_clipboard_get_display (GDK_CLIPBOARD (cb));
|
||||
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display, CLIPBOARD))
|
||||
@@ -82,7 +81,6 @@ print_atoms (GdkX11Clipboard *cb,
|
||||
gdk_debug_message ("%s", str->str);
|
||||
g_string_free (str, TRUE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -330,14 +328,12 @@ gdk_x11_clipboard_request_targets_finish (GObject *source_object,
|
||||
formats = gdk_x11_clipboard_formats_from_atoms (display,
|
||||
g_bytes_get_data (bytes, NULL),
|
||||
g_bytes_get_size (bytes) / sizeof (Atom));
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display, CLIPBOARD))
|
||||
{
|
||||
char *s = gdk_content_formats_to_string (formats);
|
||||
gdk_debug_message ("%s: got formats: %s", cb->selection, s);
|
||||
g_free (s);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* union with previously loaded formats */
|
||||
formats = gdk_content_formats_union (formats, gdk_clipboard_get_formats (GDK_CLIPBOARD (cb)));
|
||||
@@ -481,20 +477,16 @@ gdk_x11_clipboard_xevent (GdkDisplay *display,
|
||||
|
||||
case SelectionRequest:
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
const char *target, *property;
|
||||
#endif
|
||||
|
||||
if (xevent->xselectionrequest.selection != cb->xselection)
|
||||
return FALSE;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
target = gdk_x11_get_xatom_name_for_display (display, xevent->xselectionrequest.target);
|
||||
if (xevent->xselectionrequest.property == None)
|
||||
property = target;
|
||||
else
|
||||
property = gdk_x11_get_xatom_name_for_display (display, xevent->xselectionrequest.property);
|
||||
#endif
|
||||
|
||||
if (!gdk_clipboard_is_local (GDK_CLIPBOARD (cb)))
|
||||
{
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
static const char notify_modes[][19] = {
|
||||
"NotifyNormal",
|
||||
"NotifyGrab",
|
||||
@@ -57,7 +56,6 @@ static const char notify_details[][23] = {
|
||||
"NotifyPointerRoot",
|
||||
"NotifyDetailNone"
|
||||
};
|
||||
#endif
|
||||
|
||||
#define HAS_FOCUS(toplevel) \
|
||||
((toplevel)->has_focus || (toplevel)->has_pointer_focus)
|
||||
@@ -226,7 +224,6 @@ translate_valuator_class (GdkDisplay *display,
|
||||
}
|
||||
|
||||
_gdk_device_add_axis (device, use, min, max, resolution);
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display, INPUT))
|
||||
{
|
||||
const char *label;
|
||||
@@ -238,7 +235,6 @@ translate_valuator_class (GdkDisplay *display,
|
||||
|
||||
gdk_debug_message ("\n\taxis: %s %s", label, use == GDK_AXIS_IGNORE ? "(ignored)" : "(used)");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -521,7 +517,6 @@ create_device (GdkX11DeviceManagerXI2 *device_manager,
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display, INPUT))
|
||||
{
|
||||
const char *type_names[] = { "logical", "physical", "floating" };
|
||||
@@ -533,7 +528,6 @@ create_device (GdkX11DeviceManagerXI2 *device_manager,
|
||||
dev->use == XIMasterPointer,
|
||||
num_touches);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (dev->use != XIMasterKeyboard &&
|
||||
dev->use != XIMasterPointer)
|
||||
@@ -1919,7 +1913,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
GdkTouchpadGesturePhase phase;
|
||||
double x, y;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
const char *event_name = "";
|
||||
switch (xev->evtype)
|
||||
{
|
||||
@@ -1935,7 +1928,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
GDK_DEBUG (EVENTS, "pinch gesture %s:\twindow %ld\n\tfinger_count: %u%s",
|
||||
event_name,
|
||||
@@ -1979,7 +1971,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
GdkTouchpadGesturePhase phase;
|
||||
double x, y;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
const char *event_name = "";
|
||||
switch (xev->evtype)
|
||||
{
|
||||
@@ -1995,7 +1986,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
GDK_DEBUG (EVENTS, "swipe gesture %s:\twindow %ld\n\tfinger_count: %u%s",
|
||||
event_name,
|
||||
|
||||
@@ -745,7 +745,6 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
|
||||
break;
|
||||
|
||||
case VisibilityNotify:
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display, EVENTS))
|
||||
switch (xevent->xvisibility.state)
|
||||
{
|
||||
@@ -764,7 +763,6 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
/* not handled */
|
||||
break;
|
||||
|
||||
@@ -1229,13 +1227,11 @@ _gdk_wm_protocols_filter (const XEvent *xevent,
|
||||
timings->refresh_interval = refresh_interval;
|
||||
|
||||
timings->complete = TRUE;
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display, FRAMES))
|
||||
_gdk_frame_clock_debug_print_timings (clock, timings);
|
||||
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
_gdk_frame_clock_add_timings_to_profiler (clock, timings);
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1658,20 +1658,16 @@ gdk_x11_drag_xevent (GdkDisplay *display,
|
||||
case SelectionRequest:
|
||||
{
|
||||
GdkContentFormats *formats;
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
const char *target, *property;
|
||||
#endif
|
||||
|
||||
if (xevent->xselectionrequest.selection != xselection)
|
||||
return FALSE;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
target = gdk_x11_get_xatom_name_for_display (display, xevent->xselectionrequest.target);
|
||||
if (xevent->xselectionrequest.property == None)
|
||||
property = target;
|
||||
else
|
||||
property = gdk_x11_get_xatom_name_for_display (display, xevent->xselectionrequest.property);
|
||||
#endif
|
||||
|
||||
if (xevent->xselectionrequest.requestor == None)
|
||||
{
|
||||
|
||||
@@ -293,7 +293,6 @@ gdk_x11_drop_finalize (GObject *object)
|
||||
|
||||
/* Utility functions */
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
static void
|
||||
print_target_list (GdkContentFormats *formats)
|
||||
{
|
||||
@@ -301,7 +300,6 @@ print_target_list (GdkContentFormats *formats)
|
||||
g_message ("DND formats: %s", name);
|
||||
g_free (name);
|
||||
}
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
/*************************************************************
|
||||
***************************** XDND **************************
|
||||
@@ -411,7 +409,6 @@ gdk_x11_drop_read_actions (GdkDrop *drop)
|
||||
|
||||
drop_x11->xdnd_have_actions = TRUE;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display, DND))
|
||||
{
|
||||
GString *action_str = g_string_new (NULL);
|
||||
@@ -428,7 +425,6 @@ gdk_x11_drop_read_actions (GdkDrop *drop)
|
||||
g_message("Xdnd actions = %s", action_str->str);
|
||||
g_string_free (action_str, TRUE);
|
||||
}
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
}
|
||||
|
||||
if (data)
|
||||
@@ -555,10 +551,8 @@ xdnd_enter_filter (GdkSurface *surface,
|
||||
content_formats = gdk_content_formats_new ((const char **) formats->pdata, formats->len);
|
||||
g_ptr_array_unref (formats);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display, DND))
|
||||
print_target_list (content_formats);
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
drag = gdk_x11_drag_find (display, source_window, GDK_SURFACE_XID (surface));
|
||||
|
||||
|
||||
@@ -176,9 +176,7 @@ gdk_x11_selection_input_stream_read (GInputStream *input_stream,
|
||||
GError **error)
|
||||
{
|
||||
GdkX11SelectionInputStream *stream = GDK_X11_SELECTION_INPUT_STREAM (input_stream);
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
GdkX11SelectionInputStreamPrivate *priv = gdk_x11_selection_input_stream_get_instance_private (stream);
|
||||
#endif
|
||||
gssize written;
|
||||
|
||||
GDK_DISPLAY_DEBUG (priv->display, SELECTION,
|
||||
|
||||
@@ -653,7 +653,6 @@ print_atoms (GdkDisplay *display,
|
||||
const Atom *atoms,
|
||||
gsize n_atoms)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display, CLIPBOARD))
|
||||
{
|
||||
GString *str;
|
||||
@@ -666,7 +665,6 @@ print_atoms (GdkDisplay *display,
|
||||
gdk_debug_message ("%s", str->str);
|
||||
g_string_free (str, TRUE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -76,7 +76,8 @@ gsk_gl_attachment_state_bind_texture (GskGLAttachmentState *self,
|
||||
g_assert (self != NULL);
|
||||
g_assert (target == GL_TEXTURE_1D ||
|
||||
target == GL_TEXTURE_2D ||
|
||||
target == GL_TEXTURE_3D);
|
||||
target == GL_TEXTURE_3D ||
|
||||
target == GL_TEXTURE_EXTERNAL_OES);
|
||||
g_assert (texture >= GL_TEXTURE0 && texture <= GL_TEXTURE16);
|
||||
g_assert (texture - GL_TEXTURE0 < G_N_ELEMENTS (self->textures));
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@ typedef struct _GskGLBindFramebuffer GskGLBindFramebuffer;
|
||||
typedef struct _GskGLBindTexture GskGLBindTexture;
|
||||
|
||||
#define GSK_GL_N_FILTERS 3
|
||||
#define SAMPLER_EXTERNAL 9
|
||||
|
||||
G_STATIC_ASSERT (SAMPLER_EXTERNAL >= GSK_GL_N_FILTERS * GSK_GL_N_FILTERS);
|
||||
|
||||
static inline guint
|
||||
filter_index (GLint filter)
|
||||
|
||||
+34
-17
@@ -282,7 +282,10 @@ snapshot_attachments (const GskGLAttachmentState *state,
|
||||
{
|
||||
bind[count].id = state->textures[i].id;
|
||||
bind[count].texture = state->textures[i].texture;
|
||||
bind[count].sampler = state->textures[i].sampler;
|
||||
if (state->textures[i].target == GL_TEXTURE_EXTERNAL_OES)
|
||||
bind[count].sampler = SAMPLER_EXTERNAL;
|
||||
else
|
||||
bind[count].sampler = state->textures[i].sampler;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@@ -1057,10 +1060,8 @@ gsk_gl_command_queue_execute (GskGLCommandQueue *self,
|
||||
|
||||
gsk_gl_command_queue_make_current (self);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
gsk_gl_profiler_begin_gpu_region (self->gl_profiler);
|
||||
gsk_profiler_timer_begin (self->profiler, self->metrics.cpu_time);
|
||||
#endif
|
||||
|
||||
glEnable (GL_DEPTH_TEST);
|
||||
glDepthFunc (GL_LEQUAL);
|
||||
@@ -1190,12 +1191,23 @@ gsk_gl_command_queue_execute (GskGLCommandQueue *self,
|
||||
s->sync = NULL;
|
||||
}
|
||||
|
||||
glBindTexture (GL_TEXTURE_2D, bind->id);
|
||||
if (bind->sampler == SAMPLER_EXTERNAL)
|
||||
glBindTexture (GL_TEXTURE_EXTERNAL_OES, bind->id);
|
||||
else
|
||||
glBindTexture (GL_TEXTURE_2D, bind->id);
|
||||
textures[bind->texture] = bind->id;
|
||||
if (!self->has_samplers)
|
||||
{
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter_from_index (bind->sampler / GSK_GL_N_FILTERS));
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter_from_index (bind->sampler % GSK_GL_N_FILTERS));
|
||||
if (bind->sampler == SAMPLER_EXTERNAL)
|
||||
{
|
||||
glTexParameteri (GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri (GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
}
|
||||
else
|
||||
{
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter_from_index (bind->sampler / GSK_GL_N_FILTERS));
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter_from_index (bind->sampler % GSK_GL_N_FILTERS));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1205,8 +1217,16 @@ gsk_gl_command_queue_execute (GskGLCommandQueue *self,
|
||||
glBindSampler (bind->texture, self->samplers[bind->sampler]);
|
||||
else
|
||||
{
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter_from_index (bind->sampler / GSK_GL_N_FILTERS));
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter_from_index (bind->sampler % GSK_GL_N_FILTERS));
|
||||
if (bind->sampler == SAMPLER_EXTERNAL)
|
||||
{
|
||||
glTexParameteri (GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri (GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
}
|
||||
else
|
||||
{
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter_from_index (bind->sampler / GSK_GL_N_FILTERS));
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter_from_index (bind->sampler % GSK_GL_N_FILTERS));
|
||||
}
|
||||
}
|
||||
samplers[bind->texture] = bind->sampler;
|
||||
}
|
||||
@@ -1267,7 +1287,6 @@ gsk_gl_command_queue_execute (GskGLCommandQueue *self,
|
||||
gdk_profiler_set_int_counter (self->metrics.n_uploads, self->n_uploads);
|
||||
gdk_profiler_set_int_counter (self->metrics.queue_depth, self->batches.len);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
{
|
||||
gint64 start_time G_GNUC_UNUSED = gsk_profiler_timer_get_start (self->profiler, self->metrics.cpu_time);
|
||||
gint64 cpu_time = gsk_profiler_timer_end (self->profiler, self->metrics.cpu_time);
|
||||
@@ -1279,7 +1298,6 @@ gsk_gl_command_queue_execute (GskGLCommandQueue *self,
|
||||
|
||||
gsk_profiler_push_samples (self->profiler);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1324,7 +1342,7 @@ gsk_gl_command_queue_end_frame (GskGLCommandQueue *self)
|
||||
if (self->attachments->textures[i].id != 0)
|
||||
{
|
||||
glActiveTexture (GL_TEXTURE0 + i);
|
||||
glBindTexture (GL_TEXTURE_2D, 0);
|
||||
glBindTexture (self->attachments->textures[i].target, 0);
|
||||
|
||||
self->attachments->textures[i].id = 0;
|
||||
self->attachments->textures[i].changed = FALSE;
|
||||
@@ -1401,7 +1419,7 @@ gsk_gl_command_queue_create_texture (GskGLCommandQueue *self,
|
||||
|
||||
glActiveTexture (GL_TEXTURE0);
|
||||
glBindTexture (GL_TEXTURE_2D, texture_id);
|
||||
|
||||
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
@@ -1429,8 +1447,9 @@ gsk_gl_command_queue_create_texture (GskGLCommandQueue *self,
|
||||
}
|
||||
|
||||
/* Restore the previous texture if it was set */
|
||||
if (self->attachments->textures[0].id != 0)
|
||||
glBindTexture (GL_TEXTURE_2D, self->attachments->textures[0].id);
|
||||
if (self->attachments->textures[0].id != 0 &&
|
||||
self->attachments->textures[0].target == GL_TEXTURE_2D)
|
||||
glBindTexture (self->attachments->textures[0].target, self->attachments->textures[0].id);
|
||||
|
||||
return (int)texture_id;
|
||||
}
|
||||
@@ -1596,7 +1615,7 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self,
|
||||
/* Only apply swizzle if really needed, might not even be
|
||||
* supported if default values are set
|
||||
*/
|
||||
if (gl_swizzle[0] != GL_RED || gl_swizzle[1] != GL_GREEN || gl_swizzle[2] != GL_BLUE)
|
||||
if (gl_swizzle[0] != GL_RED || gl_swizzle[1] != GL_GREEN || gl_swizzle[2] != GL_BLUE || gl_swizzle[3] != GL_ALPHA)
|
||||
{
|
||||
/* Set each channel independently since GLES 3.0 doesn't support the iv method */
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, gl_swizzle[0]);
|
||||
@@ -1693,7 +1712,6 @@ void
|
||||
gsk_gl_command_queue_set_profiler (GskGLCommandQueue *self,
|
||||
GskProfiler *profiler)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
g_assert (GSK_IS_GL_COMMAND_QUEUE (self));
|
||||
g_assert (GSK_IS_PROFILER (profiler));
|
||||
|
||||
@@ -1712,5 +1730,4 @@ gsk_gl_command_queue_set_profiler (GskGLCommandQueue *self,
|
||||
self->metrics.n_programs = gdk_profiler_define_int_counter ("programs", "Number of program changes");
|
||||
self->metrics.queue_depth = gdk_profiler_define_int_counter ("gl-queue-depth", "Depth of GL command batches");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ typedef struct _GskGLCommandBind
|
||||
*/
|
||||
guint texture : 4;
|
||||
|
||||
/* the sampler to use. We set sampler to 15 to indicate external textures */
|
||||
guint sampler : 4;
|
||||
|
||||
/* The identifier for the texture created with glGenTextures(). */
|
||||
@@ -234,8 +235,13 @@ struct _GskGLCommandQueue
|
||||
|
||||
/* Array of samplers that we use for mag/min filter handling. It is indexed
|
||||
* by the sampler_index() function.
|
||||
*
|
||||
* Note that when samplers are not supported (hello GLES), we fall back to
|
||||
* setting the texture filter, but that needs to be done for every texture.
|
||||
*
|
||||
* Also note that we don't use all of these samplers since some combinations
|
||||
* are invalid. An index of SAMPLER_EXTERNAL is used to indicate an external
|
||||
* texture, which needs special sampler treatment.
|
||||
*/
|
||||
GLuint samplers[GSK_GL_N_FILTERS * GSK_GL_N_FILTERS];
|
||||
|
||||
|
||||
+15
-7
@@ -54,6 +54,7 @@ struct _GskGLCompiler
|
||||
|
||||
guint gl3 : 1;
|
||||
guint gles : 1;
|
||||
guint gles3 : 1;
|
||||
guint legacy : 1;
|
||||
guint debug_shaders : 1;
|
||||
};
|
||||
@@ -134,7 +135,10 @@ gsk_gl_compiler_new (GskGLDriver *driver,
|
||||
gdk_gl_context_get_version (context, &maj, &min);
|
||||
|
||||
if (maj >= 3)
|
||||
self->glsl_version = SHADER_VERSION_GLES3;
|
||||
{
|
||||
self->glsl_version = SHADER_VERSION_GLES3;
|
||||
self->gles3 = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
self->glsl_version = SHADER_VERSION_GLES;
|
||||
@@ -543,6 +547,7 @@ gsk_gl_compiler_compile (GskGLCompiler *self,
|
||||
const char *legacy = "";
|
||||
const char *gl3 = "";
|
||||
const char *gles = "";
|
||||
const char *gles3 = "";
|
||||
int program_id;
|
||||
int vertex_id;
|
||||
int fragment_id;
|
||||
@@ -569,15 +574,17 @@ gsk_gl_compiler_compile (GskGLCompiler *self,
|
||||
if (self->gles)
|
||||
gles = "#define GSK_GLES 1\n";
|
||||
|
||||
if (self->gles3)
|
||||
gles3 = "#define GSK_GLES3 1\n";
|
||||
|
||||
if (self->gl3)
|
||||
gl3 = "#define GSK_GL3 1\n";
|
||||
|
||||
vertex_id = glCreateShader (GL_VERTEX_SHADER);
|
||||
glShaderSource (vertex_id,
|
||||
10,
|
||||
11,
|
||||
(const char *[]) {
|
||||
version, debug, legacy, gl3, gles,
|
||||
clip,
|
||||
version, debug, legacy, gl3, gles, gles3, clip,
|
||||
get_shader_string (self->all_preamble),
|
||||
get_shader_string (self->vertex_preamble),
|
||||
get_shader_string (self->vertex_source),
|
||||
@@ -589,6 +596,7 @@ gsk_gl_compiler_compile (GskGLCompiler *self,
|
||||
strlen (legacy),
|
||||
strlen (gl3),
|
||||
strlen (gles),
|
||||
strlen (gles3),
|
||||
strlen (clip),
|
||||
g_bytes_get_size (self->all_preamble),
|
||||
g_bytes_get_size (self->vertex_preamble),
|
||||
@@ -607,10 +615,9 @@ gsk_gl_compiler_compile (GskGLCompiler *self,
|
||||
|
||||
fragment_id = glCreateShader (GL_FRAGMENT_SHADER);
|
||||
glShaderSource (fragment_id,
|
||||
10,
|
||||
11,
|
||||
(const char *[]) {
|
||||
version, debug, legacy, gl3, gles,
|
||||
clip,
|
||||
version, debug, legacy, gl3, gles, gles3, clip,
|
||||
get_shader_string (self->all_preamble),
|
||||
get_shader_string (self->fragment_preamble),
|
||||
get_shader_string (self->fragment_source),
|
||||
@@ -622,6 +629,7 @@ gsk_gl_compiler_compile (GskGLCompiler *self,
|
||||
strlen (legacy),
|
||||
strlen (gl3),
|
||||
strlen (gles),
|
||||
strlen (gles3),
|
||||
strlen (clip),
|
||||
g_bytes_get_size (self->all_preamble),
|
||||
g_bytes_get_size (self->fragment_preamble),
|
||||
|
||||
+219
-33
@@ -44,6 +44,8 @@
|
||||
#include <gdk/gdktextureprivate.h>
|
||||
|
||||
#include <gdk/gdkmemoryformatprivate.h>
|
||||
#include <gdk/gdkdmabuftextureprivate.h>
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GskGLDriver, gsk_gl_driver, G_TYPE_OBJECT)
|
||||
|
||||
@@ -224,6 +226,8 @@ gsk_gl_driver_dispose (GObject *object)
|
||||
GSK_GL_DELETE_PROGRAM(name); \
|
||||
GSK_GL_DELETE_PROGRAM(name ## _no_clip); \
|
||||
GSK_GL_DELETE_PROGRAM(name ## _rect_clip);
|
||||
#define GSK_GL_DEFINE_PROGRAM_NO_CLIP(name, resource, uniforms) \
|
||||
GSK_GL_DELETE_PROGRAM(name);
|
||||
#define GSK_GL_DELETE_PROGRAM(name) \
|
||||
G_STMT_START { \
|
||||
if (self->name) \
|
||||
@@ -238,6 +242,7 @@ gsk_gl_driver_dispose (GObject *object)
|
||||
#undef GSK_GL_SHADER_JOINED
|
||||
#undef GSK_GL_ADD_UNIFORM
|
||||
#undef GSK_GL_DEFINE_PROGRAM
|
||||
#undef GSK_GL_DEFINE_PROGRAM_NO_CLIP
|
||||
|
||||
if (self->shader_cache != NULL)
|
||||
{
|
||||
@@ -373,6 +378,11 @@ gsk_gl_driver_load_programs (GskGLDriver *self,
|
||||
GSK_GL_COMPILE_PROGRAM(name ## _no_clip, uniforms, "#define NO_CLIP 1\n"); \
|
||||
GSK_GL_COMPILE_PROGRAM(name ## _rect_clip, uniforms, "#define RECT_CLIP 1\n"); \
|
||||
GSK_GL_COMPILE_PROGRAM(name, uniforms, "");
|
||||
#define GSK_GL_DEFINE_PROGRAM_NO_CLIP(name, sources, uniforms) \
|
||||
gsk_gl_compiler_set_source (compiler, GSK_GL_COMPILER_VERTEX, NULL); \
|
||||
gsk_gl_compiler_set_source (compiler, GSK_GL_COMPILER_FRAGMENT, NULL); \
|
||||
sources \
|
||||
GSK_GL_COMPILE_PROGRAM(name, uniforms, "#define NO_CLIP 1\n");
|
||||
#define GSK_GL_COMPILE_PROGRAM(name, uniforms, clip) \
|
||||
G_STMT_START { \
|
||||
GskGLProgram *program; \
|
||||
@@ -400,6 +410,7 @@ gsk_gl_driver_load_programs (GskGLDriver *self,
|
||||
} G_STMT_END;
|
||||
# include "gskglprograms.defs"
|
||||
#undef GSK_GL_DEFINE_PROGRAM
|
||||
#undef GSK_GL_DEFINE_PROGRAM_NO_CLIP
|
||||
#undef GSK_GL_ADD_UNIFORM
|
||||
#undef GSK_GL_SHADER_SINGLE
|
||||
#undef GSK_GL_SHADER_JOINED
|
||||
@@ -702,6 +713,163 @@ gsk_gl_driver_cache_texture (GskGLDriver *self,
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(HAVE_DMABUF) && defined (HAVE_EGL)
|
||||
static void
|
||||
set_viewport_for_size (GskGLDriver *self,
|
||||
GskGLProgram *program,
|
||||
float width,
|
||||
float height)
|
||||
{
|
||||
float viewport[4] = { 0, 0, width, height };
|
||||
|
||||
gsk_gl_uniform_state_set4fv (program->uniforms,
|
||||
program->program_info,
|
||||
UNIFORM_SHARED_VIEWPORT, 0,
|
||||
1,
|
||||
(const float *)&viewport);
|
||||
self->stamps[UNIFORM_SHARED_VIEWPORT]++;
|
||||
}
|
||||
|
||||
#define ORTHO_NEAR_PLANE -10000
|
||||
#define ORTHO_FAR_PLANE 10000
|
||||
|
||||
static void
|
||||
set_projection_for_size (GskGLDriver *self,
|
||||
GskGLProgram *program,
|
||||
float width,
|
||||
float height)
|
||||
{
|
||||
graphene_matrix_t projection;
|
||||
|
||||
graphene_matrix_init_ortho (&projection, 0, width, 0, height, ORTHO_NEAR_PLANE, ORTHO_FAR_PLANE);
|
||||
graphene_matrix_scale (&projection, 1, -1, 1);
|
||||
|
||||
gsk_gl_uniform_state_set_matrix (program->uniforms,
|
||||
program->program_info,
|
||||
UNIFORM_SHARED_PROJECTION, 0,
|
||||
&projection);
|
||||
self->stamps[UNIFORM_SHARED_PROJECTION]++;
|
||||
}
|
||||
|
||||
static void
|
||||
reset_modelview (GskGLDriver *self,
|
||||
GskGLProgram *program)
|
||||
{
|
||||
graphene_matrix_t modelview;
|
||||
|
||||
graphene_matrix_init_identity (&modelview);
|
||||
|
||||
gsk_gl_uniform_state_set_matrix (program->uniforms,
|
||||
program->program_info,
|
||||
UNIFORM_SHARED_MODELVIEW, 0,
|
||||
&modelview);
|
||||
self->stamps[UNIFORM_SHARED_MODELVIEW]++;
|
||||
}
|
||||
|
||||
static void
|
||||
draw_rect (GskGLCommandQueue *command_queue,
|
||||
float min_x,
|
||||
float min_y,
|
||||
float max_x,
|
||||
float max_y)
|
||||
{
|
||||
GskGLDrawVertex *vertices = gsk_gl_command_queue_add_vertices (command_queue);
|
||||
float min_u = 0;
|
||||
float max_u = 1;
|
||||
float min_v = 1;
|
||||
float max_v = 0;
|
||||
guint16 c = FP16_ZERO;
|
||||
|
||||
vertices[0] = (GskGLDrawVertex) { .position = { min_x, min_y }, .uv = { min_u, min_v }, .color = { c, c, c, c } };
|
||||
vertices[1] = (GskGLDrawVertex) { .position = { min_x, max_y }, .uv = { min_u, max_v }, .color = { c, c, c, c } };
|
||||
vertices[2] = (GskGLDrawVertex) { .position = { max_x, min_y }, .uv = { max_u, min_v }, .color = { c, c, c, c } };
|
||||
vertices[3] = (GskGLDrawVertex) { .position = { max_x, max_y }, .uv = { max_u, max_v }, .color = { c, c, c, c } };
|
||||
vertices[4] = (GskGLDrawVertex) { .position = { min_x, max_y }, .uv = { min_u, max_v }, .color = { c, c, c, c } };
|
||||
vertices[5] = (GskGLDrawVertex) { .position = { max_x, min_y }, .uv = { max_u, min_v }, .color = { c, c, c, c } };
|
||||
}
|
||||
|
||||
static unsigned int release_render_target (GskGLDriver *self,
|
||||
GskGLRenderTarget *render_target,
|
||||
gboolean release_texture,
|
||||
gboolean cache_texture);
|
||||
|
||||
static guint
|
||||
gsk_gl_driver_import_dmabuf_texture (GskGLDriver *self,
|
||||
GdkDmabufTexture *texture)
|
||||
{
|
||||
GdkGLContext *context = self->command_queue->context;
|
||||
int max_texture_size = self->command_queue->max_texture_size;
|
||||
const GdkDmabuf *dmabuf;
|
||||
guint texture_id;
|
||||
int width, height;
|
||||
GskGLProgram *program;
|
||||
GskGLRenderTarget *render_target;
|
||||
guint prev_fbo;
|
||||
gboolean external;
|
||||
|
||||
gdk_gl_context_make_current (context);
|
||||
|
||||
width = gdk_texture_get_width (GDK_TEXTURE (texture));
|
||||
height = gdk_texture_get_height (GDK_TEXTURE (texture));
|
||||
|
||||
if (width > max_texture_size || height > max_texture_size)
|
||||
{
|
||||
GDK_DEBUG (DMABUF, "Can't import dmabuf bigger than MAX_TEXTURE_SIZE (%d)", max_texture_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
dmabuf = gdk_dmabuf_texture_get_dmabuf (texture);
|
||||
|
||||
texture_id = gdk_gl_context_import_dmabuf (context,
|
||||
width, height,
|
||||
dmabuf,
|
||||
&external);
|
||||
if (texture_id == 0)
|
||||
return 0;
|
||||
|
||||
if (!external)
|
||||
return texture_id;
|
||||
|
||||
gsk_gl_driver_autorelease_texture (self, texture_id);
|
||||
|
||||
program = self->external;
|
||||
|
||||
gsk_gl_driver_create_render_target (self, width, height, GL_RGBA8, &render_target);
|
||||
|
||||
prev_fbo = gsk_gl_command_queue_bind_framebuffer (self->command_queue, render_target->framebuffer_id);
|
||||
gsk_gl_command_queue_clear (self->command_queue, 0, &GRAPHENE_RECT_INIT (0, 0, width, height));
|
||||
|
||||
if (gsk_gl_command_queue_begin_draw (self->command_queue, program->program_info, width, height))
|
||||
{
|
||||
set_projection_for_size (self, program, width, height);
|
||||
set_viewport_for_size (self, program, width, height);
|
||||
reset_modelview (self, program);
|
||||
|
||||
gsk_gl_program_set_uniform_texture (program,
|
||||
UNIFORM_EXTERNAL_SOURCE, 0,
|
||||
GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE0, texture_id);
|
||||
|
||||
draw_rect (self->command_queue, 0, 0, width, height);
|
||||
|
||||
gsk_gl_command_queue_end_draw (self->command_queue);
|
||||
}
|
||||
|
||||
gsk_gl_command_queue_bind_framebuffer (self->command_queue, prev_fbo);
|
||||
|
||||
return release_render_target (self, render_target, FALSE, FALSE);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static guint
|
||||
gsk_gl_driver_import_dmabuf_texture (GskGLDriver *self,
|
||||
GdkDmabufTexture *texture)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* HAVE_DMABUF && HAVE_EGL */
|
||||
|
||||
/**
|
||||
* gsk_gl_driver_load_texture:
|
||||
* @self: a `GdkTexture`
|
||||
@@ -758,7 +926,11 @@ gsk_gl_driver_load_texture (GskGLDriver *self,
|
||||
return t->texture_id;
|
||||
}
|
||||
|
||||
if (GDK_IS_GL_TEXTURE (texture))
|
||||
if (GDK_IS_DMABUF_TEXTURE (texture))
|
||||
{
|
||||
texture_id = gsk_gl_driver_import_dmabuf_texture (self, GDK_DMABUF_TEXTURE (texture));
|
||||
}
|
||||
else if (GDK_IS_GL_TEXTURE (texture))
|
||||
{
|
||||
GdkGLTexture *gl_texture = (GdkGLTexture *) texture;
|
||||
GdkGLContext *texture_context = gdk_gl_texture_get_context (gl_texture);
|
||||
@@ -961,6 +1133,47 @@ gsk_gl_driver_create_render_target (GskGLDriver *self,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
release_render_target (GskGLDriver *self,
|
||||
GskGLRenderTarget *render_target,
|
||||
gboolean release_texture,
|
||||
gboolean cache_texture)
|
||||
{
|
||||
guint texture_id;
|
||||
|
||||
g_return_val_if_fail (GSK_IS_GL_DRIVER (self), 0);
|
||||
g_return_val_if_fail (render_target != NULL, 0);
|
||||
|
||||
if (release_texture)
|
||||
{
|
||||
texture_id = 0;
|
||||
g_ptr_array_add (self->render_targets, render_target);
|
||||
}
|
||||
else
|
||||
{
|
||||
texture_id = render_target->texture_id;
|
||||
|
||||
if (cache_texture)
|
||||
{
|
||||
GskGLTexture *texture;
|
||||
|
||||
texture = gsk_gl_texture_new (render_target->texture_id,
|
||||
render_target->width,
|
||||
render_target->height,
|
||||
self->current_frame_id);
|
||||
g_hash_table_insert (self->textures,
|
||||
GUINT_TO_POINTER (texture_id),
|
||||
g_steal_pointer (&texture));
|
||||
}
|
||||
|
||||
gsk_gl_driver_autorelease_framebuffer (self, render_target->framebuffer_id);
|
||||
g_free (render_target);
|
||||
|
||||
}
|
||||
|
||||
return texture_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* gsk_gl_driver_release_render_target:
|
||||
* @self: a `GskGLDriver`
|
||||
@@ -986,36 +1199,7 @@ gsk_gl_driver_release_render_target (GskGLDriver *self,
|
||||
GskGLRenderTarget *render_target,
|
||||
gboolean release_texture)
|
||||
{
|
||||
guint texture_id;
|
||||
|
||||
g_return_val_if_fail (GSK_IS_GL_DRIVER (self), 0);
|
||||
g_return_val_if_fail (render_target != NULL, 0);
|
||||
|
||||
if (release_texture)
|
||||
{
|
||||
texture_id = 0;
|
||||
g_ptr_array_add (self->render_targets, render_target);
|
||||
}
|
||||
else
|
||||
{
|
||||
GskGLTexture *texture;
|
||||
|
||||
texture_id = render_target->texture_id;
|
||||
|
||||
texture = gsk_gl_texture_new (render_target->texture_id,
|
||||
render_target->width,
|
||||
render_target->height,
|
||||
self->current_frame_id);
|
||||
g_hash_table_insert (self->textures,
|
||||
GUINT_TO_POINTER (texture_id),
|
||||
g_steal_pointer (&texture));
|
||||
|
||||
gsk_gl_driver_autorelease_framebuffer (self, render_target->framebuffer_id);
|
||||
g_free (render_target);
|
||||
|
||||
}
|
||||
|
||||
return texture_id;
|
||||
return release_render_target (self, render_target, release_texture, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1600,8 +1784,9 @@ create_texture_from_texture_destroy (gpointer data)
|
||||
}
|
||||
|
||||
GdkTexture *
|
||||
gsk_gl_driver_create_gdk_texture (GskGLDriver *self,
|
||||
guint texture_id)
|
||||
gsk_gl_driver_create_gdk_texture (GskGLDriver *self,
|
||||
guint texture_id,
|
||||
GdkMemoryFormat format)
|
||||
{
|
||||
GskGLTextureState *state;
|
||||
GdkGLTextureBuilder *builder;
|
||||
@@ -1629,6 +1814,7 @@ gsk_gl_driver_create_gdk_texture (GskGLDriver *self,
|
||||
builder = gdk_gl_texture_builder_new ();
|
||||
gdk_gl_texture_builder_set_context (builder, self->command_queue->context);
|
||||
gdk_gl_texture_builder_set_id (builder, texture_id);
|
||||
gdk_gl_texture_builder_set_format (builder, format);
|
||||
gdk_gl_texture_builder_set_width (builder, texture->width);
|
||||
gdk_gl_texture_builder_set_height (builder, texture->height);
|
||||
gdk_gl_texture_builder_set_sync (builder, state->sync);
|
||||
|
||||
@@ -69,7 +69,9 @@ typedef struct {
|
||||
#define CONCAT_EXPANDED2(a,b) a##b
|
||||
#define GSK_GL_ADD_UNIFORM(pos, KEY, name) UNIFORM_##KEY = UNIFORM_SHARED_LAST + pos,
|
||||
#define GSK_GL_DEFINE_PROGRAM(name, resource, uniforms) enum { uniforms };
|
||||
#define GSK_GL_DEFINE_PROGRAM_NO_CLIP(name, resource, uniforms) enum { uniforms };
|
||||
# include "gskglprograms.defs"
|
||||
#undef GSK_GL_DEFINE_PROGRAM_NO_CLIP
|
||||
#undef GSK_GL_DEFINE_PROGRAM
|
||||
#undef GSK_GL_ADD_UNIFORM
|
||||
#undef GSK_GL_NO_UNIFORMS
|
||||
@@ -116,10 +118,13 @@ struct _GskGLDriver
|
||||
GskGLProgram *name ## _no_clip; \
|
||||
GskGLProgram *name ## _rect_clip; \
|
||||
GskGLProgram *name;
|
||||
#define GSK_GL_DEFINE_PROGRAM_NO_CLIP(name, resource, uniforms) \
|
||||
GskGLProgram *name;
|
||||
# include "gskglprograms.defs"
|
||||
#undef GSK_GL_NO_UNIFORMS
|
||||
#undef GSK_GL_ADD_UNIFORM
|
||||
#undef GSK_GL_DEFINE_PROGRAM
|
||||
#undef GSK_GL_DEFINE_PROGRAM_NO_CLIP
|
||||
|
||||
gint64 current_frame_id;
|
||||
|
||||
@@ -149,7 +154,8 @@ void gsk_gl_driver_begin_frame (GskGLDriver *s
|
||||
void gsk_gl_driver_end_frame (GskGLDriver *self);
|
||||
void gsk_gl_driver_after_frame (GskGLDriver *self);
|
||||
GdkTexture * gsk_gl_driver_create_gdk_texture (GskGLDriver *self,
|
||||
guint texture_id);
|
||||
guint texture_id,
|
||||
GdkMemoryFormat format);
|
||||
void gsk_gl_driver_cache_texture (GskGLDriver *self,
|
||||
const GskTextureKey *key,
|
||||
guint texture_id);
|
||||
|
||||
@@ -119,7 +119,11 @@ gsk_gl_glyph_library_init_atlas (GskGLTextureLibrary *self,
|
||||
|
||||
memset (pixel_data, 255, sizeof pixel_data);
|
||||
|
||||
if (!gdk_gl_context_has_bgra (gdk_gl_context_get_current ()))
|
||||
if (!gdk_gl_context_has_bgra (gdk_gl_context_get_current ())
|
||||
#if G_BYTE_ORDER == G_BIG_ENDIAN
|
||||
|| gdk_gl_context_get_use_es (gdk_gl_context_get_current ())
|
||||
#endif
|
||||
)
|
||||
{
|
||||
gl_format = GL_RGBA;
|
||||
gl_type = GL_UNSIGNED_BYTE;
|
||||
|
||||
@@ -111,7 +111,11 @@ gsk_gl_icon_library_add (GskGLIconLibrary *self,
|
||||
gdk_gl_context_push_debug_group_printf (gdk_gl_context_get_current (),
|
||||
"Uploading texture");
|
||||
|
||||
if (!gdk_gl_context_has_bgra (gdk_gl_context_get_current ()))
|
||||
if (!gdk_gl_context_has_bgra (gdk_gl_context_get_current ())
|
||||
#if G_BYTE_ORDER == G_BIG_ENDIAN
|
||||
|| gdk_gl_context_get_use_es (gdk_gl_context_get_current ())
|
||||
#endif
|
||||
)
|
||||
{
|
||||
pixel_data = free_data = g_malloc (width * height * 4);
|
||||
gdk_memory_convert (pixel_data, width * 4,
|
||||
@@ -144,6 +148,7 @@ gsk_gl_icon_library_add (GskGLIconLibrary *self,
|
||||
gl_format, gl_type,
|
||||
pixel_data);
|
||||
/* Padding left */
|
||||
glPixelStorei (GL_UNPACK_ROW_LENGTH, width);
|
||||
glTexSubImage2D (GL_TEXTURE_2D, 0,
|
||||
packed_x, packed_y + 1,
|
||||
1, height,
|
||||
@@ -157,7 +162,6 @@ gsk_gl_icon_library_add (GskGLIconLibrary *self,
|
||||
pixel_data);
|
||||
|
||||
/* Padding right */
|
||||
glPixelStorei (GL_UNPACK_ROW_LENGTH, width);
|
||||
glPixelStorei (GL_UNPACK_SKIP_PIXELS, width - 1);
|
||||
glTexSubImage2D (GL_TEXTURE_2D, 0,
|
||||
packed_x + width + 1, packed_y + 1,
|
||||
|
||||
@@ -87,3 +87,13 @@ GSK_GL_DEFINE_PROGRAM (unblurred_outset_shadow,
|
||||
GSK_GL_ADD_UNIFORM (1, UNBLURRED_OUTSET_SHADOW_SPREAD, u_spread)
|
||||
GSK_GL_ADD_UNIFORM (2, UNBLURRED_OUTSET_SHADOW_OFFSET, u_offset)
|
||||
GSK_GL_ADD_UNIFORM (3, UNBLURRED_OUTSET_SHADOW_OUTLINE_RECT, u_outline_rect))
|
||||
|
||||
/* Texture conversion shaders.
|
||||
*
|
||||
* Note: If you add new formats here, they need to be added
|
||||
* to the list of supported formats in gdk/gdkdmabuftexture.c.
|
||||
*/
|
||||
|
||||
GSK_GL_DEFINE_PROGRAM_NO_CLIP (external,
|
||||
GSK_GL_SHADER_SINGLE (GSK_GL_SHADER_RESOURCE ("external.glsl")),
|
||||
GSK_GL_ADD_UNIFORM (1, EXTERNAL_SOURCE, u_external_source))
|
||||
|
||||
+10
-9
@@ -135,10 +135,8 @@ gsk_gl_renderer_realize (GskRenderer *renderer,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GSK_RENDERER_DEBUG_CHECK (GSK_RENDERER (self), SHADERS))
|
||||
debug_shaders = TRUE;
|
||||
#endif
|
||||
|
||||
if (!(driver = gsk_gl_driver_for_display (display, debug_shaders, error)))
|
||||
goto failure;
|
||||
@@ -307,10 +305,8 @@ gsk_gl_renderer_render (GskRenderer *renderer,
|
||||
|
||||
gsk_gl_driver_begin_frame (self->driver, self->command_queue);
|
||||
job = gsk_gl_render_job_new (self->driver, &viewport, scale, render_region, 0, clear_framebuffer);
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GSK_RENDERER_DEBUG_CHECK (GSK_RENDERER (self), FALLBACK))
|
||||
gsk_gl_render_job_set_debug_fallback (job, TRUE);
|
||||
#endif
|
||||
gsk_gl_render_job_render (job, root);
|
||||
gsk_gl_driver_end_frame (self->driver);
|
||||
gsk_gl_render_job_free (job);
|
||||
@@ -332,6 +328,7 @@ gsk_gl_renderer_render_texture (GskRenderer *renderer,
|
||||
GskGLRenderJob *job;
|
||||
GdkTexture *texture;
|
||||
guint texture_id;
|
||||
GdkMemoryFormat gdk_format;
|
||||
int width, height, max_size;
|
||||
int format;
|
||||
|
||||
@@ -375,9 +372,15 @@ gsk_gl_renderer_render_texture (GskRenderer *renderer,
|
||||
|
||||
if (gsk_render_node_get_preferred_depth (root) != GDK_MEMORY_U8 &&
|
||||
gdk_gl_context_check_version (self->context, "3.0", "3.0"))
|
||||
format = GL_RGBA32F;
|
||||
{
|
||||
gdk_format = GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED;
|
||||
format = GL_RGBA32F;
|
||||
}
|
||||
else
|
||||
format = GL_RGBA8;
|
||||
{
|
||||
format = GL_RGBA8;
|
||||
gdk_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED;
|
||||
}
|
||||
|
||||
gdk_gl_context_make_current (self->context);
|
||||
|
||||
@@ -388,13 +391,11 @@ gsk_gl_renderer_render_texture (GskRenderer *renderer,
|
||||
{
|
||||
gsk_gl_driver_begin_frame (self->driver, self->command_queue);
|
||||
job = gsk_gl_render_job_new (self->driver, viewport, 1, NULL, render_target->framebuffer_id, TRUE);
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GSK_RENDERER_DEBUG_CHECK (GSK_RENDERER (self), FALLBACK))
|
||||
gsk_gl_render_job_set_debug_fallback (job, TRUE);
|
||||
#endif
|
||||
gsk_gl_render_job_render_flipped (job, root);
|
||||
texture_id = gsk_gl_driver_release_render_target (self->driver, render_target, FALSE);
|
||||
texture = gsk_gl_driver_create_gdk_texture (self->driver, texture_id);
|
||||
texture = gsk_gl_driver_create_gdk_texture (self->driver, texture_id, gdk_format);
|
||||
gsk_gl_driver_end_frame (self->driver);
|
||||
gsk_gl_render_job_free (job);
|
||||
|
||||
|
||||
+13
-19
@@ -30,6 +30,7 @@
|
||||
#include <gsk/gskglshaderprivate.h>
|
||||
#include <gdk/gdktextureprivate.h>
|
||||
#include <gdk/gdkmemorytextureprivate.h>
|
||||
#include <gdk/gdkdmabuftexture.h>
|
||||
#include <gsk/gsktransformprivate.h>
|
||||
#include <gsk/gskroundedrectprivate.h>
|
||||
#include <gsk/gskrectprivate.h>
|
||||
@@ -47,6 +48,7 @@
|
||||
#include "ninesliceprivate.h"
|
||||
#include "fp16private.h"
|
||||
|
||||
|
||||
#define ORTHO_NEAR_PLANE -10000
|
||||
#define ORTHO_FAR_PLANE 10000
|
||||
#define MAX_GRADIENT_STOPS 6
|
||||
@@ -1224,7 +1226,6 @@ gsk_gl_render_job_visit_as_fallback (GskGLRenderJob *job,
|
||||
cairo_fill (cr);
|
||||
cairo_restore (cr);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (job->debug_fallback)
|
||||
{
|
||||
cairo_move_to (cr, 0, 0);
|
||||
@@ -1240,7 +1241,6 @@ gsk_gl_render_job_visit_as_fallback (GskGLRenderJob *job,
|
||||
cairo_set_source_rgba (cr, 1, 0, 0, 1);
|
||||
cairo_stroke (cr);
|
||||
}
|
||||
#endif
|
||||
cairo_destroy (cr);
|
||||
|
||||
/* Create texture to upload */
|
||||
@@ -3630,16 +3630,12 @@ gsk_gl_render_job_upload_texture (GskGLRenderJob *job,
|
||||
gboolean ensure_mipmap,
|
||||
GskGLRenderOffscreen *offscreen)
|
||||
{
|
||||
GdkGLTexture *gl_texture = NULL;
|
||||
|
||||
if (GDK_IS_GL_TEXTURE (texture))
|
||||
gl_texture = GDK_GL_TEXTURE (texture);
|
||||
|
||||
/* Don't put GL or dmabuf textures into icon caches, they are already on the GPU side */
|
||||
if (!ensure_mipmap &&
|
||||
gsk_gl_texture_library_can_cache ((GskGLTextureLibrary *)job->driver->icons_library,
|
||||
texture->width,
|
||||
texture->height) &&
|
||||
!gl_texture)
|
||||
!(GDK_IS_GL_TEXTURE (texture) || GDK_IS_DMABUF_TEXTURE (texture)))
|
||||
{
|
||||
const GskGLIconData *icon_data;
|
||||
|
||||
@@ -3653,16 +3649,20 @@ gsk_gl_render_job_upload_texture (GskGLRenderJob *job,
|
||||
/* Only generate a mipmap if it does not make use reupload
|
||||
* a GL texture which we could otherwise use directly.
|
||||
*/
|
||||
if (gl_texture &&
|
||||
gdk_gl_context_is_shared (gdk_gl_texture_get_context (gl_texture), job->command_queue->context))
|
||||
ensure_mipmap = gdk_gl_texture_has_mipmap (gl_texture);
|
||||
if (GDK_IS_GL_TEXTURE (texture) &&
|
||||
gdk_gl_context_is_shared (gdk_gl_texture_get_context (GDK_GL_TEXTURE (texture)),
|
||||
job->command_queue->context))
|
||||
ensure_mipmap = gdk_gl_texture_has_mipmap (GDK_GL_TEXTURE (texture));
|
||||
else if (GDK_IS_DMABUF_TEXTURE (texture))
|
||||
ensure_mipmap = FALSE;
|
||||
|
||||
offscreen->texture_id = gsk_gl_driver_load_texture (job->driver, texture, ensure_mipmap);
|
||||
init_full_texture_region (offscreen);
|
||||
offscreen->has_mipmap = ensure_mipmap;
|
||||
|
||||
if (gl_texture && offscreen->texture_id == gdk_gl_texture_get_id (gl_texture))
|
||||
offscreen->sync = gdk_gl_texture_get_sync (gl_texture);
|
||||
if (GDK_IS_GL_TEXTURE (texture) &&
|
||||
offscreen->texture_id == gdk_gl_texture_get_id (GDK_GL_TEXTURE (texture)))
|
||||
offscreen->sync = gdk_gl_texture_get_sync (GDK_GL_TEXTURE (texture));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3784,12 +3784,6 @@ gsk_gl_render_job_visit_texture_scale_node (GskGLRenderJob *job,
|
||||
GskTextureKey key;
|
||||
guint texture_id;
|
||||
|
||||
if (filter == GSK_SCALING_FILTER_LINEAR)
|
||||
{
|
||||
gsk_gl_render_job_visit_texture (job, texture, bounds);
|
||||
return;
|
||||
}
|
||||
|
||||
gsk_gl_render_job_untransform_bounds (job, &job->current_clip->rect.bounds, &clip_rect);
|
||||
|
||||
if (!graphene_rect_intersection (bounds, &clip_rect, &clip_rect))
|
||||
|
||||
@@ -140,7 +140,6 @@ gsk_gl_texture_library_real_compact (GskGLTextureLibrary *self,
|
||||
g_clear_pointer (&removed, g_ptr_array_unref);
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GSK_DEBUG_CHECK (GLYPH_CACHE))
|
||||
{
|
||||
static gint64 last_message;
|
||||
@@ -153,7 +152,6 @@ gsk_gl_texture_library_real_compact (GskGLTextureLibrary *self,
|
||||
self->atlases->len);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
// VERTEX_SHADER:
|
||||
// external.glsl
|
||||
|
||||
void main() {
|
||||
gl_Position = u_projection * u_modelview * vec4(aPosition, 0.0, 1.0);
|
||||
|
||||
vUv = vec2(aUv.x, aUv.y);
|
||||
}
|
||||
|
||||
// FRAGMENT_SHADER:
|
||||
// external.glsl
|
||||
|
||||
#if defined(GSK_GLES) || defined(GSK_GLES3)
|
||||
uniform samplerExternalOES u_external_source;
|
||||
#else
|
||||
/* Just to make this compile, we won't use it without GLES */
|
||||
uniform sampler2D u_external_source;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
/* Open-code this here, since GskTexture() expects a sampler2D */
|
||||
#if defined(GSK_GLES) || defined(GSK_LEGACY)
|
||||
vec4 color = texture2D(u_external_source, vUv);
|
||||
#else
|
||||
vec4 color = texture(u_external_source, vUv);
|
||||
#endif
|
||||
gskSetOutputColor(color);
|
||||
}
|
||||
@@ -1,3 +1,9 @@
|
||||
#if defined(GSK_GLES3)
|
||||
#extension GL_OES_EGL_image_external_essl3 : require
|
||||
#elif defined (GSK_GLES)
|
||||
#extension GL_OES_EGL_image_external : require
|
||||
#endif
|
||||
|
||||
#ifndef GSK_LEGACY
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
@@ -27,12 +27,10 @@
|
||||
#include "gskrendernodeprivate.h"
|
||||
#include "gdk/gdktextureprivate.h"
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
typedef struct {
|
||||
GQuark cpu_time;
|
||||
GQuark gpu_time;
|
||||
} ProfileTimers;
|
||||
#endif
|
||||
|
||||
struct _GskCairoRenderer
|
||||
{
|
||||
@@ -40,9 +38,7 @@ struct _GskCairoRenderer
|
||||
|
||||
GdkCairoContext *cairo_context;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
ProfileTimers profile_timers;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct _GskCairoRendererClass
|
||||
@@ -78,25 +74,19 @@ gsk_cairo_renderer_do_render (GskRenderer *renderer,
|
||||
cairo_t *cr,
|
||||
GskRenderNode *root)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
GskCairoRenderer *self = GSK_CAIRO_RENDERER (renderer);
|
||||
GskProfiler *profiler;
|
||||
gint64 cpu_time;
|
||||
#endif
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
profiler = gsk_renderer_get_profiler (renderer);
|
||||
gsk_profiler_timer_begin (profiler, self->profile_timers.cpu_time);
|
||||
#endif
|
||||
|
||||
gsk_render_node_draw (root, cr);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
cpu_time = gsk_profiler_timer_end (profiler, self->profile_timers.cpu_time);
|
||||
gsk_profiler_timer_set (profiler, self->profile_timers.cpu_time, cpu_time);
|
||||
|
||||
gsk_profiler_push_samples (profiler);
|
||||
#endif
|
||||
}
|
||||
|
||||
static GdkTexture *
|
||||
@@ -173,7 +163,6 @@ gsk_cairo_renderer_render (GskRenderer *renderer,
|
||||
|
||||
g_return_if_fail (cr != NULL);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GSK_RENDERER_DEBUG_CHECK (renderer, GEOMETRY))
|
||||
{
|
||||
GdkSurface *surface = gsk_renderer_get_surface (renderer);
|
||||
@@ -187,7 +176,6 @@ gsk_cairo_renderer_render (GskRenderer *renderer,
|
||||
cairo_stroke (cr);
|
||||
cairo_restore (cr);
|
||||
}
|
||||
#endif
|
||||
|
||||
gsk_cairo_renderer_do_render (renderer, cr, root);
|
||||
|
||||
@@ -210,11 +198,9 @@ gsk_cairo_renderer_class_init (GskCairoRendererClass *klass)
|
||||
static void
|
||||
gsk_cairo_renderer_init (GskCairoRenderer *self)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
GskProfiler *profiler = gsk_renderer_get_profiler (GSK_RENDERER (self));
|
||||
|
||||
self->profile_timers.cpu_time = gsk_profiler_add_timer (profiler, "cpu-time", "CPU time", FALSE, TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+9
-4
@@ -1781,10 +1781,15 @@ gsk_conic_curve_segment (const GskCurve *curve,
|
||||
graphene_point_t ctrl_num, ctrl_denom;
|
||||
float mid;
|
||||
|
||||
if (start <= 0.0f)
|
||||
return gsk_conic_curve_split (curve, end, segment, NULL);
|
||||
else if (end >= 1.0f)
|
||||
return gsk_conic_curve_split (curve, start, NULL, segment);
|
||||
if (start <= 0.0f || end >= 1.0f)
|
||||
{
|
||||
if (start <= 0.0f)
|
||||
gsk_conic_curve_split (curve, end, segment, NULL);
|
||||
else if (end >= 1.0f)
|
||||
gsk_conic_curve_split (curve, start, NULL, segment);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
gsk_conic_curve_ensure_coefficents (self);
|
||||
|
||||
|
||||
@@ -29,8 +29,6 @@ void gsk_set_debug_flags (GskDebugFlags flags);
|
||||
|
||||
gboolean gsk_check_debug_flags (GskDebugFlags flags);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
|
||||
#define GSK_DEBUG_CHECK(type) G_UNLIKELY (gsk_check_debug_flags (GSK_DEBUG_ ## type))
|
||||
#define GSK_RENDERER_DEBUG_CHECK(renderer,type) \
|
||||
G_UNLIKELY ((gsk_renderer_get_debug_flags (renderer) & GSK_DEBUG_ ## type) != 0)
|
||||
@@ -47,14 +45,5 @@ gboolean gsk_check_debug_flags (GskDebugFlags flags);
|
||||
gdk_debug_message (__VA_ARGS__); \
|
||||
} G_STMT_END
|
||||
|
||||
#else
|
||||
|
||||
#define GSK_DEBUG_CHECK(type) 0
|
||||
#define GSK_RENDERER_DEBUG_CHECK(renderer,type) 0
|
||||
#define GSK_RENDERER_DEBUG(display,type,...)
|
||||
#define GSK_DEBUG(type,...)
|
||||
|
||||
#endif
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -162,7 +162,6 @@ uniform_type_from_glsl (const char *str)
|
||||
return GSK_GL_UNIFORM_TYPE_NONE;
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
static const char *
|
||||
uniform_type_name (GskGLUniformType type)
|
||||
{
|
||||
@@ -195,7 +194,6 @@ uniform_type_name (GskGLUniformType type)
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
uniform_type_size (GskGLUniformType type)
|
||||
@@ -399,7 +397,6 @@ gsk_gl_shader_constructed (GObject *object)
|
||||
|
||||
shader->n_textures = max_texture_seen;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GSK_DEBUG_CHECK(SHADERS))
|
||||
{
|
||||
GString *s;
|
||||
@@ -417,7 +414,6 @@ gsk_gl_shader_constructed (GObject *object)
|
||||
s->str);
|
||||
g_string_free (s, TRUE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#define SPACE_RE "[ \\t]+" // Don't use \s, we don't want to match newlines
|
||||
|
||||
+19
-4
@@ -377,7 +377,6 @@ gsk_renderer_render_texture (GskRenderer *renderer,
|
||||
|
||||
texture = GSK_RENDERER_GET_CLASS (renderer)->render_texture (renderer, root, viewport);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GSK_RENDERER_DEBUG_CHECK (renderer, RENDERER))
|
||||
{
|
||||
GString *buf = g_string_new ("*** Texture stats ***\n\n");
|
||||
@@ -392,7 +391,6 @@ gsk_renderer_render_texture (GskRenderer *renderer,
|
||||
|
||||
g_string_free (buf, TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
g_clear_pointer (&priv->root_node, gsk_render_node_unref);
|
||||
|
||||
@@ -459,7 +457,6 @@ gsk_renderer_render (GskRenderer *renderer,
|
||||
|
||||
GSK_RENDERER_GET_CLASS (renderer)->render (renderer, root, clip);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GSK_RENDERER_DEBUG_CHECK (renderer, RENDERER))
|
||||
{
|
||||
GString *buf = g_string_new ("*** Frame stats ***\n\n");
|
||||
@@ -474,7 +471,6 @@ gsk_renderer_render (GskRenderer *renderer,
|
||||
|
||||
g_string_free (buf, TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
g_clear_pointer (&priv->prev_node, gsk_render_node_unref);
|
||||
cairo_region_destroy (clip);
|
||||
@@ -684,3 +680,22 @@ gsk_renderer_set_debug_flags (GskRenderer *renderer,
|
||||
|
||||
priv->debug_flags = flags;
|
||||
}
|
||||
|
||||
/* Feed a texture through a renderer and return the resulting 'native' texture. */
|
||||
GdkTexture *
|
||||
gsk_renderer_convert_texture (GskRenderer *self,
|
||||
GdkTexture *texture)
|
||||
{
|
||||
int width, height;
|
||||
GskRenderNode *node;
|
||||
GdkTexture *result;
|
||||
|
||||
width = gdk_texture_get_width (texture);
|
||||
height = gdk_texture_get_height (texture);
|
||||
|
||||
node = gsk_texture_node_new (texture, &GRAPHENE_RECT_INIT (0, 0, width, height));
|
||||
result = gsk_renderer_render_texture (self, node, &GRAPHENE_RECT_INIT (0, 0, width, height));
|
||||
gsk_render_node_unref (node);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -56,5 +56,8 @@ GskDebugFlags gsk_renderer_get_debug_flags (GskRenderer
|
||||
void gsk_renderer_set_debug_flags (GskRenderer *renderer,
|
||||
GskDebugFlags flags);
|
||||
|
||||
GdkTexture * gsk_renderer_convert_texture (GskRenderer *renderer,
|
||||
GdkTexture *texture);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -392,7 +392,6 @@ gsk_render_node_draw (GskRenderNode *node,
|
||||
|
||||
GSK_RENDER_NODE_GET_CLASS (node)->draw (node, cr);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GSK_DEBUG_CHECK (GEOMETRY))
|
||||
{
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
|
||||
@@ -402,7 +401,6 @@ gsk_render_node_draw (GskRenderNode *node,
|
||||
cairo_set_source_rgba (cr, 0, 0, 0, 0.5);
|
||||
cairo_stroke (cr);
|
||||
}
|
||||
#endif
|
||||
|
||||
cairo_restore (cr);
|
||||
|
||||
|
||||
+5
-15
@@ -1838,6 +1838,7 @@ gsk_texture_scale_node_draw (GskRenderNode *node,
|
||||
cairo_matrix_init_scale (&matrix,
|
||||
gdk_texture_get_width (self->texture) / node->bounds.size.width,
|
||||
gdk_texture_get_height (self->texture) / node->bounds.size.height);
|
||||
cairo_matrix_translate (&matrix, -node->bounds.origin.x, -node->bounds.origin.y);
|
||||
cairo_pattern_set_matrix (pattern, &matrix);
|
||||
cairo_pattern_set_filter (pattern, filters[self->filter]);
|
||||
|
||||
@@ -1845,23 +1846,15 @@ gsk_texture_scale_node_draw (GskRenderNode *node,
|
||||
cairo_pattern_destroy (pattern);
|
||||
cairo_surface_destroy (surface);
|
||||
|
||||
cairo_rectangle (cr2, 0, 0, node->bounds.size.width, node->bounds.size.height);
|
||||
gsk_cairo_rectangle (cr2, &node->bounds);
|
||||
cairo_fill (cr2);
|
||||
|
||||
cairo_destroy (cr2);
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
pattern = cairo_pattern_create_for_surface (surface2);
|
||||
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_PAD);
|
||||
|
||||
cairo_matrix_init_identity (&matrix);
|
||||
cairo_matrix_translate (&matrix,
|
||||
-node->bounds.origin.x,
|
||||
-node->bounds.origin.y);
|
||||
cairo_pattern_set_matrix (pattern, &matrix);
|
||||
cairo_set_source (cr, pattern);
|
||||
cairo_pattern_destroy (pattern);
|
||||
cairo_set_source_surface (cr, surface2, 0, 0);
|
||||
cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_PAD);
|
||||
cairo_surface_destroy (surface2);
|
||||
|
||||
gsk_cairo_rectangle (cr, &node->bounds);
|
||||
@@ -2348,10 +2341,7 @@ gsk_inset_shadow_node_draw (GskRenderNode *node,
|
||||
* We could remove the part of "box" where the blur doesn't
|
||||
* reach, but computing that is a bit tricky since the
|
||||
* rounded corners are on the "inside" of it. */
|
||||
r.x = floor (clip_box.bounds.origin.x);
|
||||
r.y = floor (clip_box.bounds.origin.y);
|
||||
r.width = ceil (clip_box.bounds.origin.x + clip_box.bounds.size.width) - r.x;
|
||||
r.height = ceil (clip_box.bounds.origin.y + clip_box.bounds.size.height) - r.y;
|
||||
rectangle_init_from_graphene (&r, &clip_box.bounds);
|
||||
remaining = cairo_region_create_rectangle (&r);
|
||||
|
||||
/* First do the corners of box */
|
||||
|
||||
@@ -20,6 +20,7 @@ gsk_private_gl_shaders = [
|
||||
'gl/resources/custom.glsl',
|
||||
'gl/resources/filled_border.glsl',
|
||||
'gl/resources/mask.glsl',
|
||||
'gl/resources/external.glsl',
|
||||
]
|
||||
|
||||
gsk_public_sources = files([
|
||||
|
||||
@@ -1455,7 +1455,6 @@ gtk_at_spi_context_realize (GtkATContext *context)
|
||||
if (self->connection == NULL)
|
||||
return;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (A11Y))
|
||||
{
|
||||
GtkAccessible *accessible = gtk_at_context_get_accessible (context);
|
||||
@@ -1467,7 +1466,6 @@ gtk_at_spi_context_realize (GtkATContext *context)
|
||||
role_name);
|
||||
g_free (role_name);
|
||||
}
|
||||
#endif
|
||||
|
||||
gtk_at_spi_root_queue_register (self->root, self, register_object);
|
||||
}
|
||||
|
||||
@@ -37,12 +37,10 @@ static inline void fixup_validation (GtkTreeRBTree *tree,
|
||||
GtkTreeRBNode *node);
|
||||
static inline void fixup_total_count (GtkTreeRBTree *tree,
|
||||
GtkTreeRBNode *node);
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
static void gtk_tree_rbtree_test (const char *where,
|
||||
GtkTreeRBTree *tree);
|
||||
static void gtk_tree_rbtree_debug_spew (GtkTreeRBTree *tree,
|
||||
GString *s);
|
||||
#endif
|
||||
|
||||
static const GtkTreeRBNode nil =
|
||||
{
|
||||
@@ -77,7 +75,6 @@ gtk_tree_rbnode_new (GtkTreeRBTree *tree,
|
||||
static void
|
||||
gtk_tree_rbnode_free (GtkTreeRBNode *node)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (TREE))
|
||||
{
|
||||
node->left = (gpointer) 0xdeadbeef;
|
||||
@@ -88,7 +85,6 @@ gtk_tree_rbnode_free (GtkTreeRBNode *node)
|
||||
node->count = 56789;
|
||||
node->flags = 0;
|
||||
}
|
||||
#endif
|
||||
g_slice_free (GtkTreeRBNode, node);
|
||||
}
|
||||
|
||||
@@ -398,12 +394,10 @@ gtk_rbnode_adjust (GtkTreeRBTree *tree,
|
||||
void
|
||||
gtk_tree_rbtree_remove (GtkTreeRBTree *tree)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
GtkTreeRBTree *tmp_tree;
|
||||
|
||||
if (GTK_DEBUG_CHECK (TREE))
|
||||
gtk_tree_rbtree_test (G_STRLOC, tree);
|
||||
#endif
|
||||
|
||||
/* ugly hack to make fixup_validation work in the first iteration of the
|
||||
* loop below */
|
||||
@@ -415,16 +409,12 @@ gtk_tree_rbtree_remove (GtkTreeRBTree *tree)
|
||||
-(int) tree->root->total_count,
|
||||
-tree->root->offset);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
tmp_tree = tree->parent_tree;
|
||||
#endif
|
||||
|
||||
gtk_tree_rbtree_free (tree);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (TREE))
|
||||
gtk_tree_rbtree_test (G_STRLOC, tmp_tree);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -437,7 +427,6 @@ gtk_tree_rbtree_insert_after (GtkTreeRBTree *tree,
|
||||
GtkTreeRBNode *node;
|
||||
gboolean right = TRUE;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (TREE))
|
||||
{
|
||||
GString *s;
|
||||
@@ -449,7 +438,6 @@ gtk_tree_rbtree_insert_after (GtkTreeRBTree *tree,
|
||||
g_string_free (s, TRUE);
|
||||
gtk_tree_rbtree_test (G_STRLOC, tree);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (current != NULL && !gtk_tree_rbtree_is_nil (current->right))
|
||||
{
|
||||
@@ -487,7 +475,6 @@ gtk_tree_rbtree_insert_after (GtkTreeRBTree *tree,
|
||||
|
||||
gtk_tree_rbtree_insert_fixup (tree, node);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (TREE))
|
||||
{
|
||||
GString *s;
|
||||
@@ -498,7 +485,6 @@ gtk_tree_rbtree_insert_after (GtkTreeRBTree *tree,
|
||||
g_string_free (s, TRUE);
|
||||
gtk_tree_rbtree_test (G_STRLOC, tree);
|
||||
}
|
||||
#endif
|
||||
|
||||
return node;
|
||||
}
|
||||
@@ -512,7 +498,6 @@ gtk_tree_rbtree_insert_before (GtkTreeRBTree *tree,
|
||||
GtkTreeRBNode *node;
|
||||
gboolean left = TRUE;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (TREE))
|
||||
{
|
||||
GString *s;
|
||||
@@ -524,7 +509,6 @@ gtk_tree_rbtree_insert_before (GtkTreeRBTree *tree,
|
||||
g_string_free (s, TRUE);
|
||||
gtk_tree_rbtree_test (G_STRLOC, tree);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (current != NULL && !gtk_tree_rbtree_is_nil (current->left))
|
||||
{
|
||||
@@ -563,7 +547,6 @@ gtk_tree_rbtree_insert_before (GtkTreeRBTree *tree,
|
||||
|
||||
gtk_tree_rbtree_insert_fixup (tree, node);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (TREE))
|
||||
{
|
||||
GString *s;
|
||||
@@ -574,7 +557,6 @@ gtk_tree_rbtree_insert_before (GtkTreeRBTree *tree,
|
||||
g_string_free (s, TRUE);
|
||||
gtk_tree_rbtree_test (G_STRLOC, tree);
|
||||
}
|
||||
#endif
|
||||
|
||||
return node;
|
||||
}
|
||||
@@ -613,10 +595,8 @@ gtk_tree_rbtree_node_set_height (GtkTreeRBTree *tree,
|
||||
|
||||
gtk_rbnode_adjust (tree, node, 0, 0, diff);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (TREE))
|
||||
gtk_tree_rbtree_test (G_STRLOC, tree);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1138,7 +1118,6 @@ gtk_tree_rbtree_remove_node (GtkTreeRBTree *tree,
|
||||
g_return_if_fail (node != NULL);
|
||||
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (TREE))
|
||||
{
|
||||
GString *s;
|
||||
@@ -1150,17 +1129,14 @@ gtk_tree_rbtree_remove_node (GtkTreeRBTree *tree,
|
||||
g_string_free (s, TRUE);
|
||||
gtk_tree_rbtree_test (G_STRLOC, tree);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* make sure we're deleting a node that's actually in the tree */
|
||||
for (x = node; !gtk_tree_rbtree_is_nil (x->parent); x = x->parent)
|
||||
;
|
||||
g_return_if_fail (x == tree->root);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (TREE))
|
||||
gtk_tree_rbtree_test (G_STRLOC, tree);
|
||||
#endif
|
||||
|
||||
if (gtk_tree_rbtree_is_nil (node->left) ||
|
||||
gtk_tree_rbtree_is_nil (node->right))
|
||||
@@ -1253,7 +1229,6 @@ gtk_tree_rbtree_remove_node (GtkTreeRBTree *tree,
|
||||
|
||||
gtk_tree_rbnode_free (node);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (TREE))
|
||||
{
|
||||
GString *s;
|
||||
@@ -1264,7 +1239,6 @@ gtk_tree_rbtree_remove_node (GtkTreeRBTree *tree,
|
||||
g_string_free (s, TRUE);
|
||||
gtk_tree_rbtree_test (G_STRLOC, tree);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
GtkTreeRBNode *
|
||||
@@ -1506,7 +1480,7 @@ void fixup_total_count (GtkTreeRBTree *tree,
|
||||
node->left->total_count + node->right->total_count;
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
#ifndef G_DISABLE_ASSERT
|
||||
static guint
|
||||
get_total_count (GtkTreeRBNode *node)
|
||||
{
|
||||
@@ -1563,6 +1537,7 @@ _count_nodes (GtkTreeRBTree *tree,
|
||||
g_error ("Tree failed");
|
||||
return res;
|
||||
}
|
||||
#endif /* G_DISABLE_ASSERT */
|
||||
|
||||
static void
|
||||
gtk_tree_rbtree_test_height (GtkTreeRBTree *tree,
|
||||
@@ -1744,4 +1719,3 @@ gtk_tree_rbtree_debug_spew (GtkTreeRBTree *tree,
|
||||
else
|
||||
gtk_tree_rbtree_debug_spew_helper (tree, tree->root, s, 0);
|
||||
}
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
@@ -195,7 +195,6 @@ static void gtk_tree_store_move (GtkTreeStore *
|
||||
gboolean before);
|
||||
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
static void validate_gnode (GNode *node);
|
||||
|
||||
static inline void
|
||||
@@ -207,9 +206,6 @@ validate_tree (GtkTreeStore *tree_store)
|
||||
validate_gnode (G_NODE (tree_store->priv->root));
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define validate_tree(store)
|
||||
#endif
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkTreeStore, gtk_tree_store, G_TYPE_OBJECT,
|
||||
G_ADD_PRIVATE (GtkTreeStore)
|
||||
@@ -3413,7 +3409,6 @@ gtk_tree_store_has_default_sort_func (GtkTreeSortable *sortable)
|
||||
return (tree_store->priv->default_sort_func != NULL);
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
static void
|
||||
validate_gnode (GNode* node)
|
||||
{
|
||||
@@ -3429,7 +3424,6 @@ validate_gnode (GNode* node)
|
||||
iter = iter->next;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* GtkBuildable custom tag implementation
|
||||
*
|
||||
|
||||
@@ -416,7 +416,6 @@ gtk_action_helper_set_action_name (GtkActionHelper *helper,
|
||||
if (g_strcmp0 (action_name, helper->action_name) == 0)
|
||||
return;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (ACTIONS))
|
||||
{
|
||||
if (action_name == NULL || !strchr (action_name, '.'))
|
||||
@@ -424,7 +423,6 @@ gtk_action_helper_set_action_name (GtkActionHelper *helper,
|
||||
"it is unlikely to work",
|
||||
"actionhelper", action_name);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Start by recording the current state of our properties so we know
|
||||
* what notify signals we will need to send.
|
||||
|
||||
+26
-23
@@ -1291,33 +1291,36 @@ gtk_at_context_get_text_accumulate (GtkATContext *self,
|
||||
}
|
||||
|
||||
/* Step 2.E */
|
||||
if (self->accessible_role == GTK_ACCESSIBLE_ROLE_TEXT_BOX)
|
||||
if ((property == GTK_ACCESSIBLE_PROPERTY_LABEL && is_child) || (relation == GTK_ACCESSIBLE_RELATION_LABELLED_BY && is_ref))
|
||||
{
|
||||
if (GTK_IS_EDITABLE (self->accessible))
|
||||
if (self->accessible_role == GTK_ACCESSIBLE_ROLE_TEXT_BOX)
|
||||
{
|
||||
const char *text = gtk_editable_get_text (GTK_EDITABLE (self->accessible));
|
||||
if (text && not_just_space (text))
|
||||
append_with_space (res, text);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (gtk_accessible_role_is_range_subclass (self->accessible_role))
|
||||
{
|
||||
if (gtk_accessible_attribute_set_contains (self->properties, GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT))
|
||||
if (GTK_IS_EDITABLE (self->accessible))
|
||||
{
|
||||
const char *text = gtk_editable_get_text (GTK_EDITABLE (self->accessible));
|
||||
if (text && not_just_space (text))
|
||||
append_with_space (res, text);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (gtk_accessible_role_is_range_subclass (self->accessible_role))
|
||||
{
|
||||
value = gtk_accessible_attribute_set_get_value (self->properties, GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT);
|
||||
append_with_space (res, gtk_string_accessible_value_get (value));
|
||||
}
|
||||
else if (gtk_accessible_attribute_set_contains (self->properties, GTK_ACCESSIBLE_PROPERTY_VALUE_NOW))
|
||||
{
|
||||
value = gtk_accessible_attribute_set_get_value (self->properties, GTK_ACCESSIBLE_PROPERTY_VALUE_NOW);
|
||||
if (res->len > 0)
|
||||
g_string_append (res, " ");
|
||||
g_string_append_printf (res, "%g", gtk_number_accessible_value_get (value));
|
||||
}
|
||||
if (gtk_accessible_attribute_set_contains (self->properties, GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT))
|
||||
{
|
||||
value = gtk_accessible_attribute_set_get_value (self->properties, GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT);
|
||||
append_with_space (res, gtk_string_accessible_value_get (value));
|
||||
}
|
||||
else if (gtk_accessible_attribute_set_contains (self->properties, GTK_ACCESSIBLE_PROPERTY_VALUE_NOW))
|
||||
{
|
||||
value = gtk_accessible_attribute_set_get_value (self->properties, GTK_ACCESSIBLE_PROPERTY_VALUE_NOW);
|
||||
if (res->len > 0)
|
||||
g_string_append (res, " ");
|
||||
g_string_append_printf (res, "%g", gtk_number_accessible_value_get (value));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Step 2.F */
|
||||
if (gtk_accessible_role_supports_name_from_content (self->accessible_role) || is_ref || is_child)
|
||||
|
||||
@@ -462,7 +462,6 @@ gtk_builder_finalize (GObject *object)
|
||||
g_free (priv->filename);
|
||||
g_free (priv->resource_prefix);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (BUILDER_OBJECTS))
|
||||
{
|
||||
GHashTableIter iter;
|
||||
@@ -476,7 +475,6 @@ gtk_builder_finalize (GObject *object)
|
||||
G_OBJECT_TYPE_NAME (value), (const char *)key);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
g_hash_table_destroy (priv->objects);
|
||||
if (priv->signals)
|
||||
@@ -988,14 +986,12 @@ _gtk_builder_construct (GtkBuilder *builder,
|
||||
const GValue *value = object_properties_get_value (¶meters, i);
|
||||
|
||||
iface->set_buildable_property (buildable, builder, name, value);
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (BUILDER))
|
||||
{
|
||||
char *str = g_strdup_value_contents (value);
|
||||
g_message ("set %s: %s = %s", info->id, name, str);
|
||||
g_free (str);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1004,7 +1000,6 @@ _gtk_builder_construct (GtkBuilder *builder,
|
||||
parameters.names->len,
|
||||
(const char **) parameters.names->pdata,
|
||||
(GValue *) parameters.values->data);
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (BUILDER))
|
||||
{
|
||||
for (i = 0; i < parameters.names->len; i++)
|
||||
@@ -1016,7 +1011,6 @@ _gtk_builder_construct (GtkBuilder *builder,
|
||||
g_free (str);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1072,14 +1066,12 @@ _gtk_builder_apply_properties (GtkBuilder *builder,
|
||||
const char *name = object_properties_get_name (¶meters, i);
|
||||
const GValue *value = object_properties_get_value (¶meters, i);
|
||||
iface->set_buildable_property (buildable, builder, name, value);
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (BUILDER))
|
||||
{
|
||||
char *str = g_strdup_value_contents (value);
|
||||
g_message ("set %s: %s = %s", info->id, name, str);
|
||||
g_free (str);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1088,7 +1080,6 @@ _gtk_builder_apply_properties (GtkBuilder *builder,
|
||||
parameters.names->len,
|
||||
(const char **) parameters.names->pdata,
|
||||
(GValue *) parameters.values->data);
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (BUILDER))
|
||||
{
|
||||
for (i = 0; i < parameters.names->len; i++)
|
||||
@@ -1100,7 +1091,6 @@ _gtk_builder_apply_properties (GtkBuilder *builder,
|
||||
g_free (str);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1763,7 +1763,6 @@ start_element (GtkBuildableParseContext *context,
|
||||
{
|
||||
ParserData *data = (ParserData*)user_data;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (BUILDER))
|
||||
{
|
||||
GString *tags = g_string_new ("");
|
||||
@@ -1779,7 +1778,6 @@ start_element (GtkBuildableParseContext *context,
|
||||
g_message ("<%s%s>", element_name, tags->str);
|
||||
g_string_free (tags, TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!data->last_element && strcmp (element_name, "interface") != 0)
|
||||
{
|
||||
|
||||
@@ -1099,7 +1099,6 @@ gtk_constraint_layout_allocate (GtkLayoutManager *manager,
|
||||
child_baseline);
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (LAYOUT))
|
||||
{
|
||||
GHashTableIter iter;
|
||||
@@ -1121,7 +1120,6 @@ gtk_constraint_layout_allocate (GtkLayoutManager *manager,
|
||||
gtk_constraint_variable_get_value (var_height));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* The allocation stay constraints are not needed any more */
|
||||
gtk_constraint_solver_remove_constraint (solver, stay_w);
|
||||
|
||||
@@ -728,23 +728,18 @@ gtk_constraint_solver_optimize (GtkConstraintSolver *self,
|
||||
{
|
||||
GtkConstraintVariable *entry = NULL, *exit = NULL;
|
||||
GtkConstraintExpression *z_row = g_hash_table_lookup (self->rows, z);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
gint64 start_time = g_get_monotonic_time ();
|
||||
#endif
|
||||
|
||||
g_assert (z_row != NULL);
|
||||
|
||||
self->optimize_count += 1;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (CONSTRAINTS))
|
||||
{
|
||||
char *str = gtk_constraint_variable_to_string (z);
|
||||
g_message ("optimize: %s", str);
|
||||
g_free (str);
|
||||
}
|
||||
#endif
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
@@ -801,7 +796,6 @@ gtk_constraint_solver_optimize (GtkConstraintSolver *self,
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (CONSTRAINTS))
|
||||
{
|
||||
char *entry_s = gtk_constraint_variable_to_string (entry);
|
||||
@@ -810,7 +804,6 @@ gtk_constraint_solver_optimize (GtkConstraintSolver *self,
|
||||
g_free (entry_s);
|
||||
g_free (exit_s);
|
||||
}
|
||||
#endif
|
||||
|
||||
gtk_constraint_solver_pivot (self, entry, exit);
|
||||
}
|
||||
@@ -1004,9 +997,7 @@ static void
|
||||
gtk_constraint_solver_dual_optimize (GtkConstraintSolver *self)
|
||||
{
|
||||
GtkConstraintExpression *z_row = g_hash_table_lookup (self->rows, self->objective);
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
gint64 start_time = g_get_monotonic_time ();
|
||||
#endif
|
||||
|
||||
/* We iterate until we don't have any more infeasible rows; the pivot()
|
||||
* at the end of the loop iteration may add or remove infeasible rows
|
||||
@@ -1262,14 +1253,12 @@ gtk_constraint_solver_add_with_artificial_variable (GtkConstraintSolver *self,
|
||||
gtk_constraint_solver_remove_column (self, av);
|
||||
gtk_constraint_solver_remove_row (self, az, TRUE);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (CONSTRAINTS))
|
||||
{
|
||||
char *str = gtk_constraint_expression_to_string (expression);
|
||||
g_message ("Unable to satisfy a required constraint (add): %s", str);
|
||||
g_free (str);
|
||||
}
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1313,7 +1302,6 @@ gtk_constraint_solver_add_constraint_internal (GtkConstraintSolver *self,
|
||||
&eminus,
|
||||
&prev_constant);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (CONSTRAINTS))
|
||||
{
|
||||
char *expr_s = gtk_constraint_expression_to_string (expr);
|
||||
@@ -1322,7 +1310,6 @@ gtk_constraint_solver_add_constraint_internal (GtkConstraintSolver *self,
|
||||
g_free (ref_s);
|
||||
g_free (expr_s);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (constraint->is_stay)
|
||||
{
|
||||
@@ -1494,9 +1481,7 @@ gtk_constraint_solver_create_variable (GtkConstraintSolver *self,
|
||||
void
|
||||
gtk_constraint_solver_resolve (GtkConstraintSolver *solver)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
gint64 start_time = g_get_monotonic_time ();
|
||||
#endif
|
||||
|
||||
g_return_if_fail (GTK_IS_CONSTRAINT_SOLVER (solver));
|
||||
|
||||
@@ -1626,14 +1611,12 @@ gtk_constraint_solver_add_stay_variable (GtkConstraintSolver *self,
|
||||
NULL,
|
||||
self);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (CONSTRAINTS))
|
||||
{
|
||||
char *str = gtk_constraint_expression_to_string (res->expression);
|
||||
g_message ("Adding stay variable: %s", str);
|
||||
g_free (str);
|
||||
}
|
||||
#endif
|
||||
|
||||
gtk_constraint_solver_add_constraint_internal (self, res);
|
||||
|
||||
|
||||
@@ -86,10 +86,8 @@ may_be_stored_in_cache (GtkCssStyle *style)
|
||||
*
|
||||
* We achieve that by disallowing any inserts into caches here.
|
||||
*/
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (NO_CSS_CACHE))
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
if (!GTK_IS_CSS_STATIC_STYLE (style))
|
||||
return FALSE;
|
||||
|
||||
@@ -82,16 +82,8 @@ typedef enum {
|
||||
GTK_DEBUG_INVERT_TEXT_DIR = 1 << 19,
|
||||
} GtkDebugFlags;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
|
||||
#define GTK_DEBUG_CHECK(type) G_UNLIKELY (gtk_get_debug_flags () & GTK_DEBUG_##type)
|
||||
|
||||
#else /* !G_ENABLE_DEBUG */
|
||||
|
||||
#define GTK_DEBUG_CHECK(type) 0
|
||||
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkDebugFlags gtk_get_debug_flags (void);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
||||
@@ -108,7 +108,6 @@ gtk_icon_cache_new_for_path (const char *path)
|
||||
if (!map)
|
||||
goto done;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (ICONTHEME))
|
||||
{
|
||||
CacheInfo info;
|
||||
@@ -126,7 +125,6 @@ gtk_icon_cache_new_for_path (const char *path)
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
GTK_DEBUG (ICONTHEME, "found icon cache for %s", path);
|
||||
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
#include <glib.h>
|
||||
#include <gdk-pixbuf/gdk-pixdata.h>
|
||||
|
||||
#if defined(G_ENABLE_DEBUG) || defined(BUILD_TOOLS)
|
||||
|
||||
#define VERBOSE(x)
|
||||
|
||||
#define check(name,condition) \
|
||||
@@ -401,5 +399,3 @@ gtk_icon_cache_validate (CacheInfo *info)
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -130,7 +130,6 @@ struct _GtkStringSet {
|
||||
int used_in_chunk;
|
||||
};
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
static void
|
||||
dump_string_set (GtkStringSet *set)
|
||||
{
|
||||
@@ -153,7 +152,6 @@ dump_string_set (GtkStringSet *set)
|
||||
g_print ("%s\n", string);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
gtk_string_set_init (GtkStringSet *set)
|
||||
@@ -2019,7 +2017,6 @@ load_themes (GtkIconTheme *self)
|
||||
|
||||
self->last_stat_time = g_get_monotonic_time ();
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DISPLAY_DEBUG_CHECK (self->display, ICONTHEME))
|
||||
{
|
||||
GList *l;
|
||||
@@ -2036,7 +2033,6 @@ load_themes (GtkIconTheme *self)
|
||||
|
||||
dump_string_set (&self->icons);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -2155,13 +2151,11 @@ real_choose_icon (GtkIconTheme *self,
|
||||
key.flags = flags;
|
||||
|
||||
/* This is used in the icontheme unit test */
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DISPLAY_DEBUG_CHECK (self->display, ICONTHEME))
|
||||
{
|
||||
for (i = 0; icon_names[i]; i++)
|
||||
gdk_debug_message ("\tlookup name: %s", icon_names[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
icon = icon_cache_lookup (self, &key);
|
||||
if (icon)
|
||||
@@ -2266,14 +2260,12 @@ real_choose_icon (GtkIconTheme *self,
|
||||
/* Fall back to missing icon */
|
||||
if (icon == NULL)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (ICONFALLBACK))
|
||||
{
|
||||
char *s = g_strjoinv (", ", (char **)icon_names);
|
||||
gdk_debug_message ("No icon found in %s (or fallbacks) for: %s", self->current_theme, s);
|
||||
g_free (s);
|
||||
}
|
||||
#endif
|
||||
icon = icon_paintable_new ("image-missing", size, scale);
|
||||
icon->filename = g_strdup (IMAGE_MISSING_RESOURCE_PATH);
|
||||
icon->is_resource = TRUE;
|
||||
|
||||
+2
-2
@@ -195,11 +195,11 @@ static const GdkDebugKey gtk_debug_keys[] = {
|
||||
{ "builder", GTK_DEBUG_BUILDER, "Trace GtkBuilder operation" },
|
||||
{ "builder-objects", GTK_DEBUG_BUILDER_OBJECTS, "Log unused GtkBuilder objects" },
|
||||
{ "no-css-cache", GTK_DEBUG_NO_CSS_CACHE, "Disable style property cache" },
|
||||
{ "interactive", GTK_DEBUG_INTERACTIVE, "Enable the GTK inspector", TRUE },
|
||||
{ "interactive", GTK_DEBUG_INTERACTIVE, "Enable the GTK inspector" },
|
||||
{ "snapshot", GTK_DEBUG_SNAPSHOT, "Generate debug render nodes" },
|
||||
{ "accessibility", GTK_DEBUG_A11Y, "Information about accessibility state changes" },
|
||||
{ "iconfallback", GTK_DEBUG_ICONFALLBACK, "Information about icon fallback" },
|
||||
{ "invert-text-dir", GTK_DEBUG_INVERT_TEXT_DIR, "Invert the default text direction", TRUE },
|
||||
{ "invert-text-dir", GTK_DEBUG_INVERT_TEXT_DIR, "Invert the default text direction" },
|
||||
};
|
||||
|
||||
/* This checks to see if the process is running suid or sgid
|
||||
|
||||
@@ -562,14 +562,12 @@ _gtk_menu_tracker_item_new (GtkActionObservable *observable,
|
||||
|
||||
action_name = strrchr (self->action_and_target, '|') + 1;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (ACTIONS))
|
||||
{
|
||||
if (!strchr (action_name, '.'))
|
||||
gdk_debug_message ("menutracker: action name %s doesn't look like 'app.' or 'win.'; "
|
||||
"it is unlikely to work", action_name);
|
||||
}
|
||||
#endif
|
||||
|
||||
state = NULL;
|
||||
|
||||
|
||||
@@ -1269,6 +1269,8 @@ create_print_dialog (GtkPrintDialog *self,
|
||||
if (page_setup)
|
||||
gtk_print_unix_dialog_set_page_setup (dialog, page_setup);
|
||||
|
||||
gtk_print_unix_dialog_set_embed_page_setup (dialog, TRUE);
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
|
||||
@@ -132,8 +132,6 @@ gboolean gtk_get_any_display_debug_flag_set (void);
|
||||
|
||||
GBytes *get_emoji_data (void);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
|
||||
#define GTK_DISPLAY_DEBUG_CHECK(display,type) \
|
||||
(gtk_get_any_display_debug_flag_set () && \
|
||||
G_UNLIKELY (gtk_get_display_debug_flags (display) & GTK_DEBUG_##type))
|
||||
@@ -150,14 +148,6 @@ GBytes *get_emoji_data (void);
|
||||
gdk_debug_message (__VA_ARGS__); \
|
||||
} G_STMT_END
|
||||
|
||||
#else
|
||||
|
||||
#define GTK_DISPLAY_DEBUG_CHECK(display,type) 0
|
||||
#define GTK_DISPLAY_DEBUG(display,type,...)
|
||||
#define GTK_DEBUG(type,...)
|
||||
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
char * _gtk_elide_underscores (const char *original);
|
||||
|
||||
void setlocale_initialization (void);
|
||||
|
||||
@@ -462,6 +462,7 @@ gtk_progress_bar_init (GtkProgressBar *pbar)
|
||||
NULL,
|
||||
NULL,
|
||||
NULL, NULL);
|
||||
gtk_widget_set_overflow (pbar->trough_widget, GTK_OVERFLOW_HIDDEN);
|
||||
gtk_widget_set_parent (pbar->trough_widget, GTK_WIDGET (pbar));
|
||||
|
||||
pbar->progress_widget = gtk_gizmo_new_with_role ("progress",
|
||||
|
||||
+7
-1
@@ -1698,7 +1698,13 @@ gtk_range_render_trough (GtkGizmo *gizmo,
|
||||
gtk_widget_snapshot_child (GTK_WIDGET (gizmo), priv->fill_widget, snapshot);
|
||||
|
||||
if (priv->highlight_widget)
|
||||
gtk_widget_snapshot_child (GTK_WIDGET (gizmo), priv->highlight_widget, snapshot);
|
||||
{
|
||||
GtkCssBoxes boxes;
|
||||
gtk_css_boxes_init (&boxes, GTK_WIDGET (gizmo));
|
||||
gtk_snapshot_push_rounded_clip(snapshot, gtk_css_boxes_get_padding_box (&boxes));
|
||||
gtk_widget_snapshot_child (GTK_WIDGET (gizmo), priv->highlight_widget, snapshot);
|
||||
gtk_snapshot_pop (snapshot);
|
||||
}
|
||||
|
||||
gtk_widget_snapshot_child (GTK_WIDGET (gizmo), priv->slider_widget, snapshot);
|
||||
}
|
||||
|
||||
@@ -161,14 +161,12 @@ gtk_shortcut_action_activate (GtkShortcutAction *self,
|
||||
g_return_val_if_fail (GTK_IS_SHORTCUT_ACTION (self), FALSE);
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (KEYBINDINGS))
|
||||
{
|
||||
char *act = gtk_shortcut_action_to_string (self);
|
||||
gdk_debug_message ("Shortcut action activate on %s: %s", G_OBJECT_TYPE_NAME (widget), act);
|
||||
g_free (act);
|
||||
}
|
||||
#endif
|
||||
|
||||
return GTK_SHORTCUT_ACTION_GET_CLASS (self)->activate (self, flags, widget, args);
|
||||
}
|
||||
|
||||
@@ -407,7 +407,6 @@ gtk_shortcut_controller_run_controllers (GtkEventController *controller,
|
||||
data->widget = widget;
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GTK_DEBUG_CHECK (KEYBINDINGS))
|
||||
{
|
||||
g_message ("Found %u shortcuts triggered %s by %s %u %u",
|
||||
@@ -417,7 +416,6 @@ gtk_shortcut_controller_run_controllers (GtkEventController *controller,
|
||||
gdk_key_event_get_keyval (event),
|
||||
gdk_event_get_modifier_state (event));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!shortcuts)
|
||||
return retval;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user