mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-11 17:37:33 +02:00
On Linux builds with Vulkan, WebContent already paints into GPU-backed Skia surfaces, but the backing store shared with the UI process was still a CPU ShareableBitmap. That forced every flush to read the GPU image back into a bitmap so the UI could sample it, defeating most of the benefit of GPU painting. Teach SharedImage to carry a LinuxDmaBufHandle alongside ShareableBitmap as a Variant, with a tagged IPC encoding and an fd clone on encode so both processes own an independent handle. When USE_VULKAN_DMABUF_IMAGES is enabled, BackingStoreManager now allocates the front/back buffers as linear-modifier Vulkan images and publishes their dmabuf fds to the UI; the Skia painting surfaces wrap those Vulkan images directly, so no readback is needed. The old shareable-bitmap path is preserved as a fallback for the non-Vulkan case and when image creation fails. On the receive side, SharedImageBuffer::import_from_shared_image mmaps a linear dmabuf to reconstruct a CPU Bitmap, keeping existing consumers that expect CPU access working unchanged. VulkanImage memory type selection is factored into a small helper, and linear images now request host-visible (cached if available) memory rather than device-local, since a linear dmabuf has to be CPU-mappable on the importer side.
7.0 KiB
7.0 KiB