From patchwork Mon Feb 23 14:19:45 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milan Zamazal X-Patchwork-Id: 26225 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 47EBBC0DA4 for ; Mon, 23 Feb 2026 14:19:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 082506228B; Mon, 23 Feb 2026 15:19:57 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="GfPEJjdO"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D1D55621CE for ; Mon, 23 Feb 2026 15:19:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771856393; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=07dLA700o8LmPSlRLrONecWQdUtJWnTqC63YH2VWoyU=; b=GfPEJjdOTVEVqTkAd5eIGapJzmYRJyaJ4X8ptrh4LY8+LiAVvoTz8odmWvQe5hULkjoATc Mbzb2yPgoOQ2ypCDsH+ZmEZKauTctCX0KlFw87VAM2AsGmWy8CMpqDuqJQdxp5+su+kNQH 0SruOJGGr6bPs39OTsvh37xtuEfCZrI= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-468-usYjZp3bO5uXC3KVm_bMcg-1; Mon, 23 Feb 2026 09:19:51 -0500 X-MC-Unique: usYjZp3bO5uXC3KVm_bMcg-1 X-Mimecast-MFC-AGG-ID: usYjZp3bO5uXC3KVm_bMcg_1771856391 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9467F19560B1; Mon, 23 Feb 2026 14:19:50 +0000 (UTC) Received: from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.45.225.238]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BD7B01955D71; Mon, 23 Feb 2026 14:19:48 +0000 (UTC) From: Milan Zamazal To: libcamera-devel@lists.libcamera.org Cc: Milan Zamazal , =?utf-8?b?QmFybmFiw6FzIFDFkWN6?= =?utf-8?q?e?= Subject: [PATCH] libcamera: software_isp: Set initial values of DebayerParams Date: Mon, 23 Feb 2026 15:19:45 +0100 Message-ID: <20260223141945.58779-1-mzamazal@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: l3lBi32rz6DB8VAdhOPuPfwdTFssQLy8HL-2J63Blx4_1771856391 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 --- .../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 1c0412d75..6772b43bc 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 */