From patchwork Wed Feb 21 12:49:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 19521 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 CD071BD80A for ; Wed, 21 Feb 2024 12:49:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0D88562813; Wed, 21 Feb 2024 13:49:25 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="ov/utB9L"; dkim-atps=neutral Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 84E1F61C9D for ; Wed, 21 Feb 2024 13:49:23 +0100 (CET) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-41275855dc4so4168075e9.0 for ; Wed, 21 Feb 2024 04:49:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1708519763; x=1709124563; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=PweA0cfznhN2qUFthBK9Z8S5zqPSVidIc7lgtNrB2Wk=; b=ov/utB9Lcna3s+SogCNSumaGSkChWS4yzGL9c8hqxJDOAvc7GWeMaXmXMUL7Ti424z cNHQSTFzz7vr/L6YZBLJ3r2+xndBBwICZpQFfLWPZvy8gMEuX72NODMH2sl0Jq1fQRcX y4m9rNPh6kELZezU7LZJXuMyDea+qktsN1uaMppSbGb+U9ck1f1ggcYhBWMu85L+NzPn eouxVnGmTcRNr0a690jzzW1CIBgiY0fnM/cChaQD8bjnHhfz8rZtQ7iLppxlhYNTcMsh nSVXH4qM3DyAFghR5+5vdP+5Jw7F1s7Wdpdg/gU0xJzdswG7RtptRnLY84pSiXg70aOH ABCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708519763; x=1709124563; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=PweA0cfznhN2qUFthBK9Z8S5zqPSVidIc7lgtNrB2Wk=; b=UFgrkZVFJKAdKe7rCh4peUqSnjyu4HN/O8rONEzO097vi6GTEU58lnsxvXgJ95575e gn+Xb/ABw9rsu03kx70SyT4hDeOdftSHu4nOwtgYJm67sBEbh94qAezursuE1GBJmKfY ZtQFBIBioI+sYJAavzOiUf82f36y0DCoGaYBS5dhxzNzUT3CS0ihOOFdd582eyjRYg0o +3BeTCnkB4ZjfY33FnO4/QTfHWrqA30BT1zdJsYZaaU/QfYyHMohFy2tRwkjid0CAt/j O4lIXqHnYIREItZP2m4qKiuxLT2bWecvqTr7C40CkHmNZ7Ol+bWywhOLuDf44w83l4Zb U1NA== X-Gm-Message-State: AOJu0YzDZ1QO9UlMmEv3yFZmASpTzpUmVfrga55jXo9gawxhc4Ui1Ycw +7tnXqjhzMgFXkIzcphHP/N0r/46wfFzWqjFKOosY9jSjCmUd8N79vvtQT2cWZTkgjdajx8s2Lu T X-Google-Smtp-Source: AGHT+IGofiP2bNiswG9Q4ssuiAncoReNDR2s7aZvl7rSd3CfYeXpMyhLteC2OQ9p+EcaAs+zf+grmg== X-Received: by 2002:a7b:c415:0:b0:412:e80:be4d with SMTP id k21-20020a7bc415000000b004120e80be4dmr12670700wmi.36.1708519762778; Wed, 21 Feb 2024 04:49:22 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2001:4d4e:300:1f:70fb:d051:958c:e7b3]) by smtp.gmail.com with ESMTPSA id p8-20020a5d68c8000000b0033b2799815csm16832220wrw.86.2024.02.21.04.49.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 04:49:22 -0800 (PST) From: David Plowman To: libcamera-devel@lists.libcamera.org Subject: [PATCH] pipeline: rpi: vc4: Use an unpacked format if no packed one is available Date: Wed, 21 Feb 2024 12:49:19 +0000 Message-Id: <20240221124919.2684-1-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" When validating a stream, and no valid packed pixel format can be found, see if an unpacked format can be used instead. This is particularly helpful for 8 (and 16) bit raw formats, where asking for a packed format would previously have failed. Now the configuration will be adjusted to give you a format (in fact, the only format) that will work. Signed-off-by: David Plowman Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/rpi/vc4/vc4.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp index a52f0e7a..ad76099b 100644 --- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp +++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp @@ -434,6 +434,16 @@ CameraConfiguration::Status Vc4CameraData::platformValidate(RPi::RPiCameraConfig rawBayer.packing = BayerFormat::Packing::CSI2; PixelFormat rawFormat = rawBayer.toPixelFormat(); + + /* + * Try for an unpacked format if a packed one wasn't available.This catches + * 8 (and 16) bit formats which would otherwise fail. + */ + if (!rawFormat.isValid() && rawBayer.packing != BayerFormat::Packing::None) { + rawBayer.packing = BayerFormat::Packing::None; + rawFormat = rawBayer.toPixelFormat(); + } + if (rawStream->pixelFormat != rawFormat || rawStream->size != rpiConfig->sensorFormat_.size) { rawStream->pixelFormat = rawFormat;