mirror of
https://gitlab.freedesktop.org/plymouth/plymouth.git
synced 2026-05-08 14:48:01 +02:00
Set appropreate wakeup_time to stop using 100% CPU.
This commit is contained in:
parent
53307819ff
commit
ea1ba09015
2 changed files with 20 additions and 12 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -57,13 +57,13 @@
|
|||
#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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue