From patchwork Mon Mar 7 12:46:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 15426 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 0715FC3261 for ; Mon, 7 Mar 2022 12:46:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 77CAA604EC; Mon, 7 Mar 2022 13:46:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1646657201; bh=yvZddnRTtjoThmsHUks+8mxudSbdofrYzJUoaHH94Ys=; 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=2Os/ifDYPRVN8pwmFkKFA4p8jqT3WKBdBl381bGi1oW0XErxlH7p9U83q2/XpgbKi nIg9FQW+VEY06FNvXitA8eMlo3JASwT3VCGFVvOXoyCQZ8UgBH6/L/sE6s1p6PcVso WvZHyO3cYf0GjsYr48+0bXbBhGFJMQZNYW5TH0BbZ2n8G43KbrY396OydJz/D1Qeu3 kP2PrjvQmYMToqVmFzatj+ECxl7r50P80Q/DHRc9uO3/Q8QYl/2SB4rrWezPnqmXJ5 fBXWXvv2n9RUo25VWXmMjSknrWRHLBMItCdDN6bvdVUaXoiHojrldlzmLK5T/ZfO5T SgDkBP3TJSvpg== Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C7EC8604EC for ; Mon, 7 Mar 2022 13:46:39 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="hQR849S1"; dkim-atps=neutral Received: by mail-wr1-x42e.google.com with SMTP id n15so8963434wra.6 for ; Mon, 07 Mar 2022 04:46:39 -0800 (PST) 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=ygJkOrdw8Zj5D+CKG9Kj3kJ5HukkraTyrN0mscQXzlk=; b=hQR849S1sp0jmrG4WkY/rLlFU5qTrLj/CyZ6j8unlgwlVEVTaPztxnopwAtl+BNqhq u5DTB5UgMb4Je5cK1bra6aKTuYZfODl0x3CY9OhswDHuiqrZI4EkXcVjrljRRRRM9jv4 dyfm6pCqnDho5Qj9JZ+OWOIwK4eI+IZd/K38Jtu6dCU31jjz18TS/NasuDGGZsX9BQKY y+eHKp53KbPnoTya8efW/+2CgHFD6Vqs46Q5gKWg+xsQpvZIVCnCWHGO3hwu+UTSofn3 ZR+ZsNCUGB2RoBDrYsA/UlyQG+b2sbXKLbM3fFYGk/tCNRRFB0H5wQtlGNbra6+lekn7 LDEw== 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=ygJkOrdw8Zj5D+CKG9Kj3kJ5HukkraTyrN0mscQXzlk=; b=667oWzQUV6TaPpu5tF9Ax9+YAyRCnIhMG4+5lFZanYm+SVyrGCKrQKXgewlNdAh+wf 6ygh6wU2MuxkmoGt6VH45dOF9oGx7v1a2RQM38WU1bNRJTyzUT5DWCa/pltXkaPksn90 Nke5or5bWB3tnY7yVi5B0DZfoqZoJCD1qgHYIBbQf5/8BP76RL0A6VZr4X8TxES9TQxA vTvmD5QEooOk5lj+ypu/kLilrZEA76sKJBJnCAcISLfXm7jaiH/+bnjWl3XbD1nI+set LalpMuk+uE+gWA8g71pCuystuIH1WSNTR2qrwb32AgZBMpW3sZDBpa4fi/G5Xmlwdj7I 8Bjw== X-Gm-Message-State: AOAM530czSRkL6NjGlmMtPfI99cG4fV3db9bFCd7ZYY4wEHreL7voR+Q fwsy6naeaXM8eGoRMwVSM/TyGHoo0dXkLA== X-Google-Smtp-Source: ABdhPJzfGYBwvMa1TWcE78yi43B7EPsOl6//SbWpzUEE8amtTpp6bR9frQYMj77wjtdBViNrQq1EUA== X-Received: by 2002:adf:e19d:0:b0:1f1:d7eb:71f with SMTP id az29-20020adfe19d000000b001f1d7eb071fmr8281495wrb.512.1646657199320; Mon, 07 Mar 2022 04:46:39 -0800 (PST) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:c644:e9b3:de0b:54c5]) by smtp.gmail.com with ESMTPSA id z6-20020a1cf406000000b0037c4e2d3baesm19759582wma.19.2022.03.07.04.46.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 04:46:38 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Mon, 7 Mar 2022 12:46:28 +0000 Message-Id: <20220307124633.115452-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307124633.115452-1-naush@raspberrypi.com> References: <20220307124633.115452-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 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 1 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 relevent 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 29bff9d6eee4..d604c473c26c 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -844,11 +844,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();