mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 21:05:58 +01:00
Merge pull request #1479 from emersion/lost-crtc-state
backend/drm: fix state for outputs loosing their CRTC
This commit is contained in:
commit
0db2a687b7
2 changed files with 20 additions and 5 deletions
|
@ -391,6 +391,8 @@ static void attempt_enable_needs_modeset(struct wlr_drm_backend *drm) {
|
|||
if (conn->state == WLR_DRM_CONN_NEEDS_MODESET &&
|
||||
conn->crtc != NULL && conn->desired_mode != NULL &&
|
||||
conn->desired_enabled) {
|
||||
wlr_log(WLR_DEBUG, "Output %s has a desired mode and a CRTC, "
|
||||
"attempting a modeset", conn->output.name);
|
||||
drm_connector_set_mode(&conn->output, conn->desired_mode);
|
||||
}
|
||||
}
|
||||
|
@ -981,8 +983,17 @@ static void realloc_crtcs(struct wlr_drm_backend *drm, bool *changed_outputs) {
|
|||
i++;
|
||||
struct wlr_output_mode *mode = conn->output.current_mode;
|
||||
|
||||
if (conn->state != WLR_DRM_CONN_CONNECTED || !changed_outputs[i]
|
||||
|| conn->crtc == NULL) {
|
||||
if (conn->state != WLR_DRM_CONN_CONNECTED || !changed_outputs[i]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (conn->crtc == NULL) {
|
||||
wlr_log(WLR_DEBUG, "Output has %s lost its CRTC",
|
||||
conn->output.name);
|
||||
conn->state = WLR_DRM_CONN_NEEDS_MODESET;
|
||||
wlr_output_update_enabled(&conn->output, false);
|
||||
conn->desired_mode = conn->output.current_mode;
|
||||
wlr_output_update_mode(&conn->output, NULL);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -173,8 +173,12 @@ bool wlr_output_set_custom_mode(struct wlr_output *output, int32_t width,
|
|||
void wlr_output_update_mode(struct wlr_output *output,
|
||||
struct wlr_output_mode *mode) {
|
||||
output->current_mode = mode;
|
||||
wlr_output_update_custom_mode(output, mode->width, mode->height,
|
||||
mode->refresh);
|
||||
if (mode != NULL) {
|
||||
wlr_output_update_custom_mode(output, mode->width, mode->height,
|
||||
mode->refresh);
|
||||
} else {
|
||||
wlr_output_update_custom_mode(output, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void wlr_output_update_custom_mode(struct wlr_output *output, int32_t width,
|
||||
|
|
Loading…
Reference in a new issue