aboutsummaryrefslogtreecommitdiff
path: root/render/swapchain.c
diff options
context:
space:
mode:
authorAlexander Orzechowski <alex@ozal.ski>2023-05-10 16:00:22 -0400
committerSimon Ser <contact@emersion.fr>2023-05-11 18:24:43 +0200
commit340700cb7085aff743f929845604ef95feb5820e (patch)
tree609306998e1fca465f33fb956228d730770f2efc /render/swapchain.c
parent099a147439b5b20d466316ae3dc8215f30ff3c1c (diff)
wlr_drm_format: Change wlr_drm_format_dup to copy
Diffstat (limited to 'render/swapchain.c')
-rw-r--r--render/swapchain.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/render/swapchain.c b/render/swapchain.c
index a15ac7f9..f72e722c 100644
--- a/render/swapchain.c
+++ b/render/swapchain.c
@@ -26,8 +26,7 @@ struct wlr_swapchain *wlr_swapchain_create(
swapchain->width = width;
swapchain->height = height;
- swapchain->format = wlr_drm_format_dup(format);
- if (swapchain->format == NULL) {
+ if (!wlr_drm_format_copy(&swapchain->format, format)) {
free(swapchain);
return NULL;
}
@@ -54,8 +53,7 @@ void wlr_swapchain_destroy(struct wlr_swapchain *swapchain) {
slot_reset(&swapchain->slots[i]);
}
wl_list_remove(&swapchain->allocator_destroy.link);
- wlr_drm_format_finish(swapchain->format);
- free(swapchain->format);
+ wlr_drm_format_finish(&swapchain->format);
free(swapchain);
}
@@ -107,7 +105,7 @@ struct wlr_buffer *wlr_swapchain_acquire(struct wlr_swapchain *swapchain,
wlr_log(WLR_DEBUG, "Allocating new swapchain buffer");
free_slot->buffer = wlr_allocator_create_buffer(swapchain->allocator,
- swapchain->width, swapchain->height, swapchain->format);
+ swapchain->width, swapchain->height, &swapchain->format);
if (free_slot->buffer == NULL) {
wlr_log(WLR_ERROR, "Failed to allocate buffer");
return NULL;