From patchwork Mon Mar 21 10:26:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 15484 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 D3783BD80A for ; Mon, 21 Mar 2022 10:27:08 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 794A9604EA; Mon, 21 Mar 2022 11:27:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1647858428; 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=ILkxIULU0q1llinUYi0zFAJtw1LznHogSKQuvNcnOOAnmAHEkx8PYo08FJKUYns8c jkZNTaOaz6hA7S39W4cyeuWDeG1ePzhDJ03671h86iLe6POmYu/vQn28ofGGZGebgu SOJbCV40Qms7kfYzd5ArmACx028c2thxlql3vBSo8yQ1p3dAojuY1QGjFEBRICzbDx pxSeBYn0UelSXzfGZl8uD5c1PJAff6oQkFx85ejQoPmAR3If6wz37VQOmOEttUHD/W o0z7rI6/Q30u8FPqGV3oyeEwybXMWkHGwtoJZ5qi8pR1KYn7KNZa0UGYT74vRg03CY ttrOt1qNnfkLw== Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 60A0E604C4 for ; Mon, 21 Mar 2022 11:27:06 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="do6lP/L6"; dkim-atps=neutral Received: by mail-wm1-x329.google.com with SMTP id r64so8208631wmr.4 for ; Mon, 21 Mar 2022 03:27:06 -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=do6lP/L6+wRR6gJMX4dfdCcVlPupIQYowN7ZGpGXd7EJV55aAuNdbqd3FyWaG2cium Sfj5T+vvO+OtBSY1lAbqru6qOqjsO2+eVFfRduUKsxiXM2Wl3VaFwBalzfiVTqEJ3lFT 1/C33S7L/y2ndZ1XcGt9QkIAWzfApzMe/MdExIvJX2K1SFK6kIcTXSDpBctGtaLiBB5G Gwp4qDNsLz37JNPKZs0ESov7tXj4zkd27ExypD5kjbdT7gAy9FjpPsgEW3I7gMApFLNa yyIr5O7FxKVEguAHWAsbpEDs0T4/dMyHLnIeeaee1g6JzLaCi9jdDRJoqUJU/jcbnheA Erww== 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=lmeShbnJvk+1wWYYtoK0ICI3e2HE9VMc/TGIZy96iRoU+p53t+aJb4Ot9mos4WNRj/ nMl52eXYrx/bMw3nkWwTow56xoFjhQ3JL2d1EJZ43DnvzpUhms5kMYAlVkhIJepmmwXb jB17dmGlVqid9S73/eCr7uA3YmMICpj6auZ6gB0yGBN5rC/k6xbmc6ZOJISu5mVYDVOx g3M+GAnCw28nJtPIQ7Vhv2JHBzB+piW9Y+GBwt+r6n/yYTNHXoGEBP6G+DShLWkQKLTn quPlPxWbZ5YARBrR180yETzfbVX14ERhM+wfE4y5EOFwvXiEGmTGDu59nZ4NTP5n2koo 2EEQ== X-Gm-Message-State: AOAM533MrsVaq4M9Vf1FnhyhOQ6WaoyMOwlcwGxQiNlqUPZNalArQfSN 4IqU+WxiBGLmRDzs6qY8s9em9AaPVTMTCg== X-Google-Smtp-Source: ABdhPJwDbOo1A8fldnrC1myj31l7VO02PiBOvZRkIWGrrEoq6CBH8VACShy0XNp1CQsfL3X8KAXQ7Q== X-Received: by 2002:a05:600c:49a9:b0:38c:987d:d692 with SMTP id h41-20020a05600c49a900b0038c987dd692mr8798819wmp.166.1647858425878; Mon, 21 Mar 2022 03:27:05 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:77bd:7c6c:a8b9:8855]) by smtp.gmail.com with ESMTPSA id v10-20020a056000144a00b00203df06cf9bsm13530115wrx.106.2022.03.21.03.27.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 03:27:05 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 21 Mar 2022 10:26:58 +0000 Message-Id: <20220321102702.1753800-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220321102702.1753800-1-naush@raspberrypi.com> References: <20220321102702.1753800-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 1/5] 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();