aboutsummaryrefslogtreecommitdiff
path: root/backend/drm
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-04-01 21:14:38 +0200
committerSimon Ser <contact@emersion.fr>2021-04-06 14:57:59 +0200
commit1ec97bdf4fea9ae1c9cd4d4589d15cb45d9bfb84 (patch)
treefcf1e21b458916367ab75c00445ebf8873c3fb98 /backend/drm
parent511e42be5e48b3a7eec082dc32c04863a370c4c7 (diff)
backend/drm: improve logs in drm_fb_create
Downgrade errors to DEBUG level, because drm_fb_create is used in test_buffer, so errors aren't always fatal. Add ERROR logs at call sites where a failure is fatal, to make it clear something wrong happened.
Diffstat (limited to 'backend/drm')
-rw-r--r--backend/drm/drm.c1
-rw-r--r--backend/drm/renderer.c31
2 files changed, 16 insertions, 16 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index db9747b3..8e8fa6b7 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -474,6 +474,7 @@ static bool drm_connector_commit_buffer(struct wlr_output *output) {
}
if (!drm_fb_import(&plane->pending_fb, drm, buffer,
&crtc->primary->formats)) {
+ wlr_log(WLR_ERROR, "Failed to import buffer");
return false;
}
break;
diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c
index 13e2801c..2e9c825c 100644
--- a/backend/drm/renderer.c
+++ b/backend/drm/renderer.c
@@ -319,6 +319,9 @@ bool drm_plane_lock_surface(struct wlr_drm_plane *plane,
wlr_buffer_unlock(buf);
bool ok = drm_fb_import(&plane->pending_fb, drm, local_buf, NULL);
+ if (!ok) {
+ wlr_log(WLR_ERROR, "Failed to import buffer");
+ }
wlr_buffer_unlock(local_buf);
return ok;
}
@@ -370,46 +373,42 @@ static struct wlr_drm_fb *drm_fb_create(struct wlr_drm_backend *drm,
struct wlr_buffer *buf, const struct wlr_drm_format_set *formats) {
struct wlr_drm_fb *fb = calloc(1, sizeof(*fb));
if (!fb) {
+ wlr_log_errno(WLR_ERROR, "Allocation failed");
return NULL;
}
struct wlr_dmabuf_attributes attribs;
if (!wlr_buffer_get_dmabuf(buf, &attribs)) {
- wlr_log(WLR_ERROR, "Failed to get DMA-BUF from buffer");
+ wlr_log(WLR_DEBUG, "Failed to get DMA-BUF from buffer");
goto error_get_dmabuf;
}
if (formats && !wlr_drm_format_set_has(formats, attribs.format,
attribs.modifier)) {
- const struct wlr_pixel_format_info *info =
- drm_get_pixel_format_info(attribs.format);
- if (!info) {
- wlr_log(WLR_ERROR,
- "Failed to fallback on DRM opaque substitute for format "
- "0x%"PRIX32, attribs.format);
- return false;
- }
// The format isn't supported by the plane. Try stripping the alpha
// channel, if any.
- uint32_t format = info->opaque_substitute;
- if (wlr_drm_format_set_has(formats, format, attribs.modifier)) {
- attribs.format = format;
+ const struct wlr_pixel_format_info *info =
+ drm_get_pixel_format_info(attribs.format);
+ if (info != NULL && info->opaque_substitute != DRM_FORMAT_INVALID &&
+ wlr_drm_format_set_has(formats, info->opaque_substitute, attribs.modifier)) {
+ attribs.format = info->opaque_substitute;
} else {
- wlr_log(WLR_ERROR, "Buffer format 0x%"PRIX32" cannot be scanned out",
- attribs.format);
+ wlr_log(WLR_DEBUG, "Buffer format 0x%"PRIX32" with modifier "
+ "0x%"PRIX64" cannot be scanned out",
+ attribs.format, attribs.modifier);
goto error_get_dmabuf;
}
}
fb->bo = get_bo_for_dmabuf(drm->renderer.gbm, &attribs);
if (!fb->bo) {
- wlr_log(WLR_ERROR, "Failed to import DMA-BUF in GBM");
+ wlr_log(WLR_DEBUG, "Failed to import DMA-BUF in GBM");
goto error_get_dmabuf;
}
fb->id = get_fb_for_bo(fb->bo, drm->addfb2_modifiers);
if (!fb->id) {
- wlr_log(WLR_ERROR, "Failed to import GBM BO in KMS");
+ wlr_log(WLR_DEBUG, "Failed to import GBM BO in KMS");
goto error_get_fb_for_bo;
}