Compare commits

...

4 Commits

Author SHA1 Message Date
Kenny Levinsen
af9d00381f
Merge 7a50d03d3b into 4cfcb3643b 2024-11-04 17:04:23 -06:00
Alexander Orzechowski
4cfcb3643b container: Properly constrain title bar padding
Important for centered titles
2024-11-04 19:02:16 +01:00
Kenny Levinsen
7a50d03d3b WIP silence error that happens a lot after modeset 2024-10-15 21:51:03 +02:00
Kenny Levinsen
16f9ca03b3 desktop/output: Wait for all pageflips to clear
To allow a non-blocking modeset to succeed, we need to wait for all
pageflips to clear first.
2024-10-15 21:51:03 +02:00
2 changed files with 61 additions and 4 deletions

View File

@ -296,7 +296,7 @@ static int output_repaint_timer_handler(void *data) {
}
if (!wlr_output_commit_state(output->wlr_output, &pending)) {
sway_log(SWAY_ERROR, "Page-flip failed on output %s", output->wlr_output->name);
// sway_log(SWAY_ERROR, "Page-flip failed on output %s", output->wlr_output->name);
}
wlr_output_state_finish(&pending);
return 0;
@ -391,12 +391,69 @@ void update_output_manager_config(struct sway_server *server) {
ipc_event_output();
}
// Placeholder while all render tasks clear up
static void handle_frame_nop(struct wl_listener *listener, void *user_data) {}
static void handle_frame_clear(struct wl_listener *listener, void *user_data) {
struct sway_output *output = wl_container_of(listener, output, frame);
output->frame.notify = handle_frame_nop;
sway_log(SWAY_DEBUG, "Render task for %s cleared", output->wlr_output->name);
wl_list_for_each(output, &root->all_outputs, link) {
if (output == root->fallback_output) {
continue;
}
if (output->frame.notify != handle_frame_nop) {
return;
}
}
// All done!
sway_log(SWAY_DEBUG, "All render tasks cleared, modestting");
wl_list_for_each(output, &root->all_outputs, link) {
if (output == root->fallback_output) {
continue;
}
output->frame.notify = handle_frame;
}
apply_stored_output_configs();
}
static int timer_modeset_handle(void *data) {
struct sway_server *server = data;
wl_event_source_remove(server->delayed_modeset);
server->delayed_modeset = NULL;
apply_stored_output_configs();
bool wait = false;
struct sway_output *output;
wl_list_for_each(output, &root->all_outputs, link) {
if (output == root->fallback_output) {
continue;
}
if (output->wlr_output->frame_pending) {
output->frame.notify = handle_frame_clear;
wait = true;
sway_log(SWAY_DEBUG, "Awaiting render task on %s", output->wlr_output->name);
} else {
output->frame.notify = handle_frame_nop;
}
}
if (!wait) {
// Nothing to wait for, go ahead
sway_log(SWAY_DEBUG, "No render tasks to wait for, modesetting");
wl_list_for_each(output, &root->all_outputs, link) {
if (output == root->fallback_output) {
continue;
}
output->frame.notify = handle_frame;
}
apply_stored_output_configs();
return 0;
}
return 0;
}

View File

@ -349,7 +349,7 @@ void container_arrange_title_bar(struct sway_container *con) {
h_padding = width - config->titlebar_h_padding - marks_buffer_width;
}
h_padding = MAX(h_padding, 0);
h_padding = MAX(h_padding, config->titlebar_h_padding);
int alloc_width = MIN((int)node->width,
width - h_padding - config->titlebar_h_padding);
@ -375,7 +375,7 @@ void container_arrange_title_bar(struct sway_container *con) {
h_padding = config->titlebar_h_padding;
}
h_padding = MAX(h_padding, 0);
h_padding = MAX(h_padding, config->titlebar_h_padding);
int alloc_width = MIN((int) node->width,
width - h_padding - config->titlebar_h_padding);