From be5f67f7c7cf2710b0e73df5d92be98c758c47a4 Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Sat, 13 Jun 2026 21:00:07 +0900 Subject: kernel: ui surfaces composite with per-pixel alpha + set_size resizes the target Two substrate capabilities the stage dock forced (both verified real-seat nested and on the gles2 headless path): 1. Per-pixel alpha. A ui surface composited opaque, so any overlay (the dock) occluded the toplevels beneath it. Root cause: a stray opaque render_iface->Clear() (glClearColor 0,0,0,1) in render_surface overrode the transparent BeginFrame clear, and EndFrame's premultiplied composite carried the opaque base to the buffer. Fix: drop the stray Clear(); clear the OUTPUT FBO to (0,0,0,0) once before BeginFrame. Blend was already correct premultiplied; the substrate never sets an opaque region (now guarded by a probe); ARGB8888 alpha survives end to end. A document whose is transparent now shows the scene through its un-painted pixels. 2. set_size resizes the render target. Previously logical-only (the slice-5 documented change-request): set_size re-laid-out the RmlUi document but did NOT realloc the GL target, so a surface created small and grown rendered into its original buffer (the dock, created as a 1px placeholder and grown on minimize, was invisible). Fix: set_size now reallocs the FBO + dmabuf swapchain/shm + EGLImage + texture + scene buffer on an ACTUAL size change (no-op same-size, cheap; set_position still cheap). Grow and shrink both render fully; alpha/upright-flip/blend/fence-sync preserved. ui.hpp documents both. kernel 45 cases/182 assertions green on build + build-asan (no new suppressions). Edits confined to packages/kernel/. --- packages/kernel/src/server.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'packages/kernel/src/server.cpp') diff --git a/packages/kernel/src/server.cpp b/packages/kernel/src/server.cpp index 95631df..d97104e 100644 --- a/packages/kernel/src/server.cpp +++ b/packages/kernel/src/server.cpp @@ -89,6 +89,14 @@ auto Server::ui_pixel(int x, int y) const -> unsigned int { return impl_->substrate != nullptr ? impl_->substrate->surface_pixel(x, y) : 0U; } +auto Server::ui_surface_has_opaque_region() const -> bool { + return impl_->substrate != nullptr && impl_->substrate->surface_has_opaque_region(); +} + +auto Server::ui_resize_realloc_count() const -> int { + return impl_->substrate != nullptr ? impl_->substrate->resize_realloc_count() : 0; +} + auto Server::ui_element_count(const char* tag) const -> int { return impl_->substrate != nullptr ? impl_->substrate->element_count(tag) : 0; } -- cgit v1.2.3