render/vulkan: Delay shm texture updates till render

In order to optimize rendering of shm-backed buffers, we copy the buffer
into a properly allocated texture. However, some clients might send
rapid updates for large surfaces, or may not even be visible, making the
copy wasteful.

Move the copy to the point where the texture is added to the render
pass, ensuring that we only perform the copy if texture is being used
and only once per render. This means that the shm optimization is
effectively disabled for clients that are not visible.
This commit is contained in:
Kenny Levinsen 2024-07-04 00:57:17 +02:00
parent 67b88e46b0
commit 6ca84bf64d
3 changed files with 51 additions and 15 deletions

View file

@ -612,6 +612,8 @@ static void render_pass_add_texture(struct wlr_render_pass *wlr_pass,
wl_list_insert(&renderer->foreign_textures, &texture->foreign_link);
}
vulkan_texture_update(texture);
struct wlr_fbox src_box;
wlr_render_texture_options_get_src_box(options, &src_box);
struct wlr_box dst_box;