libcamera: software_isp: Skip stop before worker start
diff mbox series

Message ID Oe4ndqz2uLfnO_YzXwHZ-zP-ybkyFL7fGin9mH3Yz0ifHbcB_n_QgT82M-Cr5PWssdcrJWjPVNhJJ5brBOjbAMNZ3LeEhTM96ZNeAgReh0o=@pm.me
State New
Headers show
Series
  • libcamera: software_isp: Skip stop before worker start
Related show

Commit Message

Birk Skyum Sept. 6, 2026, 1:44 p.m. UTC
The simple pipeline calls stop() if the capture device fails to startstreaming, before SoftwareIsp::start() has run. The blocking invocation
of Debayer::stop() then waits indefinitely for a worker thread that is
not running.

Return early when the worker has not started so that Camera::start()
can report the original capture error.

Bug: https://gitlab.freedesktop.org/camera/libcamera/-/issues/349
Signed-off-by: Birk Skyum <birk.skyum@pm.me>
---

Tested on a Lenovo Yoga Slim 7x with libcamera 0.7.2. Injecting an
ETIMEDOUT failure into VIDIOC_STREAMON causes the unpatched cam process
to hang until an eight-second timeout. With this patch, cam promptly
returns the capture-start error.

The private AArch64 build passed 46 tests, with one expected failure,
30 skips and no unexpected failures. Runtime testing was on 0.7.2;
the same unguarded stop path remains in current master.

Reproducer and detailed results:
https://gist.github.com/birkskyum/5ec156ca5654d7ac2251a275718c94b3

 src/libcamera/software_isp/software_isp.cpp | 3 +++
 1 file changed, 3 insertions(+)


base-commit: 191e202178f02430b5942397c70d215cdd2056fa

Patch
diff mbox series

diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp
index c73a16c..c801034 100644
--- a/src/libcamera/software_isp/software_isp.cpp
+++ b/src/libcamera/software_isp/software_isp.cpp
@@ -395,6 +395,9 @@  int SoftwareIsp::start()
  */
 void SoftwareIsp::stop()
 {
+ if (!ispWorkerThread_.isRunning())
+ return;
+
  debayer_->invokeMethod(&Debayer::stop,
        ConnectionTypeBlocking);