libgimpbase, libgimp, app: pass misc. GEGL config to plug-ins

Pass the GEGL tile-cache size, swap path, and thread-count to plug-
ins as part of their config, and have libgimp set the plug-in's
GeglConfig accordingly upon initialization.
This commit is contained in:
Ell
2018-11-19 16:13:07 -05:00
parent 7de86c63e6
commit 0a39f362b5
4 changed files with 42 additions and 1 deletions

View File

@ -226,6 +226,9 @@ gimp_plug_in_manager_call_run (GimpPlugInManager *manager,
config.icon_theme_dir = icon_theme_dir ? config.icon_theme_dir = icon_theme_dir ?
g_file_get_path (icon_theme_dir) : g_file_get_path (icon_theme_dir) :
NULL; NULL;
config.tile_cache_size = gegl_config->tile_cache_size;
config.swap_path = gegl_config->swap_path;
config.num_processors = gegl_config->num_processors;
proc_run.name = GIMP_PROCEDURE (procedure)->original_name; proc_run.name = GIMP_PROCEDURE (procedure)->original_name;
proc_run.nparams = gimp_value_array_length (args); proc_run.nparams = gimp_value_array_length (args);

View File

@ -2338,6 +2338,9 @@ gimp_config (GPConfig *config)
gimp_cpu_accel_set_use (config->use_cpu_accel); gimp_cpu_accel_set_use (config->use_cpu_accel);
g_object_set (gegl_config (), g_object_set (gegl_config (),
"tile-cache-size", config->tile_cache_size,
"swap", config->swap_path,
"threads", (gint) config->num_processors,
"use-opencl", config->use_opencl, "use-opencl", config->use_opencl,
"application-license", "GPL3", "application-license", "GPL3",
NULL); NULL);

View File

@ -553,6 +553,20 @@ _gp_config_read (GIOChannel *channel,
&config->icon_theme_dir, 1, user_data)) &config->icon_theme_dir, 1, user_data))
goto cleanup; goto cleanup;
if (config->version < 0x0019)
goto end;
if (! _gimp_wire_read_int64 (channel,
&config->tile_cache_size, 1, user_data))
goto cleanup;
if (! _gimp_wire_read_string (channel,
&config->swap_path, 1, user_data))
goto cleanup;
if (! _gimp_wire_read_int32 (channel,
(guint32 *) &config->num_processors, 1,
user_data))
goto cleanup;
end: end:
msg->data = config; msg->data = config;
return; return;
@ -562,6 +576,7 @@ _gp_config_read (GIOChannel *channel,
g_free (config->wm_class); g_free (config->wm_class);
g_free (config->display_name); g_free (config->display_name);
g_free (config->icon_theme_dir); g_free (config->icon_theme_dir);
g_free (config->swap_path);
g_slice_free (GPConfig, config); g_slice_free (GPConfig, config);
} }
@ -657,6 +672,20 @@ _gp_config_write (GIOChannel *channel,
if (! _gimp_wire_write_string (channel, if (! _gimp_wire_write_string (channel,
&config->icon_theme_dir, 1, user_data)) &config->icon_theme_dir, 1, user_data))
return; return;
if (config->version < 0x0019)
return;
if (! _gimp_wire_write_int64 (channel,
&config->tile_cache_size, 1, user_data))
return;
if (! _gimp_wire_write_string (channel,
&config->swap_path, 1, user_data))
return;
if (! _gimp_wire_write_int32 (channel,
(const guint32 *) &config->num_processors, 1,
user_data))
return;
} }
static void static void
@ -670,6 +699,7 @@ _gp_config_destroy (GimpWireMessage *msg)
g_free (config->wm_class); g_free (config->wm_class);
g_free (config->display_name); g_free (config->display_name);
g_free (config->icon_theme_dir); g_free (config->icon_theme_dir);
g_free (config->swap_path);
g_slice_free (GPConfig, config); g_slice_free (GPConfig, config);
} }
} }

View File

@ -26,7 +26,7 @@ G_BEGIN_DECLS
/* Increment every time the protocol changes /* Increment every time the protocol changes
*/ */
#define GIMP_PROTOCOL_VERSION 0x0018 #define GIMP_PROTOCOL_VERSION 0x0019
enum enum
@ -85,6 +85,11 @@ struct _GPConfig
/* since protocol version 0x0017: */ /* since protocol version 0x0017: */
gchar *icon_theme_dir; gchar *icon_theme_dir;
/* since protocol version 0x0019: */
guint64 tile_cache_size;
gchar *swap_path;
gint32 num_processors;
}; };
struct _GPTileReq struct _GPTileReq