Public bug reported:

Ubuntu 26.04 ships libcamera 0.7.0-1ubuntu2. Its software ISP (used by every
camera on the "simple" pipeline handler, e.g. Intel IPU-based laptops,
Surface devices) has three bugs that are fixed upstream:

1. GPU debayer leaks one EGLImage per frame.
   eGL::createDMABufTexture2D() stores the image created by
   eglCreateImageKHR() and never destroys it on success. The camera process
   grows by ~0.7 kB per frame (~1.2 MB/min at 30 fps, ~74 MB/h), without
   bound while streaming.
   - heaptrack, 150 s stream: 2.39 MB leaked over 4261 calls from
     dri2_from_dma_bufs <- eGL::createDMABufTexture2D <- DebayerEGL::debayerGPU
   - Fixed upstream: b4ca5e6f "libcamera: egl: Remove eGLImage::image_"
     (in v0.7.1), upstream issue camera/libcamera#322.

2. CPU debayer aborts at stream start (LIBCAMERA_SOFTISP_MODE=cpu).
   When the first frame is fully black the auto black level becomes 1.0,
   blackIndex becomes 1024 and updateGammaTable() reads gammaTable_[1024]
   (size 1024):
   std::array<double, 1024>::operator[]: Assertion '__n < this->size()' failed
   in DebayerCpu::process. Reproduced 2/40 short sessions with GStreamer
   libcamerasrc; 0/40 with upstream.
   - Fixed upstream: 7d650a23 "libcamera: software_isp: Fix black level
     handling in CPU ISP" (in v0.7.2).

3. GPU debayer leaks an EGL context per camera start. Each
   DebayerEGL::start() creates a new context; only the last is freed. Every
   start/stop leaves two Mesa threads and tens of MB behind (measured: a
   long-running process reached 309 threads and 4.5 GB after a few hundred
   starts).
   - Fixed upstream: a00a4ca2 "libcamera: software_isp: debayer_egl: Avoid
     EGL context leaks" (on master, after v0.7.2).

Impact: long video calls grow memory continuously (1); apps that start and
stop the camera repeatedly (browsers, PipeWire, camera switching) grow by
tens of MB per start (3); the CPU path can abort (2).

Request: update libcamera in 26.04 to 0.7.2 (fixes 1 and 2) and backport
a00a4ca2 (fix 3), or backport all three commits to 0.7.0.

Tested on: Microsoft Surface Pro 7 (Intel IPU4P, OV5693/OV8865 via an
out-of-tree driver), Ubuntu 26.04, kernel 7.2.13 (linux-surface), Mesa
26.0.8, GStreamer 1.28.2. Issue 2 was verified against an upstream master
build (0/40 aborts); for issues 1 and 3 the upstream fixes were checked in
the code, the leaks themselves were measured on 0.7.0 only.

The analysis was done with the help of an AI assistant (Claude); I reviewed
it and ran the tests on my hardware.

ProblemType: Bug
DistroRelease: Ubuntu 26.04
Package: libcamera0.7 0.7.0-1ubuntu2
Uname: Linux 7.2.13-1-surface x86_64
ApportVersion: 2.34.1-0ubuntu0.1
Architecture: amd64
CasperMD5CheckResult: fail
CurrentDesktop: ubuntu:GNOME
Date: Fri Oct 30 21:58:51 2026
InstallationDate: Installed on 2026-07-28 (95 days ago)
InstallationMedia: Ubuntu 26.04 "Resolute Raccoon" - Release amd64 (20260423.1)
ProcEnviron:
 LANG=de_DE.UTF-8
 PATH=(custom, no user)
 SHELL=/bin/bash
 TERM=xterm-256color
 XDG_RUNTIME_DIR=<set>
SourcePackage: libcamera
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: libcamera (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug resolute wayland-session

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2172636

Title:
  libcamera 0.7.0 software ISP: EGLImage leak per frame, CPU debayer
  abort, EGL context leak (fixed upstream)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/libcamera/+bug/2172636/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to