mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 06:35:58 +01:00
wlr_drm_format: Introduce drm_format_finish
This commit is contained in:
parent
e353c5c631
commit
b45396c790
7 changed files with 19 additions and 0 deletions
|
@ -513,6 +513,7 @@ static bool drm_connector_state_update_primary_fb(struct wlr_drm_connector *conn
|
||||||
// TODO: fallback to modifier-less buffer allocation
|
// TODO: fallback to modifier-less buffer allocation
|
||||||
bool ok = init_drm_surface(&plane->mgpu_surf, &drm->mgpu_renderer,
|
bool ok = init_drm_surface(&plane->mgpu_surf, &drm->mgpu_renderer,
|
||||||
source_buf->width, source_buf->height, format);
|
source_buf->width, source_buf->height, format);
|
||||||
|
wlr_drm_format_finish(format);
|
||||||
free(format);
|
free(format);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -953,6 +954,7 @@ static bool drm_connector_set_cursor(struct wlr_output *output,
|
||||||
|
|
||||||
bool ok = init_drm_surface(&plane->mgpu_surf, &drm->mgpu_renderer,
|
bool ok = init_drm_surface(&plane->mgpu_surf, &drm->mgpu_renderer,
|
||||||
buffer->width, buffer->height, format);
|
buffer->width, buffer->height, format);
|
||||||
|
wlr_drm_format_finish(format);
|
||||||
free(format);
|
free(format);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -25,6 +25,11 @@ struct wlr_drm_format {
|
||||||
uint64_t modifiers[];
|
uint64_t modifiers[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free all resources allocated to this DRM format.
|
||||||
|
*/
|
||||||
|
void wlr_drm_format_finish(struct wlr_drm_format *format);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A set of DRM formats and modifiers.
|
* A set of DRM formats and modifiers.
|
||||||
*
|
*
|
||||||
|
|
|
@ -8,8 +8,13 @@
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
#include "render/drm_format_set.h"
|
#include "render/drm_format_set.h"
|
||||||
|
|
||||||
|
void wlr_drm_format_finish(struct wlr_drm_format *format) {
|
||||||
|
// For later
|
||||||
|
}
|
||||||
|
|
||||||
void wlr_drm_format_set_finish(struct wlr_drm_format_set *set) {
|
void wlr_drm_format_set_finish(struct wlr_drm_format_set *set) {
|
||||||
for (size_t i = 0; i < set->len; ++i) {
|
for (size_t i = 0; i < set->len; ++i) {
|
||||||
|
wlr_drm_format_finish(set->formats[i]);
|
||||||
free(set->formats[i]);
|
free(set->formats[i]);
|
||||||
}
|
}
|
||||||
free(set->formats);
|
free(set->formats);
|
||||||
|
@ -60,6 +65,7 @@ bool wlr_drm_format_set_add(struct wlr_drm_format_set *set, uint32_t format,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!wlr_drm_format_add(&fmt, modifier)) {
|
if (!wlr_drm_format_add(&fmt, modifier)) {
|
||||||
|
wlr_drm_format_finish(fmt);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,6 +202,7 @@ struct wlr_drm_format *wlr_drm_format_intersect(
|
||||||
// If the intersection is empty, then the formats aren't compatible with
|
// If the intersection is empty, then the formats aren't compatible with
|
||||||
// each other.
|
// each other.
|
||||||
if (format->len == 0) {
|
if (format->len == 0) {
|
||||||
|
wlr_drm_format_set_finish(format);
|
||||||
free(format);
|
free(format);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@ void wlr_swapchain_destroy(struct wlr_swapchain *swapchain) {
|
||||||
slot_reset(&swapchain->slots[i]);
|
slot_reset(&swapchain->slots[i]);
|
||||||
}
|
}
|
||||||
wl_list_remove(&swapchain->allocator_destroy.link);
|
wl_list_remove(&swapchain->allocator_destroy.link);
|
||||||
|
wlr_drm_format_finish(swapchain->format);
|
||||||
free(swapchain->format);
|
free(swapchain->format);
|
||||||
free(swapchain);
|
free(swapchain);
|
||||||
}
|
}
|
||||||
|
|
|
@ -299,6 +299,7 @@ static struct wlr_buffer *render_cursor_buffer(struct wlr_output_cursor *cursor)
|
||||||
wlr_swapchain_destroy(output->cursor_swapchain);
|
wlr_swapchain_destroy(output->cursor_swapchain);
|
||||||
output->cursor_swapchain = wlr_swapchain_create(allocator,
|
output->cursor_swapchain = wlr_swapchain_create(allocator,
|
||||||
width, height, format);
|
width, height, format);
|
||||||
|
wlr_drm_format_finish(format);
|
||||||
free(format);
|
free(format);
|
||||||
if (output->cursor_swapchain == NULL) {
|
if (output->cursor_swapchain == NULL) {
|
||||||
wlr_log(WLR_ERROR, "Failed to create cursor swapchain");
|
wlr_log(WLR_ERROR, "Failed to create cursor swapchain");
|
||||||
|
|
|
@ -609,6 +609,7 @@ static bool output_basic_test(struct wlr_output *output,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wlr_drm_format_finish(format);
|
||||||
free(format);
|
free(format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ static struct wlr_swapchain *create_swapchain(struct wlr_output *output,
|
||||||
if (!allow_modifiers && (format->len != 1 || format->modifiers[0] != DRM_FORMAT_MOD_LINEAR)) {
|
if (!allow_modifiers && (format->len != 1 || format->modifiers[0] != DRM_FORMAT_MOD_LINEAR)) {
|
||||||
if (!wlr_drm_format_has(format, DRM_FORMAT_MOD_INVALID)) {
|
if (!wlr_drm_format_has(format, DRM_FORMAT_MOD_INVALID)) {
|
||||||
wlr_log(WLR_DEBUG, "Implicit modifiers not supported");
|
wlr_log(WLR_DEBUG, "Implicit modifiers not supported");
|
||||||
|
wlr_drm_format_finish(format);
|
||||||
free(format);
|
free(format);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -41,6 +42,7 @@ static struct wlr_swapchain *create_swapchain(struct wlr_output *output,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_swapchain *swapchain = wlr_swapchain_create(allocator, width, height, format);
|
struct wlr_swapchain *swapchain = wlr_swapchain_create(allocator, width, height, format);
|
||||||
|
wlr_drm_format_finish(format);
|
||||||
free(format);
|
free(format);
|
||||||
return swapchain;
|
return swapchain;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue