From patchwork Thu Oct 15 22:37:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10062 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 46483BE905 for ; Thu, 15 Oct 2020 22:37:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EC5B160E36; Fri, 16 Oct 2020 00:37:57 +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="DBoy6x5K"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B0C56600F2 for ; Fri, 16 Oct 2020 00:37:55 +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 2E432A42; Fri, 16 Oct 2020 00:37:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1602801475; bh=WV+v2EAoJewCWepaPmgm4Izg7iqJ5wx+/vJhix2mXXg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DBoy6x5KsmPDbIDNyXtlbqA0pBo/uCKWd8JQw5gYzZ2pOtI0V36CFL/fe00EGG1vU +In81SvHflC4jadMJxSej/aKjB+H0GaSSbpoE41aGe1Zz6pfRtNipC5C1FhiYBZrHL O83k3cN4TQCGnjsEAphb0SKPEGfBYltey54iENjo= From: Kieran Bingham To: libcamera devel Date: Thu, 15 Oct 2020 23:37:40 +0100 Message-Id: <20201015223750.58563-2-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201015223750.58563-1-kieran.bingham@ideasonboard.com> References: <20201015223750.58563-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 01/11] cam: options: Rename optional arg to prevent aliasing 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 parseValue function is given the optarg directly from the getopt library, but the function retains the same name. This causes an alias of the global optarg variable to be present in the parseValue function. While this is not harmful, rename it to work towards disabling aliases variables. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/cam/options.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cam/options.cpp b/src/cam/options.cpp index 358507eabf89..417c3ab49bc9 100644 --- a/src/cam/options.cpp +++ b/src/cam/options.cpp @@ -77,7 +77,7 @@ void OptionsBase::invalidate() template bool OptionsBase::parseValue(const T &opt, const Option &option, - const char *optarg) + const char *arg) { OptionValue value; @@ -88,9 +88,9 @@ bool OptionsBase::parseValue(const T &opt, const Option &option, case OptionInteger: unsigned int integer; - if (optarg) { + if (arg) { char *endptr; - integer = strtoul(optarg, &endptr, 0); + integer = strtoul(arg, &endptr, 0); if (*endptr != '\0') return false; } else { @@ -101,12 +101,12 @@ bool OptionsBase::parseValue(const T &opt, const Option &option, break; case OptionString: - value = OptionValue(optarg ? optarg : ""); + value = OptionValue(arg ? arg : ""); break; case OptionKeyValue: KeyValueParser *kvParser = option.keyValueParser; - KeyValueParser::Options keyValues = kvParser->parse(optarg); + KeyValueParser::Options keyValues = kvParser->parse(arg); if (!keyValues.valid()) return false; From patchwork Thu Oct 15 22:37:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10063 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 A00ABBE905 for ; Thu, 15 Oct 2020 22:38:00 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 51F7A610C4; Fri, 16 Oct 2020 00:38:00 +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="Ro/AR5Xf"; 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 199D5600F2 for ; Fri, 16 Oct 2020 00:37:56 +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 999D811F0; Fri, 16 Oct 2020 00:37:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1602801475; bh=eUl8J+hAKtxbT6JLkJ9Q6E9SpTEI1G2vXG+SIuUg2Bc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ro/AR5XfP1Zc2KLbSaHVZhX35FU/ifs3WZ5Aj0ENMxJXc6sI//Vc7/z7a76W5h8+/ dpQ31nqbbvd6fAOvZ4vSGgtG6sntaMUJEAj+95ESE9EYxjkRmCaXAj777C9CioWbaL EMie/vh4/ulw3Jt6j+jn8mv91z2/3MR5zsV1aEOw= From: Kieran Bingham To: libcamera devel Date: Thu, 15 Oct 2020 23:37:41 +0100 Message-Id: <20201015223750.58563-3-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201015223750.58563-1-kieran.bingham@ideasonboard.com> References: <20201015223750.58563-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 02/11] qcam: main_window: Explicitly name raw buffer 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 buffer obtained for queuing to a raw stream aliases the buffer passed in for the main view finder stream. Prevent aliasing, and explicitly name the buffer as a separate variable. Suggested-by: Niklas Söderlund Signed-off-by: Kieran Bingham Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/qcam/main_window.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index 0cbdab9a6bce..f140313ede8d 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -769,16 +769,16 @@ void MainWindow::queueRequest(FrameBuffer *buffer) request->addBuffer(vfStream_, buffer); if (captureRaw_) { - FrameBuffer *buffer = nullptr; + FrameBuffer *rawBuffer = nullptr; { QMutexLocker locker(&mutex_); if (!freeBuffers_[rawStream_].isEmpty()) - buffer = freeBuffers_[rawStream_].dequeue(); + rawBuffer = freeBuffers_[rawStream_].dequeue(); } - if (buffer) { - request->addBuffer(rawStream_, buffer); + if (rawBuffer) { + request->addBuffer(rawStream_, rawBuffer); captureRaw_ = false; } else { qWarning() << "No free buffer available for RAW capture"; From patchwork Thu Oct 15 22:37:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10064 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 62EA3BE905 for ; Thu, 15 Oct 2020 22:38:01 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0D8E3610A9; Fri, 16 Oct 2020 00:38:01 +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="BR1vqHsM"; 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 8341A600F2 for ; Fri, 16 Oct 2020 00:37:56 +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 054AD121C; Fri, 16 Oct 2020 00:37:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1602801476; bh=dp1QNyyJtrGb9ppLd/EsLCxKorGVyJwhsacIuJOCgLQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BR1vqHsM7anUNXzp/D/9olVaBOG2T771li58j5F65oL9HKWUf1T1o4tMwbFuD+gii 3pwlUek/6euo2HvWnJTi6qsG5TJZzA91wheeqwtjhjKQ7OQAtDhHPyfInaTNWa7U6N 2yciJSZq+ElVcVzMI9IAQ55E4fJ0TvIiwDoXRecE= From: Kieran Bingham To: libcamera devel Date: Thu, 15 Oct 2020 23:37:42 +0100 Message-Id: <20201015223750.58563-4-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201015223750.58563-1-kieran.bingham@ideasonboard.com> References: <20201015223750.58563-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 03/11] libcamera: thread: Prevent aliasing of signal name 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 Thread::wait() function creates a boolean flag 'finished' which aliases the internal member signal of the same name. Rename the boolean flag to prevent confusion and aliasing of the signal. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/libcamera/thread.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcamera/thread.cpp b/src/libcamera/thread.cpp index 87006a9c4301..b5d7103ad341 100644 --- a/src/libcamera/thread.cpp +++ b/src/libcamera/thread.cpp @@ -374,7 +374,7 @@ void Thread::exit(int code) */ bool Thread::wait(utils::duration duration) { - bool finished = true; + bool hasFinished = true; { MutexLocker locker(data_->mutex_); @@ -382,14 +382,14 @@ bool Thread::wait(utils::duration duration) if (duration == utils::duration::max()) data_->cv_.wait(locker, [&]() { return !data_->running_; }); else - finished = data_->cv_.wait_for(locker, duration, - [&]() { return !data_->running_; }); + hasFinished = data_->cv_.wait_for(locker, duration, + [&]() { return !data_->running_; }); } if (thread_.joinable()) thread_.join(); - return finished; + return hasFinished; } /** From patchwork Thu Oct 15 22:37:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10065 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 F34C8BE905 for ; Thu, 15 Oct 2020 22:38:01 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AB9C161081; Fri, 16 Oct 2020 00:38:01 +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="svO6i5sS"; 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 013A5600F2 for ; Fri, 16 Oct 2020 00:37:57 +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 73F97556; Fri, 16 Oct 2020 00:37:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1602801476; bh=wIJFz3lU2EcDsfiDCs9X7jcZxFOFw2p6V9Oq6cxFFU0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=svO6i5sSw9bfXP3ZJA4OqKNNK9L5F4fECoRDLabn9V/vZ8s5fsfabNIPnmggreIcb OSa+SctH4afKImfjxOteyCAJQuTuodr6/EoJ1tfGS5Ua0aNZie1aIXpnSJ+MP3mink v8bocfN6UlMZ5TYji6Q9kWRLDG4N4GbtqwvMycqY= From: Kieran Bingham To: libcamera devel Date: Thu, 15 Oct 2020 23:37:43 +0100 Message-Id: <20201015223750.58563-5-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201015223750.58563-1-kieran.bingham@ideasonboard.com> References: <20201015223750.58563-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 04/11] libcamera: pipeline: Prevent variable aliasing 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" Remove variable aliasing within the pipeline handler implementations. Signed-off-by: Kieran Bingham Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 6 +++--- src/libcamera/pipeline/simple/converter.cpp | 8 ++++---- src/libcamera/pipeline/simple/simple.cpp | 4 ++-- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 26dbd2573e04..85e0a1f26ab6 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -512,9 +512,9 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera, /* Translate the V4L2PixelFormat to PixelFormat. */ std::map> deviceFormats; for (const auto &format : fmts) { - PixelFormat pixelFormat = format.first.toPixelFormat(); - if (pixelFormat.isValid()) - deviceFormats[pixelFormat] = format.second; + PixelFormat pf = format.first.toPixelFormat(); + if (pf.isValid()) + deviceFormats[pf] = format.second; } /* Add the stream format based on the device node used for the use case. */ diff --git a/src/libcamera/pipeline/simple/converter.cpp b/src/libcamera/pipeline/simple/converter.cpp index 75fb297ebd58..2b541cd2bb3f 100644 --- a/src/libcamera/pipeline/simple/converter.cpp +++ b/src/libcamera/pipeline/simple/converter.cpp @@ -72,11 +72,11 @@ std::vector SimpleConverter::formats(PixelFormat input) * Set the format on the input side (V4L2 output) of the converter to * enumerate the conversion capabilities on its output (V4L2 capture). */ - V4L2DeviceFormat format; - format.fourcc = m2m_->output()->toV4L2PixelFormat(input); - format.size = { 1, 1 }; + V4L2DeviceFormat v4l2Format; + v4l2Format.fourcc = m2m_->output()->toV4L2PixelFormat(input); + v4l2Format.size = { 1, 1 }; - int ret = m2m_->output()->setFormat(&format); + int ret = m2m_->output()->setFormat(&v4l2Format); if (ret < 0) { LOG(SimplePipeline, Error) << "Failed to set format: " << strerror(-ret); diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 7adb17e2d1db..999c44515023 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -314,8 +314,8 @@ int SimpleCameraData::init() config.outputSizes = converter->sizes(format.size); - for (PixelFormat format : converter->formats(pixelFormat)) - formats_[format] = config; + for (PixelFormat fmt : converter->formats(pixelFormat)) + formats_[fmt] = config; } } diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp index 8ec0dac1e689..54ba1b87bb3e 100644 --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp @@ -490,8 +490,8 @@ int UVCCameraData::init(MediaDevice *media) /* Locate and initialise the camera data with the default video node. */ const std::vector &entities = media->entities(); auto entity = std::find_if(entities.begin(), entities.end(), - [](MediaEntity *entity) { - return entity->flags() & MEDIA_ENT_FL_DEFAULT; + [](MediaEntity *e) { + return e->flags() & MEDIA_ENT_FL_DEFAULT; }); if (entity == entities.end()) { LOG(UVC, Error) << "Could not find a default video device"; From patchwork Thu Oct 15 22:37:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10066 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 51257BEEDF for ; Thu, 15 Oct 2020 22:38:02 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0525F610D0; Fri, 16 Oct 2020 00:38:02 +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="fDuXAQiQ"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5272261081 for ; Fri, 16 Oct 2020 00:37:57 +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 E359BA42; Fri, 16 Oct 2020 00:37:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1602801477; bh=9USVpiBJjyne4Vu1QMRis8SYEWbL+Hye0a0n2VW8kUI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fDuXAQiQ1ZED8R0otvtVroi9oFwj5jgZyJzgkOvd0TfLacVUEIdVSlXz6ieF4T9Xq swDdboDQCPw4/pJx91Ndz/aHEAcJ4QK2cHCK5AiVwQzf9zYThjAYsigQgvxFXHebbn 9PTrDHUG01DySJbo7fEVSpGOq3/PCOuCssB/a/Ic= From: Kieran Bingham To: libcamera devel Date: Thu, 15 Oct 2020 23:37:44 +0100 Message-Id: <20201015223750.58563-6-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201015223750.58563-1-kieran.bingham@ideasonboard.com> References: <20201015223750.58563-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 05/11] libcamera: pipeline: Use existing variable definitions 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" Prevent variable aliasing by removing the redeclaration of variables with the same name (and type) where the existing variable can be reused. Signed-off-by: Kieran Bingham Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 2 +- src/libcamera/pipeline/simple/simple.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 85e0a1f26ab6..2d70d984a276 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1008,7 +1008,7 @@ int PipelineHandlerRPi::queueAllBuffers(Camera *camera) */ unsigned int i; for (i = 0; i < data->dropFrameCount_; i++) { - int ret = stream->queueBuffer(nullptr); + ret = stream->queueBuffer(nullptr); if (ret) return ret; } diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 999c44515023..33daa2fb1b7b 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -612,8 +612,8 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c) useConverter_ = config->needConversion(); if (useConverter_) { - int ret = converter_->configure(pipeConfig.pixelFormat, - pipeConfig.captureSize, &cfg); + ret = converter_->configure(pipeConfig.pixelFormat, + pipeConfig.captureSize, &cfg); if (ret < 0) { LOG(SimplePipeline, Error) << "Unable to configure converter"; From patchwork Thu Oct 15 22:37:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10067 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 8332CBEEE0 for ; Thu, 15 Oct 2020 22:38:02 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4869D610AE; Fri, 16 Oct 2020 00:38:02 +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="ddrtjYGf"; 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 B3A646108B for ; Fri, 16 Oct 2020 00:37:57 +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 4AFB911F0; Fri, 16 Oct 2020 00:37:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1602801477; bh=g/9rsRUTMPpvw9kLUTGWs19Y+blTVCMcCXHPIpJKNA0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ddrtjYGf5sUZb+JqWL/HPX3QRXZLADYt+3n9RHIlHqM7dIOOTK/MHiCe5/tKJIACh SaSe4FqS92UM532F68YX4arXJ5RA9la4H1VLv9+K+fV81ytc6Td2HiedX363FodvWO 0Y4e0iDx69OVHD9MvbO1V1+ki2uFWbjVk/qejl7A= From: Kieran Bingham To: libcamera devel Date: Thu, 15 Oct 2020 23:37:45 +0100 Message-Id: <20201015223750.58563-7-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201015223750.58563-1-kieran.bingham@ideasonboard.com> References: <20201015223750.58563-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 06/11] libcamera: pipeline: rpi_stream: Explicitly name requestBuffer 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 FrameBuffer used to track any addition to the reqeust in an under-run event was aliased against the returned buffer, being placed back on the availableBuffers_ queue. Rename the aliased variable to be more explicit that it is a separate Buffer. Signed-off-by: Kieran Bingham Reviewed-by: Niklas Söderlund --- src/libcamera/pipeline/raspberrypi/rpi_stream.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp index 1a42cc17bcba..3a5dadab81e0 100644 --- a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp +++ b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp @@ -163,9 +163,9 @@ void Stream::returnBuffer(FrameBuffer *buffer) * If so, do it now as availableBuffers_ will not be empty. */ while (!requestBuffers_.empty()) { - FrameBuffer *buffer = requestBuffers_.front(); + FrameBuffer *requestBuffer = requestBuffers_.front(); - if (!buffer) { + if (!requestBuffer) { /* * We want to queue an internal buffer, but none * are available. Can't do anything, quit the loop. @@ -177,12 +177,12 @@ void Stream::returnBuffer(FrameBuffer *buffer) * We want to queue an internal buffer, and at least one * is available. */ - buffer = availableBuffers_.front(); + requestBuffer = availableBuffers_.front(); availableBuffers_.pop(); } requestBuffers_.pop(); - queueToDevice(buffer); + queueToDevice(requestBuffer); } } From patchwork Thu Oct 15 22:37:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10068 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 EA51EBE905 for ; Thu, 15 Oct 2020 22:38:02 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B3939610C0; Fri, 16 Oct 2020 00:38:02 +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="dBa2108w"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1F56261098 for ; Fri, 16 Oct 2020 00:37:58 +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 A004A556; Fri, 16 Oct 2020 00:37:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1602801477; bh=5rym77LMWHxV5W7dnLcPatDD2jvv3mQJoFff/NVpSNA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dBa2108wwRwB98CLbvMh9lPjRKeeNuvFLY7zvgBZfEnhZ++f+pXnna0KLAtqy1IbL Qo5jnVuptIgEcte+TeFsXoQRtD7VhgGEYYAjyrp3pYMb0Xpl/1AmPPt7t2cGPgu7+z XSDhU/ssnXhkUuHPgA3vGOflJhw7zaBD8tDyA9/0= From: Kieran Bingham To: libcamera devel Date: Thu, 15 Oct 2020 23:37:46 +0100 Message-Id: <20201015223750.58563-8-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201015223750.58563-1-kieran.bingham@ideasonboard.com> References: <20201015223750.58563-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 07/11] libcamera: v4l2_videodevice: Prevent aliasing of V4L2BufferCache members 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 members free, and lastUsed were not following the libcamera coding style, and were producing an aliased parameter on the construction. Rename them to be marked as member variables with the _ postfix accordingly. Signed-off-by: Kieran Bingham Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- include/libcamera/internal/v4l2_videodevice.h | 4 ++-- src/libcamera/v4l2_videodevice.cpp | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h index 40ed87e17cfa..53f6a2d5515b 100644 --- a/include/libcamera/internal/v4l2_videodevice.h +++ b/include/libcamera/internal/v4l2_videodevice.h @@ -127,8 +127,8 @@ private: bool operator==(const FrameBuffer &buffer) const; - bool free; - uint64_t lastUsed; + bool free_; + uint64_t lastUsed_; private: struct Plane { diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index 508522ef42bb..0182dc4962f2 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -212,7 +212,7 @@ int V4L2BufferCache::get(const FrameBuffer &buffer) for (unsigned int index = 0; index < cache_.size(); index++) { const Entry &entry = cache_[index]; - if (!entry.free) + if (!entry.free_) continue; /* Try to find a cache hit by comparing the planes. */ @@ -222,9 +222,9 @@ int V4L2BufferCache::get(const FrameBuffer &buffer) break; } - if (entry.lastUsed < oldest) { + if (entry.lastUsed_ < oldest) { use = index; - oldest = entry.lastUsed; + oldest = entry.lastUsed_; } } @@ -248,16 +248,16 @@ int V4L2BufferCache::get(const FrameBuffer &buffer) void V4L2BufferCache::put(unsigned int index) { ASSERT(index < cache_.size()); - cache_[index].free = true; + cache_[index].free_ = true; } V4L2BufferCache::Entry::Entry() - : free(true), lastUsed(0) + : free_(true), lastUsed_(0) { } V4L2BufferCache::Entry::Entry(bool free, uint64_t lastUsed, const FrameBuffer &buffer) - : free(free), lastUsed(lastUsed) + : free_(free), lastUsed_(lastUsed) { for (const FrameBuffer::Plane &plane : buffer.planes()) planes_.emplace_back(plane); From patchwork Thu Oct 15 22:37:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10069 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 59415BEEE1 for ; Thu, 15 Oct 2020 22:38:03 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 25F17610B6; Fri, 16 Oct 2020 00:38:03 +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="PykETNe3"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9F2F960F23 for ; Fri, 16 Oct 2020 00:37:58 +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 186CFA42; Fri, 16 Oct 2020 00:37:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1602801478; bh=lEYqiJu9Sp8Dx7iDZU/u0JSJSg82Bc5v9e9XOg6YxVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PykETNe3kpp9Di/HRY0l/Xp4xablFROe89qEvuSGtrl/5gO3ub3X6WDA9wdXUdxXN xbREgkwu6L0N+GUmOzyOUdAJmPEvweAjq1PsstcYI2QA9UAwQa4+2k0eRX+BIp6mY0 u3INljgSfHM2SMMYgc6SlzodUvrYKW2GDSdMG0HI= From: Kieran Bingham To: libcamera devel Date: Thu, 15 Oct 2020 23:37:47 +0100 Message-Id: <20201015223750.58563-9-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201015223750.58563-1-kieran.bingham@ideasonboard.com> References: <20201015223750.58563-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 08/11] test: v4l2_videodevice: Prevent variable aliasing of format 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" Rename the scoped usage of the variable format while iterating the formats as it aliases the outer scoped format which is used for specific testing. Signed-off-by: Kieran Bingham Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- test/v4l2_videodevice/formats.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/v4l2_videodevice/formats.cpp b/test/v4l2_videodevice/formats.cpp index 043732dcaba1..e3283cf92bff 100644 --- a/test/v4l2_videodevice/formats.cpp +++ b/test/v4l2_videodevice/formats.cpp @@ -55,10 +55,10 @@ protected: { V4L2_PIX_FMT_Y16_BE, "Y16 -BE" } }; - for (const auto &format : formats) { - if (V4L2PixelFormat(format.first).toString() != format.second) { + for (const auto &fmt : formats) { + if (V4L2PixelFormat(fmt.first).toString() != fmt.second) { cerr << "Failed to convert V4L2PixelFormat" - << utils::hex(format.first) << "to string" + << utils::hex(fmt.first) << "to string" << endl; return TestFail; } From patchwork Thu Oct 15 22:37:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10070 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 D2C5FBEEDF for ; Thu, 15 Oct 2020 22:38:03 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9C47A60F61; Fri, 16 Oct 2020 00:38:03 +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="ITb5i+Yz"; 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 09F9D600F2 for ; Fri, 16 Oct 2020 00:37:59 +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 8BE3A11F0; Fri, 16 Oct 2020 00:37:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1602801478; bh=ILnjv7HyuM/fDmq1H7u9a25fAgMZDE8gkRwGbL7yWdE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ITb5i+YzosIYqF0hUuJ12KeeJbfMp22uwVAjDPseA45XJxzGcKCtHXT0n73F768PX XFrsA5y2UllWHTGvgatYnxNfrW8zBZB57bCrDKC2CAeKEKPAZRuyscKGU+t/O/5E9t ClPdBBM63/AJ5oM2i2G2xVy6aOTEFM0bwKGPRAys= From: Kieran Bingham To: libcamera devel Date: Thu, 15 Oct 2020 23:37:48 +0100 Message-Id: <20201015223750.58563-10-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201015223750.58563-1-kieran.bingham@ideasonboard.com> References: <20201015223750.58563-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 09/11] ipa: raspberrypi: Re-use iterator variable 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 function gauss_seidel2_SOR() makes use of a function scoped iterator 'i', for several loops, and has a precedence of re-using the function scoped iterator declaration in the majority of cases, except the first where it is declared in the loop scope before the function scope, and later which aliases a new declaration. Re-use the existing iterator variable for consistency, and to prevent variable aliasing. Signed-off-by: Kieran Bingham Reviewed-by: David Plowman Reviewed-by: Niklas Söderlund --- src/ipa/raspberrypi/controller/rpi/alsc.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ipa/raspberrypi/controller/rpi/alsc.cpp b/src/ipa/raspberrypi/controller/rpi/alsc.cpp index 42fbc8a476ad..183a0c953b9f 100644 --- a/src/ipa/raspberrypi/controller/rpi/alsc.cpp +++ b/src/ipa/raspberrypi/controller/rpi/alsc.cpp @@ -606,9 +606,9 @@ static double gauss_seidel2_SOR(double const M[XY][4], double omega, double lambda[XY]) { double old_lambda[XY]; - for (int i = 0; i < XY; i++) - old_lambda[i] = lambda[i]; int i; + for (i = 0; i < XY; i++) + old_lambda[i] = lambda[i]; lambda[0] = compute_lambda_bottom_start(0, M, lambda); for (i = 1; i < X; i++) lambda[i] = compute_lambda_bottom(i, M, lambda); @@ -628,7 +628,7 @@ static double gauss_seidel2_SOR(double const M[XY][4], double omega, lambda[i] = compute_lambda_bottom(i, M, lambda); lambda[0] = compute_lambda_bottom_start(0, M, lambda); double max_diff = 0; - for (int i = 0; i < XY; i++) { + for (i = 0; i < XY; i++) { lambda[i] = old_lambda[i] + (lambda[i] - old_lambda[i]) * omega; if (fabs(lambda[i] - old_lambda[i]) > fabs(max_diff)) max_diff = lambda[i] - old_lambda[i]; From patchwork Thu Oct 15 22:37:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10071 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 5011CBEEE0 for ; Thu, 15 Oct 2020 22:38:04 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 154AC61056; Fri, 16 Oct 2020 00:38:04 +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="hbdBDNrC"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 64B4961027 for ; Fri, 16 Oct 2020 00:37:59 +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 EC7EC556; Fri, 16 Oct 2020 00:37:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1602801479; bh=jTktellVnBLLEmLhgHHZeUgXx2t0uOwYFh6yj+iC4cE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hbdBDNrC/HCKoxwb5bxeLvDagK0tcUxCuAbZex/v72Bw+d/f57aJYjFdPDYW1w6a/ rNnVqnA6wyLQeRTGijaGZY/0cNCKu3g1e+BwL2ALgu+XtiRUS70bBjbNfdl7cLMhE4 zmuLDO0f1NuebXVAw14oZqm3G2/hmwN/nl1NflZE= From: Kieran Bingham To: libcamera devel Date: Thu, 15 Oct 2020 23:37:49 +0100 Message-Id: <20201015223750.58563-11-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201015223750.58563-1-kieran.bingham@ideasonboard.com> References: <20201015223750.58563-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 10/11] android: metadata: Disable -Wshadow 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" Do not warn on shadowed variables inside the metadata library, which is directly imported without modifications. Signed-off-by: Kieran Bingham Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/android/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/src/android/meson.build b/src/android/meson.build index b2b2293cf62d..2103745dd822 100644 --- a/src/android/meson.build +++ b/src/android/meson.build @@ -32,4 +32,5 @@ android_camera_metadata_sources = files([ android_camera_metadata = static_library('camera_metadata', android_camera_metadata_sources, + cpp_args : '-Wnoshadow', include_directories : android_includes) From patchwork Thu Oct 15 22:37:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10072 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 BCABEBE905 for ; Thu, 15 Oct 2020 22:38:04 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8590D610DD; Fri, 16 Oct 2020 00:38:04 +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="v67+ZtqV"; 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 D1573610C0 for ; Fri, 16 Oct 2020 00:37:59 +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 54651A42; Fri, 16 Oct 2020 00:37:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1602801479; bh=LSClShbT982AoXYBYL15w32WUSx2bAjx6qNPLuuZ4L8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v67+ZtqVQeUd126p8fxpPX90GVAPHoUHXRET8/TefYPwGSoLBE3PfXz5BQvttdIDS oa673PrkGqAS7huBtz4SJHlPuy+YJT37WRoVooi1IHVTpoC3q3+p+tGa6nHfi5bYHw S6CZ1W5NIOQABNnABKs4U1o9KnE+1b+MuN6GUkBw= From: Kieran Bingham To: libcamera devel Date: Thu, 15 Oct 2020 23:37:50 +0100 Message-Id: <20201015223750.58563-12-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201015223750.58563-1-kieran.bingham@ideasonboard.com> References: <20201015223750.58563-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 11/11] meson: Enable shadowed variable warning 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" Shadowing variables can lead to unexpected bugs where a code path utilises a variable that may not have been intended by the developer, leading to hard to find bugs. Enable warnings for shadowed variables as defined at: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wshadow As an effect of utilising -Werror, this will cause variable or type shadowing to become a build-time error. Suggested-by: Laurent Pinchart Signed-off-by: Kieran Bingham Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- The reference here is that I lost around 2 hours digging into a bug that looked like some other code path was calling a destructor or such, but was because I had accidentally aliased a private member variable in the constructor, so all my initialisation was lost after the constructor completed. meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/meson.build b/meson.build index de15cc16da81..10423f523ca5 100644 --- a/meson.build +++ b/meson.build @@ -38,6 +38,7 @@ if cc.has_header_symbol('stdlib.h', 'secure_getenv', prefix : '#define _GNU_SOUR endif common_arguments = [ + '-Wshadow', '-include', 'config.h', ]