aboutsummaryrefslogtreecommitdiff
path: root/backend/drm
diff options
context:
space:
mode:
authorsghctoma <sghctoma@gmail.com>2018-09-02 18:32:31 +0200
committersghctoma <sghctoma@gmail.com>2018-09-02 18:32:31 +0200
commit3b2b8c18446bb98ec0e5eea46fb1212b7bf64445 (patch)
tree1efb3ccee04a7589a1c963b3cace215ca8236c56 /backend/drm
parent2bd6fbf20ebb055d4871ffb8eedefa7d7aa60ee8 (diff)
parent95d05acda511e8559ab87a3d8956ee942ca1999e (diff)
Merge remote-tracking branch 'upstream/master' into fix-freebsd-direct-session
Diffstat (limited to 'backend/drm')
-rw-r--r--backend/drm/drm.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index a666ce71..5396dcd4 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -344,7 +344,8 @@ static void drm_connector_start_renderer(struct wlr_drm_connector *conn) {
void enable_drm_connector(struct wlr_output *output, bool enable) {
struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
- if (conn->state != WLR_DRM_CONN_CONNECTED) {
+ if (conn->state != WLR_DRM_CONN_CONNECTED
+ && conn->state != WLR_DRM_CONN_NEEDS_MODESET) {
return;
}
@@ -563,7 +564,7 @@ static bool drm_connector_set_mode(struct wlr_output *output,
struct wlr_drm_crtc *crtc = conn->crtc;
if (!crtc) {
wlr_log(WLR_ERROR, "Unable to match %s with a CRTC", conn->output.name);
- goto error_conn;
+ return false;
}
wlr_log(WLR_DEBUG, "%s: crtc=%td ovr=%td pri=%td cur=%td", conn->output.name,
crtc - drm->crtcs,
@@ -867,7 +868,9 @@ void scan_drm_connectors(struct wlr_drm_backend *drm) {
// +1 so length can never be 0, which is undefined behaviour.
// Last element isn't used.
bool seen[seen_len + 1];
- memset(seen, 0, sizeof(seen));
+ memset(seen, false, sizeof(seen));
+ size_t new_outputs_len = 0;
+ struct wlr_drm_connector *new_outputs[res->count_connectors + 1];
for (int i = 0; i < res->count_connectors; ++i) {
drmModeConnector *drm_conn = drmModeGetConnector(drm->fd,
@@ -973,13 +976,10 @@ void scan_drm_connectors(struct wlr_drm_backend *drm) {
wl_list_insert(&wlr_conn->output.modes, &mode->wlr_mode.link);
}
- wlr_output_update_enabled(&wlr_conn->output, true);
+ wlr_output_update_enabled(&wlr_conn->output, wlr_conn->crtc != NULL);
wlr_conn->state = WLR_DRM_CONN_NEEDS_MODESET;
- wlr_log(WLR_INFO, "Sending modesetting signal for '%s'",
- wlr_conn->output.name);
- wlr_signal_emit_safe(&drm->backend.events.new_output,
- &wlr_conn->output);
+ new_outputs[new_outputs_len++] = wlr_conn;
} else if (wlr_conn->state == WLR_DRM_CONN_CONNECTED &&
drm_conn->connection != DRM_MODE_CONNECTED) {
wlr_log(WLR_INFO, "'%s' disconnected", wlr_conn->output.name);
@@ -1010,6 +1010,15 @@ void scan_drm_connectors(struct wlr_drm_backend *drm) {
wl_list_remove(&conn->link);
free(conn);
}
+
+ for (size_t i = 0; i < new_outputs_len; ++i) {
+ struct wlr_drm_connector *conn = new_outputs[i];
+
+ wlr_log(WLR_INFO, "Requesting modeset for '%s'",
+ conn->output.name);
+ wlr_signal_emit_safe(&drm->backend.events.new_output,
+ &conn->output);
+ }
}
static void page_flip_handler(int fd, unsigned seq,