output: don't emit the mode event if it hasn't changed

This also fixes #535.
master
emersion 7 years ago
parent 63763d3279
commit 94fa6c88f4
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

@ -496,11 +496,15 @@ static bool wlr_drm_connector_set_mode(struct wlr_output *output,
conn->state = WLR_DRM_CONN_CONNECTED;
wlr_output_update_mode(&conn->output, mode);
// When switching VTs, the mode is not updated but the buffers become
// invalid, so we need to manually damage the output here
wlr_output_damage_whole(&conn->output);
// Since realloc_crtcs can deallocate planes on OTHER outputs,
// we actually need to reinitialize any than has changed
// we actually need to reinitialize any that has changed
ssize_t output_index = -1;
wl_list_for_each(conn, &drm->outputs, link) {
output_index += 1;
output_index++;
struct wlr_output_mode *mode = conn->output.current_mode;
struct wlr_drm_crtc *crtc = conn->crtc;

@ -33,6 +33,7 @@ void wlr_output_update_custom_mode(struct wlr_output *output, int32_t width,
int32_t height, int32_t refresh);
void wlr_output_update_enabled(struct wlr_output *output, bool enabled);
void wlr_output_update_needs_swap(struct wlr_output *output);
void wlr_output_damage_whole(struct wlr_output *output);
void wlr_output_send_frame(struct wlr_output *output);
#endif

@ -178,6 +178,11 @@ void wlr_output_update_mode(struct wlr_output *output,
void wlr_output_update_custom_mode(struct wlr_output *output, int32_t width,
int32_t height, int32_t refresh) {
if (output->width == width && output->height == height &&
output->refresh == refresh) {
return;
}
output->width = width;
output->height = height;
wlr_output_update_matrix(output);
@ -563,7 +568,7 @@ void wlr_output_update_needs_swap(struct wlr_output *output) {
wlr_signal_emit_safe(&output->events.needs_swap, output);
}
static void output_damage_whole(struct wlr_output *output) {
void wlr_output_damage_whole(struct wlr_output *output) {
int width, height;
wlr_output_transformed_resolution(output, &width, &height);
@ -577,7 +582,7 @@ static void output_fullscreen_surface_reset(struct wlr_output *output) {
wl_list_remove(&output->fullscreen_surface_commit.link);
wl_list_remove(&output->fullscreen_surface_destroy.link);
output->fullscreen_surface = NULL;
output_damage_whole(output);
wlr_output_damage_whole(output);
}
}
@ -591,7 +596,7 @@ static void output_fullscreen_surface_handle_commit(
output->fullscreen_height != surface->current->height) {
output->fullscreen_width = surface->current->width;
output->fullscreen_height = surface->current->height;
output_damage_whole(output);
wlr_output_damage_whole(output);
return;
}
@ -627,7 +632,7 @@ void wlr_output_set_fullscreen_surface(struct wlr_output *output,
output_fullscreen_surface_reset(output);
output->fullscreen_surface = surface;
output_damage_whole(output);
wlr_output_damage_whole(output);
if (surface == NULL) {
return;

Loading…
Cancel
Save