From patchwork Thu Dec 9 10:12:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 15096 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 BE6AABF415 for ; Thu, 9 Dec 2021 10:13:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7A39760224; Thu, 9 Dec 2021 11:13:40 +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="VdmnbNCE"; dkim-atps=neutral Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 991FC60876 for ; Thu, 9 Dec 2021 11:13:35 +0100 (CET) Received: by mail-wm1-x336.google.com with SMTP id i12so3744963wmq.4 for ; Thu, 09 Dec 2021 02:13:35 -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=K60rAz66vWi9F057w7dISj11FLoL/9HFVty+RyVxed8=; b=VdmnbNCEdWt9UN4XvxyHAIv1/yCXgX3PDYyefELrvHuCmUeKD1iKjXw006DcTu4CQ7 vxtczPkzmZD7gmdIzHc0LyWDQdyJlrR44AQGkaHcfWnpcH0WScZfo4ObKUWQ5tFLELah 2uqL3PbPRUn6Lt7w0udazDun1hCuo7sJN0sKsR7kxU/gnVtTCuZP+A7Nx1P1FEOw3NPj kQ7oIASQ/dLj5lD+euoEalK+9CxaAy2SlU9n4vy1SB3O6GE0p56TsuXpMsxYQslBAaH0 1Ih8Dm4EdmVePIAb71+2ihina1PCeeUhOfKhh0ArCGCvUM6u8VVnOJLrQ+Zv95gYRCWj KOtA== 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=K60rAz66vWi9F057w7dISj11FLoL/9HFVty+RyVxed8=; b=0AaeuFLDljJbnFT/26cpcWZSbP60GZIMXELpQhW7xbr9wH83AAkEQjRO2FbFyEwfER 8zl+AxhAiHzh4EobmDgCMblhYQDh8IYK2UZmCUMHezYJvW3ZwfvGsxE0gspqAJApXdwp mccnxj8oX6nknxNuhvzBF1hp6yoV8q2GI9UJ0QUPOYCqyR8qrvmdfVjasiuOIAHRvn5q 3sRk85VGWmDbn4sMtlv4gihv19mBjamdJCkWQpsY83FMnIuDYRZfkTZnPG6Ax0DqbQZW otWifYh1zT5UMZ53aFZWkhZXSCCQZQlKdr9zrn7HxeiIPOaePobqDlVNRjGM1D2QjocM SJZw== X-Gm-Message-State: AOAM533MDVxUc5wFD35v6sktukZgpKXw+1JT9RoGtMyeyPPnrNJPExYC MmRIQQThL2h6YGm5IcpWsjakKXV12JtIRwWu X-Google-Smtp-Source: ABdhPJxWsoxn3YIVcryK2lCY7oepdV8Oh+2rysLQUISS9XCZ7wNZ3AMuNvtGYZG7YQp+ufnJto7fdQ== X-Received: by 2002:a05:600c:190e:: with SMTP id j14mr5831248wmq.75.1639044815166; Thu, 09 Dec 2021 02:13:35 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:e4a2:3070:eea4:e434]) by smtp.gmail.com with ESMTPSA id j8sm5079449wrh.16.2021.12.09.02.13.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Dec 2021 02:13:34 -0800 (PST) From: David Plowman To: libcamera-devel@lists.libcamera.org, Laurent Pinchart , Kieran Bingham , Hans Verkuil , Tomasz Figa , Jacopo Mondi , Naushir Patuck Date: Thu, 9 Dec 2021 10:12:43 +0000 Message-Id: <20211209101245.6187-7-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211209101245.6187-1-david.plowman@raspberrypi.com> References: <20211209101245.6187-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v10 6/8] libcamera: v4l2_subdevice: 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 b782325a..8caa73d6 100644 --- a/src/libcamera/v4l2_subdevice.cpp +++ b/src/libcamera/v4l2_subdevice.cpp @@ -415,6 +415,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; } @@ -443,7 +444,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 @@ -454,6 +461,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; }