From 4478cf1ddc9109dd39ed447bdab854838a423e2a Mon Sep 17 00:00:00 2001 From: Timidger Date: Sun, 21 Jan 2018 14:57:24 -0500 Subject: [PATCH 1/3] Fixes #575 --- backend/drm/drm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 0d32605a..30eb1256 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -501,6 +501,9 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output, struct wlr_drm_renderer *renderer = &drm->renderer; struct wlr_drm_crtc *crtc = conn->crtc; + if (!crtc) { + return false; + } struct wlr_drm_plane *plane = crtc->cursor; // We don't have a real cursor plane, so we make a fake one From 9d4ea146b66282e4cee6aedc8e0f27db3561d9a3 Mon Sep 17 00:00:00 2001 From: Timidger Date: Sun, 21 Jan 2018 15:37:23 -0500 Subject: [PATCH 2/3] Added crtc null check for other drm funcs --- backend/drm/drm.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 30eb1256..c3cdd9f8 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -193,6 +193,9 @@ static void wlr_drm_connector_swap_buffers(struct wlr_output *output) { struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend; struct wlr_drm_crtc *crtc = conn->crtc; + if (!crtc) { + return; + } struct wlr_drm_plane *plane = crtc->primary; struct gbm_bo *bo = wlr_drm_surface_swap_buffers(&plane->surf); @@ -230,6 +233,9 @@ void wlr_drm_connector_start_renderer(struct wlr_drm_connector *conn) { struct wlr_drm_backend *drm = (struct wlr_drm_backend *)conn->output.backend; struct wlr_drm_crtc *crtc = conn->crtc; + if (!crtc) { + return; + } struct wlr_drm_plane *plane = crtc->primary; struct gbm_bo *bo = wlr_drm_surface_get_front( @@ -450,6 +456,9 @@ static bool wlr_drm_connector_set_mode(struct wlr_output *output, } struct wlr_drm_crtc *crtc = conn->crtc; + if (!crtc) { + return false; + } wlr_log(L_DEBUG, "%s: crtc=%ju ovr=%jd pri=%jd cur=%jd", conn->output.name, crtc - drm->crtcs, crtc->overlay ? crtc->overlay - drm->overlay_planes : -1, From f8b9f44ff53c25ad8feef1f2239b82c5e725c082 Mon Sep 17 00:00:00 2001 From: Timidger Date: Sun, 21 Jan 2018 15:47:02 -0500 Subject: [PATCH 3/3] Add con/crtc null check to move_cursor in drm --- backend/drm/drm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index c3cdd9f8..47bd4e3a 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -634,6 +634,9 @@ static bool wlr_drm_connector_move_cursor(struct wlr_output *output, int x, int y) { struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend; + if (!conn || !conn->crtc) { + return false; + } struct wlr_drm_plane *plane = conn->crtc->cursor; struct wlr_box box;