mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-22 09:59:48 +01:00
render/allocator/drm_dumb: get format info before allocating
Simplifies error handling a bit.
This commit is contained in:
parent
d81f68d2b4
commit
3e7ea8715b
1 changed files with 8 additions and 8 deletions
|
@ -55,6 +55,14 @@ static struct wlr_drm_dumb_buffer *create_buffer(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const struct wlr_pixel_format_info *info =
|
||||
drm_get_pixel_format_info(format->format);
|
||||
if (info == NULL) {
|
||||
wlr_log(WLR_ERROR, "DRM format 0x%"PRIX32" not supported",
|
||||
format->format);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct wlr_drm_dumb_buffer *buffer = calloc(1, sizeof(*buffer));
|
||||
if (buffer == NULL) {
|
||||
return NULL;
|
||||
|
@ -62,14 +70,6 @@ static struct wlr_drm_dumb_buffer *create_buffer(
|
|||
wlr_buffer_init(&buffer->base, &buffer_impl, width, height);
|
||||
wl_list_insert(&alloc->buffers, &buffer->link);
|
||||
|
||||
const struct wlr_pixel_format_info *info =
|
||||
drm_get_pixel_format_info(format->format);
|
||||
if (info == NULL) {
|
||||
wlr_log(WLR_ERROR, "DRM format 0x%"PRIX32" not supported",
|
||||
format->format);
|
||||
goto create_err;
|
||||
}
|
||||
|
||||
struct drm_mode_create_dumb create = {0};
|
||||
create.width = (uint32_t)width;
|
||||
create.height = (uint32_t)height;
|
||||
|
|
Loading…
Reference in a new issue