@@ -106,6 +106,7 @@ struct display {
106106
107107 time_ns_t t0 ;
108108 int frames ;
109+ int dropped ;
109110};
110111
111112void list_video_display_devices (bool full )
@@ -352,17 +353,22 @@ struct video_frame *display_get_frame(struct display *d)
352353 * indicator but externally linked for those that do not, like vulkan_sdl3.
353354 */
354355void
355- display_print_fps (const char * prefix , double seconds , int frames ,
356+ display_print_fps (const char * prefix , double seconds , int frames , int dropped ,
356357 double nominal_fps )
357358{
358359 const double fps = frames / seconds ;
359360 const char * const fps_col = get_stat_color (fps / nominal_fps );
360361
362+ char drop_str [32 ] = "" ;
363+ if (dropped > 0 ){
364+ snprintf (drop_str , sizeof (drop_str ), " (%d frames dropped)" , dropped );
365+ }
366+
361367 log_msg (LOG_LEVEL_INFO ,
362368 TERM_BOLD TERM_FG_MAGENTA "%s" TERM_RESET
363369 "%d frames in %g seconds = " TERM_BOLD
364- "%s%g FPS" TERM_RESET "\n" ,
365- prefix , frames , seconds , fps_col , fps );
370+ "%s%g FPS%s " TERM_RESET "\n" ,
371+ prefix , frames , seconds , fps_col , fps , drop_str );
366372}
367373
368374static bool display_frame_helper (struct display * d , struct video_frame * frame , long long timeout_ns )
@@ -378,16 +384,19 @@ static bool display_frame_helper(struct display *d, struct video_frame *frame, l
378384 }
379385 if (ret ) {
380386 d -> frames ++ ;
387+ } else {
388+ d -> dropped ++ ;
381389 }
382390 // display FPS
383391 time_ns_t t = get_time_in_ns ();
384392 long long seconds_ns = t - d -> t0 ;
385393 if (seconds_ns > 5 * NS_IN_SEC ) {
386394 const double seconds = (double ) seconds_ns / NS_IN_SEC ;
387395 display_print_fps (d -> funcs -> generic_fps_indicator_prefix ,
388- seconds , d -> frames , frame_fps );
396+ seconds , d -> frames , d -> dropped , frame_fps );
389397
390398 d -> frames = 0 ;
399+ d -> dropped = 0 ;
391400 d -> t0 = t ;
392401 }
393402 return ret ;
0 commit comments