From patchwork Fri Dec 10 11:21:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 15110 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 94D55C3258 for ; Fri, 10 Dec 2021 11:22:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3F404608E5; Fri, 10 Dec 2021 12:22:12 +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="Wrl2E789"; dkim-atps=neutral Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DCD366088E for ; Fri, 10 Dec 2021 12:22:07 +0100 (CET) Received: by mail-wm1-x32a.google.com with SMTP id i12so6546811wmq.4 for ; Fri, 10 Dec 2021 03:22: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=K60rAz66vWi9F057w7dISj11FLoL/9HFVty+RyVxed8=; b=Wrl2E789/shUI1lgPdW4mncRL11LlTL/CVwhjNq67rK8hBiuGmasOuKl9shwDTqPrX CXNTkZNVesEzOwLKbuGqm19ZJwltvkR+DB/z8Ekf538Ehvyv4EEGRhs+c2MISzxjGRI0 kT7nEtp8xOte53ZNADhwSdbW1tmj+A6eO2bnaVvlDmHVUqyvz85UXXN1RAlxLVw6LSC+ tTjchHcPeuGiIrqljVA6rxvxtprq/BzwdPhlJtHxi00L8faxm0QUmXOcziCgVupXvFdG FfCllRtlNFdRcSkCw1ItfSAGlKD7eCnjAJTJIFRzxBeKUPl8hhxs/22F4U1FrTu5lUoX jDag== 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=XBrooQTiOaIWpdtjKvQiU8NY0qreKYKx5pYpsZ3lI//wK6pf9MWTqyM1oWeoVxXbrE D/yOmIm4vvRkIUJCgiMBby0at2FGHJbOq6GYPPPIxRCMOi3xeZZf8gIbFYghubenL1Kv WhMElu0E/zWcJ8Y/eVf5M8FMdUxHe6mSL36SPhgbp8XT31RzQAIdb4dBTd+Nxf8iwkoT EBcErdt6n0oFVo9oj4slBd/q1Jg4lQz0MK/UKP9stK6KvGaRAAkPGN9jmr3TKbMpZfgK C5CbjaF9iuwUwTl+uYNFMUQgfCES5yeCmyLnF9rjYePqqoRBurBm3pv8ksgsGnTRSnPF 9s4w== X-Gm-Message-State: AOAM532Tu4fggJ2421BcTwN7329b8mvWprxBTZ1qRncFz6vmGJwGScvO jKKq/8TVvUtaoJudVWsB5aRtkA== X-Google-Smtp-Source: ABdhPJwc4sJk9+Lsw8/M5jbaGdFQK6n3RkpRNhWiw6LaIxLB3S4D7ImedTsIMWBdhKdGwXxUPzs76w== X-Received: by 2002:a05:600c:4154:: with SMTP id h20mr15518918wmm.189.1639135327516; Fri, 10 Dec 2021 03:22:07 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:e4a2:3070:eea4:e434]) by smtp.gmail.com with ESMTPSA id z18sm2198469wrq.11.2021.12.10.03.22.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 03:22:07 -0800 (PST) From: David Plowman To: Laurent Pinchart , Kieran Bingham , Hans Verkuil , Tomasz Figa , Jacopo Mondi , Naushir Patuck , libcamera-devel@lists.libcamera.org Date: Fri, 10 Dec 2021 11:21:40 +0000 Message-Id: <20211210112142.18441-7-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211210112142.18441-1-david.plowman@raspberrypi.com> References: <20211210112142.18441-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v11 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; }