]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
Set appropreate wakeup_time to stop using 100% CPU.
authorCharles Brej <cbrej@cs.man.ac.uk>
Sun, 12 Oct 2008 19:53:56 +0000 (20:53 +0100)
committerCharles Brej <cbrej@cs.man.ac.uk>
Sun, 12 Oct 2008 19:53:56 +0000 (20:53 +0100)
src/libply/ply-event-loop.c
src/plugins/splash/solar/plugin.c

index 31d6016f65b5cf5d07d4f11a0a9be3f93e8378f2..ac200bbe6221f8d42f70eea7cc6a5a517b4def8d 100644 (file)
@@ -893,7 +893,9 @@ ply_event_loop_stop_watching_for_timeout (ply_event_loop_t *loop,
                                           void             *user_data)
 {
   ply_list_node_t *node;
-
+  
+  loop->wakeup_time = PLY_EVENT_LOOP_NO_TIMED_WAKEUP;
+  
   node = ply_list_get_first_node (loop->timeout_watches);
   while (node != NULL)
     {
@@ -908,6 +910,12 @@ ply_event_loop_stop_watching_for_timeout (ply_event_loop_t *loop,
               ply_list_remove_node (loop->timeout_watches, node);
               free (timeout_watch);
       }
+      else {
+        if (fabs (loop->wakeup_time - PLY_EVENT_LOOP_NO_TIMED_WAKEUP) <= 0)
+          loop->wakeup_time = timeout_watch->timeout;
+        else
+          loop->wakeup_time = MIN (loop->wakeup_time, timeout_watch->timeout);
+      }
 
       node = next_node;
     }
@@ -1122,6 +1130,7 @@ ply_event_loop_handle_timeouts (ply_event_loop_t *loop)
 
   now = ply_get_timestamp ();
   node = ply_list_get_first_node (loop->timeout_watches);
+  loop->wakeup_time=PLY_EVENT_LOOP_NO_TIMED_WAKEUP;
   while (node != NULL)
     {
       ply_list_node_t *next_node;
@@ -1137,12 +1146,16 @@ ply_event_loop_handle_timeouts (ply_event_loop_t *loop)
           free (watch);
           ply_list_remove_node (loop->timeout_watches, node);
         }
+      else {
+          if (fabs (loop->wakeup_time - PLY_EVENT_LOOP_NO_TIMED_WAKEUP) <= 0)
+            loop->wakeup_time = watch->timeout;
+          else
+            loop->wakeup_time = MIN (loop->wakeup_time, watch->timeout);
+        }
 
       node = next_node;
     }
 
-  if (ply_list_get_length (loop->timeout_watches) == 0)
-    loop->wakeup_time = PLY_EVENT_LOOP_NO_TIMED_WAKEUP;
 }
 
 static void
index 83b4b77819d6d18f669737c6931cbe59db2d8220..9dd0522f90879cd172738b7e795c52691c8c6ef4 100644 (file)
 #include <linux/kd.h>
 
 #ifndef FRAMES_PER_SECOND
-#define FRAMES_PER_SECOND 20
+#define FRAMES_PER_SECOND 50
 #endif
 
-#define FLARE_FRAMES_PER_SECOND 10
+#define FLARE_FRAMES_PER_SECOND 25
 #define FLARE_COUNT 60
 #define FLARE_LINE_COUNT 4
-#define HALO_BLUR 6
+#define HALO_BLUR 4
 
 /*you can comment one or both of these out*/
 /*#define SHOW_PLANETS */
@@ -755,11 +755,6 @@ start_animation (ply_boot_splash_plugin_t *plugin)
   ply_frame_buffer_get_size (plugin->frame_buffer, &area);
 
   plugin->now = ply_get_timestamp ();
-  ply_event_loop_watch_for_timeout (plugin->loop, 
-                                    1.0 / FRAMES_PER_SECOND,
-                                    (ply_event_loop_timeout_handler_t)
-                                    on_timeout, plugin);
-
   setup_solar (plugin);
   on_timeout (plugin);
   ply_window_draw_area (plugin->window, area.x, area.y, area.width, area.height);
@@ -945,7 +940,7 @@ void highlight_image (ply_image_t *highlighted_image, ply_image_t *orig_image, i
     for (subx=min_x; subx<max_x; subx++){
     for (suby=min_y; suby<max_y; suby++){
         uint32_t pixel = orig_image_data[x+subx+x_offset + (y+suby+y_offset) * orig_width];
-        float current = 1-(sqrt((subx*subx)+(suby*suby))+1)/(distance+3);
+        float current = 1-(sqrt((subx*subx)+(suby*suby))+1)/(distance+2);
         current*=pixel>>24;
         if (current>best) best=current;
         }