From patchwork Tue May 23 12:02:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18648 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 6E7FAC3284 for ; Tue, 23 May 2023 12:03:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E2E2F60547; Tue, 23 May 2023 14:03:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1684843391; bh=BmkQ9qQ/CHIAiw1xSO/GUnoAcYxGMj0SiR0LmskiuWg=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=eM3tQ1x4Nty9rs+f4zpjl0GjewJelZUgf3bDvERfLTSj32IGjthIJuymKGGuGyQys jn2STTzeQmQfh5L6/sBOOGUDX/3Yhun++t5o0eAP5Yo0gOTW4ohAUrN6NMCJ9ZzJjU HNV8N8mgh/rV4fsD6LpkdupR94l1k3wOHR8f2v/oFBXEkL00Lp1o9SULSoHUdKxFkJ Pa+RC1WONs7MC+955ZKYDxoi1+MpG5wyQrxonnLlDquvnG4TUyNtBUPVbiiyU+1ScB s/0fpE2LonT+yyyDgdx2RaSrbZk/yXXE6jJ+qSVqoG7XEeGrYc7uIREI6zm9FBIzeh 4eyFDEbt2imkg== Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 36CCF603F7 for ; Tue, 23 May 2023 14:03:10 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="Lj5VYsWH"; dkim-atps=neutral Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3f6077660c6so13270635e9.0 for ; Tue, 23 May 2023 05:03:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1684843389; x=1687435389; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=wWGe67/4cMA3iQ1Mj72JNeiBeZrSUZvEyrlncu9VBHk=; b=Lj5VYsWHg9Kj9Z9Ynq6NNnM9hNW0xwP4n34Lcfp1x8NFOSw0Yjm15GfEayca31/w1j TAJvjhv4Q3Wg3fMktgwcQTMXoBy04EcUjQI0qO8UuMg1SZjJqNn+pbW4W6u86xZN9Cgs u2H5kmOwIA9UGRDoyS3GRrJMfs/6+5q6MuDgdmbnRvxFEBZd05+UGJr/uk4H7yH5iV55 BnU/aOmaP1NBs609fxp8mFmvu3er8ofHmjqhghZ954Ud5JH0JP1oCIiUoXq6MWtuuw4z gntg9ZB4jlAJfEoe7/5SZWlGtESIV3oJwBt/tmlA9WPoVcDUJnqkwdmpJP39NJDkJZ0S I48Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684843389; x=1687435389; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wWGe67/4cMA3iQ1Mj72JNeiBeZrSUZvEyrlncu9VBHk=; b=UoXbgS6N2jqTWHA1aPhNvzmO8AYsHHWuDmDYAqCmNOEdX/a9lETzfN559Cvrpot7qD ktNtIEpzSgo0Q/j7/7E6RJnVfnEGr0eBqz9SNNZGTKe4SIE2HVjACzFxCsf8UaMHZMpR 7lnWRnOBqLIO0+WrW1ysB6ClYKSe97etR9KnJiiZLF7P1S/94l7eWWMepJWSkV/GZfJN 8hD7GkWjt/lVLsYqZTenpc7T83lMdH5gR2a4Sq1oKU4tWoxGZJeH6/02c2KfU5coeJHA Wf4kVR+yAzjKphpb/0YOpde4N5ODYq/W5UgVP25gcObHOIZ5r2Lh5yn78M3qXmC5OFsD pABg== X-Gm-Message-State: AC+VfDynsy4+VbPxsm+k3CxUMDPDg7/0ZwbdW8wK6Z6iZibih047PVFz hl/0ax32PhYLLLv7TJM05H+rOQLCz3cua8GcOwXcdw== X-Google-Smtp-Source: ACHHUZ4E7wgkuNlZ4fYH4on9hRcvz6o9VNhbqBqpA7DgER4JqWlTSf2Jh3JcFwmPtGiobrg6uArlsg== X-Received: by 2002:a05:600c:204:b0:3f6:106:35b6 with SMTP id 4-20020a05600c020400b003f6010635b6mr6439765wmi.37.1684843389418; Tue, 23 May 2023 05:03:09 -0700 (PDT) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id m25-20020a7bcb99000000b003f195d540d9sm14812282wmi.14.2023.05.23.05.03.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 05:03:08 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Tue, 23 May 2023 13:02:08 +0100 Message-Id: <20230523120208.31292-1-naush@raspberrypi.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] pipeline: rpi: ipa_base: Parse config files after platformRegister() 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: , X-Patchwork-Original-From: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" If a user uses a pipeline handler config file where a custom timeout value is specified, it would lead to a segmentation fault when loadPipelineConfiguration() tried to access the as yet uninitialised V4L2VideoDevice object. To fix this, parse the pipeline handler config file only after fully initialising and registering the pipeline handler and V4L2VideoDevice objects. Fixes: 6c71ee1f15305 ("pipeline: raspberrypi: Introduce PipelineHandlerBase class") Signed-off-by: Naushir Patuck Reviewed-by: Jacopo Mondi Reviewed-by: David Plowman --- src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp index ba1797bcfef0..3bb5ec531e4f 100644 --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp @@ -888,16 +888,16 @@ int PipelineHandlerBase::registerCamera(std::unique_ptr &camera } data->nativeBayerOrder_ = bayerFormat.order; + ret = platformRegister(cameraData, frontend, backend); + if (ret) + return ret; + ret = data->loadPipelineConfiguration(); if (ret) { LOG(RPI, Error) << "Unable to load pipeline configuration"; return ret; } - ret = platformRegister(cameraData, frontend, backend); - if (ret) - return ret; - /* Setup the general IPA signal handlers. */ data->frontendDevice()->dequeueTimeout.connect(data, &RPi::CameraData::cameraTimeout); data->frontendDevice()->frameStart.connect(data, &RPi::CameraData::frameStarted);