mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 06:35:58 +01:00
backend/drm: use wlr_drm_format_{create,add}
Instead of manually allocating and initializing the structs, use the new wlr_drm_format helpers.
This commit is contained in:
parent
d37214cb16
commit
1e2c7fce86
1 changed files with 7 additions and 8 deletions
|
@ -256,20 +256,19 @@ bool drm_plane_init_surface(struct wlr_drm_plane *plane,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const struct wlr_drm_format format_no_modifiers = { .format = format };
|
drm_format = wlr_drm_format_create(format);
|
||||||
drm_format = wlr_drm_format_dup(&format_no_modifiers);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_drm_format *drm_format_linear =
|
struct wlr_drm_format *drm_format_linear = wlr_drm_format_create(format);
|
||||||
calloc(1, sizeof(struct wlr_drm_format) + sizeof(uint64_t));
|
|
||||||
if (drm_format_linear == NULL) {
|
if (drm_format_linear == NULL) {
|
||||||
free(drm_format);
|
free(drm_format);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
drm_format_linear->format = drm_format->format;
|
if (!wlr_drm_format_add(&drm_format_linear, DRM_FORMAT_MOD_LINEAR)) {
|
||||||
drm_format_linear->len = 1;
|
free(drm_format_linear);
|
||||||
drm_format_linear->cap = 1;
|
free(drm_format);
|
||||||
drm_format_linear->modifiers[0] = DRM_FORMAT_MOD_LINEAR;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (force_linear) {
|
if (force_linear) {
|
||||||
free(drm_format);
|
free(drm_format);
|
||||||
|
|
Loading…
Reference in a new issue