From patchwork Tue Jun 6 10:33:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 18708 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 220AAC3200 for ; Tue, 6 Jun 2023 10:33:54 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 756B862892; Tue, 6 Jun 2023 12:33:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1686047633; bh=oMEWLht72sqD1+xkME4lCe0KN7D5yClCMIOmsr8Oz4E=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=WKKmE1MBMak2HdfEgC2581AzOWz1bOyE27Gxm2PYz245YOv0vMntqDXf7p5JNJ5Uf pfC4b0yVl+QdfWIHeQQpYzBtikxLq+9ap9GiK53msicqnoivG+e4AkAf8zuSHNJGDt o66h1ArvrPf4ACW8Jrg7pW61d2cbCchIIYFX7oayegi9a805Q953trUTAYLcM2sLQP xIpDITeB+aaMukpBh1EKyTsBYZm3nEUctTqhO1ipsXf6FFptqYvkU/+XyjO0gh9fJU KtH5qGz0ll+CYpt8NeH40CEl76og9Qh3WEguNqkwF5hU/h0o2wgjNHXTR0juKlFJaS cuNnUBToJ1nUw== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id ECD5C62722 for ; Tue, 6 Jun 2023 12:33:51 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="cvo9OBgV"; dkim-atps=neutral Received: from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6D4DC105; Tue, 6 Jun 2023 12:33:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1686047606; bh=oMEWLht72sqD1+xkME4lCe0KN7D5yClCMIOmsr8Oz4E=; h=From:To:Cc:Subject:Date:From; b=cvo9OBgVtUy9muR7wIRvKdb8Zevo/TAC3fEBdHTmrM0x/AM+HpOme9EDNhSkEkoK9 edKK5KunAwBfDg4H8KV9YknuHjrQhZC7AwdgIYAcmMZIy4rRi5ihLaioo7VCkSel0g 0G678QE9NzIPWZ7owmFgIJda31NokrBzDom9vk7k= To: libcamera-devel@lists.libcamera.org Date: Tue, 6 Jun 2023 12:33:32 +0200 Message-Id: <20230606103336.17782-1-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 0/4] libcamera: rkisp1: Fix generateConfiguration X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jacopo Mondi via libcamera-devel From: Jacopo Mondi Reply-To: Jacopo Mondi Cc: Jacopo Mondi , libcamera@luigi311.com Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The series started with bug 180: https://bugs.libcamera.org/show_bug.cgi?id=180 Patch 1 fixes the bug by using main path if a single stream is requested I have then noticed how the current implementation of RkISP1Path::generateConfiguration() could produce unusual sizes, such as 1920x1432 in case the sensor's resolution is larger than the maximum supported 1920x1920 output. Before assigning fixed sizes to StreamConfiguration, Laurent pointed out that we should maintain pixel square before downscaling. Add 2/4 for that reason Finally 4/4 "fixes" generatation of RAW stream formats, by listing all supported sensor's resolutions, and only report them when the raw stream is requested (this is debatable). Tested on Pinephone Pro with imx258 camera. v4->v5: - Check for max size width and height separately in 4/4 - Fix the cropping rectangle centering in 2/4 - Add todo notes - Add reviewed-by notes v3->v4: - Drop "Reserve main path for StillCapture" to continue prioritize the stream role order when assigning outputs - Add "Crop on ISP before downscaling" to address Laurent's comment on maintaining pixel square v2->v3: - Add review tags - Improve 3/4 as suggested by Paul v1->v2: - Enumerate StreamFormats for all the available size and not limited to the current output size. This allows to enumerate higher resolutions even if the desired role has a smaller resolution. In example: gst-launch-1.0 libcamerasrc camera-name="/base/i2c\@ff110000/camera\@1a" ! 'video/x-raw,format=NV12,width=4208,height=3120' ! glimagesink which used to fail now works correctly - Enumerate all the RAW sizes the sensor can produce but only if the requested role is StreamRole::Raw Jacopo Mondi (4): libcamera: rkisp1: Generate config using main path libcamera: rkisp1: Crop on ISP before downscaling libcamera: rkisp1: Assign sizes to roles libcamera: rkisp1: Fix enumeration of RAW formats src/libcamera/pipeline/rkisp1/rkisp1.cpp | 32 +++++++++----- src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 42 ++++++++++++++++--- src/libcamera/pipeline/rkisp1/rkisp1_path.h | 1 + 3 files changed, 59 insertions(+), 16 deletions(-) --- 2.40.1