restore dpms state on drm resume

If there is no current mode, set outputs to dpms off in drm resume.
Sets current mode to null on disable to ensure this can be checked.
This commit is contained in:
Markus Ongyerth 2018-02-26 18:12:51 +01:00
parent 3296365ce5
commit a65ef8ea86
3 changed files with 6 additions and 1 deletions

View file

@ -83,6 +83,8 @@ static void session_signal(struct wl_listener *listener, void *data) {
wl_list_for_each(conn, &drm->outputs, link){ wl_list_for_each(conn, &drm->outputs, link){
if (conn->output.current_mode) { if (conn->output.current_mode) {
wlr_output_set_mode(&conn->output, conn->output.current_mode); wlr_output_set_mode(&conn->output, conn->output.current_mode);
} else {
wlr_drm_connector_enable(&conn->output, false);
} }
if (!conn->crtc) { if (!conn->crtc) {

View file

@ -282,7 +282,7 @@ void wlr_drm_connector_start_renderer(struct wlr_drm_connector *conn) {
} }
} }
static void wlr_drm_connector_enable(struct wlr_output *output, bool enable) { void wlr_drm_connector_enable(struct wlr_output *output, bool enable) {
struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
if (conn->state != WLR_DRM_CONN_CONNECTED) { if (conn->state != WLR_DRM_CONN_CONNECTED) {
return; return;
@ -296,6 +296,8 @@ static void wlr_drm_connector_enable(struct wlr_output *output, bool enable) {
if (enable) { if (enable) {
wlr_drm_connector_start_renderer(conn); wlr_drm_connector_start_renderer(conn);
} else {
output->current_mode = NULL;
} }
wlr_output_update_enabled(&conn->output, enable); wlr_output_update_enabled(&conn->output, enable);

View file

@ -144,6 +144,7 @@ void wlr_drm_restore_outputs(struct wlr_drm_backend *drm);
void wlr_drm_connector_cleanup(struct wlr_drm_connector *conn); void wlr_drm_connector_cleanup(struct wlr_drm_connector *conn);
void wlr_drm_scan_connectors(struct wlr_drm_backend *state); void wlr_drm_scan_connectors(struct wlr_drm_backend *state);
int wlr_drm_event(int fd, uint32_t mask, void *data); int wlr_drm_event(int fd, uint32_t mask, void *data);
void wlr_drm_connector_enable(struct wlr_output *output, bool enable);
void wlr_drm_connector_start_renderer(struct wlr_drm_connector *conn); void wlr_drm_connector_start_renderer(struct wlr_drm_connector *conn);