From e06ea4e84a4e6882ecaa58697280ac89d3aa4dba Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 31 May 2021 19:35:25 +0200 Subject: [PATCH] backend/drm: remove format arg from drm_plane_init_surface This was always set to ARGB8888. --- backend/drm/drm.c | 9 +++------ backend/drm/renderer.c | 4 +++- include/backend/drm/renderer.h | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 9e2c870b..c9d3b54a 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -676,10 +676,9 @@ static bool drm_connector_init_renderer(struct wlr_drm_connector *conn, int width = mode.hdisplay; int height = mode.vdisplay; - uint32_t format = DRM_FORMAT_ARGB8888; bool modifiers = drm->addfb2_modifiers; - if (!drm_plane_init_surface(plane, drm, width, height, format, modifiers) || + if (!drm_plane_init_surface(plane, drm, width, height, modifiers) || !drm_connector_pageflip_renderer(conn, state)) { if (!modifiers) { wlr_drm_conn_log(conn, WLR_ERROR, "Failed to initialize renderer:" @@ -694,8 +693,7 @@ static bool drm_connector_init_renderer(struct wlr_drm_connector *conn, "retrying without modifiers"); modifiers = false; - if (!drm_plane_init_surface(plane, drm, width, height, format, - modifiers)) { + if (!drm_plane_init_surface(plane, drm, width, height, modifiers)) { return false; } if (!drm_connector_pageflip_renderer(conn, state)) { @@ -860,8 +858,7 @@ static bool drm_connector_set_cursor(struct wlr_output *output, ret = drmGetCap(drm->fd, DRM_CAP_CURSOR_HEIGHT, &h); h = ret ? 64 : h; - if (!drm_plane_init_surface(plane, drm, w, h, - DRM_FORMAT_ARGB8888, true)) { + if (!drm_plane_init_surface(plane, drm, w, h, true)) { wlr_drm_conn_log(conn, WLR_ERROR, "Cannot allocate cursor resources"); return false; } diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c index 5ca7ed46..1e2888fa 100644 --- a/backend/drm/renderer.c +++ b/backend/drm/renderer.c @@ -193,7 +193,9 @@ static struct wlr_drm_format *create_linear_format(uint32_t format) { bool drm_plane_init_surface(struct wlr_drm_plane *plane, struct wlr_drm_backend *drm, int32_t width, uint32_t height, - uint32_t format, bool with_modifiers) { + bool with_modifiers) { + uint32_t format = DRM_FORMAT_ARGB8888; + if (!wlr_drm_format_set_has(&plane->formats, format, DRM_FORMAT_MOD_INVALID)) { const struct wlr_pixel_format_info *info = drm_get_pixel_format_info(format); diff --git a/include/backend/drm/renderer.h b/include/backend/drm/renderer.h index 089c7923..c4dee425 100644 --- a/include/backend/drm/renderer.h +++ b/include/backend/drm/renderer.h @@ -57,7 +57,7 @@ bool drm_surface_render_black_frame(struct wlr_drm_surface *surf); bool drm_plane_init_surface(struct wlr_drm_plane *plane, struct wlr_drm_backend *drm, int32_t width, uint32_t height, - uint32_t format, bool with_modifiers); + bool with_modifiers); void drm_plane_finish_surface(struct wlr_drm_plane *plane); bool drm_plane_lock_surface(struct wlr_drm_plane *plane, struct wlr_drm_backend *drm);