[gegl/gsoc2009-gpu] Make use of GeglConfig::gpu_enabled to enable/disable GPU support during startup



commit 0fb813effe35c65bb6a77983fffb6485c41f1385
Author: Jerson Michael Perpetua <jersonperpetua gmail com>
Date:   Thu Aug 27 07:34:33 2009 +0800

    Make use of GeglConfig::gpu_enabled to enable/disable GPU support during startup
    
    Make use of GeglConfig::gpu_enabled to enable/disable GPU support
    during startup.  Likewise, call gegl_gpu_exit() only if GPU support was
    previously enabled.

 gegl/gegl-init.c |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)
---
diff --git a/gegl/gegl-init.c b/gegl/gegl-init.c
index a1f49a4..1576481 100644
--- a/gegl/gegl-init.c
+++ b/gegl/gegl-init.c
@@ -162,11 +162,6 @@ gegl_init (gint    *argc,
   if (config)
     return;
 
-  /* initialize GPU subsystem and let it handle the program command-line
-   * first
-   */
-  gegl_gpu_init (argc, argv);
-
   /*  If any command-line actions are ever added to GEGL, then the commented
    *  out code below should be used.  Until then, we simply call the parse hook
    *  directly.
@@ -188,6 +183,9 @@ gegl_init (gint    *argc,
 
   g_option_context_free (context);
 #endif
+
+  if (config->gpu_enabled)
+    gegl_gpu_init (argc, argv);
 }
 
 static gchar *cmd_gegl_swap        = NULL;
@@ -342,6 +340,7 @@ gegl_exit (void)
   gegl_tile_cache_destroy ();
   gegl_operation_gtype_cleanup ();
   gegl_extension_handler_cleanup ();
+  gegl_buffer_iterator_cleanup ();
 
   if (module_db != NULL)
     {
@@ -349,6 +348,9 @@ gegl_exit (void)
       module_db = NULL;
     }
 
+  if (gegl_gpu_is_accelerated ())
+    gegl_gpu_exit ();
+
   babl_exit ();
 
   timing = gegl_ticks () - timing;
@@ -412,12 +414,6 @@ gegl_exit (void)
   config = NULL;
 
   g_printf ("\n");
-
-  /* XXX: Should probably output some debug information. Everybody else is
-   * doing it, why aren't we?
-   */
-  gegl_buffer_iterator_cleanup ();
-  gegl_gpu_exit ();
 }
 
 static void swap_clean (void);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]