Skip to content

vo_gpu_next: only re-upload OSD textures when they change - #18352

Open
rlauuzo wants to merge 1 commit into
mpv-player:masterfrom
rlauuzo:osd-upload-cache
Open

vo_gpu_next: only re-upload OSD textures when they change#18352
rlauuzo wants to merge 1 commit into
mpv-player:masterfrom
rlauuzo:osd-upload-cache

Conversation

@rlauuzo

@rlauuzo rlauuzo commented Aug 8, 2026

Copy link
Copy Markdown

update_overlays() uploaded every sub_bitmaps item to its texture on
every call, and draw_frame() calls it unconditionally, so an OSD that
was not changing got re-uploaded at the display refresh rate rather
than at the rate it actually changed.

vo_gpu already avoids this: gen_osd_cb() compares sub_bitmaps.change_id
against a cached copy and skips upload_osd() when they match.
osd_render() computes that change_id for both VOs, so vo_gpu_next had
the information and did not read it. Cache the id next to the texture
and skip pl_tex_upload() when it matches.

Also restrict pl_tex_recreate() to the cases where the size or format
has to change. The cache requires this, because pl_tex_recreate()
invalidates the texture even when it keeps it, and the cached id would
then describe contents that are no longer defined.

AI Disclosure: The patch was written with AI assistance. I understand
what it does and why. The change is submitted under the same
licence as video/out/vo_gpu_next.c (LGPLv2.1+).

update_overlays() uploaded every sub_bitmaps item to its texture on
every call, and draw_frame() calls it unconditionally, so an OSD that
was not changing got re-uploaded at the display refresh rate rather
than at the rate it actually changed.

vo_gpu already avoids this: gen_osd_cb() compares sub_bitmaps.change_id
against a cached copy and skips upload_osd() when they match.
osd_render() computes that change_id for both VOs, so vo_gpu_next had
the information and did not read it. Cache the id next to the texture
and skip pl_tex_upload() when it matches.

Also restrict pl_tex_recreate() to the cases where the size or format
has to change. The cache requires this, because pl_tex_recreate()
invalidates the texture even when it keeps it, and the cached id would
then describe contents that are no longer defined.
@kasper93 kasper93 added this to the Release v0.42.0 milestone Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants