From patchwork Tue Mar 22 09:22:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 15498 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 E92F1BD80A for ; Tue, 22 Mar 2022 09:23:04 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 31B35610F8; Tue, 22 Mar 2022 10:23:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1647940983; 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=DTtBh0YwNX/6VLHB1MwbSXs2bWjcS/c1l0ThxbxqNt+PLIkcHf+AKl0Y2c9eScAXH mZJ8LU7FUfjrK+i/QF+wxUZyT4vsXGAiNKQFZPnosaIRVRi1ikyZdTOMSV9hrE7Y2R xCTdAf2Sqq2BiOUy/fdahCisgVau5gklUL07wEM1KRSJ22Dh4sWvo2PPCopvHgK8F/ ew4aB93sT4E7JnoY4o0Yoy/F7Nk2d3iVZXk2bxrE0pKey/ifsoIYZDlPg4oPuvZ6zf Nrqmje68U+V6DNh7h7FCxocqVQh6ncOnentP7mbPMcN3qPZsX3xT+GJXPA3KAdFR6z nB+pOmSQQhrYg== 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 E71C5604C7 for ; Tue, 22 Mar 2022 10:23:01 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="UoVdijD9"; dkim-atps=neutral Received: by mail-wm1-x329.google.com with SMTP id j13-20020a05600c1c0d00b0038c8f94aac2so1016104wms.3 for ; Tue, 22 Mar 2022 02:23:01 -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=UoVdijD9k5czPIoKj/3QiCmKvQe52efw9ZGcCgunseFVsCDSh2LQprq2q1lp1LM4ih Y8Stur8IfgONf4+RUiGSGeXkIIKq+fL6kaa06idGk8R5B2PO06so/3B0LpmAjtjAHsHG 1N4xIt60VdD2G7RX9wJsHSKle/vdDjMyJeAbuPVsTzjRKePnCy0+z8NyT2xuib0I2ZS7 CqByNxPt2AM3+xsx+XbnWEwFJcF2H+N8gbLfz77/4TAOv+Fe2adaAQ0cSbn5CnqNuDir FaJCzFWepxw7+nJ/i2mMszCVD36OBeR4xINyDgDs40C3dDYncKcQ1hyZl8hU/AEW78B6 pOYQ== 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=menPD9fCee8XKEYcZEZqnhs0wVsEmqpJiDQbLEfa0dMkeBBNTra0LpVWVYTvIfWXhI Dd6BXInmm75MmcmrFPxvm3qTifrWpUfdEnHZmThdy/31wcLlcy9qWfLSK8CBatZ5/VCQ 7eBSEOqQX2ixjUKkImgxhOHM3vurU9lru5o8utvmBzGWEgDQ8/ieJM5JdPJo5N4lblFP vXRnYeMQL36+OAX78sUl7Kc3JddSzZ6ZkPvSaDVZPNB1jtgEwi4XGB7Hb9lhU/vwNBdt yedDOllJwws+0lZaVgv7rooJw0cYyQrTEhW8x0p80ADmxh8oszGnTw7iNtSEDF3KmLrD zoVA== X-Gm-Message-State: AOAM533enRoo3VmPzloptKogNmXzZR+OFYQ7RGOxphiOn76l5EL7Kxmh EB6kaEuxa9ty9lDdF+HZ3B+iSeXMeiAGdg== X-Google-Smtp-Source: ABdhPJwG7XQLDbZiTQq9Ioawk6fZI2nGATWWfG75sX1OoIqPPErz4xg5fFWVy+6HtbDKPfSjqvPNrQ== X-Received: by 2002:a5d:59a1:0:b0:204:1777:fc08 with SMTP id p1-20020a5d59a1000000b002041777fc08mr5875151wrr.545.1647940981434; Tue, 22 Mar 2022 02:23:01 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:9e9a:99af:e5a6:319b]) by smtp.gmail.com with ESMTPSA id r14-20020a05600c35ce00b0038c9f469979sm1471695wmq.40.2022.03.22.02.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Mar 2022 02:23:01 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Tue, 22 Mar 2022 09:22:50 +0000 Message-Id: <20220322092257.2713521-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220322092257.2713521-1-naush@raspberrypi.com> References: <20220322092257.2713521-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 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();