From 0d3e543b4d6690f65070b95450aecb5792d0d51f Mon Sep 17 00:00:00 2001 From: Milan Zamazal Date: Mon, 23 Feb 2026 15:19:45 +0100 Subject: [PATCH] libcamera: software_isp: Set initial values of DebayerParams Debayer parameters and processing are currently run asynchronously. This can lead to assertion errors in case the processing tries to use not yet computed debayer parameters. To prevent this situation, specify some default values for DebayerParams members. This doesn't make correct parameters but prevents crashes or other crazy behaviours at least. Note this patch is just a workaround. The mutually asynchronous parameters computation and processing can cause more problems, like using parameters computed for a different frame. But it is non-trivial to fix that; in the meantime, setting the default values solves the worst problem. Closes: https://gitlab.freedesktop.org/camera/libcamera/-/issues/311 Signed-off-by: Milan Zamazal Reviewed-by: Hans de Goede Reviewed-by: Kieran Bingham Signed-off-by: Kieran Bingham --- .../libcamera/internal/software_isp/debayer_params.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/include/libcamera/internal/software_isp/debayer_params.h b/include/libcamera/internal/software_isp/debayer_params.h index 1c0412d7..6772b43b 100644 --- a/include/libcamera/internal/software_isp/debayer_params.h +++ b/include/libcamera/internal/software_isp/debayer_params.h @@ -18,11 +18,13 @@ namespace libcamera { struct DebayerParams { - Matrix combinedMatrix; - RGB blackLevel; - float gamma; - float contrastExp; - RGB gains; + Matrix combinedMatrix = { { 1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0 } }; + RGB blackLevel = RGB({ 0.0, 0.0, 0.0 }); + float gamma = 1.0; + float contrastExp = 1.0; + RGB gains = RGB({ 1.0, 1.0, 1.0 }); }; } /* namespace libcamera */