From patchwork Thu Mar 17 14:08:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 15471 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 82094BD80A for ; Thu, 17 Mar 2022 14:08:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E8ABD604E8; Thu, 17 Mar 2022 15:08:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1647526115; bh=i63d6hUH3isSXt4iyQ9OeO4uzCK+/jYWFH31E+5m1HE=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=xfo2hs5AARCwW7OvdK8jp+NMsB5iZdAt62tTwah/cjO1odqAyPVXip5UauhkvrvzN /Wd1lBc262wle+S5X2nxX5NEiNUv5lGkX8EIukAJe6XQr0F6DJlx0G9EoE3QiW9oJM snIsL9+u4Fsch8+9P1iPHTaHeQymL1x+5hX0UwBuyawsSzfv5UHt1fIT5yGRB80p1O 6SMSfytYzdJPnVzi6kiG0F/MAM6j0YIT9jWHY3VUQ7Rfq/h6pz0D2cWqVuSz56Y3vl N4RJT8w8Egq6caIMAE7mDBfVFgLe/z85qHIY56ry5JQifUUmc+Adrgpigti7bKvyGC ySJBWWM+9VVeQ== Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 938EE604DC for ; Thu, 17 Mar 2022 15:08:33 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="NWUNfTVx"; dkim-atps=neutral Received: by mail-wm1-x32f.google.com with SMTP id r64so3165561wmr.4 for ; Thu, 17 Mar 2022 07:08:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jcfkXUDyQsMHFwrfe/cenXQcfke3b/k+swts4GnZTjQ=; b=NWUNfTVxgZJmjEXWloMya5Yv40/Y/JOsaukTnshQO7iynv/lmYh9pq+6RLaPV4cjS+ LTwjvEqGtI0VGJNmWV+drvsMzGlGjXPnp5VF++P7zvKq72+6JMZIckKE8lxHJuqy+23h w/pJhCT7YrKBIZW2GPUoo6UT/gdoRz1zz9cX2m+wXeyNjbSq4nOXKLeEt7hXPtdfhxcq K5AnQRQpFxuHFY5zBdn/YZfPEwFDzCDO6MNXoAGWfFc9FGSepMTUf/IXu4s6L6S5qWe2 M9yDJ60mCsuGJMW3DuThXI1DPCytiD/zTu1gab8S9aqeyN9VV8PFQMoHS1p2O4OKxdGX R8VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jcfkXUDyQsMHFwrfe/cenXQcfke3b/k+swts4GnZTjQ=; b=4Hk3e9mN79FDf8UjpbjSdwV77jxllrNsN3e0w6aGDQl8TaTviDHNaUPgxVvIc+62Rw MQNfwoLpRc2uC9zfYkFg49/CmTaLYZj8bQd3Hb2fRLrkWfNqbNKc2Ez7jpCXhHxhwq/p 6e6jfDmG07f448iVUPJuilu87JIrWahguA1CMXxan9wepVsVpyD5zTaCYsV6+Yq5gDao DOLl7P5GHoDQIZK6iR7/LUaGfGUMV3Brlu/uSJ7zyjOZR/l1ZdCKpL49YMZpQb8HlN2s q6eTJjn2/yTIjrTUHTK56tIBUtnjpvDpMVIC/nzubou2yKdie3dF9YR/M7Mxmbii5jms 027A== X-Gm-Message-State: AOAM531cioRVzPjSzOWmcOouTlKd9LYTn+gb/PE7TgGfMEfPgxmVBPOl EuEsiu2KKShu0BoiA1LZjrZG9KkjVeXGOQ== X-Google-Smtp-Source: ABdhPJzo0d4YjHnbQTnEyD4Xz7uoVXGOoRUc5gmVOmkYrkOgv51WXcroRfFZD9mI/79va4IxkM+CFg== X-Received: by 2002:a7b:c24d:0:b0:38c:68a4:eb4b with SMTP id b13-20020a7bc24d000000b0038c68a4eb4bmr8487972wmj.108.1647526113076; Thu, 17 Mar 2022 07:08:33 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:371b:8e01:111f:5322]) by smtp.gmail.com with ESMTPSA id z5-20020a05600c0a0500b0037fa93193a8sm5287831wmp.44.2022.03.17.07.08.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Mar 2022 07:08:32 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Thu, 17 Mar 2022 14:08:22 +0000 Message-Id: <20220317140827.1835029-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220317140827.1835029-1-naush@raspberrypi.com> References: <20220317140827.1835029-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 1/6] pipeline: raspberrypi: Avoid over-allocation for ISP Output 1 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The V4L2DeviceFormat structure for the ISP Output 1 node was a copy of what is used ISP Output 0 node, but with the size changed. However, the plane size and stride values were not updated. So there is a possibility that the buffer might be over-sized for the requested resolution. Fix this by only copying the relevant fields from the ISP Output 0 V4L2DeviceFormat structure, and let the device driver size the planes as needed. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Tested-by: David Plowman Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index c2230199fed7..43e87a406036 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -845,11 +845,13 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config) * colour denoise will not run. */ if (!output1Set) { - V4L2DeviceFormat output1Format = format; + V4L2DeviceFormat output1Format; constexpr Size maxDimensions(1200, 1200); const Size limit = maxDimensions.boundedToAspectRatio(format.size); output1Format.size = (format.size / 2).boundedTo(limit).alignedDownTo(2, 2); + output1Format.colorSpace = format.colorSpace; + output1Format.fourcc = V4L2PixelFormat::fromPixelFormat(formats::YUV420); LOG(RPI, Debug) << "Setting ISP Output1 (internal) to " << output1Format.toString();