aboutsummaryrefslogtreecommitdiff
path: root/backend/drm/legacy.c
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2020-12-09 14:50:39 +0100
committerSimon Ser <contact@emersion.fr>2020-12-18 10:48:44 +0100
commitc89b131f29343c6c91f24cdb259c5dd6663dd80e (patch)
tree69c8c3f77b0ff0b993ef887766b83068caf03cf9 /backend/drm/legacy.c
parent0aefa186906420f2a8f37f2f823a533c9187e7f5 (diff)
backend/drm: introduce wlr_drm_conn_log
Simplify and unify connector-specific logging with a new wlr_drm_conn_log macro. This makes it easier to understand which connector a failure is about, without having to explicitly integrate the connector name in each log message.
Diffstat (limited to 'backend/drm/legacy.c')
-rw-r--r--backend/drm/legacy.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/backend/drm/legacy.c b/backend/drm/legacy.c
index 3380461c..fc3158e1 100644
--- a/backend/drm/legacy.c
+++ b/backend/drm/legacy.c
@@ -42,15 +42,14 @@ static bool legacy_crtc_commit(struct wlr_drm_backend *drm,
DRM_MODE_DPMS_ON : DRM_MODE_DPMS_OFF;
if (drmModeConnectorSetProperty(drm->fd, conn->id, conn->props.dpms,
dpms) != 0) {
- wlr_log_errno(WLR_ERROR, "%s: failed to set DPMS property",
- conn->output.name);
+ wlr_drm_conn_log_errno(conn, WLR_ERROR,
+ "Failed to set DPMS property");
return false;
}
if (drmModeSetCrtc(drm->fd, crtc->id, fb_id, 0, 0,
conns, conns_len, mode)) {
- wlr_log_errno(WLR_ERROR, "%s: failed to set CRTC",
- conn->output.name);
+ wlr_drm_conn_log_errno(conn, WLR_ERROR, "Failed to set CRTC");
return false;
}
}
@@ -67,16 +66,15 @@ static bool legacy_crtc_commit(struct wlr_drm_backend *drm,
if (drmModeObjectSetProperty(drm->fd, crtc->id, DRM_MODE_OBJECT_CRTC,
crtc->props.vrr_enabled,
output->pending.adaptive_sync_enabled) != 0) {
- wlr_log_errno(WLR_ERROR,
+ wlr_drm_conn_log_errno(conn, WLR_ERROR,
"drmModeObjectSetProperty(VRR_ENABLED) failed");
return false;
}
output->adaptive_sync_status = output->pending.adaptive_sync_enabled ?
WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED :
WLR_OUTPUT_ADAPTIVE_SYNC_DISABLED;
- wlr_log(WLR_DEBUG, "VRR %s on connector '%s'",
- output->pending.adaptive_sync_enabled ? "enabled" : "disabled",
- output->name);
+ wlr_drm_conn_log(conn, WLR_DEBUG, "VRR %s",
+ output->pending.adaptive_sync_enabled ? "enabled" : "disabled");
}
if (cursor != NULL && drm_connector_is_cursor_visible(conn)) {
@@ -84,29 +82,26 @@ static bool legacy_crtc_commit(struct wlr_drm_backend *drm,
struct gbm_bo *cursor_bo =
drm_fb_acquire(cursor_fb, drm, &cursor->mgpu_surf);
if (!cursor_bo) {
- wlr_log_errno(WLR_DEBUG, "%s: failed to acquire cursor FB",
- conn->output.name);
+ wlr_drm_conn_log_errno(conn, WLR_DEBUG,
+ "Failed to acquire cursor FB");
return false;
}
if (drmModeSetCursor(drm->fd, crtc->id,
gbm_bo_get_handle(cursor_bo).u32,
cursor->surf.width, cursor->surf.height)) {
- wlr_log_errno(WLR_DEBUG, "%s: failed to set hardware cursor",
- conn->output.name);
+ wlr_drm_conn_log_errno(conn, WLR_DEBUG, "drmModeSetCursor failed");
return false;
}
if (drmModeMoveCursor(drm->fd,
crtc->id, conn->cursor_x, conn->cursor_y) != 0) {
- wlr_log_errno(WLR_ERROR, "%s: failed to move cursor",
- conn->output.name);
+ wlr_drm_conn_log_errno(conn, WLR_ERROR, "drmModeMoveCursor failed");
return false;
}
} else {
if (drmModeSetCursor(drm->fd, crtc->id, 0, 0, 0)) {
- wlr_log_errno(WLR_DEBUG, "%s: failed to unset hardware cursor",
- conn->output.name);
+ wlr_drm_conn_log_errno(conn, WLR_DEBUG, "drmModeSetCursor failed");
return false;
}
}
@@ -114,7 +109,7 @@ static bool legacy_crtc_commit(struct wlr_drm_backend *drm,
if (flags & DRM_MODE_PAGE_FLIP_EVENT) {
if (drmModePageFlip(drm->fd, crtc->id, fb_id,
DRM_MODE_PAGE_FLIP_EVENT, drm)) {
- wlr_log_errno(WLR_ERROR, "%s: Failed to page flip", conn->output.name);
+ wlr_drm_conn_log_errno(conn, WLR_ERROR, "drmModePageFlip failed");
return false;
}
}