From patchwork Mon Dec 6 10:50:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 15047 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 A7341C3259 for ; Mon, 6 Dec 2021 10:51:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 973F2608A1; Mon, 6 Dec 2021 11:51:28 +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="OmnOPz7K"; dkim-atps=neutral Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D7D1260890 for ; Mon, 6 Dec 2021 11:51:24 +0100 (CET) Received: by mail-wm1-x32c.google.com with SMTP id d72-20020a1c1d4b000000b00331140f3dc8so7291649wmd.1 for ; Mon, 06 Dec 2021 02:51:24 -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=mbZZhCZgEn6YYtA3/51M6wXPUxmxfiWlFLNpGT7zY88=; b=OmnOPz7KK1PUrnlrkVkEGKE2DOb0pnrTc4hS4ZYKAk6g4gEPJvG2tmLRILvIfvaxcM dwyloi+e7jgTaUrmQvZMqFTxQVIAhIFlCT5drGSygg/r49OkDHlt8V0FBJZueBByAtnO oDkPbaFY78wuUc04tm1pD2WtnWSLPenQIhtNrnabTrHfT9L0Ft2/ZXlzDIGVUcofgr1o EfSEjrdEzGiJAIDaUQS9G0CveokcimmFNWP4qIvuI6QQdaNwLazgqSeTqCTlfFvLy6dm 2A6WCdbgw/aWaEVZwoEToYMgciIMTXZRQqWqDr0wt6KShWv33xenB8C50K2Z2c2OnxW5 LJGg== 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=mbZZhCZgEn6YYtA3/51M6wXPUxmxfiWlFLNpGT7zY88=; b=Jn/pUKxmi3dv93WIlU0SGZMkeBtC0PvmDOxnh1aksw9aONY4niiRkgL4alnvNQRbRx bV+jnSgGPxPyL+i4sGBp8IcMH82fABoM3qcpfZJy0YJGcPPZgc2kJBW8VWWvEvkudvLQ pGG/DttRIH6j74Mm2DyvrES7WqvrqX9xBGPxJ1iT8wKX5KWVGdvUnNtTpl5OYC2LZOcs 93H9d+Odj04ZxaTAKu+p3Z7Y2W4iY6NpT7GKVh+2yZFvsfTetz+r8HXQm6G6pYb3yVSj k+7j/9bu0aJeArCQ0ilrFo3h61SDGrzgQYiDSkAODaEa8rAjdmGOI1VcLEVa7glgOb8Z Dz3g== X-Gm-Message-State: AOAM530ugX3SSC3PjbA2ST42hzTjALsAH4ZZAmX4LOtQiT0E+PSB6RB4 dWmIfxZlmveoopIN3H0Gzer/H4BXHKbQAQM+ X-Google-Smtp-Source: ABdhPJzwgttQ9pRArkqaJc+VFVWVn+2f+jVthpKcKwbdNM6RyefMwZ5f26zwtP5SAan7ts9JQecMbg== X-Received: by 2002:a7b:c109:: with SMTP id w9mr38978470wmi.114.1638787884430; Mon, 06 Dec 2021 02:51:24 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:1ce1:9965:4328:89c4]) by smtp.gmail.com with ESMTPSA id r7sm10878186wrq.29.2021.12.06.02.51.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Dec 2021 02:51:24 -0800 (PST) From: David Plowman To: libcamera-devel@lists.libcamera.org, naush@raspberrypi.com, jacopo@jmondi.org, tfiga@google.com, hverkuil-cisco@xs4all.nl, kieran.bingham@ideasonboard.com, laurent.pinchart@ideasonboard.com Date: Mon, 6 Dec 2021 10:50:29 +0000 Message-Id: <20211206105032.13876-7-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211206105032.13876-1-david.plowman@raspberrypi.com> References: <20211206105032.13876-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v9 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 Reviewed-by: Laurent Pinchart --- 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 981645e0..f5ec6901 100644 --- a/src/libcamera/v4l2_subdevice.cpp +++ b/src/libcamera/v4l2_subdevice.cpp @@ -411,6 +411,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; } @@ -439,7 +440,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 @@ -450,6 +457,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; }