render/gles2: add scissor-based clipping for tile-based renderers

Add an optional scissor-based clipping strategy to the GLES2 render
pass, it is enabled with WLR_GLES2_SCISSOR_CLIP=1 env var. And it is
disabled by default so it doesn't affect current users.

On tile-based renderers like V3D (Broadcom VideoCore, used in Raspberry
Pi), not using scissoring makes the GPU to render the full-surface.
If scissor is applied only the tiles affected are load/render/stored
reducing the GPU usage.

Patch backported to wlroots 0.19 with labwc on Raspberry Pi OS with
v3d running glxgear 300x300 on top left corner of screen:

- Before: labwc uses 21.5% of GPU render availability.
- After : labwc uses  3.3% of GPU render availability.

This patch over wlroots master with sway on Raspberry Pi OS with
v3d running glxgear half-screen and a terminal half screen:

- Before: sway uses 23.5% of GPU render availability.
- After : sway uses 13.6% of GPU render availability.
This commit is contained in:
Jose Maria Casanova Crespo 2026-03-06 12:07:30 +01:00
parent 736c0f3f25
commit f33853f861
3 changed files with 59 additions and 27 deletions

View file

@ -87,6 +87,8 @@ struct wlr_gles2_renderer {
struct wl_list buffers; // wlr_gles2_buffer.link
struct wl_list textures; // wlr_gles2_texture.link
bool scissor; // enables scissor clipping for tile render GPUs
};
struct wlr_gles2_render_timer {