From patchwork Wed Dec 1 15:44:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 14979 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 1E85AC3251 for ; Wed, 1 Dec 2021 15:45:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 50A10607C5; Wed, 1 Dec 2021 16:45:11 +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="MqYFmHu8"; dkim-atps=neutral Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 837FF607DA for ; Wed, 1 Dec 2021 16:45:07 +0100 (CET) Received: by mail-wr1-x433.google.com with SMTP id a18so53329372wrn.6 for ; Wed, 01 Dec 2021 07:45:07 -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=ZHv2BE5qFSbf6FhZH1c6JuntQk94zpM3K7P0xT4gJ58=; b=MqYFmHu896DyNgClkTvpPw1lmZ5gDJ/nWnsY54FUQAaXxcLqiApRaex/Uc8q9g+sgU AnohFjrJOWHBGCpBuuLqz41VmxmniVjBuYBqV94F6QNqQHsXdcIKf13pZuCUlulBMkn7 29eehjrtV7u2hHz0hchNaSLnYf1e3PATvUlWZv52pm+/6N/rKfGKdcH4Qu7J8Zi0KEB4 jL3O8Vhe+v7bzD/H51NYFVwmeyAoBUhE6/koy37f/PoAJdQ7i6MFAktBklZsLDh3vsai Kl1Ot1bVHzskh9If7Yc0GVxgvrBmDDzXKUQOW3rp5loisyaPTcu9kxYCoxmf2J97X9SF /DEA== 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=ZHv2BE5qFSbf6FhZH1c6JuntQk94zpM3K7P0xT4gJ58=; b=LnbvhYhvOsbW344+Y8sAVAbSTLzWvNASSNx/3pTnf7U3+5ssMeFIliKQvZvXXNpEiT KCvKcc8iYBGBj7idFMD2HY76LYjlpgYfD2ggK5dUXKluqmZBuJGNJ5u4k5ID8JcwzkA8 74Vo0S19fbxMtxgSGmJi3uG3U86KTDoMKhfmY46QzdeG3NMLf5WvWpOtRHL4FiaGmB+R IFPG6GNhz4NebAtvMPBt1WxG3ZuFvPSrQe6iGDuKckOu0jfCE0PXg4yOVndwmDpNwmBL lKSEkozR2qFdPeP01cHBYetRZIKmQKoi4qnWqNN9W8nqMkjNAzkEaX9TVsffW0pG2xt4 itgQ== X-Gm-Message-State: AOAM530ZzwQTVbxAEKLLEgRXjOwWOSGlCH6jgNCL9mz79MxpeRyF9acG MwMYUvCrCOWbH7kAEl7plCheAKLxmUC3b+ai X-Google-Smtp-Source: ABdhPJzllcTQVaPtOFwNq5GeDOat9k+glRl3C6jlzFsj0bTitr/6xptJtc2MYCD3O8z9+9BtPbtPBQ== X-Received: by 2002:adf:df0d:: with SMTP id y13mr7754214wrl.176.1638373507117; Wed, 01 Dec 2021 07:45:07 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:e4a2:3070:eea4:e434]) by smtp.gmail.com with ESMTPSA id y7sm148209wrw.55.2021.12.01.07.45.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Dec 2021 07:45:06 -0800 (PST) From: David Plowman To: libcamera-devel@lists.libcamera.org, Laurent Pinchart , Kieran Bingham , Jacopo Mondi , Hans Verkuil , Tomasz Figa , Naushir Patuck Date: Wed, 1 Dec 2021 15:44:32 +0000 Message-Id: <20211201154434.23127-7-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211201154434.23127-1-david.plowman@raspberrypi.com> References: <20211201154434.23127-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v8 6/8] libcamera: Support passing ColorSpaces to V4L2 subdevices 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" The ColorSpace from the StreamConfiguration is now handled appropriately in the V4L2Subdevice. Signed-off-by: David Plowman --- src/libcamera/v4l2_subdevice.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp index 66e08333..ee450c31 100644 --- a/src/libcamera/v4l2_subdevice.cpp +++ b/src/libcamera/v4l2_subdevice.cpp @@ -414,6 +414,7 @@ int V4L2Subdevice::getFormat(unsigned int pad, V4L2SubdeviceFormat *format, format->size.width = subdevFmt.format.width; format->size.height = subdevFmt.format.height; format->mbus_code = subdevFmt.format.code; + format->colorSpace = toColorSpace(subdevFmt.format); return 0; } @@ -442,7 +443,13 @@ int V4L2Subdevice::setFormat(unsigned int pad, V4L2SubdeviceFormat *format, subdevFmt.format.code = format->mbus_code; subdevFmt.format.field = V4L2_FIELD_NONE; - int ret = ioctl(VIDIOC_SUBDEV_S_FMT, &subdevFmt); + int ret = fromColorSpace(format->colorSpace, subdevFmt.format); + if (ret < 0) + LOG(V4L2, Warning) + << "Setting color space unrecognised by V4L2: " + << ColorSpace::toString(format->colorSpace); + + ret = ioctl(VIDIOC_SUBDEV_S_FMT, &subdevFmt); if (ret) { LOG(V4L2, Error) << "Unable to set format on pad " << pad @@ -453,6 +460,7 @@ int V4L2Subdevice::setFormat(unsigned int pad, V4L2SubdeviceFormat *format, format->size.width = subdevFmt.format.width; format->size.height = subdevFmt.format.height; format->mbus_code = subdevFmt.format.code; + format->colorSpace = toColorSpace(subdevFmt.format); return 0; }