diff options
author | Simon Ser <contact@emersion.fr> | 2020-12-12 22:26:52 +0100 |
---|---|---|
committer | Ilia Bozhinov <ammen99@gmail.com> | 2020-12-18 09:41:12 +0100 |
commit | 1e2c7fce869c009fdcd91e011cffcfdf229816e7 (patch) | |
tree | 6416f928431ad0f30e81da9d95e990b579c7488f | |
parent | d37214cb1622458b4d2009a98279b67edcda15b5 (diff) |
backend/drm: use wlr_drm_format_{create,add}
Instead of manually allocating and initializing the structs, use the new
wlr_drm_format helpers.
-rw-r--r-- | backend/drm/renderer.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c index 7599623a..61b838bc 100644 --- a/backend/drm/renderer.c +++ b/backend/drm/renderer.c @@ -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); |