Skip to content

Commit

Permalink
sub/osd: add log if osd rendering takes too long time
Browse files Browse the repository at this point in the history
Ideally it should be fast, it is on VO thread and steals precious frame
time budget. Looks like this is one of the main reasons why
display-resample on higher refresh rate displays is too slow.
  • Loading branch information
kasper93 committed Sep 14, 2024
1 parent 0e43eea commit ef19a4a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sub/osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ struct sub_bitmap_list *osd_render(struct osd_state *osd, struct mp_osd_res res,
{
mp_mutex_lock(&osd->lock);

int64_t start_time = mp_time_ns();

struct sub_bitmap_list *list = talloc_zero(NULL, struct sub_bitmap_list);
list->change_id = 1;
list->w = res.w;
Expand Down Expand Up @@ -388,6 +390,11 @@ struct sub_bitmap_list *osd_render(struct osd_state *osd, struct mp_osd_res res,
if (!(draw_flags & OSD_DRAW_SUB_FILTER))
osd->want_redraw_notification = false;

double elapsed = MP_TIME_NS_TO_MS(mp_time_ns() - start_time);
bool slow = elapsed > 5;
mp_msg(osd->log, slow ? MSGL_DEBUG : MSGL_TRACE, "Spent %.3f ms in %s%s\n",
elapsed, __func__, slow ? " (slow!)" : "");

mp_mutex_unlock(&osd->lock);
return list;
}
Expand Down

0 comments on commit ef19a4a

Please sign in to comment.