From patchwork Tue Dec 11 14:00:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 27 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 63E9160B0C for ; Tue, 11 Dec 2018 14:59:49 +0100 (CET) Received: from avalon.bb.dnainternet.fi (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8E1F455A for ; Tue, 11 Dec 2018 14:59:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1544536788; bh=zir8mpyr7m2qO/0Wahve29zbxJ27Sekcs6lxWSsshp8=; h=From:To:Subject:Date:From; b=Owe98mTMcIVkwpA+GLC30uZ59q/oUrzHXsGETGbH94O0osu05RPANNwyQJb+S97VM rz/NgWFTj08WiAyizASfEbhoPTNDsnucqm+l8ZbB/lFfT9xpZEU2RoJKgjUvpBtjLW GVkdu2BIZc272PxE/3eaB7cd8VAu947DIGSSyguo= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Tue, 11 Dec 2018 16:00:26 +0200 Message-Id: <20181211140028.25241-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/3] utils: ipu3: Abort when sensor or media device isn't found X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Dec 2018 13:59:49 -0000 Calling exit from a function only exits from the function, it doesn't abort the whole script. Propagate the errors to stop operation when the sensor or media device can't be found. Signed-off-by: Laurent Pinchart --- utils/ipu3/ipu3-capture.sh | 16 ++++++---------- utils/ipu3/ipu3-process.sh | 6 +++--- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/utils/ipu3/ipu3-capture.sh b/utils/ipu3/ipu3-capture.sh index af189da3f8d8..ba6147b49799 100755 --- a/utils/ipu3/ipu3-capture.sh +++ b/utils/ipu3/ipu3-capture.sh @@ -20,7 +20,8 @@ find_sensor() { bus=$(grep "$sensor_name" /sys/class/video4linux/v4l-subdev*/name | cut -d ' ' -f 2) if [[ -z $bus ]]; then - return + echo "Sensor '$sensor_name' not found." >&2 + exit 1 fi echo "$sensor_name $bus" @@ -36,8 +37,8 @@ find_media_device() { done if [[ -z $mdev ]] ; then - echo "IPU3 media device not found." >&2 - exit 1 + echo "IPU3 media device not found." >&2 + exit 1 fi echo $mdev @@ -170,13 +171,8 @@ fi sensor_name=$1 -sensor=$(find_sensor $sensor_name) -if [[ -z $sensor ]] ; then - echo "Sensor '$sensor_name' not found." >&2 - exit 1 -fi - -mdev=$(find_media_device) +sensor=$(find_sensor $sensor_name) || exit +mdev=$(find_media_device) || exit mediactl="media-ctl -d $mdev" parse_pipeline $sensor diff --git a/utils/ipu3/ipu3-process.sh b/utils/ipu3/ipu3-process.sh index 6412aea4a3e7..78a7937fca70 100755 --- a/utils/ipu3/ipu3-process.sh +++ b/utils/ipu3/ipu3-process.sh @@ -23,8 +23,8 @@ find_media_device() { done if [[ -z $mdev ]] ; then - echo "IPU3 media device not found." >&2 - exit 1 + echo "IPU3 media device not found." >&2 + exit 1 fi echo $mdev @@ -173,7 +173,7 @@ fi out_size=${out_size:-$in_size} vf_size=${vf_size:-$in_size} -mdev=$(find_media_device) +mdev=$(find_media_device) || exit mediactl="media-ctl -d $mdev" echo "Using device $mdev" From patchwork Tue Dec 11 14:00:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 28 Return-Path: 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 EC05060B10 for ; Tue, 11 Dec 2018 14:59:49 +0100 (CET) Received: from avalon.bb.dnainternet.fi (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4A7CD564 for ; Tue, 11 Dec 2018 14:59:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1544536789; bh=SuvokrYF2RCmHEC3QNLMVEbgpJQr0zUG7lUc8tGC/Qc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Qoi572zIXjwYu6V1YObWo+edzpaU/tjqKqFzoSvqceLNPm44O9H9UPbKiYsnifM4s sW/lItTVQZkLsCzwpuEVEIcfQHYyktTExBvBCV4GQqSxXYKktetgd4mxhLnvQavgL7 QzZ1Uy9ZYdZ0WAS3OXzl5sF+fAegBp6nsgvncNwU= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Tue, 11 Dec 2018 16:00:27 +0200 Message-Id: <20181211140028.25241-2-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181211140028.25241-1-laurent.pinchart@ideasonboard.com> References: <20181211140028.25241-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/3] utils: ipu3: process: Fix typo in output files path X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Dec 2018 13:59:50 -0000 A typo in the output files path causes the script to attempt to write all captured frames to /. Fix it. Signed-off-by: Laurent Pinchart --- utils/ipu3/ipu3-process.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/ipu3/ipu3-process.sh b/utils/ipu3/ipu3-process.sh index 78a7937fca70..0d1df9435271 100755 --- a/utils/ipu3/ipu3-process.sh +++ b/utils/ipu3/ipu3-process.sh @@ -52,7 +52,7 @@ process_frames() { # Save the main and viewfinder outputs to disk, capture and drop 3A # statistics. Sleep 500ms between each execution of yavta to keep the # stdout messages readable. - $yavta -f $IMGU_OUT_PIXELFORMAT -s $out_size "-F$ouput_dir/frame-out-#.bin" \ + $yavta -f $IMGU_OUT_PIXELFORMAT -s $out_size "-F$output_dir/frame-out-#.bin" \ $($mediactl -e "ipu3-imgu 0 output") & sleep 0.5 $yavta -f $IMGU_VF_PIXELFORMAT -s $vf_size "-F$output_dir/frame-vf-#.bin" \ From patchwork Tue Dec 11 14:00:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 29 Return-Path: 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 A0FCA60B10 for ; Tue, 11 Dec 2018 14:59:50 +0100 (CET) Received: from avalon.bb.dnainternet.fi (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0559F55A for ; Tue, 11 Dec 2018 14:59:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1544536790; bh=flsOWhPiOc/kRHDwa/lQr75BdpHcyJbjl9gVREHrFUU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Z42YcoqJ/KAuJCYKgQ836WsObdEf7nVPXDO7F6eKcEHYNuaTdmxZ0FlPsDRS2LUsu U8PG3sMZEZ8tidVnWySVbhZFShFVc0IzZYJKjbesnijgb6YZxIma3ImugWWLTUYH2t LAQpOSGA5YVML/ymE0PW9KTWdJoZb/a3/axOvkmQ= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Tue, 11 Dec 2018 16:00:28 +0200 Message-Id: <20181211140028.25241-3-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181211140028.25241-1-laurent.pinchart@ideasonboard.com> References: <20181211140028.25241-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/3] utils: ipu3: process: Configure formats on ImgU subdev pads X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Dec 2018 13:59:50 -0000 Set format and selection rectangles on the ImgU subdev as required by the driver. Signed-off-by: Laurent Pinchart --- utils/ipu3/ipu3-process.sh | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/utils/ipu3/ipu3-process.sh b/utils/ipu3/ipu3-process.sh index 0d1df9435271..bb4abbe883a0 100755 --- a/utils/ipu3/ipu3-process.sh +++ b/utils/ipu3/ipu3-process.sh @@ -13,6 +13,8 @@ # - raw2pnm (from nvt https://github.com/intel/nvt.git) # - yavta (from git://git.ideasonboard.org/yavta.git) +imgu_entity="ipu3-imgu 0" + # Locate the media device find_media_device() { local mdev @@ -35,12 +37,25 @@ configure_pipeline() { local enable_3a=1 local enable_out=1 local enable_vf=1 + local mode=0 + # Configure the links $mediactl -r - $mediactl -l "\"ipu3-imgu 0 input\":0 -> \"ipu3-imgu 0\":0[1]" - $mediactl -l "\"ipu3-imgu 0\":2 -> \"ipu3-imgu 0 output\":0[$enable_out]" - $mediactl -l "\"ipu3-imgu 0\":3 -> \"ipu3-imgu 0 viewfinder\":0[$enable_vf]" - $mediactl -l "\"ipu3-imgu 0\":4 -> \"ipu3-imgu 0 3a stat\":0[$enable_3a]" + $mediactl -l "\"$imgu_entity input\":0 -> \"$imgu_entity\":0[1]" + $mediactl -l "\"$imgu_entity\":2 -> \"$imgu_entity output\":0[$enable_out]" + $mediactl -l "\"$imgu_entity\":3 -> \"$imgu_entity viewfinder\":0[$enable_vf]" + $mediactl -l "\"$imgu_entity\":4 -> \"$imgu_entity 3a stat\":0[$enable_3a]" + + # Select processing mode (0 for video, 1 for still image) + yavta --no-query -w "0x009819c1 $mode" $($mediactl -e "$imgu_entity") + + # Set formats. The media bus code doesn't matter as it is ignored by the + # driver. We should use the FIXED format, but media-ctl doesn't support + # it. + $mediactl -V "\"$imgu_entity\":0 [fmt:SBGGR10_1X10/$out_size crop:(0,0)/$in_size compose:(0,0)/$in_size]" + $mediactl -V "\"$imgu_entity\":2 [fmt:SBGGR10_1X10/$out_size]" + $mediactl -V "\"$imgu_entity\":3 [fmt:SBGGR10_1X10/$vf_size]" + $mediactl -V "\"$imgu_entity\":4 [fmt:SBGGR10_1X10/$out_size]" } # Perform frame processing through the IMGU @@ -53,17 +68,17 @@ process_frames() { # statistics. Sleep 500ms between each execution of yavta to keep the # stdout messages readable. $yavta -f $IMGU_OUT_PIXELFORMAT -s $out_size "-F$output_dir/frame-out-#.bin" \ - $($mediactl -e "ipu3-imgu 0 output") & + $($mediactl -e "$imgu_entity output") & sleep 0.5 $yavta -f $IMGU_VF_PIXELFORMAT -s $vf_size "-F$output_dir/frame-vf-#.bin" \ - $($mediactl -e "ipu3-imgu 0 viewfinder") & + $($mediactl -e "$imgu_entity viewfinder") & sleep 0.5 - $yavta $($mediactl -e "ipu3-imgu 0 3a stat") & + $yavta $($mediactl -e "$imgu_entity 3a stat") & sleep 0.5 # Feed the IMGU input. $yavta -f $IMGU_IN_PIXELFORMAT -s $in_size "-F$in_file" \ - $($mediactl -e "ipu3-imgu 0 input") + $($mediactl -e "$imgu_entity input") } # Convert captured files to ppm