From patchwork Wed Oct 21 15:41:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10178 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 C05C5BDB13 for ; Wed, 21 Oct 2020 15:41:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7567560DF8; Wed, 21 Oct 2020 17:41:55 +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="F33lSUez"; 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 8F04660986 for ; Wed, 21 Oct 2020 17:41:53 +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 94BBAAEE; Wed, 21 Oct 2020 17:41:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1603294913; bh=OtrTKmCaTvWBCtkRvw14X1FPLDeE3Sx+DMPQTrhPlqE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F33lSUezrSzhCLr+/Dtrpg3Ly9YBYrq6bWKcYbVN36wF7nCJ2tp8G7erg7+3MpHqO FoY6Kmspb+6GiiahTg7SbM47Ul+SMTgULxhWtNkgjSaddSVydbZG3r1sQNeA224UAs mxmiQjPkThSYMmsBpFhC0nQ6zc7qHfeIl4HVKm2M= From: Kieran Bingham To: libcamera devel Date: Wed, 21 Oct 2020 16:41:34 +0100 Message-Id: <20201021154148.511505-2-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> References: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 01/15] libcamera: thread: Prevent shadowing 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 shadows the internal member signal of the same name. Rename the boolean flag to prevent confusion and shadowing 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 Wed Oct 21 15:41:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10179 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 8DAF3BDB13 for ; Wed, 21 Oct 2020 15:41:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 35F6360E1C; Wed, 21 Oct 2020 17:41:56 +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="q09rKzwK"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0BCF560BE5 for ; Wed, 21 Oct 2020 17:41:54 +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 8214592; Wed, 21 Oct 2020 17:41:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1603294913; bh=WGhrcRrGpjzH+p+axk3IihQfuadx58hQvvABa3X+87o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q09rKzwKmOpRL7bcV1ifyODDIRBLQv+ax6JgfVmNCIYDRbRVxiV1CQFFjoMPxnd+p DmU10Zqw67+YN2moIjIk4K24bJ7fPPXqTEGMPqkQxLZP9zssiueAkoTYwVIzHBTKQ+ U9ShH6882eO9T/2bg8SjZ5AEOZgPp95FV2gLqDtk= From: Kieran Bingham To: libcamera devel Date: Wed, 21 Oct 2020 16:41:35 +0100 Message-Id: <20201021154148.511505-3-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> References: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 02/15] libcamera: pipeline: Prevent variable shadowing 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 shadowing 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 331ada7a0f6c..7f8deb38bd22 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 b4ee021f6210..c21479a191fe 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 8c00c0ffc121..477377301ee9 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 a903a823f652..3862631b7bed 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 Wed Oct 21 15:41:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10180 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 75F34BDB13 for ; Wed, 21 Oct 2020 15:41:57 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EF2E060E5C; Wed, 21 Oct 2020 17:41:56 +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="fwRdBQNM"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4D0B260C1F for ; Wed, 21 Oct 2020 17:41:54 +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 DBBB6BB5; Wed, 21 Oct 2020 17:41:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1603294914; bh=4aBhYoo1dHxs3aFFTg688mQcIbe8Q4lRDP4GQuqJSPo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fwRdBQNMaGFOs3xYdhZo4AwYunBXdnnagUCQ6a1iGbehKRWCZeKNnx3oKAHBQdxZr 8YTG6o6X6w4zhZkJoxMAD3PZWFYDiVCX2b1w5suRCs45WZlqpxOs8RySyFTvo4aP19 jw+u4N5ZRkf1l0i4Av3QW3ZYgTOH03Oi1HPhYtP4= From: Kieran Bingham To: libcamera devel Date: Wed, 21 Oct 2020 16:41:36 +0100 Message-Id: <20201021154148.511505-4-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> References: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 03/15] 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 shadowing 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 7f8deb38bd22..dd62dfc743da 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 477377301ee9..d63f97015c78 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 Wed Oct 21 15:41:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10181 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 1E8AEBDB13 for ; Wed, 21 Oct 2020 15:41:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B411960995; Wed, 21 Oct 2020 17:41: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="m0Tc978Q"; 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 A796060BE5 for ; Wed, 21 Oct 2020 17:41:54 +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 414EEAEE; Wed, 21 Oct 2020 17:41:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1603294914; bh=p8OVJy2+spdtsu3tlRc3jASGz2jYQOq37XEfR3jGRg4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m0Tc978QHGWQCZjGRT4on4J4TT9OkvMNL6MnWA0yt5oMbuHEpTiCv0NjqssRzP2lA enhvo2ktK4NG0PFsdsYk9Q/ohHmqkz+4OLxPbH4VNUXlCw0h67YvdfhRj6ASf9LnAk Vfsi7W+oI92w2KWiGGcQa98uVlTIvn7feruOZ680= From: Kieran Bingham To: libcamera devel Date: Wed, 21 Oct 2020 16:41:37 +0100 Message-Id: <20201021154148.511505-5-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> References: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 04/15] 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 request in an under-run event was shadowed against the returned buffer, being placed back on the availableBuffers_ queue. Rename the shadowed 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 Wed Oct 21 15:41:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10182 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 91B5FBDB13 for ; Wed, 21 Oct 2020 15:42:00 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5F42F60C14; Wed, 21 Oct 2020 17:42: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="AywV46Nx"; 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 1818C60C1F for ; Wed, 21 Oct 2020 17:41: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 9A8BE116B; Wed, 21 Oct 2020 17:41:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1603294914; bh=MmZ0POr1xbH6Ysj0uiTsVJ6/gVUAoF5QgOzzZzFzOVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AywV46NxOOU8yUXe98brh3LhQ8IvQljU28nshx0EG7zUrPcb5W0lbiSeX9ze+49XA 2M+Cz8117iQs4EuKxidYzl49Y+2uKw5fl1dhpfl9cbvKOYRtyCbQV5e6k18G7IY/0m MStCK2ElI93VPxMZ/qT31xQRmfm7lvxOmdnjO1dM= From: Kieran Bingham To: libcamera devel Date: Wed, 21 Oct 2020 16:41:38 +0100 Message-Id: <20201021154148.511505-6-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> References: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 05/15] libcamera: v4l2_videodevice: Prevent shadowing 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 a shadowed 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 16162e1edba3..36d7d9a0f27a 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -213,7 +213,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. */ @@ -223,9 +223,9 @@ int V4L2BufferCache::get(const FrameBuffer &buffer) break; } - if (entry.lastUsed < oldest) { + if (entry.lastUsed_ < oldest) { use = index; - oldest = entry.lastUsed; + oldest = entry.lastUsed_; } } @@ -249,16 +249,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 Wed Oct 21 15:41:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10183 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 0337DBDB13 for ; Wed, 21 Oct 2020 15:42:01 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C1D8360E0C; Wed, 21 Oct 2020 17:42: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="C5JIH2Di"; 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 71DB060D65 for ; Wed, 21 Oct 2020 17:41: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 F356692; Wed, 21 Oct 2020 17:41:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1603294915; bh=ykEv1uQkwC0mGpDH/2uuOR3LCzq8sLz2nKmZrlQiKKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C5JIH2DiJOqxEQkWpBhEaZrra1gdFm0A24kaVapvGMiwQR0njzvNl9rNdQ60QPOan yAtPnfhNLqoI0bArVZzTk41mAJHbmqDQK58KMZ0KUdm5sYSk43+pZN3lyuMMA31Hkz wccr8W7ZFxV6YsJJ296l2D+Jr+at/3IetRXCVkso= From: Kieran Bingham To: libcamera devel Date: Wed, 21 Oct 2020 16:41:39 +0100 Message-Id: <20201021154148.511505-7-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> References: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 06/15] 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 Wed Oct 21 15:41:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10184 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 86853BDB13 for ; Wed, 21 Oct 2020 15:42:01 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 418B960DF8; Wed, 21 Oct 2020 17:42: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="Ma8hpaY1"; 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 C306660C1F for ; Wed, 21 Oct 2020 17:41: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 5781BAEE; Wed, 21 Oct 2020 17:41:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1603294915; bh=h8VyB8DvYvnofHdPfx6LBGktwsB0kHLx9SkL1idm+a0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ma8hpaY1xsperzdIYJ819d8qS3+UoKFhyR7fYYpbcgR67USkv0lAOQBZjb4QkxsXz I88ug2FXazAYyN8S/BaE/sgXB+QNkHfP3vJGsT6QTu0jwrTpVJuxTC3mIDjd7Wwkhq JTgzIYxhoNt1TjdFJJTEj5DKEhDldI8cV5lCk/gg= From: Kieran Bingham To: libcamera devel Date: Wed, 21 Oct 2020 16:41:40 +0100 Message-Id: <20201021154148.511505-8-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> References: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 07/15] android: camera_device: 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 shadowing 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: Laurent Pinchart --- src/android/camera_device.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index e9404c2f3004..5272b9ecded7 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1316,7 +1316,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list) * the Android camera3_stream_t. */ for (CameraStream &cameraStream : streams_) { - int ret = cameraStream.configure(); + ret = cameraStream.configure(); if (ret) { LOG(HAL, Error) << "Failed to configure camera stream"; return ret; From patchwork Wed Oct 21 15:41:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10185 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 15BE7BDB13 for ; Wed, 21 Oct 2020 15:42:02 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C1DBD60F3E; Wed, 21 Oct 2020 17:42: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="DONrD6FI"; 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 1A8AF60C21 for ; Wed, 21 Oct 2020 17:41: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 A99BFBB5; Wed, 21 Oct 2020 17:41:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1603294915; bh=hfSr/lTm/td/TXGUPuLj4tL0PxxXw6o1IR2NExokVx4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DONrD6FIUO3tTjsDNHbgSE8heWjuydKkO1FfF5fqxqEt2NDVdpejfek4TOQjt9Z9w rwIbCdNHWOa8XfL6rUE8m5y7OqenR8pAAuAZPiIJ7uAFRE0SytcHhA//Cf9SFimNyg OZluLRrF1yxbeWQOOUVytETAV+pK+dp6HP9othho= From: Kieran Bingham To: libcamera devel Date: Wed, 21 Oct 2020 16:41:41 +0100 Message-Id: <20201021154148.511505-9-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> References: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 08/15] android: camera_device: use member style on Camera3RequestDescriptor 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" Use the postfixed '_' member variable naming style for the Camera3RequestDescriptor structure, which in turn ensures that variable shadowing does not occur on the constructor. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/android/camera_device.cpp | 56 +++++++++++++++++------------------ src/android/camera_device.h | 10 +++---- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 5272b9ecded7..9cf1c98410f9 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -170,28 +170,28 @@ MappedCamera3Buffer::MappedCamera3Buffer(const buffer_handle_t camera3buffer, CameraDevice::Camera3RequestDescriptor::Camera3RequestDescriptor( Camera *camera, unsigned int frameNumber, unsigned int numBuffers) - : frameNumber(frameNumber), numBuffers(numBuffers) + : frameNumber_(frameNumber), numBuffers_(numBuffers) { - buffers = new camera3_stream_buffer_t[numBuffers]; + buffers_ = new camera3_stream_buffer_t[numBuffers]; /* * FrameBuffer instances created by wrapping a camera3 provided dmabuf * are emplaced in this vector of unique_ptr<> for lifetime management. */ - frameBuffers.reserve(numBuffers); + frameBuffers_.reserve(numBuffers); /* * Create the libcamera::Request unique_ptr<> to tie its lifetime * to the descriptor's one. Set the descriptor's address as the * request's cookie to retrieve it at completion time. */ - request = std::make_unique(camera, - reinterpret_cast(this)); + request_ = std::make_unique(camera, + reinterpret_cast(this)); } CameraDevice::Camera3RequestDescriptor::~Camera3RequestDescriptor() { - delete[] buffers; + delete[] buffers_; } /* @@ -1393,8 +1393,8 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques camera3Request->num_output_buffers); LOG(HAL, Debug) << "Queueing Request to libcamera with " - << descriptor->numBuffers << " HAL streams"; - for (unsigned int i = 0; i < descriptor->numBuffers; ++i) { + << descriptor->numBuffers_ << " HAL streams"; + for (unsigned int i = 0; i < descriptor->numBuffers_; ++i) { camera3_stream *camera3Stream = camera3Buffers[i].stream; CameraStream *cameraStream = static_cast(camera3Buffers[i].stream->priv); @@ -1403,8 +1403,8 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques * Keep track of which stream the request belongs to and store * the native buffer handles. */ - descriptor->buffers[i].stream = camera3Buffers[i].stream; - descriptor->buffers[i].buffer = camera3Buffers[i].buffer; + descriptor->buffers_[i].stream = camera3Buffers[i].stream; + descriptor->buffers_[i].buffer = camera3Buffers[i].buffer; std::stringstream ss; ss << i << " - (" << camera3Stream->width << "x" @@ -1435,7 +1435,7 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques * lifetime management only. */ buffer = createFrameBuffer(*camera3Buffers[i].buffer); - descriptor->frameBuffers.emplace_back(buffer); + descriptor->frameBuffers_.emplace_back(buffer); LOG(HAL, Debug) << ss.str() << " (direct)"; break; @@ -1458,12 +1458,12 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques return -ENOMEM; } - descriptor->request->addBuffer(cameraStream->stream(), buffer, - camera3Buffers[i].acquire_fence); + descriptor->request_->addBuffer(cameraStream->stream(), buffer, + camera3Buffers[i].acquire_fence); } /* Queue the request to the CameraWorker. */ - worker_.queueRequest(descriptor->request.get()); + worker_.queueRequest(descriptor->request_.get()); return 0; } @@ -1489,13 +1489,13 @@ void CameraDevice::requestComplete(Request *request) * pipeline handlers) timestamp in the Request itself. */ FrameBuffer *buffer = buffers.begin()->second; - resultMetadata = getResultMetadata(descriptor->frameNumber, + resultMetadata = getResultMetadata(descriptor->frameNumber_, buffer->metadata().timestamp); /* Handle any JPEG compression. */ - for (unsigned int i = 0; i < descriptor->numBuffers; ++i) { + for (unsigned int i = 0; i < descriptor->numBuffers_; ++i) { CameraStream *cameraStream = - static_cast(descriptor->buffers[i].stream->priv); + static_cast(descriptor->buffers_[i].stream->priv); if (cameraStream->camera3Stream().format != HAL_PIXEL_FORMAT_BLOB) continue; @@ -1511,7 +1511,7 @@ void CameraDevice::requestComplete(Request *request) * separate thread. */ - MappedCamera3Buffer mapped(*descriptor->buffers[i].buffer, + MappedCamera3Buffer mapped(*descriptor->buffers_[i].buffer, PROT_READ | PROT_WRITE); if (!mapped.isValid()) { LOG(HAL, Error) << "Failed to mmap android blob buffer"; @@ -1535,19 +1535,19 @@ void CameraDevice::requestComplete(Request *request) /* Prepare to call back the Android camera stack. */ camera3_capture_result_t captureResult = {}; - captureResult.frame_number = descriptor->frameNumber; - captureResult.num_output_buffers = descriptor->numBuffers; - for (unsigned int i = 0; i < descriptor->numBuffers; ++i) { - descriptor->buffers[i].acquire_fence = -1; - descriptor->buffers[i].release_fence = -1; - descriptor->buffers[i].status = status; + captureResult.frame_number = descriptor->frameNumber_; + captureResult.num_output_buffers = descriptor->numBuffers_; + for (unsigned int i = 0; i < descriptor->numBuffers_; ++i) { + descriptor->buffers_[i].acquire_fence = -1; + descriptor->buffers_[i].release_fence = -1; + descriptor->buffers_[i].status = status; } captureResult.output_buffers = - const_cast(descriptor->buffers); + const_cast(descriptor->buffers_); if (status == CAMERA3_BUFFER_STATUS_OK) { - notifyShutter(descriptor->frameNumber, + notifyShutter(descriptor->frameNumber_, buffer->metadata().timestamp); captureResult.partial_result = 1; @@ -1561,8 +1561,8 @@ void CameraDevice::requestComplete(Request *request) * is here signalled. Make sure the error path plays well with * the camera stack state machine. */ - notifyError(descriptor->frameNumber, - descriptor->buffers[0].stream); + notifyError(descriptor->frameNumber_, + descriptor->buffers_[0].stream); } callbacks_->process_capture_result(callbacks_, &captureResult); diff --git a/src/android/camera_device.h b/src/android/camera_device.h index 86f2b8974b53..fd08738a5351 100644 --- a/src/android/camera_device.h +++ b/src/android/camera_device.h @@ -79,11 +79,11 @@ private: unsigned int numBuffers); ~Camera3RequestDescriptor(); - uint32_t frameNumber; - uint32_t numBuffers; - camera3_stream_buffer_t *buffers; - std::vector> frameBuffers; - std::unique_ptr request; + uint32_t frameNumber_; + uint32_t numBuffers_; + camera3_stream_buffer_t *buffers_; + std::vector> frameBuffers_; + std::unique_ptr request_; }; struct Camera3StreamConfiguration { From patchwork Wed Oct 21 15:41:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10186 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 8C60CBDB13 for ; Wed, 21 Oct 2020 15:42:02 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 432EE60995; Wed, 21 Oct 2020 17:42: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="s/Wr8be5"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 56F4360E31 for ; Wed, 21 Oct 2020 17:41: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 014F292; Wed, 21 Oct 2020 17:41:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1603294916; bh=7XRIr5RtZR4JrnPX+8VdL17j1FfDzRAPZsCq5A5ApUA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s/Wr8be5VzhB0W8D3HZn4g5c+HLTM25VFXn4NOC+b6T3nBzW+282hlm9pwqSRwC/B cwuJVVUrPO/pN/A1vjSM7d6JuwVTzx3LHsr4oozglVG/BqcerE+zn5YQ2v+CEobfEM BKDIi1VKatUpoXqiVi1yMalMOuYhSBM+Cf5ZPtbs= From: Kieran Bingham To: libcamera devel Date: Wed, 21 Oct 2020 16:41:42 +0100 Message-Id: <20201021154148.511505-10-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> References: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 09/15] android: camera_device: Rename shadowed 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" A FrameBuffer *buffer is used to obtain the 'first' buffer from a request which is used purely to identify the timestamp from the metadata. This should be determined by the Request, and set appropriately by the pipeline handlers, but make sure that this buffer instance is distinct for now. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/android/camera_device.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 9cf1c98410f9..7bb2560025e2 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1488,9 +1488,9 @@ void CameraDevice::requestComplete(Request *request) * It might be appropriate to return a 'correct' (as determined by * pipeline handlers) timestamp in the Request itself. */ - FrameBuffer *buffer = buffers.begin()->second; + FrameBuffer *timestampBuf = buffers.begin()->second; resultMetadata = getResultMetadata(descriptor->frameNumber_, - buffer->metadata().timestamp); + timestampBuf->metadata().timestamp); /* Handle any JPEG compression. */ for (unsigned int i = 0; i < descriptor->numBuffers_; ++i) { @@ -1548,7 +1548,7 @@ void CameraDevice::requestComplete(Request *request) if (status == CAMERA3_BUFFER_STATUS_OK) { notifyShutter(descriptor->frameNumber_, - buffer->metadata().timestamp); + timestampBuf->metadata().timestamp); captureResult.partial_result = 1; captureResult.result = resultMetadata->get(); From patchwork Wed Oct 21 15:41: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: 10187 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 F3740BDB13 for ; Wed, 21 Oct 2020 15:42:02 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BF6B060C14; Wed, 21 Oct 2020 17:42: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="qBL6NOIA"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C004E60D5A for ; Wed, 21 Oct 2020 17:41: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 47AD5116B; Wed, 21 Oct 2020 17:41:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1603294916; bh=4cG1mI7Pb2IcTyAjAnQorh4uWiwngvevHCB9h10I83A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qBL6NOIANVPhEV5Q2n7+W4wzceWqcOcvcx6M5jjyt6tiVI7texkIOdB3GTRanyhKd BcT7wTQ99RO90UQGMmI1ZhCIZUcdSEnUbT1gx42W/82G7y4luI/bntLiykdBh3HW7k Iq3PVXQiwlRT1GBgAgTcVTIMFJ4yKwW2AXGnfT3g= From: Kieran Bingham To: libcamera devel Date: Wed, 21 Oct 2020 16:41:43 +0100 Message-Id: <20201021154148.511505-11-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> References: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 10/15] 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. Suggested-by: Laurent Pinchart 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 5a01bea374c3..f72376a09497 100644 --- a/src/android/meson.build +++ b/src/android/meson.build @@ -33,4 +33,5 @@ android_camera_metadata_sources = files([ android_camera_metadata = static_library('camera_metadata', android_camera_metadata_sources, + c_args : '-Wno-shadow', include_directories : android_includes) From patchwork Wed Oct 21 15:41:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10188 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 AE025BDB13 for ; Wed, 21 Oct 2020 15:42:04 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7AF9760E12; Wed, 21 Oct 2020 17:42: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="NvGLY0Mo"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 06E7060E81 for ; Wed, 21 Oct 2020 17:41: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 A5D0792; Wed, 21 Oct 2020 17:41:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1603294916; bh=cjtTz+AHW3Sk5fLAVkX/mYl+cI/e1cATkJKNjY7Znxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NvGLY0MoSwncIbv4EwuU14TEpKB1ZxQ9W+uaY0XT/jXwG8pkLon0b7bZHYNET3OT9 oWXlKNPV7AgTxGYk56AejeTUCjuNOJ2/BgD8brO72P55QadwiIvJzmar+sJdVUHsw8 TuUcBc8z6CMdcFlKyBpj4+E11yv/hBwsWa4ivhUc= From: Kieran Bingham To: libcamera devel Date: Wed, 21 Oct 2020 16:41:44 +0100 Message-Id: <20201021154148.511505-12-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> References: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 11/15] v4l2: camera: Prevent shadowing within V4L2Camera::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" Rename the internal member variables to use the post-fixed '_' member variable naming style. This in turn ensures variable shadowing does not occur on the constructor. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/v4l2/v4l2_camera.h | 6 +++--- src/v4l2/v4l2_camera_proxy.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/v4l2/v4l2_camera.h b/src/v4l2/v4l2_camera.h index a6c35a2eb578..d238046250e3 100644 --- a/src/v4l2/v4l2_camera.h +++ b/src/v4l2/v4l2_camera.h @@ -26,12 +26,12 @@ class V4L2Camera public: struct Buffer { Buffer(unsigned int index, const FrameMetadata &data) - : index(index), data(data) + : index_(index), data_(data) { } - unsigned int index; - FrameMetadata data; + unsigned int index_; + FrameMetadata data_; }; V4L2Camera(std::shared_ptr camera); diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp index 7803d37ecf4f..f8bfe595e90e 100644 --- a/src/v4l2/v4l2_camera_proxy.cpp +++ b/src/v4l2/v4l2_camera_proxy.cpp @@ -206,8 +206,8 @@ void V4L2CameraProxy::updateBuffers() { std::vector completedBuffers = vcam_->completedBuffers(); for (const V4L2Camera::Buffer &buffer : completedBuffers) { - const FrameMetadata &fmd = buffer.data; - struct v4l2_buffer &buf = buffers_[buffer.index]; + const FrameMetadata &fmd = buffer.data_; + struct v4l2_buffer &buf = buffers_[buffer.index_]; switch (fmd.status) { case FrameMetadata::FrameSuccess: From patchwork Wed Oct 21 15:41: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: 10189 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 29253BDB13 for ; Wed, 21 Oct 2020 15:42:05 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E4A0B60F35; Wed, 21 Oct 2020 17:42: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="aQP8Hgui"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5F60160BE7 for ; Wed, 21 Oct 2020 17:41: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 EE18FBB5; Wed, 21 Oct 2020 17:41:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1603294917; bh=WsT4Ga5qooj1Lmo83sXjkvx8v55lkwOMWMI9Y/TYYf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aQP8HguierCaMhcVuHBcydG7/FsKIsQoG14D5EcrvHtCkNoBE3Jx59FH4XAzULxqL oHyHvCb5VOEAKNDYy/wY9vE15F72GwBqWwLIbD9bT0Al9NZg4ZOdvsjKzoXe4m8k0P +HVA07Hrua0+H6fvOrgEVImA4uDFQIdAN8e0z7fc= From: Kieran Bingham To: libcamera devel Date: Wed, 21 Oct 2020 16:41:45 +0100 Message-Id: <20201021154148.511505-13-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> References: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 12/15] cam: options: Rename optional arg to prevent shadowing 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 shadowed variable of the global optarg variable to be present in the parseValue function. While this is not harmful, rename it to work towards disabling shadowed 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 Wed Oct 21 15:41: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: 10190 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 A6454BDB13 for ; Wed, 21 Oct 2020 15:42:05 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 702E160E0C; Wed, 21 Oct 2020 17:42:05 +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="GfTYxvuf"; 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 C61AE60C33 for ; Wed, 21 Oct 2020 17:41: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 50C7092; Wed, 21 Oct 2020 17:41:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1603294917; bh=axY2+nnMEqGsTzikd4CtJMBYSTip7WI2zR7Ef7Lhymo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GfTYxvufq3euUjKp/t+EYNEPRuCyH7WQHwzydYRSjs8AURjaZziyGBzjZkDoDjo3T /8jmGf3q3STvTyDFkSoLAKQcalfpmZpipWgSy6e9dHBVAW91HeSSwU/rYHBR8VPnPC jzr5V0teBVaJHfsC1Slx2QGOrl9KHMEzHuUPutkE= From: Kieran Bingham To: libcamera devel Date: Wed, 21 Oct 2020 16:41:46 +0100 Message-Id: <20201021154148.511505-14-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> References: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 13/15] 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 shadows the buffer passed in for the main view finder stream. Prevent shadowing, 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 Wed Oct 21 15:41: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: 10191 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 2E35DBDB13 for ; Wed, 21 Oct 2020 15:42:06 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EC7CE60F6F; Wed, 21 Oct 2020 17:42:05 +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="HJUjtgnQ"; 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 2AAAD603F9 for ; Wed, 21 Oct 2020 17:41: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 AED21116B; Wed, 21 Oct 2020 17:41:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1603294917; bh=FWbcbdxbuYlrWMximjA4KHJiaXV2z5DdBW+e6Zf/PHo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HJUjtgnQhqhSZxfWAOqA3CXGO+bDtt9gQIed9YrMuPGH4HxqR33dTC87+SW+FcMdB K8EH+XXzlwj7Hefc4Zi+FwAiQ01o18ZYUj+3iCaArWINzrWNmj5fflmfxDHOamihjo kTmhmyLVfKrqBJguonI7aIdnz7nx1vqNiHIZnTzo= From: Kieran Bingham To: libcamera devel Date: Wed, 21 Oct 2020 16:41:47 +0100 Message-Id: <20201021154148.511505-15-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> References: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 14/15] test: v4l2_videodevice: Prevent variable shadowing 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 shadows 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 b5020d2bedd2..255446fe758a 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 Wed Oct 21 15:41: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: 10192 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 A00CEBDB13 for ; Wed, 21 Oct 2020 15:42:06 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6ABA760F73; Wed, 21 Oct 2020 17:42:06 +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="u3aGKCXq"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 882B460D51 for ; Wed, 21 Oct 2020 17:41: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 144A092; Wed, 21 Oct 2020 17:41:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1603294918; bh=JG3ljPgsceq13gR88BNChkuFk4aPIviv2oBPp0n6lpQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u3aGKCXqVHD9tWeHFh2eKnhtuLd6qifodZSNeMsEFqrKQHcXxYsQ3N7l2+dSHBlLP 1g6u0HozOpurG9oQ5pdt+8eIe+NI8TNNjV7Acoa5njumefByz4xXcC09TXCdcmNDgm l6gsg6DB88oERjiYIqtCC2S8mAuEtcjMGJGfbDrM= From: Kieran Bingham To: libcamera devel Date: Wed, 21 Oct 2020 16:41:48 +0100 Message-Id: <20201021154148.511505-16-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> References: <20201021154148.511505-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 15/15] 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 --- meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/meson.build b/meson.build index b0c17d3e430b..e6f6c84a13e0 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', ]