mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-23 02:19:49 +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;
|
||||
}
|
||||
} else {
|
||||
const struct wlr_drm_format format_no_modifiers = { .format = format };
|
||||
drm_format = wlr_drm_format_dup(&format_no_modifiers);
|
||||
drm_format = wlr_drm_format_create(format);
|
||||
}
|
||||
|
||||
struct wlr_drm_format *drm_format_linear =
|
||||
calloc(1, sizeof(struct wlr_drm_format) + sizeof(uint64_t));
|
||||
struct wlr_drm_format *drm_format_linear = wlr_drm_format_create(format);
|
||||
if (drm_format_linear == NULL) {
|
||||
free(drm_format);
|
||||
return false;
|
||||
}
|
||||
drm_format_linear->format = drm_format->format;
|
||||
drm_format_linear->len = 1;
|
||||
drm_format_linear->cap = 1;
|
||||
drm_format_linear->modifiers[0] = DRM_FORMAT_MOD_LINEAR;
|
||||
if (!wlr_drm_format_add(&drm_format_linear, DRM_FORMAT_MOD_LINEAR)) {
|
||||
free(drm_format_linear);
|
||||
free(drm_format);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (force_linear) {
|
||||
free(drm_format);
|
||||
|
|
Loading…
Reference in a new issue