From patchwork Fri May 7 12:44:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 12231 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 7A101BF831 for ; Fri, 7 May 2021 12:44:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EBC67602BF; Fri, 7 May 2021 14:44:51 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="nuifAkRO"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0EA44602BB for ; Fri, 7 May 2021 14:44:50 +0200 (CEST) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7B4E22CF; Fri, 7 May 2021 14:44:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1620391489; bh=H69quKw70i6kvFDAMlvqhDSLqDiR5egO5slYBWWLtYc=; h=From:To:Cc:Subject:Date:From; b=nuifAkROwJRxtwFBocxoHV8mev12gOg9W4IMz19GEQ1rF8a5/khlKbJ1orRCzlabn Qr7/dOJo+t8gnWRYeWgbS8MTQT5TMHhxUvCqpEAvOJfw42156HF4FDiiFKXtaDjS5x u4d1fEm28MF2G0ofGjyTv1+JXlCOY6RJfRPMumPc= From: Kieran Bingham To: libcamera devel Date: Fri, 7 May 2021 13:44:44 +0100 Message-Id: <20210507124444.1089347-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: controls: Remove merge assertion 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" The ControlList merge operation is protected with an ASSERT to guarantee that the two lists are compatible. Unfortunately this assertion fails when we run IPAs in an isolated case as while the lists are compatible, the isolated IPA has a unique instance of the id map. This breaks the pointer comparison, and the assertion fails with a false positive. Remove the assertion, leaving only a todo in it's place as this breaks active users of the library. Bugzilla: https://bugs.libcamera.org/show_bug.cgi?id=31 Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- src/libcamera/controls.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp index b763148d4391..5aef4e7145bd 100644 --- a/src/libcamera/controls.cpp +++ b/src/libcamera/controls.cpp @@ -890,7 +890,17 @@ ControlList::ControlList(const ControlInfoMap &infoMap, ControlValidator *valida */ void ControlList::merge(const ControlList &source) { - ASSERT(idmap_ == source.idmap_); + /** + * \todo: ASSERT that the current and source ControlList are derived + * from a compatible ControlIdMap, to prevent undefined behaviour due to + * id collisions. + * + * This can not currently be a direct pointer comparison due to the + * duplication of the ControlIdMaps in the isolated IPA use cases. + * Furthermore, manually checking each entry of the id map is identical + * is expensive. + * See https://bugs.libcamera.org/show_bug.cgi?id=31 for further details + */ for (const auto &ctrl : source) { if (contains(ctrl.first)) {