mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-05 05:05:57 +01:00
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.
This commit is contained in:
parent
0aefa18690
commit
c89b131f29
3 changed files with 62 additions and 65 deletions
|
@ -363,8 +363,8 @@ static bool drm_crtc_page_flip(struct wlr_drm_connector *conn) {
|
||||||
// we'll wait for all queued page-flips to complete, so we don't need this
|
// we'll wait for all queued page-flips to complete, so we don't need this
|
||||||
// safeguard.
|
// safeguard.
|
||||||
if (conn->pageflip_pending && !crtc->pending_modeset) {
|
if (conn->pageflip_pending && !crtc->pending_modeset) {
|
||||||
wlr_log(WLR_ERROR, "Failed to page-flip output '%s': "
|
wlr_drm_conn_log(conn, WLR_ERROR, "Failed to page-flip output: "
|
||||||
"a page-flip is already pending", conn->output.name);
|
"a page-flip is already pending");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,7 +445,8 @@ static bool drm_connector_test(struct wlr_output *output) {
|
||||||
output->pending.enabled) {
|
output->pending.enabled) {
|
||||||
if (output->current_mode == NULL &&
|
if (output->current_mode == NULL &&
|
||||||
!(output->pending.committed & WLR_OUTPUT_STATE_MODE)) {
|
!(output->pending.committed & WLR_OUTPUT_STATE_MODE)) {
|
||||||
wlr_log(WLR_DEBUG, "Can't enable an output without a mode");
|
wlr_drm_conn_log(conn, WLR_DEBUG,
|
||||||
|
"Can't enable an output without a mode");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -492,7 +493,7 @@ static bool drm_connector_commit_buffer(struct wlr_output *output) {
|
||||||
switch (output->pending.buffer_type) {
|
switch (output->pending.buffer_type) {
|
||||||
case WLR_OUTPUT_STATE_BUFFER_RENDER:
|
case WLR_OUTPUT_STATE_BUFFER_RENDER:
|
||||||
if (!drm_fb_lock_surface(&plane->pending_fb, &plane->surf)) {
|
if (!drm_fb_lock_surface(&plane->pending_fb, &plane->surf)) {
|
||||||
wlr_log(WLR_ERROR, "drm_fb_lock_surface failed");
|
wlr_drm_conn_log(conn, WLR_ERROR, "drm_fb_lock_surface failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -527,13 +528,13 @@ bool drm_connector_supports_vrr(struct wlr_drm_connector *conn) {
|
||||||
if (conn->props.vrr_capable == 0 ||
|
if (conn->props.vrr_capable == 0 ||
|
||||||
!get_drm_prop(drm->fd, conn->id, conn->props.vrr_capable,
|
!get_drm_prop(drm->fd, conn->id, conn->props.vrr_capable,
|
||||||
&vrr_capable) || !vrr_capable) {
|
&vrr_capable) || !vrr_capable) {
|
||||||
wlr_log(WLR_DEBUG, "Failed to enable adaptive sync: "
|
wlr_drm_conn_log(conn, WLR_DEBUG, "Failed to enable adaptive sync: "
|
||||||
"connector '%s' doesn't support VRR", conn->output.name);
|
"connector doesn't support VRR");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crtc->props.vrr_enabled == 0) {
|
if (crtc->props.vrr_enabled == 0) {
|
||||||
wlr_log(WLR_DEBUG, "Failed to enable adaptive sync: "
|
wlr_drm_conn_log(conn, WLR_DEBUG, "Failed to enable adaptive sync: "
|
||||||
"CRTC %"PRIu32" doesn't support VRR", crtc->id);
|
"CRTC %"PRIu32" doesn't support VRR", crtc->id);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -663,8 +664,7 @@ struct wlr_drm_fb *plane_get_next_fb(struct wlr_drm_plane *plane) {
|
||||||
static bool drm_connector_pageflip_renderer(struct wlr_drm_connector *conn) {
|
static bool drm_connector_pageflip_renderer(struct wlr_drm_connector *conn) {
|
||||||
struct wlr_drm_crtc *crtc = conn->crtc;
|
struct wlr_drm_crtc *crtc = conn->crtc;
|
||||||
if (!crtc) {
|
if (!crtc) {
|
||||||
wlr_log(WLR_ERROR, "Page-flip failed on connector '%s': no CRTC",
|
wlr_drm_conn_log(conn, WLR_ERROR, "Page-flip failed: no CRTC");
|
||||||
conn->output.name);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -691,13 +691,12 @@ static bool drm_connector_init_renderer(struct wlr_drm_connector *conn,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(WLR_DEBUG, "Initializing renderer on connector '%s'",
|
wlr_drm_conn_log(conn, WLR_DEBUG, "Initializing renderer");
|
||||||
conn->output.name);
|
|
||||||
|
|
||||||
struct wlr_drm_crtc *crtc = conn->crtc;
|
struct wlr_drm_crtc *crtc = conn->crtc;
|
||||||
if (!crtc) {
|
if (!crtc) {
|
||||||
wlr_log(WLR_ERROR, "Failed to initialize renderer on connector '%s': "
|
wlr_drm_conn_log(conn, WLR_ERROR,
|
||||||
"no CRTC", conn->output.name);
|
"Failed to initialize renderer: no CRTC");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
struct wlr_drm_plane *plane = crtc->primary;
|
struct wlr_drm_plane *plane = crtc->primary;
|
||||||
|
@ -713,7 +712,7 @@ static bool drm_connector_init_renderer(struct wlr_drm_connector *conn,
|
||||||
bool modifiers = true;
|
bool modifiers = true;
|
||||||
const char *no_modifiers = getenv("WLR_DRM_NO_MODIFIERS");
|
const char *no_modifiers = getenv("WLR_DRM_NO_MODIFIERS");
|
||||||
if (no_modifiers != NULL && strcmp(no_modifiers, "1") == 0) {
|
if (no_modifiers != NULL && strcmp(no_modifiers, "1") == 0) {
|
||||||
wlr_log(WLR_DEBUG,
|
wlr_drm_conn_log(conn, WLR_DEBUG,
|
||||||
"WLR_DRM_NO_MODIFIERS set, initializing planes without modifiers");
|
"WLR_DRM_NO_MODIFIERS set, initializing planes without modifiers");
|
||||||
modifiers = false;
|
modifiers = false;
|
||||||
}
|
}
|
||||||
|
@ -721,15 +720,15 @@ static bool drm_connector_init_renderer(struct wlr_drm_connector *conn,
|
||||||
if (!drm_plane_init_surface(plane, drm, width, height, format, false, modifiers) ||
|
if (!drm_plane_init_surface(plane, drm, width, height, format, false, modifiers) ||
|
||||||
!drm_connector_pageflip_renderer(conn)) {
|
!drm_connector_pageflip_renderer(conn)) {
|
||||||
if (!modifiers) {
|
if (!modifiers) {
|
||||||
wlr_log(WLR_ERROR, "Failed to initialize renderer "
|
wlr_drm_conn_log(conn, WLR_ERROR, "Failed to initialize renderer:"
|
||||||
"on connector '%s': initial page-flip failed",
|
"initial page-flip failed");
|
||||||
conn->output.name);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If page-flipping with modifiers enabled doesn't work, retry without
|
// If page-flipping with modifiers enabled doesn't work, retry without
|
||||||
// modifiers
|
// modifiers
|
||||||
wlr_log(WLR_INFO, "Page-flip failed with primary FB modifiers enabled, "
|
wlr_drm_conn_log(conn, WLR_INFO,
|
||||||
|
"Page-flip failed with primary FB modifiers enabled, "
|
||||||
"retrying without modifiers");
|
"retrying without modifiers");
|
||||||
modifiers = false;
|
modifiers = false;
|
||||||
|
|
||||||
|
@ -742,9 +741,8 @@ static bool drm_connector_init_renderer(struct wlr_drm_connector *conn,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!drm_connector_pageflip_renderer(conn)) {
|
if (!drm_connector_pageflip_renderer(conn)) {
|
||||||
wlr_log(WLR_ERROR, "Failed to initialize renderer "
|
wlr_drm_conn_log(conn, WLR_ERROR, "Failed to initialize renderer:"
|
||||||
"on connector '%s': initial page-flip failed",
|
"initial page-flip failed");
|
||||||
conn->output.name);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -762,8 +760,8 @@ static void attempt_enable_needs_modeset(struct wlr_drm_backend *drm) {
|
||||||
if (conn->state == WLR_DRM_CONN_NEEDS_MODESET &&
|
if (conn->state == WLR_DRM_CONN_NEEDS_MODESET &&
|
||||||
conn->crtc != NULL && conn->desired_mode != NULL &&
|
conn->crtc != NULL && conn->desired_mode != NULL &&
|
||||||
conn->desired_enabled) {
|
conn->desired_enabled) {
|
||||||
wlr_log(WLR_DEBUG, "Output %s has a desired mode and a CRTC, "
|
wlr_drm_conn_log(conn, WLR_DEBUG,
|
||||||
"attempting a modeset", conn->output.name);
|
"Output has a desired mode and a CRTC, attempting a modeset");
|
||||||
drm_connector_set_mode(conn, conn->desired_mode);
|
drm_connector_set_mode(conn, conn->desired_mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -794,7 +792,8 @@ bool drm_connector_set_mode(struct wlr_drm_connector *conn,
|
||||||
|
|
||||||
if (conn->state != WLR_DRM_CONN_CONNECTED
|
if (conn->state != WLR_DRM_CONN_CONNECTED
|
||||||
&& conn->state != WLR_DRM_CONN_NEEDS_MODESET) {
|
&& conn->state != WLR_DRM_CONN_NEEDS_MODESET) {
|
||||||
wlr_log(WLR_ERROR, "Cannot modeset a disconnected output");
|
wlr_drm_conn_log(conn, WLR_ERROR,
|
||||||
|
"Cannot modeset a disconnected output");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -803,18 +802,19 @@ bool drm_connector_set_mode(struct wlr_drm_connector *conn,
|
||||||
realloc_crtcs(drm);
|
realloc_crtcs(drm);
|
||||||
}
|
}
|
||||||
if (conn->crtc == NULL) {
|
if (conn->crtc == NULL) {
|
||||||
wlr_log(WLR_ERROR, "Cannot modeset '%s': no CRTC for this connector",
|
wlr_drm_conn_log(conn, WLR_ERROR,
|
||||||
conn->output.name);
|
"Cannot perform modeset: no CRTC for this connector");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(WLR_INFO, "Modesetting '%s' with '%" PRId32 "x%" PRId32 "@%" PRId32 "mHz'",
|
wlr_drm_conn_log(conn, WLR_INFO,
|
||||||
conn->output.name, wlr_mode->width, wlr_mode->height,
|
"Modesetting with '%" PRId32 "x%" PRId32 "@%" PRId32 "mHz'",
|
||||||
wlr_mode->refresh);
|
wlr_mode->width, wlr_mode->height, wlr_mode->refresh);
|
||||||
|
|
||||||
struct wlr_drm_mode *mode = (struct wlr_drm_mode *)wlr_mode;
|
struct wlr_drm_mode *mode = (struct wlr_drm_mode *)wlr_mode;
|
||||||
if (!drm_connector_init_renderer(conn, mode)) {
|
if (!drm_connector_init_renderer(conn, mode)) {
|
||||||
wlr_log(WLR_ERROR, "Failed to initialize renderer for plane");
|
wlr_drm_conn_log(conn, WLR_ERROR,
|
||||||
|
"Failed to initialize renderer for plane");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -857,7 +857,7 @@ struct wlr_output_mode *wlr_drm_connector_add_mode(struct wlr_output *output,
|
||||||
mode->wlr_mode.height = mode->drm_mode.vdisplay;
|
mode->wlr_mode.height = mode->drm_mode.vdisplay;
|
||||||
mode->wlr_mode.refresh = calculate_refresh_rate(modeinfo);
|
mode->wlr_mode.refresh = calculate_refresh_rate(modeinfo);
|
||||||
|
|
||||||
wlr_log(WLR_INFO, "Registered custom mode "
|
wlr_drm_conn_log(conn, WLR_INFO, "Registered custom mode "
|
||||||
"%"PRId32"x%"PRId32"@%"PRId32,
|
"%"PRId32"x%"PRId32"@%"PRId32,
|
||||||
mode->wlr_mode.width, mode->wlr_mode.height,
|
mode->wlr_mode.width, mode->wlr_mode.height,
|
||||||
mode->wlr_mode.refresh);
|
mode->wlr_mode.refresh);
|
||||||
|
@ -893,7 +893,7 @@ static bool drm_connector_set_cursor(struct wlr_output *output,
|
||||||
|
|
||||||
if (!drm_plane_init_surface(plane, drm, w, h,
|
if (!drm_plane_init_surface(plane, drm, w, h,
|
||||||
DRM_FORMAT_ARGB8888, true, false)) {
|
DRM_FORMAT_ARGB8888, true, false)) {
|
||||||
wlr_log(WLR_ERROR, "Cannot allocate cursor resources");
|
wlr_drm_conn_log(conn, WLR_ERROR, "Cannot allocate cursor resources");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -931,7 +931,7 @@ static bool drm_connector_set_cursor(struct wlr_output *output,
|
||||||
height = height * output->scale / scale;
|
height = height * output->scale / scale;
|
||||||
|
|
||||||
if (width > (int)plane->surf.width || height > (int)plane->surf.height) {
|
if (width > (int)plane->surf.width || height > (int)plane->surf.height) {
|
||||||
wlr_log(WLR_ERROR, "Cursor too large (max %dx%d)",
|
wlr_drm_conn_log(conn, WLR_ERROR, "Cursor too large (max %dx%d)",
|
||||||
(int)plane->surf.width, (int)plane->surf.height);
|
(int)plane->surf.width, (int)plane->surf.height);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1043,8 +1043,8 @@ static void dealloc_crtc(struct wlr_drm_connector *conn) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_log(WLR_DEBUG, "De-allocating CRTC %zu for output '%s'",
|
wlr_drm_conn_log(conn, WLR_DEBUG, "De-allocating CRTC %zu",
|
||||||
conn->crtc - drm->crtcs, conn->output.name);
|
conn->crtc - drm->crtcs);
|
||||||
|
|
||||||
conn->crtc->pending_modeset = true;
|
conn->crtc->pending_modeset = true;
|
||||||
conn->crtc->pending.active = false;
|
conn->crtc->pending.active = false;
|
||||||
|
@ -1159,8 +1159,7 @@ static void realloc_crtcs(struct wlr_drm_backend *drm) {
|
||||||
|
|
||||||
if (connector_match[i] == -1) {
|
if (connector_match[i] == -1) {
|
||||||
if (prev_enabled) {
|
if (prev_enabled) {
|
||||||
wlr_log(WLR_DEBUG, "Output has %s lost its CRTC",
|
wlr_drm_conn_log(conn, WLR_DEBUG, "Output has lost its CRTC");
|
||||||
conn->output.name);
|
|
||||||
conn->state = WLR_DRM_CONN_NEEDS_MODESET;
|
conn->state = WLR_DRM_CONN_NEEDS_MODESET;
|
||||||
wlr_output_update_enabled(&conn->output, false);
|
wlr_output_update_enabled(&conn->output, false);
|
||||||
conn->desired_mode = conn->output.current_mode;
|
conn->desired_mode = conn->output.current_mode;
|
||||||
|
@ -1179,8 +1178,7 @@ static void realloc_crtcs(struct wlr_drm_backend *drm) {
|
||||||
struct wlr_drm_mode *mode =
|
struct wlr_drm_mode *mode =
|
||||||
(struct wlr_drm_mode *)conn->output.current_mode;
|
(struct wlr_drm_mode *)conn->output.current_mode;
|
||||||
if (!drm_connector_init_renderer(conn, mode)) {
|
if (!drm_connector_init_renderer(conn, mode)) {
|
||||||
wlr_log(WLR_ERROR, "Failed to initialize renderer on output %s",
|
wlr_drm_conn_log(conn, WLR_ERROR, "Failed to initialize renderer");
|
||||||
conn->output.name);
|
|
||||||
wlr_output_update_enabled(&conn->output, false);
|
wlr_output_update_enabled(&conn->output, false);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1298,14 +1296,14 @@ void scan_drm_connectors(struct wlr_drm_backend *drm) {
|
||||||
uint64_t link_status;
|
uint64_t link_status;
|
||||||
if (!get_drm_prop(drm->fd, wlr_conn->id,
|
if (!get_drm_prop(drm->fd, wlr_conn->id,
|
||||||
wlr_conn->props.link_status, &link_status)) {
|
wlr_conn->props.link_status, &link_status)) {
|
||||||
wlr_log(WLR_ERROR, "Failed to get link status for '%s'",
|
wlr_drm_conn_log(wlr_conn, WLR_ERROR,
|
||||||
wlr_conn->output.name);
|
"Failed to get link status prop");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (link_status == DRM_MODE_LINK_STATUS_BAD) {
|
if (link_status == DRM_MODE_LINK_STATUS_BAD) {
|
||||||
// We need to reload our list of modes and force a modeset
|
// We need to reload our list of modes and force a modeset
|
||||||
wlr_log(WLR_INFO, "Bad link for '%s'", wlr_conn->output.name);
|
wlr_drm_conn_log(wlr_conn, WLR_INFO, "Bad link detected");
|
||||||
drm_connector_cleanup(wlr_conn);
|
drm_connector_cleanup(wlr_conn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1368,8 +1366,7 @@ void scan_drm_connectors(struct wlr_drm_backend *drm) {
|
||||||
|
|
||||||
wlr_conn->possible_crtc = get_possible_crtcs(drm->fd, res, drm_conn);
|
wlr_conn->possible_crtc = get_possible_crtcs(drm->fd, res, drm_conn);
|
||||||
if (wlr_conn->possible_crtc == 0) {
|
if (wlr_conn->possible_crtc == 0) {
|
||||||
wlr_log(WLR_ERROR, "No CRTC possible for connector '%s'",
|
wlr_drm_conn_log(wlr_conn, WLR_ERROR, "No CRTC possible");
|
||||||
wlr_conn->output.name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: this results in connectors being enabled without a mode
|
// TODO: this results in connectors being enabled without a mode
|
||||||
|
@ -1414,8 +1411,7 @@ void scan_drm_connectors(struct wlr_drm_backend *drm) {
|
||||||
for (size_t i = 0; i < new_outputs_len; ++i) {
|
for (size_t i = 0; i < new_outputs_len; ++i) {
|
||||||
struct wlr_drm_connector *conn = new_outputs[i];
|
struct wlr_drm_connector *conn = new_outputs[i];
|
||||||
|
|
||||||
wlr_log(WLR_INFO, "Requesting modeset for '%s'",
|
wlr_drm_conn_log(conn, WLR_INFO, "Requesting modeset");
|
||||||
conn->output.name);
|
|
||||||
wlr_signal_emit_safe(&drm->backend.events.new_output,
|
wlr_signal_emit_safe(&drm->backend.events.new_output,
|
||||||
&conn->output);
|
&conn->output);
|
||||||
}
|
}
|
||||||
|
@ -1440,7 +1436,7 @@ static void page_flip_handler(int fd, unsigned seq,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!conn) {
|
if (!conn) {
|
||||||
wlr_log(WLR_DEBUG, "No connector for crtc_id %u", crtc_id);
|
wlr_log(WLR_DEBUG, "No connector for CRTC %u", crtc_id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,15 +42,14 @@ static bool legacy_crtc_commit(struct wlr_drm_backend *drm,
|
||||||
DRM_MODE_DPMS_ON : DRM_MODE_DPMS_OFF;
|
DRM_MODE_DPMS_ON : DRM_MODE_DPMS_OFF;
|
||||||
if (drmModeConnectorSetProperty(drm->fd, conn->id, conn->props.dpms,
|
if (drmModeConnectorSetProperty(drm->fd, conn->id, conn->props.dpms,
|
||||||
dpms) != 0) {
|
dpms) != 0) {
|
||||||
wlr_log_errno(WLR_ERROR, "%s: failed to set DPMS property",
|
wlr_drm_conn_log_errno(conn, WLR_ERROR,
|
||||||
conn->output.name);
|
"Failed to set DPMS property");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drmModeSetCrtc(drm->fd, crtc->id, fb_id, 0, 0,
|
if (drmModeSetCrtc(drm->fd, crtc->id, fb_id, 0, 0,
|
||||||
conns, conns_len, mode)) {
|
conns, conns_len, mode)) {
|
||||||
wlr_log_errno(WLR_ERROR, "%s: failed to set CRTC",
|
wlr_drm_conn_log_errno(conn, WLR_ERROR, "Failed to set CRTC");
|
||||||
conn->output.name);
|
|
||||||
return false;
|
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,
|
if (drmModeObjectSetProperty(drm->fd, crtc->id, DRM_MODE_OBJECT_CRTC,
|
||||||
crtc->props.vrr_enabled,
|
crtc->props.vrr_enabled,
|
||||||
output->pending.adaptive_sync_enabled) != 0) {
|
output->pending.adaptive_sync_enabled) != 0) {
|
||||||
wlr_log_errno(WLR_ERROR,
|
wlr_drm_conn_log_errno(conn, WLR_ERROR,
|
||||||
"drmModeObjectSetProperty(VRR_ENABLED) failed");
|
"drmModeObjectSetProperty(VRR_ENABLED) failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
output->adaptive_sync_status = output->pending.adaptive_sync_enabled ?
|
output->adaptive_sync_status = output->pending.adaptive_sync_enabled ?
|
||||||
WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED :
|
WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED :
|
||||||
WLR_OUTPUT_ADAPTIVE_SYNC_DISABLED;
|
WLR_OUTPUT_ADAPTIVE_SYNC_DISABLED;
|
||||||
wlr_log(WLR_DEBUG, "VRR %s on connector '%s'",
|
wlr_drm_conn_log(conn, WLR_DEBUG, "VRR %s",
|
||||||
output->pending.adaptive_sync_enabled ? "enabled" : "disabled",
|
output->pending.adaptive_sync_enabled ? "enabled" : "disabled");
|
||||||
output->name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursor != NULL && drm_connector_is_cursor_visible(conn)) {
|
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 =
|
struct gbm_bo *cursor_bo =
|
||||||
drm_fb_acquire(cursor_fb, drm, &cursor->mgpu_surf);
|
drm_fb_acquire(cursor_fb, drm, &cursor->mgpu_surf);
|
||||||
if (!cursor_bo) {
|
if (!cursor_bo) {
|
||||||
wlr_log_errno(WLR_DEBUG, "%s: failed to acquire cursor FB",
|
wlr_drm_conn_log_errno(conn, WLR_DEBUG,
|
||||||
conn->output.name);
|
"Failed to acquire cursor FB");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drmModeSetCursor(drm->fd, crtc->id,
|
if (drmModeSetCursor(drm->fd, crtc->id,
|
||||||
gbm_bo_get_handle(cursor_bo).u32,
|
gbm_bo_get_handle(cursor_bo).u32,
|
||||||
cursor->surf.width, cursor->surf.height)) {
|
cursor->surf.width, cursor->surf.height)) {
|
||||||
wlr_log_errno(WLR_DEBUG, "%s: failed to set hardware cursor",
|
wlr_drm_conn_log_errno(conn, WLR_DEBUG, "drmModeSetCursor failed");
|
||||||
conn->output.name);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drmModeMoveCursor(drm->fd,
|
if (drmModeMoveCursor(drm->fd,
|
||||||
crtc->id, conn->cursor_x, conn->cursor_y) != 0) {
|
crtc->id, conn->cursor_x, conn->cursor_y) != 0) {
|
||||||
wlr_log_errno(WLR_ERROR, "%s: failed to move cursor",
|
wlr_drm_conn_log_errno(conn, WLR_ERROR, "drmModeMoveCursor failed");
|
||||||
conn->output.name);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (drmModeSetCursor(drm->fd, crtc->id, 0, 0, 0)) {
|
if (drmModeSetCursor(drm->fd, crtc->id, 0, 0, 0)) {
|
||||||
wlr_log_errno(WLR_DEBUG, "%s: failed to unset hardware cursor",
|
wlr_drm_conn_log_errno(conn, WLR_DEBUG, "drmModeSetCursor failed");
|
||||||
conn->output.name);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,7 +109,7 @@ static bool legacy_crtc_commit(struct wlr_drm_backend *drm,
|
||||||
if (flags & DRM_MODE_PAGE_FLIP_EVENT) {
|
if (flags & DRM_MODE_PAGE_FLIP_EVENT) {
|
||||||
if (drmModePageFlip(drm->fd, crtc->id, fb_id,
|
if (drmModePageFlip(drm->fd, crtc->id, fb_id,
|
||||||
DRM_MODE_PAGE_FLIP_EVENT, drm)) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,9 +110,10 @@ struct wlr_drm_mode {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wlr_drm_connector {
|
struct wlr_drm_connector {
|
||||||
struct wlr_output output;
|
struct wlr_output output; // only valid if state != DISCONNECTED
|
||||||
|
|
||||||
struct wlr_drm_backend *backend;
|
struct wlr_drm_backend *backend;
|
||||||
|
char name[24];
|
||||||
enum wlr_drm_connector_state state;
|
enum wlr_drm_connector_state state;
|
||||||
struct wlr_output_mode *desired_mode;
|
struct wlr_output_mode *desired_mode;
|
||||||
bool desired_enabled;
|
bool desired_enabled;
|
||||||
|
@ -155,4 +156,9 @@ size_t drm_crtc_get_gamma_lut_size(struct wlr_drm_backend *drm,
|
||||||
|
|
||||||
struct wlr_drm_fb *plane_get_next_fb(struct wlr_drm_plane *plane);
|
struct wlr_drm_fb *plane_get_next_fb(struct wlr_drm_plane *plane);
|
||||||
|
|
||||||
|
#define wlr_drm_conn_log(conn, verb, fmt, ...) \
|
||||||
|
wlr_log(verb, "connector %s: " fmt, conn->output.name, ##__VA_ARGS__)
|
||||||
|
#define wlr_drm_conn_log_errno(conn, verb, fmt, ...) \
|
||||||
|
wlr_log_errno(verb, "connector %s: " fmt, conn->output.name, ##__VA_ARGS__)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue