From patchwork Fri Mar 25 09:08:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 15542 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 734B5C3264 for ; Fri, 25 Mar 2022 09:09:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 04446604E8; Fri, 25 Mar 2022 10:09:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1648199349; 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=maJJr/lxWpwyBLjqvrDnKkB0u0WCXZY1MjjFq/XJEX4nJE1ALx65wfrtrP4z4o8Xm Ql7WBUH/fZ0DwUU3MJo+8lGjCokNE05TeRKx8VGDgqo6J9M2gcmBDMNFpbG+JGl+KC ZDYME2RoD3EXh26Att8bewFb11LE5nsxzZXnw4Nb5uOCyNcUEojALtW/IAQYvKG9pR /gHaEiBg9ec8BKVQXWEJT+9XbVPShhoomQIm1wXerk+27zCZW5R02OTtlz2BEpVvzl NDfEaL8fGqX4fXuaokPjpR4TysmvbLiACbE5NpRd5pTfPT2zz1bXXAbLmjF8a7Fegt 40HKN+p60AB7A== Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AB55260136 for ; Fri, 25 Mar 2022 10:09:07 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="QKONn7bI"; dkim-atps=neutral Received: by mail-wm1-x32d.google.com with SMTP id i67-20020a1c3b46000000b0038ce25c870dso506650wma.1 for ; Fri, 25 Mar 2022 02:09:07 -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=QKONn7bIny5rbEB1IRawLgBY5Z4KVqFDjp/SIvAJQ8DwN0PCBuNoMHuxI32GahvcRz eqO0sU3F2+9M0yYX41CrqksAmxnvGKIEDDYfuI2w9BRHy1EoCV1pWw2O5Hdl/2hli9Xa eHW3L2XdSmTP3k1Fq0evHMZVY0JPbyd5KbodmzsRCe4f9djV9Lj1wL9i+0TvTWqdBmVl PWZxJR6neY/ctpC3MFGInhnabzlo3mZhq/QscEBVKGdiBRKHluux2na6cOKiu2EknhmH tbbRxSWAXrtZCizTuZSzwxX3kFPoAT2Hf6PeoEXnbxO4aZHr4mJx1ga/ARa7/NC8BFFr QjkA== 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=QpmxKtSLgg2nnEkBlE7uYiPcY4mj7Df9jMcc5LdCpU1LulgTyLZlEP6NxjbeoH4mKw xo3mfH2zL5Q31bl+x2UhyNKLQ0vTWebKtFyudYsQs1NrmziTluuR6gjgQx/CHa+J6+ZR 8OVH+46/gfLzDkpGADNASbC6OGKgQV/KYdNaB1PS68XSfYztAg0TBS7C2d2ryApSaBZO iCDPXiS4Ng6MT9kyO5ejDHJyjeOCrHUfb5/max16pshfnbI2QwzNPqv7imipxeEmkcD/ thlwVThJ8tUQhdRA3N7N8mA7QBOrWfMyyFgvyAr7rVihqlQmF0oZ6rr2xs+tfL/i+QjN geDg== X-Gm-Message-State: AOAM530tv9bPzfkpir8eis/EswaQA5X4M712FWu8WGaZLgUnFQUa6DHT dh/LMnew8vKTc7Ep3S/5CeMrVEcLVdtRgw== X-Google-Smtp-Source: ABdhPJyJMrXtbzQcH0j9dBg+ovQ1CWKpvQ8gpOvHMZL+BxYXlI5ck2jQtGSK8fq2IGizT7XA85jEzA== X-Received: by 2002:a1c:7219:0:b0:38c:a4f8:484f with SMTP id n25-20020a1c7219000000b0038ca4f8484fmr18069189wmc.99.1648199347157; Fri, 25 Mar 2022 02:09:07 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:478c:773f:4734:d0bc]) by smtp.gmail.com with ESMTPSA id c4-20020a056000184400b0020584c40778sm4915297wri.103.2022.03.25.02.09.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 02:09:06 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 25 Mar 2022 09:08:56 +0000 Message-Id: <20220325090903.880311-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220325090903.880311-1-naush@raspberrypi.com> References: <20220325090903.880311-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 1/8] 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();