Use wlr_raster allocator variants

This commit is contained in:
Alexander Orzechowski 2024-05-05 13:41:50 -04:00
parent f960378dd2
commit 57c5666cfd
2 changed files with 9 additions and 10 deletions

View file

@ -2096,7 +2096,8 @@ bool wlr_scene_output_build_state(struct wlr_scene_output *scene_output,
}
struct wlr_scene_buffer *buffer = wlr_scene_buffer_from_node(entry->node);
wlr_raster_create_texture(buffer->raster, output->renderer);
wlr_raster_obtain_texture_with_allocator(buffer->raster,
output->renderer, output->allocator);
}
render_data.render_pass = render_pass;

View file

@ -152,10 +152,6 @@ static void raster_attach_with_allocator(struct wlr_raster *raster,
source->allocator = allocator;
}
static void raster_attach(struct wlr_raster *raster, struct wlr_texture *texture) {
raster_attach_with_allocator(raster, texture, NULL);
}
static struct wlr_texture *wlr_raster_get_texture(struct wlr_raster *raster,
struct wlr_renderer *renderer) {
struct wlr_raster_source *source;
@ -379,13 +375,13 @@ struct wlr_texture *wlr_raster_obtain_texture_with_allocator(struct wlr_raster *
struct wlr_texture *texture = wlr_texture_from_buffer(
linux_dmabuf->main_renderer, raster->buffer);
if (texture) {
wlr_raster_attach_with_allocator(raster, texture,
raster_attach_with_allocator(raster, texture,
linux_dmabuf->main_allocator);
// try to create a blit but this time through the primary device
texture = raster_try_texture_from_blit(raster, renderer);
if (texture) {
wlr_raster_attach_with_allocator(raster, texture, allocator);
raster_attach_with_allocator(raster, texture, allocator);
return texture;
}
}
@ -404,7 +400,7 @@ struct wlr_texture *wlr_raster_obtain_texture_with_allocator(struct wlr_raster *
struct wlr_texture *wlr_raster_obtain_texture(struct wlr_raster *raster,
struct wlr_renderer *renderer) {
return wlr_raster_create_texture_with_allocator(raster, renderer, NULL);
return wlr_raster_obtain_texture_with_allocator(raster, renderer, NULL);
}
struct raster_update_state {
@ -444,9 +440,10 @@ static void raster_update_handle_old_raster_destroy(struct wl_listener *listener
struct wlr_raster_source *source, *tmp_source;
wl_list_for_each_safe(source, tmp_source, &state->old_raster->sources, link) {
struct wlr_texture *texture = source->texture;
struct wlr_allocator *allocator = source->allocator;
if (wlr_texture_update_from_buffer(texture, state->buffer, &state->damage)) {
raster_detach(state->old_raster, texture);
raster_attach(state->new_raster, texture);
raster_attach_with_allocator(state->new_raster, texture, allocator);
}
}
@ -530,7 +527,8 @@ static void surface_raster_handle_buffer_prerelease(struct wl_listener *listener
struct wlr_surface_output *output;
wl_list_for_each(output, &surface_raster->surface->current_outputs, link) {
wlr_raster_obtain_texture(raster, output->output->renderer);
wlr_raster_obtain_texture_with_allocator(raster,
output->output->renderer, output->output->allocator);
}
// if there was a failed texture upload, keep on locking the buffer