shm: don't bother with xrgb surfaces, always use argb

Before this patch, foot used xrgb surfaces for all fully opaque
surfaces, and only used argb surfaces for the main window when the
user enabled translucency.

However, several compositors have damage-like issues when we switch
between opaque and non-opaque surfaces (for example, when switching
color theme, or when toggling fullscreen).

Since the performance benefit of using non-alpha aware surfaces are
likely minor (if there's any measurable performance difference at
all!), lets workaround these compositor issues by always using argb
surfaces.
This commit is contained in:
Daniel Eklöf 2026-01-04 07:57:25 +01:00
parent 42e04c5c87
commit b78cc92322
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
7 changed files with 42 additions and 79 deletions

View file

@ -2012,7 +2012,7 @@ render_overlay(struct terminal *term)
}
struct buffer *buf = shm_get_buffer(
term->render.chains.overlay, term->width, term->height, true);
term->render.chains.overlay, term->width, term->height);
pixman_image_set_clip_region32(buf->pix[0], NULL);
/* Bounding rectangle of damaged areas - for wl_surface_damage_buffer() */
@ -2970,7 +2970,7 @@ render_csd(struct terminal *term)
}
struct buffer *bufs[CSD_SURF_COUNT];
shm_get_many(term->render.chains.csd, CSD_SURF_COUNT, widths, heights, bufs, true);
shm_get_many(term->render.chains.csd, CSD_SURF_COUNT, widths, heights, bufs);
for (size_t i = CSD_SURF_LEFT; i <= CSD_SURF_BOTTOM; i++)
render_csd_border(term, i, &infos[i], bufs[i]);
@ -3110,7 +3110,7 @@ render_scrollback_position(struct terminal *term)
}
struct buffer_chain *chain = term->render.chains.scrollback_indicator;
struct buffer *buf = shm_get_buffer(chain, width, height, false);
struct buffer *buf = shm_get_buffer(chain, width, height);
wl_subsurface_set_position(
win->scrollback_indicator.sub, roundf(x / scale), roundf(y / scale));
@ -3153,7 +3153,7 @@ render_render_timer(struct terminal *term, struct timespec render_time)
height = roundf(scale * ceilf(height / scale));
struct buffer_chain *chain = term->render.chains.render_timer;
struct buffer *buf = shm_get_buffer(chain, width, height, false);
struct buffer *buf = shm_get_buffer(chain, width, height);
wl_subsurface_set_position(
win->render_timer.sub,
@ -3336,10 +3336,7 @@ grid_render(struct terminal *term)
xassert(term->height > 0);
struct buffer_chain *chain = term->render.chains.grid;
bool use_alpha = !term->window->is_fullscreen &&
term->colors.alpha != 0xffff;
struct buffer *buf = shm_get_buffer(
chain, term->width, term->height, use_alpha);
struct buffer *buf = shm_get_buffer(chain, term->width, term->height);
/* Dirty old and current cursor cell, to ensure they're repainted */
dirty_old_cursor(term);
@ -3787,7 +3784,7 @@ render_search_box(struct terminal *term)
size_t glyph_offset = term->render.search_glyph_offset;
struct buffer_chain *chain = term->render.chains.search;
struct buffer *buf = shm_get_buffer(chain, width, height, true);
struct buffer *buf = shm_get_buffer(chain, width, height);
pixman_region32_t clip;
pixman_region32_init_rect(&clip, 0, 0, width, height);
@ -4252,7 +4249,7 @@ render_urls(struct terminal *term)
struct buffer_chain *chain = term->render.chains.url;
struct buffer *bufs[render_count];
shm_get_many(chain, render_count, widths, heights, bufs, false);
shm_get_many(chain, render_count, widths, heights, bufs);
uint32_t fg = term->conf->colors_dark.use_custom.jump_label
? term->conf->colors_dark.jump_label.fg