From patchwork Mon Feb 3 08:58:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13957066 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 696C51FE47D for ; Mon, 3 Feb 2025 08:59:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573151; cv=none; b=RTl8O6ixzFDW+auXN0QD1lfR2RpLYAGDKqd4YLfYM0FSIGlFWraECUqQbQ2zHlGpfN0otkyFWT6yvDtWg0vJxCf0UPORia1eJtbkO5KrqOBTXRyKfVIQWFAzgILJbvg+Q2I/GM2IaDB0vaWIh/XgY9e/GibhmgBe9t+E6IbffXI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573151; c=relaxed/simple; bh=wb6ckfnT3F2LaTpzZEkD0WrE05oukIrBrqVDH2YbYEY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=IIqLzH1dzufmth6banwtDXgkraqIkC+WUWStCV12ylXeLCpa1y3VPLMDsoC9mbY9dWEnllF+zmLhznKvYehU2zrnn1OrV06i/QzVJMBdLFdiGKfjUjEjiFjy7wV+WVx9Ko7SkGfkttTukum+mMhaw8fr+uojzV5MX587LfhyfD0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Mu0VG2iA; arc=none smtp.client-ip=192.198.163.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Mu0VG2iA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1738573151; x=1770109151; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wb6ckfnT3F2LaTpzZEkD0WrE05oukIrBrqVDH2YbYEY=; b=Mu0VG2iA3TPXeE5TCf5LTD28ds09X33FIKlq27wm1s+Bj3k2ZwLFOGuh i/WPhiRx+YNPAog1NnvqaRNAQ+4J4Y5rFjyZanukdCXOOciMs19/Tqr8h 29Bu9SBXrI32U1a68wNkw3FxE/qz5KzYbmCqlf12emcEOBKsBoC0/Qzy4 8ztmips7nZtRyUiK133ASvFdzGbNQMkBa705CmSab1SMduB+tFvNg5xVm Tu9mpM3A+XA0pxWerybbEoWzxi4YqljlmBfhP68JvUOW59zMIzmnlirkJ td4pMmTukpNJhgOq92+Pn6ebeEUebsMv7GPn7R9zqeLFZC38OfMCGTQRp A==; X-CSE-ConnectionGUID: evFESvFYTBi6MNVaLW3JdA== X-CSE-MsgGUID: dF3TMHoMR8yAnEdYuhWS4Q== X-IronPort-AV: E=McAfee;i="6700,10204,11314"; a="50472561" X-IronPort-AV: E=Sophos;i="6.12,310,1728975600"; d="scan'208";a="50472561" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:10 -0800 X-CSE-ConnectionGUID: MePhPOhYQ266lyLAPhFFpA== X-CSE-MsgGUID: GuHfCDjdQU2bMuxQvbQzMw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,255,1732608000"; d="scan'208";a="110382922" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:04 -0800 Received: from svinhufvud.intel.com (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 4B84711FAB1; Mon, 3 Feb 2025 10:58:58 +0200 (EET) Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo From: Sakari Ailus To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, Prabhakar , Kate Hsuan , Alexander Shiyan , Mikhail Rudenko , Dave Stevenson , Tommaso Merciai , Umang Jain , Benjamin Mugnier , Sylvain Petinot , Christophe JAILLET , Julien Massot , Naushir Patuck , "Yan, Dongcheng" , "Cao, Bingbu" , "Qiu, Tian Shu" , "Wang, Hongju" , Stefan Klug , Mirela Rabulea , =?utf-8?q?Andr=C3=A9_Apitzsch?= , Heimir Thor Sverrisson , Kieran Bingham , Stanislaw Gruszka , Mehdi Djait , Ricardo Ribalda Delgado , Hans de Goede Subject: [RFC v5 01/15] media: Documentation: Rework embedded data documentation Date: Mon, 3 Feb 2025 10:58:39 +0200 Message-Id: <20250203085853.1361401-2-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> References: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Rework embedded data documentation by removing the reference to the pixel data stream. The specific documentation of the embedded data interface will be elsewhere, in the near future either CCS or common raw camera sensor model documentation. Signed-off-by: Sakari Ailus Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart Reviewed-by: Tomi Valkeinen Reviewed-by: Lad Prabhakar --- .../userspace-api/media/drivers/camera-sensor.rst | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Documentation/userspace-api/media/drivers/camera-sensor.rst b/Documentation/userspace-api/media/drivers/camera-sensor.rst index dc415b8f6c8e..8e1083417ae1 100644 --- a/Documentation/userspace-api/media/drivers/camera-sensor.rst +++ b/Documentation/userspace-api/media/drivers/camera-sensor.rst @@ -111,13 +111,12 @@ the sensor configuration for the captured frame back to the host. While CSI-2 is the most common data interface used by such sensors, embedded data can be available on other interfaces as well. -Such sensors expose two internal sink pads (pads that have both the -``MEDIA_PAD_FL_SINK `` and ``MEDIA_PAD_FL_INTERNAL -`` flags set) to model the source of the image and -embedded data streams. Both of these pads produces a single stream, and the -sub-device routes those streams to the external (source) pad. If the sub-device -driver supports disabling embedded data, this can be done by disabling the -embedded data route via the ``VIDIOC_SUBDEV_S_ROUTING`` IOCTL. +Embedded data support is indicated by the precence of an internal sink pad (pad +that has both the ``MEDIA_PAD_FL_SINK `` and +``MEDIA_PAD_FL_INTERNAL `` flags set) with a metadata +format to model the embedded data stream. If the sub-device driver supports +disabling embedded data, this can be done by disabling the embedded data route +via the ``VIDIOC_SUBDEV_S_ROUTING`` IOCTL. In general, changing the embedded data format from the driver-configured values is not supported. The height of the metadata is device-specific and the width From patchwork Mon Feb 3 08:58:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13957067 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A5A51FE47D for ; Mon, 3 Feb 2025 08:59:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573157; cv=none; b=HX+Bv7PsD3kPFQ8najh5wOZ5JtgeupIR7PPgt53MspCgr+tf6MGGusp/ez53XGs5HwjANuoVj3OcuYxurVhRTpMVeRyNYv8deQQ36HeuQ4zoAefQuKqCPZ5qx4MsLWqt0XYTwImwiyscAB/HQHek5FebsHPSvz/9EMox3Re4A4o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573157; c=relaxed/simple; bh=K6qqTvaiF1u+v0Khv428uEMt2HzkXUBHV5NlRdmkX70=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XBp4rtmuLYcdz0LgMuTGnEzGBvcBcBNGkcFhJksXZWReiyANI19tKAqVFdNabaOCq5/4hawVbIQj3FKj79XPjxeZMGEmFJJ6QpiWoJw23JbSUIplsJW1jPiqbWA8tAduiJiM3ZIShsUmS3If6Wgy+59SpHAL2JlWtC1NDDwVENc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=RzQKsFpM; arc=none smtp.client-ip=192.198.163.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="RzQKsFpM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1738573156; x=1770109156; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=K6qqTvaiF1u+v0Khv428uEMt2HzkXUBHV5NlRdmkX70=; b=RzQKsFpMHok8fBasaft9I2/RJWP7SVXuRNZqyBLKwim2fXt9phAgYyW2 kEKHxYyS/VdcfnzNkW4UntvTMIFGQXschxoUjUVY3D7uH5roh1SALIAGr IBYLd0XRbig8wYd4kq0qzhONMNCMCdvGxI0v4lDvjJkosvpbT6QWt5zMI EJRB6jeXKQXx4enPeG9tsuRdt3V9XwQyzd11Plbpga9pJTBV4TMwtRhoc rx8Ol3DcIH6nCs81TXqRL5txIESLRS65TmIjeIu9Qr4O46abkDCc3sDcR 8tIskeS5rTBbAhffkQzA4QgTBJvD9rcngFP/ufis1pBLbn0J/7IvRryzf A==; X-CSE-ConnectionGUID: ERDu2oDCSR63+qWrUE/cqA== X-CSE-MsgGUID: Esh4wBWIR9qc2y+wtUJGAw== X-IronPort-AV: E=McAfee;i="6700,10204,11314"; a="50472583" X-IronPort-AV: E=Sophos;i="6.12,310,1728975600"; d="scan'208";a="50472583" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:16 -0800 X-CSE-ConnectionGUID: 15Z3YKfySv+QP/KScmsV4w== X-CSE-MsgGUID: /hEe+T5nSvKJUqB+mwgD3w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,255,1732608000"; d="scan'208";a="110382936" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:09 -0800 Received: from svinhufvud.intel.com (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 848FB11FC22; Mon, 3 Feb 2025 10:59:02 +0200 (EET) Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo From: Sakari Ailus To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, Prabhakar , Kate Hsuan , Alexander Shiyan , Mikhail Rudenko , Dave Stevenson , Tommaso Merciai , Umang Jain , Benjamin Mugnier , Sylvain Petinot , Christophe JAILLET , Julien Massot , Naushir Patuck , "Yan, Dongcheng" , "Cao, Bingbu" , "Qiu, Tian Shu" , "Wang, Hongju" , Stefan Klug , Mirela Rabulea , =?utf-8?q?Andr=C3=A9_Apitzsch?= , Heimir Thor Sverrisson , Kieran Bingham , Stanislaw Gruszka , Mehdi Djait , Ricardo Ribalda Delgado , Hans de Goede Subject: [RFC v5 02/15] media: Documentation: Add a hyphen to list-based Date: Mon, 3 Feb 2025 10:58:40 +0200 Message-Id: <20250203085853.1361401-3-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> References: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add a hyphen to list-based for uniform spelling in camera-sensor.rst. Signed-off-by: Sakari Ailus Reviewed-by: Jacopo Mondi Reviewed-by: Tomi Valkeinen Reviewed-by: Lad Prabhakar --- Documentation/userspace-api/media/drivers/camera-sensor.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/userspace-api/media/drivers/camera-sensor.rst b/Documentation/userspace-api/media/drivers/camera-sensor.rst index 8e1083417ae1..9a1e8aa9fc77 100644 --- a/Documentation/userspace-api/media/drivers/camera-sensor.rst +++ b/Documentation/userspace-api/media/drivers/camera-sensor.rst @@ -26,10 +26,10 @@ of cropping and scaling operations from the device's pixel array's size. An example of such a driver is the CCS driver. -Register list based drivers +Register list-based drivers ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Register list based drivers generally, instead of able to configure the device +Register list-based drivers generally, instead of able to configure the device they control based on user requests, are limited to a number of preset configurations that combine a number of different parameters that on hardware level are independent. How a driver picks such configuration is based on the @@ -67,7 +67,7 @@ is pixels and the unit of the ``V4L2_CID_VBLANK`` is lines. The pixel rate in the sensor's **pixel array** is specified by ``V4L2_CID_PIXEL_RATE`` in the same sub-device. The unit of that control is pixels per second. -Register list based drivers need to implement read-only sub-device nodes for the +Register list-based drivers need to implement read-only sub-device nodes for the purpose. Devices that are not register list based need these to configure the device's internal processing pipeline. From patchwork Mon Feb 3 08:58:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13957068 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCDC01FE47D for ; Mon, 3 Feb 2025 08:59:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573161; cv=none; b=o6VMWQ0UAd/Yh+Kv6kaLebQGaSgfxJWW/JcoSxSvXuqnPV7uOjp/p7UhyNkSz0rMiLgBrwxHkxK9MuK+VQNF8c21sxn8Rt0u3gwkSVN0qFP7ewhHmhXGl8QJnmAZDI9tdqaWZj+rQDywXEvSaWmcw6K3CEVDws1djHl+JRIychM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573161; c=relaxed/simple; bh=1hEYM8/y3YkSsR//oPssUvzHYFPdQm1A4na53VRF+kw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YPZXLWAF1nSWisP2GHOTo8Ke7Nfb9L1k1T6wsng8yxrazH1GPDHChVhFX0Ut5lpnjuv7C5xg76aKdw8hTLe/CWb14iHFECjIoIvA/d3UwgTzzaWl9tbOEm+CDW2Ti+er2gGzeRPT7LEAj4ZvqZXEq4+4zkjQxV0Hrbm3slqlRyo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=CjJTnRbI; arc=none smtp.client-ip=192.198.163.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="CjJTnRbI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1738573160; x=1770109160; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1hEYM8/y3YkSsR//oPssUvzHYFPdQm1A4na53VRF+kw=; b=CjJTnRbINTzk6z3ESpWC3KvqJZe297IA072lc9spxSq3OZu2BqEXhcxI QgEfCZFDaMspyYleLbge6GpnN6+/GsGoVBt1XmykLXHZARL7htktd4o2W A3B6x69uHagKed1aITBX/rXyOZf/ETAzr5mjuTOE6eZMZ5UwSyz8uJriB u14F1aFrXsMeqveLVxOYmJw3NaAJo+vE9pZRfwv9Kh6zRXBK6JCbLR2oT L3YCUY/Q/B+ZBIYWnHkygyfpnEKCf+tmC2QVOSnZbT8eWoUxSmVddLbqk 8HLZCUpUYYPjsM92YgZpV2Cr+TeLRQTqEmA4HKVhZCyqJmAlS5EJlmhMC w==; X-CSE-ConnectionGUID: Qx8+4q9eQMqTtVIEYQ8TRg== X-CSE-MsgGUID: 64VYO5zNToOtZPsYPBDWPw== X-IronPort-AV: E=McAfee;i="6700,10204,11314"; a="50472602" X-IronPort-AV: E=Sophos;i="6.12,310,1728975600"; d="scan'208";a="50472602" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:20 -0800 X-CSE-ConnectionGUID: 4eTnF31WQyGi4w9pUxXGOw== X-CSE-MsgGUID: I0VLOyCiS8q5bM5pZx5Atw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,255,1732608000"; d="scan'208";a="110382945" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:13 -0800 Received: from svinhufvud.intel.com (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 8D6B011F9C3; Mon, 3 Feb 2025 10:59:07 +0200 (EET) Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo From: Sakari Ailus To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, Prabhakar , Kate Hsuan , Alexander Shiyan , Mikhail Rudenko , Dave Stevenson , Tommaso Merciai , Umang Jain , Benjamin Mugnier , Sylvain Petinot , Christophe JAILLET , Julien Massot , Naushir Patuck , "Yan, Dongcheng" , "Cao, Bingbu" , "Qiu, Tian Shu" , "Wang, Hongju" , Stefan Klug , Mirela Rabulea , =?utf-8?q?Andr=C3=A9_Apitzsch?= , Heimir Thor Sverrisson , Kieran Bingham , Stanislaw Gruszka , Mehdi Djait , Ricardo Ribalda Delgado , Hans de Goede Subject: [RFC v5 03/15] media: Documentation: Reword split of sensor driver to two classes Date: Mon, 3 Feb 2025 10:58:41 +0200 Message-Id: <20250203085853.1361401-4-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> References: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The sensor drivers do not configure the output size of the sensors but the entire internal pipeline. Reflect this in the documentation. Signed-off-by: Sakari Ailus Reviewed-by: Laurent Pinchart Reviewed-by: Jacopo Mondi Reviewed-by: Tomi Valkeinen Reviewed-by: Lad Prabhakar --- .../userspace-api/media/drivers/camera-sensor.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Documentation/userspace-api/media/drivers/camera-sensor.rst b/Documentation/userspace-api/media/drivers/camera-sensor.rst index 9a1e8aa9fc77..bc55c861fb69 100644 --- a/Documentation/userspace-api/media/drivers/camera-sensor.rst +++ b/Documentation/userspace-api/media/drivers/camera-sensor.rst @@ -10,11 +10,13 @@ used to control the camera sensor drivers. You may also find :ref:`media_writing_camera_sensor_drivers` useful. -Frame size ----------- +Sensor internal pipeline configuration +-------------------------------------- -There are two distinct ways to configure the frame size produced by camera -sensors. +Camera sensors have an internal processing pipeline including cropping and +binning functionality. The sensor drivers belong to two distinct classes, freely +configurable and register list-based drivers, depending on how the driver +configures this functionality. Freely configurable camera sensor drivers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From patchwork Mon Feb 3 08:58:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13957069 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0457B1FDE22 for ; Mon, 3 Feb 2025 08:59:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573167; cv=none; b=tuI87scujUR5MXQomai4HvVr1JF0OyOcQTXhICr3aXAwhjaySEXXELkjaLLduSYl+hFHBlgIKhUjzMRlxCMpGiQGRiZdoWN1SxsbE1x97+h+SRgnw6e950lP5fScrPHoLf7ueyY6r51LOTiEWkF97gAOvsjanLjSZ2HXrcjcfCE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573167; c=relaxed/simple; bh=BTxVCDr7efo2g2IfuPmAEX13Q9oDVjflYhKjA8VF3yA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EAgWRxuMbXtY1DdZYm4XQPjc9nfGUD6wkbBkbxBo34YFpEiPcRqUV/+6F13fSXeTVuQOePgkO5SV980vn6+uY3UOtTpaeyjy2nMpBG4ui85UNi4ftyR5Xhhl5WeUcCa4mT83YbYdaQEYdMD0h2OvrRBxeXw62REZtKRedXy71ZA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=SbF3nuHt; arc=none smtp.client-ip=192.198.163.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="SbF3nuHt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1738573164; x=1770109164; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BTxVCDr7efo2g2IfuPmAEX13Q9oDVjflYhKjA8VF3yA=; b=SbF3nuHt154AQCjzQceagJMj8gBSfCTVHf4ExKRExv363zlzc1zJMRKP jSefvDOI38KBXXC5duak94DBVgTFF6mIHfTcCyaXt1etV6aPnXjuUpk4v BIZ6CUHPX42dmKj2DwttuAjENBH6t9EP6UqDgKKs48ZKeKTnJngPFKhrj VneMoM5QAEbL1T96u64Xb0pMz+2vOxcnWjx4BNb6R0cc8xDf0Mhkw16uU KsJ+xMcd5ibTfc25rhhwHfl/rbmfBw/h7Cn6q7saZcqAuyXuk1cq3jLJD zFs6EMKfvVth3DcxnfC/m9XQ/l04Q06wnrYC/hgO2A+aj5hg6lvy5Nmvi A==; X-CSE-ConnectionGUID: +j+FYjW1Stam14i9P4yNVA== X-CSE-MsgGUID: wj8/arvLS9KzQTof63TSYg== X-IronPort-AV: E=McAfee;i="6700,10204,11314"; a="50472622" X-IronPort-AV: E=Sophos;i="6.12,310,1728975600"; d="scan'208";a="50472622" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:24 -0800 X-CSE-ConnectionGUID: sl67IcfURcqZKH5FFhSqwA== X-CSE-MsgGUID: Sa3EaIItSxaKcVqLEX8eLQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,255,1732608000"; d="scan'208";a="110382953" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:16 -0800 Received: from svinhufvud.intel.com (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 84B4C11FAB1; Mon, 3 Feb 2025 10:59:11 +0200 (EET) Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo From: Sakari Ailus To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, Prabhakar , Kate Hsuan , Alexander Shiyan , Mikhail Rudenko , Dave Stevenson , Tommaso Merciai , Umang Jain , Benjamin Mugnier , Sylvain Petinot , Christophe JAILLET , Julien Massot , Naushir Patuck , "Yan, Dongcheng" , "Cao, Bingbu" , "Qiu, Tian Shu" , "Wang, Hongju" , Stefan Klug , Mirela Rabulea , =?utf-8?q?Andr=C3=A9_Apitzsch?= , Heimir Thor Sverrisson , Kieran Bingham , Stanislaw Gruszka , Mehdi Djait , Ricardo Ribalda Delgado , Hans de Goede Subject: [RFC v5 04/15] media: Documentation: Add subdev configuration models, raw sensor model Date: Mon, 3 Feb 2025 10:58:42 +0200 Message-Id: <20250203085853.1361401-5-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> References: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sub-device configuration models define what V4L2 API elements are available on a compliant sub-device and how do they behave. The patch also adds a model for common raw sensors. Signed-off-by: Sakari Ailus Reviewed-by: Tomi Valkeinen Reviewed-by: Lad Prabhakar --- .../media/drivers/camera-sensor.rst | 4 + .../media/v4l/common-raw-sensor.dia | 441 ++++++++++++++++++ .../media/v4l/common-raw-sensor.svg | 134 ++++++ .../userspace-api/media/v4l/dev-subdev.rst | 2 + .../media/v4l/subdev-config-model.rst | 209 +++++++++ 5 files changed, 790 insertions(+) create mode 100644 Documentation/userspace-api/media/v4l/common-raw-sensor.dia create mode 100644 Documentation/userspace-api/media/v4l/common-raw-sensor.svg create mode 100644 Documentation/userspace-api/media/v4l/subdev-config-model.rst diff --git a/Documentation/userspace-api/media/drivers/camera-sensor.rst b/Documentation/userspace-api/media/drivers/camera-sensor.rst index bc55c861fb69..5bc4c79d230c 100644 --- a/Documentation/userspace-api/media/drivers/camera-sensor.rst +++ b/Documentation/userspace-api/media/drivers/camera-sensor.rst @@ -18,6 +18,8 @@ binning functionality. The sensor drivers belong to two distinct classes, freely configurable and register list-based drivers, depending on how the driver configures this functionality. +Also see :ref:`media_subdev_config_model_common_raw_sensor`. + Freely configurable camera sensor drivers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -105,6 +107,8 @@ values programmed by the register sequences. The default values of these controls shall be 0 (disabled). Especially these controls shall not be inverted, independently of the sensor's mounting rotation. +.. _media_using_camera_sensor_drivers_embedded_data: + Embedded data ------------- diff --git a/Documentation/userspace-api/media/v4l/common-raw-sensor.dia b/Documentation/userspace-api/media/v4l/common-raw-sensor.dia new file mode 100644 index 000000000000..aa927527eae3 --- /dev/null +++ b/Documentation/userspace-api/media/v4l/common-raw-sensor.dia @@ -0,0 +1,441 @@ + + + + + + + + + + + + + #A4# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #image data (1)# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #embedded data (2)# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #source pad (0)# + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Documentation/userspace-api/media/v4l/common-raw-sensor.svg b/Documentation/userspace-api/media/v4l/common-raw-sensor.svg new file mode 100644 index 000000000000..1d6055da2519 --- /dev/null +++ b/Documentation/userspace-api/media/v4l/common-raw-sensor.svg @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Documentation/userspace-api/media/v4l/dev-subdev.rst b/Documentation/userspace-api/media/v4l/dev-subdev.rst index dcfcbd52490d..4d145bd3bd09 100644 --- a/Documentation/userspace-api/media/v4l/dev-subdev.rst +++ b/Documentation/userspace-api/media/v4l/dev-subdev.rst @@ -838,3 +838,5 @@ stream while it may be possible to enable and disable the embedded data stream. The embedded data format does not need to be configured on the sensor's pads as the format is dictated by the pixel data format in this case. + +.. include:: subdev-config-model.rst diff --git a/Documentation/userspace-api/media/v4l/subdev-config-model.rst b/Documentation/userspace-api/media/v4l/subdev-config-model.rst new file mode 100644 index 000000000000..b0bd09772ceb --- /dev/null +++ b/Documentation/userspace-api/media/v4l/subdev-config-model.rst @@ -0,0 +1,209 @@ +.. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later + +.. _media_subdev_config_model: + +Sub-device configuration models +=============================== + +A sub-device configuration model specifies in detail what the user space can +expect from a sub-device in terms of V4L2 sub-device interface support, +semantics included. + +A sub-device may implement more than one configuration model at the same +time. The implemented configuration models can be obtained from the sub-device's +``V4L2_CID_CONFIG_MODEL`` control. + +.. _media_subdev_config_model_common_raw_sensor: + +Common raw camera sensor model +------------------------------ + +The common raw camera sensor model defines a set of enumeration and +configuration interfaces (formats, selections etc.) that cover the vast majority +of functionality of raw camera sensors. Not all of the interfaces are +necessarily offered by all drivers. + +A sub-device complies with the common raw sensor model if the +``V4L2_CONFIG_MODEL_COMMON_RAW`` bit is set in the ``V4L2_CID_CONFIG_MODEL`` +control of the sub-device. + +The common raw camera sensor model is aligned with +:ref:`media_using_camera_sensor_drivers`. Please refer to that regarding aspects +not specified here. + +Each camera sensor implementing the common raw sensor model exposes a single +V4L2 sub-device. The sub-device contains a single source pad (0) and two or more +internal pads: an image data internal pad (1) and optionally an embedded data +pad (2). Additionally, further internal pads may be supported for other +features, in which case they are documented separately for the given device. + +This is shown in :ref:`media_subdev_config_model_common_raw_sensor_subdev`. + +.. _media_subdev_config_model_common_raw_sensor_subdev: + +.. kernel-figure:: common-raw-sensor.svg + :alt: common-raw-sensor.svg + :align: center + + **Common raw sensor sub-device** + +Routes +^^^^^^ + +A sub-device conforming to common raw camera sensor model implements the +following routes. + +.. flat-table:: Routes + :header-rows: 1 + + * - Sink pad/stream + - Source pad/stream + - Static (X/M(aybe)/-) + - Mandatory (X/-) + - Synopsis + * - 1/0 + - 0/0 + - X + - X + - Image data + * - 2/0 + - 0/1 + - M + - \- + - Embedded data + +Support for the embedded data stream is optional. Drivers supporting the +embedded data stream may allow disabling and enabling the route when the +streaming is disabled. + +Sensor pixel array size, cropping and binning +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The sensor's pixel array is divided into one or more areas. The areas around the +edge of the pixel array, usually one or more sides, may contain optical black +pixels, dummy pixels and other non-image pixels. The entire pixel array size is +conveyed by the format on (pad, stream) pair 1/0. + +A rectangle within the pixel array contains the visible pixels. Capturing the +non-visible pixels outside the visible pixel area may be supported by the +sensor. The visible pixel area corresponds to the ``V4L2_SEL_TGT_CROP_DEFAULT`` +selection target on (pad, stream) pair 1/0. + +Sensors can perform multiple operations that affect the output image size. First +of these is the analogue crop. Analogue crop limits the area of the pixel array +which the sensor will read, affecting sensor timing as well. The granularity of +the analogue crop configuration varies greatly across sensors: some sensors +support only a few different analogue crop configurations whereas others may +support anything divisible by a given number of pixels. The analogue crop +configuration corresponds the ``V4L2_SEL_TGT_CROP`` selection target on (pad, +stream) pair 1/0. The default analogue crop rectangle corresponds to the visible +pixel area. + +In the next step, binning is performed on the image data read from camera +sensor's pixel array, as determined by the analogue crop configuration. Enabling +binning will effectively result in an image smaller than the original by given +binning factors horizontally and vertically. Typical values are 1/2 and 1/3 but +others may well be supported by the hardware as well. + +Sub-sampling follows binning. Sub-sampling, like binning, reduces the size of +the image by including only a subset of samples read from the sensor's pixel +matrix, typically every n'th pixel horizontally and vertically, taking the +sensor's colour pattern into account. Sub-sampling is generally configurable +separately horizontally and vertically. + +Binning and sub-sampling are configured using the ``V4L2_SEL_TGT_COMPOSE`` +rectangle, relative to the analogue crop rectangle, on (pad, stream) pair +1/0. The driver implementation determines how to configure binning and +sub-sampling to achieve the desired size. + +The digital crop operation takes place after binning and sub-sampling. It is +configured by setting the ``V4L2_SEL_TGT_CROP`` rectangle on (pad, stream) pair +0/0. The resulting image size is further output by the sensor. + +The sensor's output mbus code is configured by setting the format on the (pad, +stream) pair 0/0. When setting the format, always use the same width and height +as for the digital crop setting. + +Drivers may only support some of even none of these configurations, in which +case they do not expose the corresponding selection rectangles. If any selection +targets are omitted, the further selection rectangle or format is instead +related to the previous implemented selection rectangle. For instance, if the +sensor supports binning but not analogue crop, then the binning configuration +(``V4L2_SEL_TGT_COMPOSE`` selection target) is done in relation to the visible +pixel area (``V4L2_SEL_TGT_CROP_DEFAULT`` selection target). + +Also refer to :ref:`Selection targets `. + +.. flat-table:: Selection targets on pads + :header-rows: 1 + + * - Pad/Stream + - Selection target/format + - Mandatory (X/-) + - Modifiable (X/-) + - Synopsis + * - 1/0 + - Format + - X + - \- + - Image data format. The width and the height fields indicates the full + size of the pixel array, including non-visible pixels. The media bus + code of this format reflects the native pixel depth of the sensor. + * - 1/0 + - ``V4L2_SEL_TGT_CROP_DEFAULT`` + - X + - \ + - The visible pixel area. This rectangle is relative to the format on the + same (pad, stream). + * - 1/0 + - ``V4L2_SEL_TGT_CROP`` + - \- + - X + - Analogue crop. Analogue crop typically has a coarse granularity. This + rectangle is relative to the format on the same (pad, stream). + * - 1/0 + - ``V4L2_SEL_TGT_COMPOSE`` + - \- + - X + - Binning and sub-sampling. This rectangle is relative to the + ``V4L2_SEL_TGT_CROP`` rectangle on the same (pad, stream). The + combination of binning and sub-sampling is configured using this + selection target. + * - 2/0 + - Format + - X + - \- + - Embedded data format. + * - 0/0 + - ``V4L2_SEL_TGT_CROP`` + - \- + - X + - Digital crop. This rectangle is relative to the ``V4L2_SEL_TGT_COMPOSE`` + rectangle on (pad, stream) pair 1/0. + * - 0/0 + - Format + - X + - X + - Image data source format. Always assign the width and height fields of + the format to the same values than for the ``V4L2_SEL_TGT_CROP`` + rectangle on (pad, stream) pair 0/0. The media bus code reflects the + pixel data output of the sensor. + * - 0/1 + - Format + - X + - \- + - Embedded data source format. + +Embedded data +^^^^^^^^^^^^^ + +The embedded data stream is produced by the sensor when the corresponding route +is enabled. The embedded data route may also be immutable or not exist at all, +in case the sensor (or the driver) does not support it. + +Generally the sensor embedded data width is determined by the width of the image +data whereas the number of lines are constant for the embedded data. The user +space may obtain the size of the embedded data once the image data size on the +source pad has been configured. + +Also see :ref:`media_using_camera_sensor_drivers_embedded_data`. From patchwork Mon Feb 3 08:58:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13957070 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6BE862066EA for ; Mon, 3 Feb 2025 08:59:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573169; cv=none; b=tWv9nIXvSCYViPx990easrhxULIgJkQqHJgqMITnfy+1VaX0tsvnars/hzT4/7UFWkE7dwixmipzlEj2rKAencEEPR0IAhyaiZJ1HfhxHmvvHSTR+2qZsZLYO6ykbMr948EKPs/iE4lLf0e2KlVlATxUxjGuTUJ99oeyvgMcjo8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573169; c=relaxed/simple; bh=5vlaUg1R9x+PdU7jkf01tddKR5QgqMcfnNVKYq+QLvc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eFvXzW5AjiISmj/JxMLB0KrVFdSAdx7lFnR9PTARHZ5v9S6OJZJgVjgAOsExBgk33SggSoOWL+WpuRJ06sX2JPMBwSwgwSimkOmIs+a/hIsx7PWjxKTykQzJStcUkpShixV/rQXiakB1lUeY8ECAC+cR97+3u3B/Fa7phbIVZaI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=MJqCdzfB; arc=none smtp.client-ip=192.198.163.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="MJqCdzfB" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1738573168; x=1770109168; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5vlaUg1R9x+PdU7jkf01tddKR5QgqMcfnNVKYq+QLvc=; b=MJqCdzfBIjzuDe3eKxec2fl8eeysGbnz5BxguH6+IvaMdAUj2KWH6Bkj VnwS9O14YdLjEj9M5gdD1Sir04y7O87aGDhg88ZXpyl9yrM4CQxRcByoe tOI4y7lfbirWP5P8TbpVglp8eD4z6Vpc0qA0PN3q1ADvhkz398zAyeBXh CoLWLIIVhFLJAT2J0wWugE0qg+zJPSQxKqx7CsBiifh+/9GG0dTaJdckm JMONXte/hlbRdJ5NgU5lhYPctN3H93wn3KTRtG1tuyboBxVgB5AC8Qgvr FznD/hdFwBNoMLn8X8RgPzTQlsunwliDqPe2KN7ZXIIxcf859qESyhrJM w==; X-CSE-ConnectionGUID: WbqPJZgfQ62ktFfUr5KuHA== X-CSE-MsgGUID: 6KK7nIMsQqm+Fi4Xkq8Oew== X-IronPort-AV: E=McAfee;i="6700,10204,11314"; a="50472651" X-IronPort-AV: E=Sophos;i="6.12,310,1728975600"; d="scan'208";a="50472651" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:27 -0800 X-CSE-ConnectionGUID: n0pFkRyrTHe3uHadU5Bmxw== X-CSE-MsgGUID: wFtZ3gSIRpm7VjN92Na2Kg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,255,1732608000"; d="scan'208";a="110382959" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:21 -0800 Received: from svinhufvud.intel.com (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 0D02E1204F2; Mon, 3 Feb 2025 10:59:14 +0200 (EET) Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo From: Sakari Ailus To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, Prabhakar , Kate Hsuan , Alexander Shiyan , Mikhail Rudenko , Dave Stevenson , Tommaso Merciai , Umang Jain , Benjamin Mugnier , Sylvain Petinot , Christophe JAILLET , Julien Massot , Naushir Patuck , "Yan, Dongcheng" , "Cao, Bingbu" , "Qiu, Tian Shu" , "Wang, Hongju" , Stefan Klug , Mirela Rabulea , =?utf-8?q?Andr=C3=A9_Apitzsch?= , Heimir Thor Sverrisson , Kieran Bingham , Stanislaw Gruszka , Mehdi Djait , Ricardo Ribalda Delgado , Hans de Goede Subject: [RFC v5 05/15] media: Documentation: Add scaling and post-scaler crop for common raw Date: Mon, 3 Feb 2025 10:58:43 +0200 Message-Id: <20250203085853.1361401-6-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> References: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Document scaling and post-scaler digital crop operations for the common raw sensor model. Signed-off-by: Sakari Ailus Reviewed-by: Tomi Valkeinen Reviewed-by: Lad Prabhakar --- .../media/v4l/subdev-config-model.rst | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/Documentation/userspace-api/media/v4l/subdev-config-model.rst b/Documentation/userspace-api/media/v4l/subdev-config-model.rst index b0bd09772ceb..f15e5495cc34 100644 --- a/Documentation/userspace-api/media/v4l/subdev-config-model.rst +++ b/Documentation/userspace-api/media/v4l/subdev-config-model.rst @@ -118,11 +118,18 @@ sub-sampling to achieve the desired size. The digital crop operation takes place after binning and sub-sampling. It is configured by setting the ``V4L2_SEL_TGT_CROP`` rectangle on (pad, stream) pair -0/0. The resulting image size is further output by the sensor. +0/0. + +The scaling operation is performed after the digital crop. It is configured by +setting the ``V4L2_SEL_TGT_COMPOSE`` rectangle on (pad, stream) pair 0/0, +relative to the digital crop. The sensor's output mbus code is configured by setting the format on the (pad, -stream) pair 0/0. When setting the format, always use the same width and height -as for the digital crop setting. +stream) pair 0/0. The width and height fields are used to configure post-scaler +digital crop if supported by the driver, affecting the right and bottom edges of +the frame. If post-scaler digital crop is not supported, the width and height +fields of the format will match the compose rectangle sizes applied on the same +0/0 (pad, stream) pair. Drivers may only support some of even none of these configurations, in which case they do not expose the corresponding selection rectangles. If any selection @@ -180,12 +187,19 @@ Also refer to :ref:`Selection targets `. - X - Digital crop. This rectangle is relative to the ``V4L2_SEL_TGT_COMPOSE`` rectangle on (pad, stream) pair 1/0. + * - 0/0 + - ``V4L2_SEL_TGT_COMPOSE`` + - \- + - X + - Scaling. This rectangle is relative to the ``V4L2_SEL_TGT_CROP`` + rectangle on (pad, stream) pair 0/0. * - 0/0 - Format - X - X - - Image data source format. Always assign the width and height fields of - the format to the same values than for the ``V4L2_SEL_TGT_CROP`` + - Image data source format and post-scaler crop. The width and height + fields of the format, used to configure post-scaler crop on the right + and bottom edges of the image, are related to the ``V4L2_SEL_TGT_COMPOSE`` rectangle on (pad, stream) pair 0/0. The media bus code reflects the pixel data output of the sensor. * - 0/1 From patchwork Mon Feb 3 08:58:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13957071 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B1462066EA for ; Mon, 3 Feb 2025 08:59:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573172; cv=none; b=RoiLs13P1KFSE9yjq35Jt0xS8ekKTeR9V62ac7nTqSUVPXOEvfGX1wBkzFYIS3pvZ3JPOzHlA7ahanGpmsj1kBnDs475v1Gp/4sj3G55yJVWYPiN6rcfDhBAsDRFmKvBSjMo+LZEfj8DD89J5K1OjHsMEi8qFMZKO9tk2eHnqO4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573172; c=relaxed/simple; bh=r9zqIRw6f+8FmkHtzsQ40XEEK1zoMIrS6/e9TGsu/wQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=IJ8B1KXQMWCPCn0iXypchKOZAXHYtPhUu9YRPTYICRAkD1xMCQKgb/n+2oYJQn7bTX4xNlJc79Z+c1Qs+5F4OMYHL/eoHFYPNdKJOxXz8fnANYBT5HthnDD/JlXPxVSadhk0271tRZZc87DkhW7xqlchArB6p+T2MLav2/p6wxw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=WxnDl+zZ; arc=none smtp.client-ip=192.198.163.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="WxnDl+zZ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1738573171; x=1770109171; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=r9zqIRw6f+8FmkHtzsQ40XEEK1zoMIrS6/e9TGsu/wQ=; b=WxnDl+zZzPZNlb2vG1b6vxLT7y/xegpFKSrcWwNEBkZ1YvnPiJM1mxTC PuBDhC28Utft5V/rIVdswJRtgDYbq0LnTbzkttnDZFZ6lOz9zth0U1H/3 QOsmJ9QL0mQ2cyxuHOpjcgeM1syMHzQFin9JTZ/ruMgnmj0FoZWGEC3U0 W4y0c3vqqKlmf0+/8A9oTZxrRteETFJpf/akjSZ4K/9FKPT30DnQmfSAa sBqGYhvikQhAROBCzdQP+4iCQ62DpY69CNOmtsweyjyE0hQR5S4j3KB6f 2OwmV7RZLyMH+ODMr/jbRsJ54+I114rrNwlhOpWJeR/R0hPBeUCbXNQUY A==; X-CSE-ConnectionGUID: zUYXIezMQnSYYPIUzreCVg== X-CSE-MsgGUID: qQD7fx95SwS5uRP55HWZnA== X-IronPort-AV: E=McAfee;i="6700,10204,11314"; a="50472683" X-IronPort-AV: E=Sophos;i="6.12,310,1728975600"; d="scan'208";a="50472683" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:31 -0800 X-CSE-ConnectionGUID: yI+Yb3DHTJqAu/m41qqVIw== X-CSE-MsgGUID: SXgGQ6vxS3OzKYwnfsmLWg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,255,1732608000"; d="scan'208";a="110382968" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:24 -0800 Received: from svinhufvud.intel.com (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 01FEF11FC22; Mon, 3 Feb 2025 10:59:18 +0200 (EET) Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo From: Sakari Ailus To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, Prabhakar , Kate Hsuan , Alexander Shiyan , Mikhail Rudenko , Dave Stevenson , Tommaso Merciai , Umang Jain , Benjamin Mugnier , Sylvain Petinot , Christophe JAILLET , Julien Massot , Naushir Patuck , "Yan, Dongcheng" , "Cao, Bingbu" , "Qiu, Tian Shu" , "Wang, Hongju" , Stefan Klug , Mirela Rabulea , =?utf-8?q?Andr=C3=A9_Apitzsch?= , Heimir Thor Sverrisson , Kieran Bingham , Stanislaw Gruszka , Mehdi Djait , Ricardo Ribalda Delgado , Hans de Goede Subject: [RFC v5 06/15] media: uapi: Add V4L2_CID_CONFIG_MODEL control Date: Mon, 3 Feb 2025 10:58:44 +0200 Message-Id: <20250203085853.1361401-7-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> References: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add the V4L2_CID_CONFIG_MODEL control for the configuration model. Signed-off-by: Sakari Ailus Reviewed-by: Laurent Pinchart Reviewed-by: Lad Prabhakar --- .../userspace-api/media/v4l/ext-ctrls-image-process.rst | 4 ++++ drivers/media/v4l2-core/v4l2-ctrls-defs.c | 5 +++++ include/uapi/linux/v4l2-controls.h | 3 +++ 3 files changed, 12 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst index 27803dca8d3e..2ae17ed99729 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst @@ -55,3 +55,7 @@ Image Process Control IDs control value divided by e.g. 0x100, meaning that to get no digital gain the control value needs to be 0x100. The no-gain configuration is also typically the default. + +``V4L2_CID_CONFIG_MODEL (bitmask)`` + Which configuration models the sub-device supports. Please see + :ref:`media_subdev_config_model`. This is a read-only control. diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c index 1ea52011247a..24c9c25e20d1 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c @@ -1164,6 +1164,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_TEST_PATTERN: return "Test Pattern"; case V4L2_CID_DEINTERLACING_MODE: return "Deinterlacing Mode"; case V4L2_CID_DIGITAL_GAIN: return "Digital Gain"; + case V4L2_CID_CONFIG_MODEL: return "Sub-device configuration model"; /* DV controls */ /* Keep the order of the 'case's the same as in v4l2-controls.h! */ @@ -1481,6 +1482,10 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_DV_RX_POWER_PRESENT: *type = V4L2_CTRL_TYPE_BITMASK; break; + case V4L2_CID_CONFIG_MODEL: + *flags |= V4L2_CTRL_FLAG_READ_ONLY; + *type = V4L2_CTRL_TYPE_BITMASK; + break; case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE: case V4L2_CID_MIN_BUFFERS_FOR_OUTPUT: *type = V4L2_CTRL_TYPE_INTEGER; diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 974fd254e573..731add75d9ee 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -1225,6 +1225,9 @@ enum v4l2_jpeg_chroma_subsampling { #define V4L2_CID_TEST_PATTERN (V4L2_CID_IMAGE_PROC_CLASS_BASE + 3) #define V4L2_CID_DEINTERLACING_MODE (V4L2_CID_IMAGE_PROC_CLASS_BASE + 4) #define V4L2_CID_DIGITAL_GAIN (V4L2_CID_IMAGE_PROC_CLASS_BASE + 5) +#define V4L2_CID_CONFIG_MODEL (V4L2_CID_IMAGE_PROC_CLASS_BASE + 6) + +#define V4L2_CID_CONFIG_MODEL_COMMON_RAW (1U << 0) /* DV-class control IDs defined by V4L2 */ #define V4L2_CID_DV_CLASS_BASE (V4L2_CTRL_CLASS_DV | 0x900) From patchwork Mon Feb 3 08:58:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13957072 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 67E4D206F18 for ; Mon, 3 Feb 2025 08:59:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573175; cv=none; b=ZDTMce3b5qAdVf89dWXweTxL0tieo1HMW4xehGV6V/y4FwEp+j/J3Ta2WsNQabj0IHSx240Et8seC6N1MxtcUmJ4FUbtuT0olty9KOMw6ZQE/j5iWnAoEEFWJ65iJHVyOJlyVEQ0sJzbGaD7+WsEOZEAHT0Q1OuhzNtCq28r80w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573175; c=relaxed/simple; bh=7KTRKidiKuQyjrzuGr1x3NP6RgTolxd1QWlMqfM/9b4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YsSK3oZLDUWqXrE4F6SzCCE5RPAz+tb7OTanCT/pzLatMNmYP9xDjgdgTdEWM44ZZmVr+UOPmRqYnE6XklUCvNhJ5KruSf/SftHOCWRO4V3mM/rQTlvQwGuWasGcHJkrEuDupXxiWb2soTSnV7WaSgOJHgGNEIof4+nUGp3FHXo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=QwWkTHhL; arc=none smtp.client-ip=192.198.163.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="QwWkTHhL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1738573175; x=1770109175; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7KTRKidiKuQyjrzuGr1x3NP6RgTolxd1QWlMqfM/9b4=; b=QwWkTHhLH0O+HrB1dFn1qk7cgAbk9VbWmcXPsbXEukMQrAKK4E/x4B6N 1A2FdaMVCHpbfpP6Z5/Ec7kh/KCk8kcpY12QPxBJwb36sZtaz6FkOpUEI dHMopkjEPLR2r/UAJWm/Owy4+adPIs5u3nUVvQRQKe0m/UgWWlb4WvyYn HgWg974yFIAUqwMaWjJ367FBol9UkykuMvJU8xJ5Qnp6a+Yc62k6kYTSM URlbxTJxxowpDcdnpgWNygiroZWiiHY9zt9gM8pXAMq4VTAZxTTtBKRaz YS0QNC0UenBIuqMrn9skS4DyYQ/BRZ/qK+d4kd9p1SyLF+oQLmaqHr3Px A==; X-CSE-ConnectionGUID: b4votyyTRDaZtrXsGPQSJA== X-CSE-MsgGUID: LhjiBNGxT7+P2LjPpASgFA== X-IronPort-AV: E=McAfee;i="6700,10204,11314"; a="50472697" X-IronPort-AV: E=Sophos;i="6.12,310,1728975600"; d="scan'208";a="50472697" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:34 -0800 X-CSE-ConnectionGUID: KSlutdmkTs6VSaELE1yGXw== X-CSE-MsgGUID: 5raauqzRSHK1c4f3DXhpCw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,255,1732608000"; d="scan'208";a="110382977" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:28 -0800 Received: from svinhufvud.intel.com (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id F293B11F9C3; Mon, 3 Feb 2025 10:59:22 +0200 (EET) Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo From: Sakari Ailus To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, Prabhakar , Kate Hsuan , Alexander Shiyan , Mikhail Rudenko , Dave Stevenson , Tommaso Merciai , Umang Jain , Benjamin Mugnier , Sylvain Petinot , Christophe JAILLET , Julien Massot , Naushir Patuck , "Yan, Dongcheng" , "Cao, Bingbu" , "Qiu, Tian Shu" , "Wang, Hongju" , Stefan Klug , Mirela Rabulea , =?utf-8?q?Andr=C3=A9_Apitzsch?= , Heimir Thor Sverrisson , Kieran Bingham , Stanislaw Gruszka , Mehdi Djait , Ricardo Ribalda Delgado , Hans de Goede Subject: [RFC v5 07/15] media: uapi: Add V4L2_CID_COLOUR_PATTERN for describing colour patterns Date: Mon, 3 Feb 2025 10:58:45 +0200 Message-Id: <20250203085853.1361401-8-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> References: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add V4L2_CID_COLOUR_PATTERN to tell the camera sensor's native colour pattern. Signed-off-by: Sakari Ailus --- .../userspace-api/media/v4l/ext-ctrls-image-source.rst | 10 ++++++++++ drivers/media/v4l2-core/v4l2-ctrls-defs.c | 1 + include/uapi/linux/v4l2-controls.h | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst index 71f23f131f97..fca729512b6f 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst @@ -92,3 +92,13 @@ Image Source Control IDs representing a gain of exactly 1.0. For example, if this default value is reported as being (say) 128, then a value of 192 would represent a gain of exactly 1.5. + +``V4L2_CID_COLOUR_PATTERN (integer)`` + This control determines the colour components and pixel order in the + sensor's CFA (Colour Filter Array) when used in conjunction with + :ref:`luma-only mbus codes MEDIA_BUS_FMT_Yx_1Xx (where 'x' is the bit depth) + ` pixelformats. + + This control may only be used on a V4L2 sub-device. + + This is a read-only control. diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c index 24c9c25e20d1..5b6a4a94f18f 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c @@ -1155,6 +1155,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_TEST_PATTERN_BLUE: return "Blue Pixel Value"; case V4L2_CID_TEST_PATTERN_GREENB: return "Green (Blue) Pixel Value"; case V4L2_CID_NOTIFY_GAINS: return "Notify Gains"; + case V4L2_CID_COLOUR_PATTERN: return "Colour Pattern"; /* Image processing controls */ /* Keep the order of the 'case's the same as in v4l2-controls.h! */ diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 731add75d9ee..8e761c38b995 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -1214,6 +1214,12 @@ enum v4l2_jpeg_chroma_subsampling { #define V4L2_CID_UNIT_CELL_SIZE (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 8) #define V4L2_CID_NOTIFY_GAINS (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 9) +#define V4L2_CID_COLOUR_PATTERN (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 10) +#define V4L2_COLOUR_PATTERN_GRBG 0 +#define V4L2_COLOUR_PATTERN_RGGB 1 +#define V4L2_COLOUR_PATTERN_BGGR 2 +#define V4L2_COLOUR_PATTERN_GBRG 3 + /* Image processing controls */ From patchwork Mon Feb 3 08:58:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13957073 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7326A207A1D for ; Mon, 3 Feb 2025 08:59:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573180; cv=none; b=qlAHFgh4m8Ov/dJ0pVltWMzY/ztxnqDfgDDUibki0EX5aAjOZuZpeUeHdMVDpXNrv/fKfinERE857osMegkxHMIY9bQteet7sQrqOszCb+krd5/XhF6yaJOtikv0cRqYW1VZbj+xmIApNvzheP63dFIgdddLJiJDAI3Ui4MsiZ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573180; c=relaxed/simple; bh=RCRhkxsTuLiB0PNoqmda/tuNlvjwXmN41bUIajl8d/Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KRyRb8B1jbanZfTy/cR27/k7SlGkDBi5yMxkj6nfTiUctGnDvb5ZUwu76GbcnSbRr6vLjZbIbRtM1nuo+iEuOewsXG5uYxlHfykSlcHpvzuWav7F8z1wk3L+zgMu59CDnT4PyKIESNVrlEpEj8QMFkCJ/+UAOmavABq0+pVdjOQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=HVyW1TUp; arc=none smtp.client-ip=198.175.65.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="HVyW1TUp" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1738573179; x=1770109179; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RCRhkxsTuLiB0PNoqmda/tuNlvjwXmN41bUIajl8d/Y=; b=HVyW1TUpbEtOioIVSr9/iXy07udet+aaqF0O4qiCrr4BTovl6/G24GJg 1qkv8TuhOBpA8AbdpD7pwF3BEHlNxSClhWWUcwcYX4MVJYLg2hh5QKujt ZicmUo3YXGPIxLlp7ZArNVqakfL6YrM9+VpSyI/y9fAczKj8bKEDhviG+ eAffVEQhvVX8CoC7X9Hhl49TzS9BIt17ketpoEL8eEA/HdgfcbnYVY6GF 6U6D5UhTVJl+gOHiQdhPWCC7VAI/1DlxVnsAiAZMdK3CP40eYRchflFFv Oy+hAyCdWBbA7tNHxpvUvc5fBAWkvBTbkCl6gHV66iyxFAo7xC2hRgbP0 A==; X-CSE-ConnectionGUID: l970VrDeQlGNbaXCjEIGfQ== X-CSE-MsgGUID: OGRGlQJKQOmOy4VpAP2+Og== X-IronPort-AV: E=McAfee;i="6700,10204,11334"; a="56485375" X-IronPort-AV: E=Sophos;i="6.13,255,1732608000"; d="scan'208";a="56485375" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:39 -0800 X-CSE-ConnectionGUID: Fk18M5a8QJOtbEjB+46cwg== X-CSE-MsgGUID: TnaZ3y6GSQKG1x1+4Jy4zA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,255,1732608000"; d="scan'208";a="110066341" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:32 -0800 Received: from svinhufvud.intel.com (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id DA08611FAB1; Mon, 3 Feb 2025 10:59:26 +0200 (EET) Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo From: Sakari Ailus To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, Prabhakar , Kate Hsuan , Alexander Shiyan , Mikhail Rudenko , Dave Stevenson , Tommaso Merciai , Umang Jain , Benjamin Mugnier , Sylvain Petinot , Christophe JAILLET , Julien Massot , Naushir Patuck , "Yan, Dongcheng" , "Cao, Bingbu" , "Qiu, Tian Shu" , "Wang, Hongju" , Stefan Klug , Mirela Rabulea , =?utf-8?q?Andr=C3=A9_Apitzsch?= , Heimir Thor Sverrisson , Kieran Bingham , Stanislaw Gruszka , Mehdi Djait , Ricardo Ribalda Delgado , Hans de Goede Subject: [RFC v5 08/15] media: uapi: Correct generic CSI-2 metadata format 4cc Date: Mon, 3 Feb 2025 10:58:46 +0200 Message-Id: <20250203085853.1361401-9-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> References: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Rework the pixelformat 4cc for CSI-2 generic metadata. This can be done as no driver uses this yet and the interface is disabled. Signed-off-by: Sakari Ailus --- .../userspace-api/media/v4l/metafmt-generic.rst | 2 +- include/uapi/linux/videodev2.h | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Documentation/userspace-api/media/v4l/metafmt-generic.rst b/Documentation/userspace-api/media/v4l/metafmt-generic.rst index 5116038af13d..1d46f1c4add1 100644 --- a/Documentation/userspace-api/media/v4l/metafmt-generic.rst +++ b/Documentation/userspace-api/media/v4l/metafmt-generic.rst @@ -1,7 +1,7 @@ .. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later ******************************************************************************************************************************************************************************************************************************************************************************** -V4L2_META_FMT_GENERIC_8 ('MET8'), V4L2_META_FMT_GENERIC_CSI2_10 ('MC1A'), V4L2_META_FMT_GENERIC_CSI2_12 ('MC1C'), V4L2_META_FMT_GENERIC_CSI2_14 ('MC1E'), V4L2_META_FMT_GENERIC_CSI2_16 ('MC1G'), V4L2_META_FMT_GENERIC_CSI2_20 ('MC1K'), V4L2_META_FMT_GENERIC_CSI2_24 ('MC1O') +V4L2_META_FMT_GENERIC_8 ('MET8'), V4L2_META_FMT_GENERIC_CSI2_10 ('MECA'), V4L2_META_FMT_GENERIC_CSI2_12 ('MECC'), V4L2_META_FMT_GENERIC_CSI2_14 ('MECE'), V4L2_META_FMT_GENERIC_CSI2_16 ('MECG'), V4L2_META_FMT_GENERIC_CSI2_20 ('MECK'), V4L2_META_FMT_GENERIC_CSI2_24 ('MECO') ******************************************************************************************************************************************************************************************************************************************************************************** diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index e7c4dce39007..c8e30ab1de7b 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -869,12 +869,12 @@ struct v4l2_pix_format { * adding new ones! */ #define V4L2_META_FMT_GENERIC_8 v4l2_fourcc('M', 'E', 'T', '8') /* Generic 8-bit metadata */ -#define V4L2_META_FMT_GENERIC_CSI2_10 v4l2_fourcc('M', 'C', '1', 'A') /* 10-bit CSI-2 packed 8-bit metadata */ -#define V4L2_META_FMT_GENERIC_CSI2_12 v4l2_fourcc('M', 'C', '1', 'C') /* 12-bit CSI-2 packed 8-bit metadata */ -#define V4L2_META_FMT_GENERIC_CSI2_14 v4l2_fourcc('M', 'C', '1', 'E') /* 14-bit CSI-2 packed 8-bit metadata */ -#define V4L2_META_FMT_GENERIC_CSI2_16 v4l2_fourcc('M', 'C', '1', 'G') /* 16-bit CSI-2 packed 8-bit metadata */ -#define V4L2_META_FMT_GENERIC_CSI2_20 v4l2_fourcc('M', 'C', '1', 'K') /* 20-bit CSI-2 packed 8-bit metadata */ -#define V4L2_META_FMT_GENERIC_CSI2_24 v4l2_fourcc('M', 'C', '1', 'O') /* 24-bit CSI-2 packed 8-bit metadata */ +#define V4L2_META_FMT_GENERIC_CSI2_10 v4l2_fourcc('M', 'E', 'C', 'A') /* 10-bit CSI-2 packed 8-bit metadata */ +#define V4L2_META_FMT_GENERIC_CSI2_12 v4l2_fourcc('M', 'E', 'C', 'C') /* 12-bit CSI-2 packed 8-bit metadata */ +#define V4L2_META_FMT_GENERIC_CSI2_14 v4l2_fourcc('M', 'E', 'C', 'E') /* 14-bit CSI-2 packed 8-bit metadata */ +#define V4L2_META_FMT_GENERIC_CSI2_16 v4l2_fourcc('M', 'E', 'C', 'G') /* 16-bit CSI-2 packed 8-bit metadata */ +#define V4L2_META_FMT_GENERIC_CSI2_20 v4l2_fourcc('M', 'E', 'C', 'K') /* 20-bit CSI-2 packed 8-bit metadata */ +#define V4L2_META_FMT_GENERIC_CSI2_24 v4l2_fourcc('M', 'E', 'C', 'O') /* 24-bit CSI-2 packed 8-bit metadata */ #endif /* priv field value to indicates that subsequent fields are valid. */ From patchwork Mon Feb 3 08:58:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13957074 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 70525207A1C for ; Mon, 3 Feb 2025 08:59:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573183; cv=none; b=RIJ2XFYNn7BxUVW/3XiqZl/LvElaEw91INH1FpMrJ6u9RiQ1Rd9bdZ4D08XEuWwvWMwO6cCWbCC+BnenWQMpblMxeQZuoWQ2tTtIg8YxdsdsD7AKD2mlufLm7TVoHJ87VBg7RrdpxBJDEutUKhTMCe4px/gD0VxFsK0MJslkxO8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573183; c=relaxed/simple; bh=SfzJn9M2bjse7hkVshxkPCf9F6K8r07NrS2mWkE8rYE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BN3gd5VUtshX+UpD6/RpXxy8YwvK21QYNRkjtHkJAlm0c7fy+13vFQ++c5D2NUGRIXHypfqOSFjAJXHvmw2rvwSVuZoW90SEgutJ11EO7t9H6mOuP6AQQ6n4n/7seR2tV1x1qEn3PlUn5bxlNYvGHh/TSHd1k2/PCtQDNAwKYnw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ESmvUH2C; arc=none smtp.client-ip=198.175.65.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ESmvUH2C" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1738573182; x=1770109182; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SfzJn9M2bjse7hkVshxkPCf9F6K8r07NrS2mWkE8rYE=; b=ESmvUH2COr2bqD60y9fx0rdcJRSNHbZ1cXc0D1SUu+j90YDTQzADC0fk MG7rUjdW+Vjx11VdXpMmdBZgzwfYnNlqwN7z+6vq+pbzXXagQZh0DK94V LYDJ3d8CbjKrN4qEA7f4XundGwOWg74cz7bvAukg2hxr7TaKFmMgjbsEu Fy/6B3Kn46mRM4DvvDoHuqWV/0SV4sCOQB2NqpTxME1JqkiWtZGpYDr6O +Z0rECvbI19UWN4IAcakZOZ9xr/CRwQtzWHrCPIkKmXrYo+K37k+eS6D1 XKGTIRyd1OXTqv8at/tlkghmKTRFh3DqvyvLZPxvcNcLXdDpNBeMzoCdm Q==; X-CSE-ConnectionGUID: jh2Z2dD+QmqwHpiKjppuUQ== X-CSE-MsgGUID: n2gns8ueSLOm13SJUZJQKw== X-IronPort-AV: E=McAfee;i="6700,10204,11334"; a="56485401" X-IronPort-AV: E=Sophos;i="6.13,255,1732608000"; d="scan'208";a="56485401" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:42 -0800 X-CSE-ConnectionGUID: X/QFMKdoQv6Qz0OgfjD92A== X-CSE-MsgGUID: rSfR41gRQW2BlhPk4PW+eg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,255,1732608000"; d="scan'208";a="110066351" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:36 -0800 Received: from svinhufvud.intel.com (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id B244011FC22; Mon, 3 Feb 2025 10:59:30 +0200 (EET) Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo From: Sakari Ailus To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, Prabhakar , Kate Hsuan , Alexander Shiyan , Mikhail Rudenko , Dave Stevenson , Tommaso Merciai , Umang Jain , Benjamin Mugnier , Sylvain Petinot , Christophe JAILLET , Julien Massot , Naushir Patuck , "Yan, Dongcheng" , "Cao, Bingbu" , "Qiu, Tian Shu" , "Wang, Hongju" , Stefan Klug , Mirela Rabulea , =?utf-8?q?Andr=C3=A9_Apitzsch?= , Heimir Thor Sverrisson , Kieran Bingham , Stanislaw Gruszka , Mehdi Djait , Ricardo Ribalda Delgado , Hans de Goede Subject: [RFC v5 09/15] media: uapi: Documentation: Improve column width hints for examples Date: Mon, 3 Feb 2025 10:58:47 +0200 Message-Id: <20250203085853.1361401-10-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> References: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use less arbitrary widths for the columns in metadata layout examples. Signed-off-by: Sakari Ailus --- Documentation/userspace-api/media/v4l/metafmt-generic.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/userspace-api/media/v4l/metafmt-generic.rst b/Documentation/userspace-api/media/v4l/metafmt-generic.rst index 1d46f1c4add1..a800342c8071 100644 --- a/Documentation/userspace-api/media/v4l/metafmt-generic.rst +++ b/Documentation/userspace-api/media/v4l/metafmt-generic.rst @@ -74,7 +74,7 @@ This format is little endian. **Byte Order Of V4L2_META_FMT_GENERIC_CSI2_10.** Each cell is one byte. "M" denotes a byte of metadata and "x" a byte of padding. -.. tabularcolumns:: |p{2.4cm}|p{1.2cm}|p{1.2cm}|p{1.2cm}|p{1.2cm}|p{.8cm}| +.. tabularcolumns:: |p{2.4cm}|p{1.2cm}|p{1.2cm}|p{1.2cm}|p{1.2cm}|p{1.8cm}| .. flat-table:: Sample 4x2 Metadata Frame :header-rows: 0 @@ -118,7 +118,7 @@ This format is little endian. **Byte Order Of V4L2_META_FMT_GENERIC_CSI2_12.** Each cell is one byte. "M" denotes a byte of metadata and "x" a byte of padding. -.. tabularcolumns:: |p{2.4cm}|p{1.2cm}|p{1.2cm}|p{1.2cm}|p{1.2cm}|p{.8cm}|p{.8cm}| +.. tabularcolumns:: |p{2.4cm}|p{1.2cm}|p{1.2cm}|p{1.8cm}|p{1.2cm}|p{1.2cm}|p{1.8cm}| .. flat-table:: Sample 4x2 Metadata Frame :header-rows: 0 @@ -159,7 +159,7 @@ This format is little endian. **Byte Order Of V4L2_META_FMT_GENERIC_CSI2_14.** Each cell is one byte. "M" denotes a byte of metadata and "x" a byte of padding. -.. tabularcolumns:: |p{2.4cm}|p{1.2cm}|p{1.2cm}|p{1.2cm}|p{1.2cm}|p{.8cm}|p{.8cm}|p{.8cm}| +.. tabularcolumns:: |p{2.4cm}|p{1.2cm}|p{1.2cm}|p{1.2cm}|p{1.2cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}| .. flat-table:: Sample 4x2 Metadata Frame :header-rows: 0 @@ -255,7 +255,7 @@ This format is little endian. **Byte Order Of V4L2_META_FMT_GENERIC_CSI2_20.** Each cell is one byte. "M" denotes a byte of metadata and "x" a byte of padding. -.. tabularcolumns:: |p{2.4cm}|p{1.2cm}|p{.8cm}|p{1.2cm}|p{.8cm}|p{.8cm}|p{1.2cm}|p{.8cm}|p{1.2cm}|p{.8cm}|p{.8cm}| +.. tabularcolumns:: |p{2.4cm}|p{1.2cm}|p{1.2cm}|p{1.2cm}|p{1.2cm}|p{1.8cm}|p{1.2cm}|p{1.2cm}|p{1.2cm}|p{1.2cm}|p{1.8cm} .. flat-table:: Sample 4x2 Metadata Frame :header-rows: 0 From patchwork Mon Feb 3 08:58:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13957075 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86979207A31 for ; Mon, 3 Feb 2025 08:59:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573187; cv=none; b=u2Xqeree+kABlXZFfUKoBPbXEEpajzzPKRlumlr5AKwMWTuEw1hxrMcDq1jJGkDP9xkvOKW+69bIPUBfEz973G44rmkWlAEy1p26jurw3HyTN3t5vNO3F/CrlLvF8SSGB6l5nJIzPJ26q36lL6/y/vJjNBWXgxuvIL6UBXLipy0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573187; c=relaxed/simple; bh=A7LfAM8uQlowCF2ENCO4YsrEYCod4Tp1T3ZsImhdxwo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HhgFZpgkFpdDC6qB5vPKPZ6FMS7iOML6yMnEo3GirsXwBVGXeMsN86FRH35FPU7a10TjUcSmTOyPsWOXVEu7HLt1sJo3W3mcEOfN1/VJ41MrCqGH7QDyvUXnP3fb7mkjwpUUMuuuu3fNJCaXc/GlcNCdv/cez2H7QpyolOV5wNc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=gZR3zefg; arc=none smtp.client-ip=198.175.65.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gZR3zefg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1738573186; x=1770109186; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=A7LfAM8uQlowCF2ENCO4YsrEYCod4Tp1T3ZsImhdxwo=; b=gZR3zefg1iy2XyiuBYIQDrMWn9h7UIfejw8zzl4zjGM2J0yc8Vv8zTpo pzjpOR3dVcYR2QwchlmwGczqjrjLrvQCm2FUAnnuyfBAWpd2VPLvWY3Q3 XW6UQReY1LzThhaSbBgbI1PjDNhOkM36vUJgSKqUeQ5wTbO11im5C+Mf/ Q0M/5NHjaBC80k77gpB5nPMmLeHY4U5hJpEi8kdL764DzRZkHilnFkz3R b7E6l1bABm1ROZWg4+wxGbw8VC5xUXNSDCErMgKAFy6s6V/X1M05KxcLs WL8QapOZhrJ/I+XrTW6VtUY/vAwBq2zCykwXLjwpgTbtV5O1DEKaOF94/ w==; X-CSE-ConnectionGUID: TaAT2/1NSSK0CSVbZ28Z0w== X-CSE-MsgGUID: SleW+mnwRveah+xSNrw50g== X-IronPort-AV: E=McAfee;i="6700,10204,11334"; a="56485428" X-IronPort-AV: E=Sophos;i="6.13,255,1732608000"; d="scan'208";a="56485428" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:45 -0800 X-CSE-ConnectionGUID: pLCP3vXISrCrHb3pRo8wew== X-CSE-MsgGUID: KYUAU68vQOWt5+RDAYUdwg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,255,1732608000"; d="scan'208";a="110066406" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:39 -0800 Received: from svinhufvud.intel.com (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 3B63A11F9C3; Mon, 3 Feb 2025 10:59:34 +0200 (EET) Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo From: Sakari Ailus To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, Prabhakar , Kate Hsuan , Alexander Shiyan , Mikhail Rudenko , Dave Stevenson , Tommaso Merciai , Umang Jain , Benjamin Mugnier , Sylvain Petinot , Christophe JAILLET , Julien Massot , Naushir Patuck , "Yan, Dongcheng" , "Cao, Bingbu" , "Qiu, Tian Shu" , "Wang, Hongju" , Stefan Klug , Mirela Rabulea , =?utf-8?q?Andr=C3=A9_Apitzsch?= , Heimir Thor Sverrisson , Kieran Bingham , Stanislaw Gruszka , Mehdi Djait , Ricardo Ribalda Delgado , Hans de Goede Subject: [RFC v5 10/15] media: v4l: uapi: Add a control for colour pattern flipping effect Date: Mon, 3 Feb 2025 10:58:48 +0200 Message-Id: <20250203085853.1361401-11-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> References: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add a bitmask control (V4L2_CID_COLOUR_PATTERN_FLIP) to tell whether flipping results in a change in the sensor's colour pattern, separately horizontally and vertically. The information is essential for raw formats when using generic raw mbus codes. Signed-off-by: Sakari Ailus --- .../media/v4l/ext-ctrls-image-source.rst | 8 ++++++++ drivers/media/v4l2-core/v4l2-ctrls-defs.c | 2 ++ include/uapi/linux/v4l2-controls.h | 15 +++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst index fca729512b6f..ecfa38c118e3 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst @@ -102,3 +102,11 @@ Image Source Control IDs This control may only be used on a V4L2 sub-device. This is a read-only control. + +``V4L2_CID_COLOUR_PATTERN_FLIP (bitmask)`` + Whether the horizontal or vertical flipping controls (V4L2_CID_HFLIP and + V4L2_CID_VFLIP) have an effect on the pixel order of the output colour + pattern. Macros ``V4L2_COLOUR_PATTERN_FLIP_HORIZONTAL`` and + ``V4L2_COLOUR_PATTERN_FLIP_VERTICAL`` define bitmasks for both bits. If + either horizontal or vertical bit is set, the readout pattern order is that + of the reversed readout. diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c index 5b6a4a94f18f..3f0704a982b8 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c @@ -1156,6 +1156,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_TEST_PATTERN_GREENB: return "Green (Blue) Pixel Value"; case V4L2_CID_NOTIFY_GAINS: return "Notify Gains"; case V4L2_CID_COLOUR_PATTERN: return "Colour Pattern"; + case V4L2_CID_COLOUR_PATTERN_FLIP: return "Colour Pattern Flip"; /* Image processing controls */ /* Keep the order of the 'case's the same as in v4l2-controls.h! */ @@ -1474,6 +1475,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, *max = 0xffff; break; case V4L2_CID_FLASH_FAULT: + case V4L2_CID_COLOUR_PATTERN_FLIP: case V4L2_CID_JPEG_ACTIVE_MARKER: case V4L2_CID_3A_LOCK: case V4L2_CID_AUTO_FOCUS_STATUS: diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 8e761c38b995..fd6465e9a743 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -1215,11 +1215,26 @@ enum v4l2_jpeg_chroma_subsampling { #define V4L2_CID_NOTIFY_GAINS (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 9) #define V4L2_CID_COLOUR_PATTERN (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 10) +/* + * CFA pattern start shall be aligned with the number of patterns for colour + * components. Patterns shall be calculable based on flipping when it affects + * the pattern the following way: + * + * flipped_pattern = native_pattern ^ + * ((hflip ? V4L2_COLOUR_PATTERN_FLIP_HORIZONTAL : 0) | + * (vflip ? V4L2_COLOUR_PATTERN_FLIP_VERTICAL : 0)) + * + * where hflip and vflip are the values of V4L2_CID_HFLIP and V4L2_CID_VFLIP + * controls, respectively. + */ #define V4L2_COLOUR_PATTERN_GRBG 0 #define V4L2_COLOUR_PATTERN_RGGB 1 #define V4L2_COLOUR_PATTERN_BGGR 2 #define V4L2_COLOUR_PATTERN_GBRG 3 +#define V4L2_CID_COLOUR_PATTERN_FLIP (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 11) +#define V4L2_COLOUR_PATTERN_FLIP_HORIZONTAL (1U << 0) +#define V4L2_COLOUR_PATTERN_FLIP_VERTICAL (1U << 1) /* Image processing controls */ From patchwork Mon Feb 3 08:58:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13957076 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 872EE1FCCFB for ; Mon, 3 Feb 2025 08:59:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573193; cv=none; b=PGFndHN3I0TW1xe4s51fTRtYVXdKlll9yxRYPOck7D/R+fqVYU2vyle5cEV+nvMzNsWjAAlfCoV5pO8kpiAzOV2iAp2TFC7DdcOojmDICkOVT6sCWTjYyRg84hbbuY5TubTGLh8znC83Vj7c0k96ZuofIPW4qpFIbFyg9cuMOf4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573193; c=relaxed/simple; bh=KCrj/XECXXQT6k1H85UI83DYiKvw++6bblnG4i6p5e8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cLsY9+3AxZo1VE0thOVzavNqjrVSRFo1w1HNn47Q3Li9noaIYSrpxztZRZoL0iLHnbaG46vLhABC7FqKEOEJ19UeZ1GxY+Z+NPOuVd/iWZT/rctah47eaH8CrrPe0XKRK7F0jQYMSPt31lWGza0Jd+7oCJFDKEBS3daiyjfV+d4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=bShQlJ9+; arc=none smtp.client-ip=192.198.163.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="bShQlJ9+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1738573192; x=1770109192; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KCrj/XECXXQT6k1H85UI83DYiKvw++6bblnG4i6p5e8=; b=bShQlJ9+H98Qa98F+ApT7AKi6nq0Y4ceEtZTitgE0wLU8wJq9SknuUun hL9ufiOHoJFvjJTgpedDurHrvQOfiv/zPkML46ZdPOsCNcnHddGgptEyp ZdpNcHQZOIdEtnxV/xExxReQlzYFirn/p2m3gc03GY0Qrtu23cFeGv3+M yVnQZNDoT9fU4W0KAvQaWr2Y9JNQQJulm3+O5GAjBCwVkaeAglOKNcjPW jSjB+pgGrMmu8OIxmo3yCJpViepoGL7UCDR7oIyMBKBT9AmCnlUkj4YCu O5iD5rpxsHDHB+NrodWPVlmeqbyCmrw09Jio3zoJpTQoSBJccmiGh+0ju A==; X-CSE-ConnectionGUID: olnGke0xSKaPB2anNxODMQ== X-CSE-MsgGUID: lvvF9dW6SC+6VIb43N8eLw== X-IronPort-AV: E=McAfee;i="6700,10204,11334"; a="39211581" X-IronPort-AV: E=Sophos;i="6.13,255,1732608000"; d="scan'208";a="39211581" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:51 -0800 X-CSE-ConnectionGUID: iaCnPqAVQvCgjRU1Ggfbxw== X-CSE-MsgGUID: yTtW/sJoSFuUdrCT9v4qLA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,255,1732608000"; d="scan'208";a="109988798" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:44 -0800 Received: from svinhufvud.intel.com (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id D21A71204F2; Mon, 3 Feb 2025 10:59:37 +0200 (EET) Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo From: Sakari Ailus To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, Prabhakar , Kate Hsuan , Alexander Shiyan , Mikhail Rudenko , Dave Stevenson , Tommaso Merciai , Umang Jain , Benjamin Mugnier , Sylvain Petinot , Christophe JAILLET , Julien Massot , Naushir Patuck , "Yan, Dongcheng" , "Cao, Bingbu" , "Qiu, Tian Shu" , "Wang, Hongju" , Stefan Klug , Mirela Rabulea , =?utf-8?q?Andr=C3=A9_Apitzsch?= , Heimir Thor Sverrisson , Kieran Bingham , Stanislaw Gruszka , Mehdi Djait , Ricardo Ribalda Delgado , Hans de Goede Subject: [RFC v5 11/15] media: Documentation: Document luma-only mbus codes and CFA for cameras Date: Mon, 3 Feb 2025 10:58:49 +0200 Message-Id: <20250203085853.1361401-12-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> References: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Document the use of luma-only mbus codes for camera sensors and how the V4L2_CID_COLOUR_PATTERN and V4L2_CID_COLOUR_PATTERN_FLIP controls are used to convey the colour filter array pattern on UAPI. Signed-off-by: Sakari Ailus --- .../userspace-api/media/drivers/camera-sensor.rst | 13 +++++++++++++ .../media/v4l/ext-ctrls-image-source.rst | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/Documentation/userspace-api/media/drivers/camera-sensor.rst b/Documentation/userspace-api/media/drivers/camera-sensor.rst index 5bc4c79d230c..91e5305458b9 100644 --- a/Documentation/userspace-api/media/drivers/camera-sensor.rst +++ b/Documentation/userspace-api/media/drivers/camera-sensor.rst @@ -41,6 +41,19 @@ format set on a source pad at the end of the device's internal pipeline. Most sensor drivers are implemented this way. +V4L2_CID_COLOUR_PATTERN, luma-only mbus formats, flipping and cropping +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +For raw image data originating from camera sensors, :ref:`luma-only mbus codes +MEDIA_BUS_FMT_Yx_1Xx (where 'x' is the bit depth) ` +are used as Colour Filter Array (CFA) agnostic raw formats. The +``V4L2_CID_COLOUR_PATTERN `` control in the +same sub-device defines the native colour pattern of the device. Flipping may +further affect the readout pattern as indicated by the +``V4L2_CID_COLOUR_PATTERN_FLIP `` +control. Further on, cropping also has an effect on the pattern if cropped +amount is not divisible by the size of the pattern, horizontally and vertically. + Frame interval configuration ---------------------------- diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst index ecfa38c118e3..4b98a740236a 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst @@ -93,6 +93,8 @@ Image Source Control IDs is reported as being (say) 128, then a value of 192 would represent a gain of exactly 1.5. +.. _image-source-control-colour-pattern: + ``V4L2_CID_COLOUR_PATTERN (integer)`` This control determines the colour components and pixel order in the sensor's CFA (Colour Filter Array) when used in conjunction with @@ -103,6 +105,8 @@ Image Source Control IDs This is a read-only control. +.. _image-source-control-colour-pattern-flip: + ``V4L2_CID_COLOUR_PATTERN_FLIP (bitmask)`` Whether the horizontal or vertical flipping controls (V4L2_CID_HFLIP and V4L2_CID_VFLIP) have an effect on the pixel order of the output colour From patchwork Mon Feb 3 08:58:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13957079 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD697207DED for ; Mon, 3 Feb 2025 08:59:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573205; cv=none; b=eRa6oWgID7dAGGl68anP4UPDdQzGcIFJKnC0scXx9akrmyUhwyl1m/xLFX2qGIgUHYI8SYdDVphb0OQSmEY4cPX4ufVskyk3Ub2gvGsklnces05miDjVXPEWy7U6bdqpbkOrcu7OKDrlJrirGTRloC7xCiNvPDZqrvyaG03MKy0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573205; c=relaxed/simple; bh=DCDd4l42t5wgUgKJbmC/nWT/Ei31a0a25pOSaKlzovQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Jk7tRLrFv8TmI5DjT1nc6DgNGfq0xAi0TbMFYGkSB4wDe+MM2d2hAC/IDxhUY2nYVwadkqah0S80H5caOsrvp3UJme5r7kN1AxNTtCuxDtUnOxill+QbrZ7F33VUZEKDYaNNDyVEFqccCUaYmSFpLoS3qu6uDNkmb+9QQxi0G5Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ORC5CbZg; arc=none smtp.client-ip=192.198.163.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ORC5CbZg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1738573194; x=1770109194; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DCDd4l42t5wgUgKJbmC/nWT/Ei31a0a25pOSaKlzovQ=; b=ORC5CbZgV3ACFVQ5rSr2/HcrUUil39vJw8iUaiOKc7gckPv+BBBb1Hc0 Bvzkwkhj8AWsF5b9SxetCNTkMuu24Ii50TfoYV/Kb/QcYTB58Y3jo9cCp tbwq7nXM5zTVLJVhsNvkpLMR/5Hsekdnr3Bftv46QkH0NALSa0AQqW42D 6Ea3HbXwkyMfnQ04+I9s4av5zyZW+qWTHyv9Hdgq6nf92r5nTzH/ZPylG 9w2QFcZqf9G+i6hTxmVRi5RqqYeQrluZbV9PCSjMWllPXfdW7V6j/Go8R VkeR73Rw23URRhG9rIalr9Adit7uD0iFYbtKUPr6j69w1Rj+mZ6+pzKfp g==; X-CSE-ConnectionGUID: EZXTTIcqTK6avZxF1y4zCw== X-CSE-MsgGUID: 9J4abgY4TeK+4SXxB3mluw== X-IronPort-AV: E=McAfee;i="6700,10204,11334"; a="39211589" X-IronPort-AV: E=Sophos;i="6.13,255,1732608000"; d="scan'208";a="39211589" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:53 -0800 X-CSE-ConnectionGUID: iwtt06VURDazftMYP18KVQ== X-CSE-MsgGUID: UgjrJaK2Q6+eTkbsbgIg1Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,255,1732608000"; d="scan'208";a="109988802" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:47 -0800 Received: from svinhufvud.intel.com (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id E5FD911FAB1; Mon, 3 Feb 2025 10:59:41 +0200 (EET) Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo From: Sakari Ailus To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, Prabhakar , Kate Hsuan , Alexander Shiyan , Mikhail Rudenko , Dave Stevenson , Tommaso Merciai , Umang Jain , Benjamin Mugnier , Sylvain Petinot , Christophe JAILLET , Julien Massot , Naushir Patuck , "Yan, Dongcheng" , "Cao, Bingbu" , "Qiu, Tian Shu" , "Wang, Hongju" , Stefan Klug , Mirela Rabulea , =?utf-8?q?Andr=C3=A9_Apitzsch?= , Heimir Thor Sverrisson , Kieran Bingham , Stanislaw Gruszka , Mehdi Djait , Ricardo Ribalda Delgado , Hans de Goede Subject: [RFC v5 12/15] media: uapi: Documentation: Use luma formats with CFA pattern control Date: Mon, 3 Feb 2025 10:58:50 +0200 Message-Id: <20250203085853.1361401-13-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> References: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Document that the luma-only, greyscale formats (Y10 etc.) are used also for non-greyscale images with the CFA pattern specified by the V4L2_CID_COLOUR_PATTERN control. The advantage of this approach is that there is little (or none at all) work needed to be able to capture such images with existing CSI-2 receiver drivers as many already support greyscale formats when compared to new CFA-agnostic pixelformats. Signed-off-by: Sakari Ailus --- Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst b/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst index 74df19be91f6..ae4e431b5fd9 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst @@ -9,6 +9,11 @@ Luma-Only Formats This family of formats only store the luma component of a Y'CbCr image. They are often referred to as greyscale formats. +These pixel formats are also used on :term:`MC-centric` devices when the CFA +pattern is specified by the :ref:`V4L2_CID_COLOUR_PATTERN +` control in the image source, typically a +camera sensor. + .. note:: - In all the tables that follow, bit 7 is the most significant bit in a byte. From patchwork Mon Feb 3 08:58:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13957077 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE6CB207A2F for ; Mon, 3 Feb 2025 08:59:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573200; cv=none; b=jfcKiA0v/vbNHhABof7kTE42Ql81bBCstZTR5QdtYDmMHU27x9MR91Brqjyx6EVDz5bvseC5tZq17MN4JUFgAS5gVM8WpGnAdbsn8Erj3JIe4GpyXC4R5plmY14QyDI9o2x6yHqNvXp86MKXDWaGwi0P3ax4f5hMFmzZVDJ5vas= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573200; c=relaxed/simple; bh=tolS8nUilg8AHdDSlI8azmr//P956Z52ZBmE63VjJ8w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VFLV1KnU/M3Jpe2aBalMn28J5xaGIxHKqPrUd/xGL7yH342GTZCvHp2HHoy0FglPEPV/39ss0uRDoGddFhbxv1q2MPI6l1jo4JY9izzLqVvJTpCRLji3Z13Fus9ZLAQ/mhq64TplOxT1qYTAW+nxQ1/CcvjsBmlcbV34qD7ascM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=YmXvz71g; arc=none smtp.client-ip=192.198.163.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="YmXvz71g" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1738573199; x=1770109199; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tolS8nUilg8AHdDSlI8azmr//P956Z52ZBmE63VjJ8w=; b=YmXvz71gpcbAQpGnA99+caZ73Xco1W44h+ACm0nBz3Ey9dgylGB7Dbfb NitFSiQh0i8udI8M15hXUouPIytmUEPN+AsSYTuoR2SfFY5r13NxciyVa +TMYeR7S1BAEh6fpCBGTds6wgmNpi+loXkrBdHB6fkqo4F2qmb+v4ThI0 qtC76mxR6H3RD9nUIRjCVlx7P7CZ5Bs43pg5hVaZ473i2kx853hkLZkQ9 Y2y8q5i5OBGHyE4w4UHIdQVGxySsRHf1euHxkds98OJgk9rM3oZOeWBkn XD0W5virH3XUS3Po63ejVn9kJp6AXIehiQpGPsdGmZ/XQnB7/KUROvSy/ w==; X-CSE-ConnectionGUID: D//era8qQlOHh5t1TnHUUA== X-CSE-MsgGUID: JgpVz1pIRuKYqXe98NrbZg== X-IronPort-AV: E=McAfee;i="6700,10204,11334"; a="39211602" X-IronPort-AV: E=Sophos;i="6.13,255,1732608000"; d="scan'208";a="39211602" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:58 -0800 X-CSE-ConnectionGUID: mFAVE9uGQlGiUhlYsYFx9Q== X-CSE-MsgGUID: i8lc/GyhQHiUEl0Ieopf0Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,255,1732608000"; d="scan'208";a="109988806" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:51 -0800 Received: from svinhufvud.intel.com (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 9173711F9C3; Mon, 3 Feb 2025 10:59:45 +0200 (EET) Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo From: Sakari Ailus To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, Prabhakar , Kate Hsuan , Alexander Shiyan , Mikhail Rudenko , Dave Stevenson , Tommaso Merciai , Umang Jain , Benjamin Mugnier , Sylvain Petinot , Christophe JAILLET , Julien Massot , Naushir Patuck , "Yan, Dongcheng" , "Cao, Bingbu" , "Qiu, Tian Shu" , "Wang, Hongju" , Stefan Klug , Mirela Rabulea , =?utf-8?q?Andr=C3=A9_Apitzsch?= , Heimir Thor Sverrisson , Kieran Bingham , Stanislaw Gruszka , Mehdi Djait , Ricardo Ribalda Delgado , Hans de Goede Subject: [RFC v5 13/15] media: uapi: Add V4L2_CID_BINNING control for binning configuration Date: Mon, 3 Feb 2025 10:58:51 +0200 Message-Id: <20250203085853.1361401-14-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> References: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add V4L2_CID_BINNING control for configuring binning and enumerating a camera sensor's binning capabilities. The control combines horizontal and vertical binning into a single control as the two are generally related. New drivers should use this control to configure binning. Signed-off-by: Sakari Ailus Reviewed-by: Tomi Valkeinen --- .../media/drivers/camera-sensor.rst | 10 +++++++ .../media/v4l/ext-ctrls-camera.rst | 29 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-ctrls-defs.c | 2 ++ include/uapi/linux/v4l2-controls.h | 1 + 4 files changed, 42 insertions(+) diff --git a/Documentation/userspace-api/media/drivers/camera-sensor.rst b/Documentation/userspace-api/media/drivers/camera-sensor.rst index 91e5305458b9..59431ab0b923 100644 --- a/Documentation/userspace-api/media/drivers/camera-sensor.rst +++ b/Documentation/userspace-api/media/drivers/camera-sensor.rst @@ -120,6 +120,16 @@ values programmed by the register sequences. The default values of these controls shall be 0 (disabled). Especially these controls shall not be inverted, independently of the sensor's mounting rotation. +Binning +------- + +Binning has traditionally been configured using :ref:`the compose selection +rectangle `. The :ref:`V4L2_CID_BINNING +` is also available for binning configuration and +users should use it when it's available. Drivers supporting the control shall +also support the compose rectangle, albeit the rectangle may be read-only when +the control is present. + .. _media_using_camera_sensor_drivers_embedded_data: Embedded data diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst index cdc515c60468..18b484ff5d75 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst @@ -672,3 +672,32 @@ enum v4l2_scene_mode - As modes differ for each sensor, menu items are not standardized by this control and are left to the programmer. + +.. _v4l2-cid-camera-sensor-binning: + +``V4L2_CID_BINNING_FACTORS (integer menu)`` + + Horizontal and vertical binning factors. Binning combines several + horizontal, vertical or both pixel values into a single pixel. It is a way + to scale an image. Binning typically produces fairly good quality output. + + Determines both horizontal and vertical binning factors for a camera + sensor. The values are encoded in the following way: + +.. flat-table:: + :header-rows: 1 + :stub-columns: 0 + + * - Bits + - Synopsis + * - 48--63 + - Horizontal binning numerator. + * - 32--47 + - Horizontal binning denominator. + * - 16--31 + - Vertical binning numerator. + * - 0--15 + - Vertical binning denominator. + +For instance, a value of ``0x0001000300020003`` indicates binning by 3 +(horizontally) * 3/2 (vertically). diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c index 3f0704a982b8..6be3d4a37127 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c @@ -1087,6 +1087,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_CAMERA_ORIENTATION: return "Camera Orientation"; case V4L2_CID_CAMERA_SENSOR_ROTATION: return "Camera Sensor Rotation"; case V4L2_CID_HDR_SENSOR_MODE: return "HDR Sensor Mode"; + case V4L2_CID_BINNING_FACTORS: return "Binning Factors"; /* FM Radio Modulator controls */ /* Keep the order of the 'case's the same as in v4l2-controls.h! */ @@ -1426,6 +1427,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_HDR_SENSOR_MODE: *type = V4L2_CTRL_TYPE_MENU; break; + case V4L2_CID_BINNING_FACTORS: case V4L2_CID_LINK_FREQ: *type = V4L2_CTRL_TYPE_INTEGER_MENU; break; diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index fd6465e9a743..ac0e38e98a38 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -1088,6 +1088,7 @@ enum v4l2_auto_focus_range { #define V4L2_CID_CAMERA_SENSOR_ROTATION (V4L2_CID_CAMERA_CLASS_BASE+35) #define V4L2_CID_HDR_SENSOR_MODE (V4L2_CID_CAMERA_CLASS_BASE+36) +#define V4L2_CID_BINNING_FACTORS (V4L2_CID_CAMERA_CLASS_BASE+37) /* FM Modulator class control IDs */ From patchwork Mon Feb 3 08:58:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13957078 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5710207DEA for ; Mon, 3 Feb 2025 09:00:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573203; cv=none; b=RwqGZm/gmDtOy1BfHmJVVjiDsBS2i7+zm78W73beRkJdWWHhMotUOA6S3OHor9Vcl+GYNCXZyXh6YV3yWR6lSVhdtOnt2yKBqMgCcSFzFu2hv/LDPMVUIZW1sSF1A1OBvbVYqbUGeWt7WC5rOufNDglT4brdZlBkyS7mfKg8+Aw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573203; c=relaxed/simple; bh=0bVoD49YZ1dwUgxndQAJNi/mPiubgmOqoCmQhkpeLZM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=j15Gpa9R7tOBvtkZK6MLEM0tuJ3BLTKa/fgaFxLb9EMVk5wcZL51mlw8zCHJFDnbs2Kbz93j+XuVOc7oloj9kgSwrQriPKu3qSxlcjVqlSURnmy6TA0hjNc0GY3vtzmyUUCb9+sOlGZ0sdeI7lTC0+HvoPrEFuDZemnOom0DLZQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=PmBpBEKa; arc=none smtp.client-ip=192.198.163.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="PmBpBEKa" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1738573202; x=1770109202; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0bVoD49YZ1dwUgxndQAJNi/mPiubgmOqoCmQhkpeLZM=; b=PmBpBEKaZrt1s9gK9CaZ25HB4eTbVLo/KYgcCBLI7jfGaIpVmyywYkYg ZVZ9oZbLm+hzkaRM34dZZLd5myb5sGDqeD2K4nbftr8+jyvWctH9pAfZw cy0EJB0mOOJUGRf7W01M5X5qhpYBCPuhQS6MJNSVbai3x9jqyZrDebVVJ CZB0xDzjPk7ERO0Ju4KYZqY42Qb1ukoZOTysf/Dv59g/IIna8MKVvUsaI f1tvKUWVp+u77k4EjCBPTVOB7hlBwKV+UmrpXQdwaT6SqdfqGroTSV/mB K49bW/TtH+39avYMN8aIU5uGVXAWVvAMap29KpnDJ6eotmt+4MoEYXv3u g==; X-CSE-ConnectionGUID: jmuppUu4RLaECA6an0Phmg== X-CSE-MsgGUID: Kt4rzdUdTmeV4+QsTMZXHw== X-IronPort-AV: E=McAfee;i="6700,10204,11334"; a="39211614" X-IronPort-AV: E=Sophos;i="6.13,255,1732608000"; d="scan'208";a="39211614" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 01:00:01 -0800 X-CSE-ConnectionGUID: 6APj+ASAReO6aqIgToeTBQ== X-CSE-MsgGUID: QVHL27wISnS3YCSF6dqNKw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,255,1732608000"; d="scan'208";a="109988813" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:55 -0800 Received: from svinhufvud.intel.com (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id B4E7A11FC22; Mon, 3 Feb 2025 10:59:49 +0200 (EET) Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo From: Sakari Ailus To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, Prabhakar , Kate Hsuan , Alexander Shiyan , Mikhail Rudenko , Dave Stevenson , Tommaso Merciai , Umang Jain , Benjamin Mugnier , Sylvain Petinot , Christophe JAILLET , Julien Massot , Naushir Patuck , "Yan, Dongcheng" , "Cao, Bingbu" , "Qiu, Tian Shu" , "Wang, Hongju" , Stefan Klug , Mirela Rabulea , =?utf-8?q?Andr=C3=A9_Apitzsch?= , Heimir Thor Sverrisson , Kieran Bingham , Stanislaw Gruszka , Mehdi Djait , Ricardo Ribalda Delgado , Hans de Goede Subject: [RFC v5 14/15] media: uapi: Add controls for sub-sampling configuration Date: Mon, 3 Feb 2025 10:58:52 +0200 Message-Id: <20250203085853.1361401-15-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> References: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sub-sampling is a way to decrease the data rates after the pixel array by systematically discarding some samples, either vertically or horizontally or both. Add two controls for the purpose and document them. The sub-sampling configuration is taken into account in the compose rectangle. Signed-off-by: Sakari Ailus Reviewed-by: Tomi Valkeinen --- .../userspace-api/media/drivers/camera-sensor.rst | 14 ++++++++++++-- .../userspace-api/media/v4l/ext-ctrls-camera.rst | 11 +++++++++++ drivers/media/v4l2-core/v4l2-ctrls-defs.c | 2 ++ include/uapi/linux/v4l2-controls.h | 2 ++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Documentation/userspace-api/media/drivers/camera-sensor.rst b/Documentation/userspace-api/media/drivers/camera-sensor.rst index 59431ab0b923..9e74eb02e02a 100644 --- a/Documentation/userspace-api/media/drivers/camera-sensor.rst +++ b/Documentation/userspace-api/media/drivers/camera-sensor.rst @@ -120,8 +120,8 @@ values programmed by the register sequences. The default values of these controls shall be 0 (disabled). Especially these controls shall not be inverted, independently of the sensor's mounting rotation. -Binning -------- +Binning and sub-sampling +------------------------ Binning has traditionally been configured using :ref:`the compose selection rectangle `. The :ref:`V4L2_CID_BINNING @@ -130,6 +130,16 @@ users should use it when it's available. Drivers supporting the control shall also support the compose rectangle, albeit the rectangle may be read-only when the control is present. +Sub-sampling is often supported as part of a camera sensor's binning +functionality and performed after the binning operation. Sub-sampling typically +produces quality-wise worse results than binning. Sub-sampling factors are +independent horizontally and vertically and they are controlled using two +controls, :ref:`V4L2_CID_SUBSAMPLING_HORIZONTAL and +V4L2_CID_SUBSAMPLING_VERTICAL `. In +sub-sampling, the image size before sub-sampling is horizontally and vertically +divided by the respective sub-sampling factors. Drivers supporting the control shall +also reflect the sub-sampling configuration in the compose rectangle. + .. _media_using_camera_sensor_drivers_embedded_data: Embedded data diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst index 18b484ff5d75..577b73045bee 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst @@ -701,3 +701,14 @@ enum v4l2_scene_mode - For instance, a value of ``0x0001000300020003`` indicates binning by 3 (horizontally) * 3/2 (vertically). + +.. _v4l2-cid-camera-sensor-subsampling: + +``V4L2_CID_SUBSAMPLING_HORIZONTAL`` and ``V4L2_CID_SUBSAMPLING_VERTICAL`` +(integer) + + Horizontal and vertical subsampling factors. + + Sub-sampling is used to downscale an image, horizontally and vertically, by + discarding a part of the image data. Typically sub-sampling produces lower + quality images than binning. diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c index 6be3d4a37127..5f4a8cc9f53b 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c @@ -1088,6 +1088,8 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_CAMERA_SENSOR_ROTATION: return "Camera Sensor Rotation"; case V4L2_CID_HDR_SENSOR_MODE: return "HDR Sensor Mode"; case V4L2_CID_BINNING_FACTORS: return "Binning Factors"; + case V4L2_CID_SUBSAMPLING_HORIZONTAL: return "Sub-Sampling Factor, Horizontal"; + case V4L2_CID_SUBSAMPLING_VERTICAL: return "Sub-Sampling Factor, Vertical"; /* FM Radio Modulator controls */ /* Keep the order of the 'case's the same as in v4l2-controls.h! */ diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index ac0e38e98a38..4eade177d40f 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -1089,6 +1089,8 @@ enum v4l2_auto_focus_range { #define V4L2_CID_HDR_SENSOR_MODE (V4L2_CID_CAMERA_CLASS_BASE+36) #define V4L2_CID_BINNING_FACTORS (V4L2_CID_CAMERA_CLASS_BASE+37) +#define V4L2_CID_SUBSAMPLING_HORIZONTAL (V4L2_CID_CAMERA_CLASS_BASE+38) +#define V4L2_CID_SUBSAMPLING_VERTICAL (V4L2_CID_CAMERA_CLASS_BASE+39) /* FM Modulator class control IDs */ From patchwork Mon Feb 3 08:58:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13957080 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 989241FF60F for ; Mon, 3 Feb 2025 09:00:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573207; cv=none; b=Es1pCHaccpxh3B/cDqB0Q91LC+KQ71qOJ/pWA6z0yazWDm4qkbXIlCSZ5I9qYKYdcHjaMnkzLBgKZ0RwrU/VZxHWIKC9JDrhIdpTlyYU4XjTCWdetxEbCUqjc6MbiVMH1zKvt99ur/uysbre0kxgvw1UXJy3O5UpXQeXv4OgTcg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738573207; c=relaxed/simple; bh=j6Wf++t4tR9d3+JpRD4UsIZfaGMbstR49RtMy0C9GPw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kBD/3jWFns+R+PbLx7x+rCu8scmGrgkU3lR+1unrtcKErYiSvAaI44pHhGUeEr5ZtnIprn5iCabRUsn+QkaVUrpMKpkE8iGtnX0vPv/EEdY2H0FSAo2xn5IKbIwB+Dy3cKlefdjeVhgAnUuM7bOv6/0dt/z58UAdqqtpfJG5nKs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Dyj/nVV+; arc=none smtp.client-ip=192.198.163.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Dyj/nVV+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1738573206; x=1770109206; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=j6Wf++t4tR9d3+JpRD4UsIZfaGMbstR49RtMy0C9GPw=; b=Dyj/nVV+7N0MRSt29nxGptFCS4XJSlRIuhCuAkYyEN31TdgT+9Bp4t0/ mJoOzcIki31b2mfsQ/EW91tILIOtZg/2WwSJMCyrMWNpj6ZNRNQj3NSUU mW7SphRRwwc7g9R7b/nxtk90wDAt2HE6HtgP12hOZV7jbe7P76887ojZP +IoI6aYtDtuWiMBlp+jrazMVeaqMSbRWugJIkqCBQiX9Ytf08SLC7nNth 2lycXDZmaSwtm/z+u1lzqr68TlSswwdZMeLi+LbiRSxT8Cia4KMCd5EyH Ul1CYg/Uu1xDWFStFHJMmRq2t+WH5i0M0JRk7vb/xwH/dTPJep/et448T A==; X-CSE-ConnectionGUID: bJS9R87XQACHAYEnox6AOw== X-CSE-MsgGUID: hYJHzSPES72FeShw+uvtyA== X-IronPort-AV: E=McAfee;i="6700,10204,11334"; a="39211627" X-IronPort-AV: E=Sophos;i="6.13,255,1732608000"; d="scan'208";a="39211627" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 01:00:05 -0800 X-CSE-ConnectionGUID: mzyjA0KNRF+rxtdeAW0C0g== X-CSE-MsgGUID: SHQOKeO9QBuoOYaxvcn57Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,255,1732608000"; d="scan'208";a="109988854" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2025 00:59:58 -0800 Received: from svinhufvud.intel.com (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 3B6121204F2; Mon, 3 Feb 2025 10:59:53 +0200 (EET) Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo From: Sakari Ailus To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, Prabhakar , Kate Hsuan , Alexander Shiyan , Mikhail Rudenko , Dave Stevenson , Tommaso Merciai , Umang Jain , Benjamin Mugnier , Sylvain Petinot , Christophe JAILLET , Julien Massot , Naushir Patuck , "Yan, Dongcheng" , "Cao, Bingbu" , "Qiu, Tian Shu" , "Wang, Hongju" , Stefan Klug , Mirela Rabulea , =?utf-8?q?Andr=C3=A9_Apitzsch?= , Heimir Thor Sverrisson , Kieran Bingham , Stanislaw Gruszka , Mehdi Djait , Ricardo Ribalda Delgado , Hans de Goede Subject: [RFC v5 15/15] media: Documentation: Add binning and sub-sampling controls Date: Mon, 3 Feb 2025 10:58:53 +0200 Message-Id: <20250203085853.1361401-16-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> References: <20250203085853.1361401-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Document the binning and scaling controls (V4L2_CID_BINNING and V4L2_CID_SUBSAMPLING_{HORIZONTAL,VERTICAL}) in the common raw sensor model. Signed-off-by: Sakari Ailus Reviewed-by: Tomi Valkeinen --- .../media/v4l/subdev-config-model.rst | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Documentation/userspace-api/media/v4l/subdev-config-model.rst b/Documentation/userspace-api/media/v4l/subdev-config-model.rst index f15e5495cc34..84957dc62800 100644 --- a/Documentation/userspace-api/media/v4l/subdev-config-model.rst +++ b/Documentation/userspace-api/media/v4l/subdev-config-model.rst @@ -113,8 +113,12 @@ separately horizontally and vertically. Binning and sub-sampling are configured using the ``V4L2_SEL_TGT_COMPOSE`` rectangle, relative to the analogue crop rectangle, on (pad, stream) pair -1/0. The driver implementation determines how to configure binning and -sub-sampling to achieve the desired size. +1/0. It depends on the driver which of these operations are being used to +achieve the resulting size. Binning and sub-sampling are also directly +configured using :ref:`V4L2_CID_BINNING_FACTORS +` and :ref:`V4L2_CID_SUBSAMPLING_HORIZONTAL and +V4L2_CID_SUBSAMPLING_VERTICAL ` controls on +drivers that support them. The digital crop operation takes place after binning and sub-sampling. It is configured by setting the ``V4L2_SEL_TGT_CROP`` rectangle on (pad, stream) pair @@ -173,9 +177,15 @@ Also refer to :ref:`Selection targets `. - \- - X - Binning and sub-sampling. This rectangle is relative to the - ``V4L2_SEL_TGT_CROP`` rectangle on the same (pad, stream). The - combination of binning and sub-sampling is configured using this - selection target. + ``V4L2_SEL_TGT_CROP`` rectangle on the same (pad, stream). Binning is + configured using the :ref:`V4L2_CID_BINNING_FACTORS + ` control and sub-sampling is configured + using the :ref:`V4L2_CID_SUBSAMPLING_HORIZONTAL and + V4L2_CID_SUBSAMPLING_VERTICAL ` + controls on drivers that support these controls. To configure binning + and sub-sampling on drivers that do not support these controls, the + selection rectangle may be changed directly to configure the combined + effect on the image size. * - 2/0 - Format - X