From patchwork Fri Dec 20 13:24:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13916745 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (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 B6202215706 for ; Fri, 20 Dec 2024 13:24:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734701077; cv=none; b=s1uu8V0FcegeBkatJMrYroZ6IOJbk4NEOl1aStum52KGPoorSzQf5Hxq5krdjinJkJ3jI9Br3EbgeXU0WJh017ieN/6aXCd+r9tnFimIjUNllbl6VG/Gtg4/KI8xKlykOAFSo/XNGiOhCKLE7FEoGBkuhLB504hBeII73v3Eo8E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734701077; c=relaxed/simple; bh=WBfBUTc7foxaXJtaX15rqZrWhtCGrvhQTyIm9yDq+Io=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=S1+/5p6tWHG8bwlbgXbGdYBfUaGFlgjj9NCKhnq4HwiBa5TMVOLka/hwmAWOs6WjpkakStLM1rZDp/zXikwM0zHtknpHVdSWAQyR7zZNsUaJj9E9X/vyRZG4Hhp/kVLEKjWsl+DiHjbX59g6ZVbY9/vTvYC0M/LnJwb1mfq384I= 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=kh3VrRby; arc=none smtp.client-ip=192.198.163.9 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="kh3VrRby" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1734701076; x=1766237076; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WBfBUTc7foxaXJtaX15rqZrWhtCGrvhQTyIm9yDq+Io=; b=kh3VrRbySn2r83jHmNtPjj+KH9lmTpIbuaic0JeVqrodIQz9UA6ZP9hg pkoZz0mFZPS1cm0BJbwQPWBQKTWAVfdnIBheuqN84D41w7S4kDn6NxCua KP8/1AuRkBPQLdW4bu5hkn4OExjE3g3XvLPILHcDGS3xpF2OpRtnWjAgN Vj9qXLyD3W8/INVStARRsmtPuNCehFCXuvphfTicG8xwOI51EYCZaiY1P /VBd2+alkE7lqwIz3dp0izpLihrN4j/GVwMrAWAXIDPV+9J0l7cZbCXH1 Wtw+ocUQ16dJJBhrd5cm75zVsNS384z4ebGN71+JFgAF4IRt5fivy2sAH g==; X-CSE-ConnectionGUID: 1fLvJ2ClSe+wkiNlwRlzaw== X-CSE-MsgGUID: mm8ryBxHSAq7vuy638E0wA== X-IronPort-AV: E=McAfee;i="6700,10204,11292"; a="45937554" X-IronPort-AV: E=Sophos;i="6.12,250,1728975600"; d="scan'208";a="45937554" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2024 05:24:35 -0800 X-CSE-ConnectionGUID: I1s+zRlsRKGw/xo/CbRChA== X-CSE-MsgGUID: YX6/IrYcQz6r871szX7hnA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,250,1728975600"; d="scan'208";a="98333222" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2024 05:24:30 -0800 Received: from svinhufvud.intel.com (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id A6E9E11FADB; Fri, 20 Dec 2024 15:24:24 +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 Subject: [RFC v4 1/9] media: Documentation: Rework embedded data documentation Date: Fri, 20 Dec 2024 15:24:11 +0200 Message-Id: <20241220132419.1027206-2-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241220132419.1027206-1-sakari.ailus@linux.intel.com> References: <20241220132419.1027206-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 --- .../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 Fri Dec 20 13:24:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13916746 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (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 A457F215707 for ; Fri, 20 Dec 2024 13:24:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734701081; cv=none; b=X9sCAsNitufJBsXn+dAAbJi6ma29pSGmBTabpvsErPMpVn1ReYFvtYH6J9YAp/jzG1m0AXjzUvrVlzuI/C3N/dZjjH2H02PQCcb0i2YgiWXiYqMoYQhG9FNQmdRruQErTuJ4ppcui02WgecsUY1xDpnxAZKHOq5sd4OVEyelv3k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734701081; c=relaxed/simple; bh=SKwaAoUmQHNMztRdyl8MMQYFhpacjG9ZHGa8rQn9uwQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lWTWl9IJJynrnobgC4DJbxXJP8SBZBOEpdsPAoZ7dWm3gO7sJSXkY+L4WjL5Hl0P6Xz/VcpcUi8dvomLY+xxI6rProtLzaJqzrqJNMBG74/Bd96QYjWabkHH2g+m0K6AjDblsxLbgyVYRtJu7A8bqPBfdxdY0ULPH0Kb+aey3iA= 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=GIt5yBXG; arc=none smtp.client-ip=192.198.163.9 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="GIt5yBXG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1734701080; x=1766237080; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SKwaAoUmQHNMztRdyl8MMQYFhpacjG9ZHGa8rQn9uwQ=; b=GIt5yBXGkmPrIqGOO+IY5x/x+2EG+MdMx8WMqVEnk/QZFnSC+UBcnVJ7 kh/hgdy4FgNBY6D0uUbpkJRbk3n8+4Hw5ZnDqlNw+3eFA40VOw9u8Bnhi uHiN/OnCWAWxJ2TLg5MhshJheUCxavpsSfWLoFGvBiBJA2TK7TJMXHzrg 00MRK+mp4OroABruf5NSFqV2ZZDl9hwSPdwP3SOiXHK4nwbsUY4kMB37E 6KDBMaWhCUphMZakHRpROgKW/QYaK+kXKnXqIjQajhBURhVXOx4EOjamO 0VH85YX2/qkhrIAxF5ZSEzjR7WkjSoDuhWR5OgneWSqNpxtj+4rMUz9Ev A==; X-CSE-ConnectionGUID: x3HfkSIuR8ePXAYlPaTtpg== X-CSE-MsgGUID: W0bZtyriS1mQ+N9zUCgaVA== X-IronPort-AV: E=McAfee;i="6700,10204,11292"; a="45937568" X-IronPort-AV: E=Sophos;i="6.12,250,1728975600"; d="scan'208";a="45937568" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2024 05:24:39 -0800 X-CSE-ConnectionGUID: 3V9TP5DeRCWw4vnSclKkhQ== X-CSE-MsgGUID: proboxxMShSuR6oOIPMZRw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,250,1728975600"; d="scan'208";a="98333242" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2024 05:24:34 -0800 Received: from svinhufvud.intel.com (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 6D365120867; Fri, 20 Dec 2024 15:24:28 +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 Subject: [RFC v4 2/9] media: Documentation: Add a hyphen to list-based Date: Fri, 20 Dec 2024 15:24:12 +0200 Message-Id: <20241220132419.1027206-3-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241220132419.1027206-1-sakari.ailus@linux.intel.com> References: <20241220132419.1027206-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 --- 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 Fri Dec 20 13:24:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13916747 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (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 2B24F215707 for ; Fri, 20 Dec 2024 13:24:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734701084; cv=none; b=Mpwa5T8+xqrELtfZduk3504SM44aqNiCMmhNup6OUqyuNYiOEV/hcCIDCq5pDDLu316ouOv3VK2dFY+wYvrocsZjQ91nIZfgAT3qXyDEHHminW0UsA+QpleHM2PMRr2EbWeZoovv6D+3m0ZxN1GFdJ/CeWgXUyZiWrS77dTlijQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734701084; c=relaxed/simple; bh=iBppAmcg/4oeQmFNol3/v5Tdg5CR//+q6p+zX2mWQUI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EZjhv+gWD5W52S7p/ohf+WHKHRU1x2g+Fq3Jij98o71U7aOKLnycxdKMQiX8tRsMnU/CxzYRM4e5O0B56JtgzVWTP8Qapow3+xONQOCe6o0feuNy2bkEG/wMwVH2nvZ9sDHQEzvXG8Z0DHyMT3NB5wZ6gallhwUN+9K5GGd1UyI= 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=YNG5+icO; arc=none smtp.client-ip=192.198.163.9 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="YNG5+icO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1734701083; x=1766237083; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iBppAmcg/4oeQmFNol3/v5Tdg5CR//+q6p+zX2mWQUI=; b=YNG5+icO9IzUDa2R/Ba5oSE4/zrOzGd4wc0ke8XO2D0SiIJeGb2saoIC rrOjQ45F0wypKcL853muIzQbHy/22wAkm9wzs4GJUrOEEN/tni0KXybaP FMCkorv7UIoXLkAiA33ntRw8MMHLwQq8PQX4hWkp/O87yO1sFmzF54rYi 0x+uBai5pHDYCARjeD8HlxucMXGFViUyne/lzGnnwawF0Ee2mdAqZscfO snJBRESy4KxX7wfnw9l9bXD2oVjklojKqlWBI1Y6T7ljrKly6w1h4kJe/ EgpKMKFitScAHjG0hH0LU+sdEfCeXfLSqBfSXF5NWSfcHDXWZ4xzNPt4i Q==; X-CSE-ConnectionGUID: O10yUD4ESeWyeY1txE9CcA== X-CSE-MsgGUID: vJqxlqOcTm62NFIcIMoMMQ== X-IronPort-AV: E=McAfee;i="6700,10204,11292"; a="45937583" X-IronPort-AV: E=Sophos;i="6.12,250,1728975600"; d="scan'208";a="45937583" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2024 05:24:43 -0800 X-CSE-ConnectionGUID: sRA5njW9Q8mot5Gut8EaSA== X-CSE-MsgGUID: nvhYWyR9TgK6UwwF9N6mYA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,250,1728975600"; d="scan'208";a="98333251" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2024 05:24:37 -0800 Received: from svinhufvud.intel.com (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 28513120B3E; Fri, 20 Dec 2024 15:24:32 +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 Subject: [RFC v4 3/9] media: Documentation: Reword split of sensor driver to two classes Date: Fri, 20 Dec 2024 15:24:13 +0200 Message-Id: <20241220132419.1027206-4-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241220132419.1027206-1-sakari.ailus@linux.intel.com> References: <20241220132419.1027206-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 --- .../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 Fri Dec 20 13:24:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13916748 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (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 B1306215F5B for ; Fri, 20 Dec 2024 13:24:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734701091; cv=none; b=D55lGxedwg+5CgAZgZ+HMwLAak+lBnl8PhNeqw2nAfF6nvRbAwBqriEe4PWxe1knHlzilS5HPBlI4oMxfbY+AqViwWPeqDcqJnVTIvBFARwpKSANpH45BQK4q1SF1eQrW23ex1LGJs11SlfGyzMsm0C4u8Tl1TiJkDqeb2xacOI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734701091; c=relaxed/simple; bh=O9Mw3G6PtBMJ+8ZuureCfVuvbfT5UFvJEEdHcvgGN7g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=D0Dg166JcCAzljW3cq9BSVGqRX3yoA/ibdyF81T6mDsgXl45mVPS590Cbr8MP82hqk/egh+C9FJEtX5UiUqkIHhGdpFWvtmyviGt4gYV6bIundyNOpj6FoSTZvPNGk9mW6VZANMb/REDM2CoNW6pxXGtQscZX1+TWxFZ9CiaMQ8= 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=CvQSEOOB; arc=none smtp.client-ip=192.198.163.9 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="CvQSEOOB" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1734701088; x=1766237088; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=O9Mw3G6PtBMJ+8ZuureCfVuvbfT5UFvJEEdHcvgGN7g=; b=CvQSEOOBlz+GDtggxampqfUQy1+Gsbec9NUH5l23eo98ingiDkxR+EPr AZPGY5jIrmrhlWIDXeHbM/VAUG8NiMIroPFuH5XnDZCiyEBNf9dzG1EOF E5Se6Vxz7oyjUr9Hp6KJUbK1vzaniLDnZ9Aj9lJwGw8JyuK9Acbv88Zj7 sPcJap2ICT5fdaZBIiDSSCTIXUOBPvqKuXp8KEUhiipGVEWvrG+eN9LTr 6Y/GU0iJlNZJB3XPu9SzPXUa2luyiuK5kgdJftIM7bnaYHJjINHUYTVqg k5lj6cdse9VmGTyKl2/J7b2SIt4TpzNJ8R69WjOf4Qs9UErcaxBg8vCQj A==; X-CSE-ConnectionGUID: Nq0krXy6Rs+TzS0o4BL3Vw== X-CSE-MsgGUID: FE2US/M+Qqu9KDyJE8m8aQ== X-IronPort-AV: E=McAfee;i="6700,10204,11292"; a="45937598" X-IronPort-AV: E=Sophos;i="6.12,250,1728975600"; d="scan'208";a="45937598" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2024 05:24:47 -0800 X-CSE-ConnectionGUID: XOyyw5vxSTC2TA820FVZ+w== X-CSE-MsgGUID: nAcV1B2pS+C8JesmrUrn2A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,250,1728975600"; d="scan'208";a="98333264" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2024 05:24:41 -0800 Received: from svinhufvud.intel.com (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id B0EAE11F984; Fri, 20 Dec 2024 15:24:35 +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 Subject: [RFC v4 4/9] media: Documentation: Add subdev configuration models, raw sensor model Date: Fri, 20 Dec 2024 15:24:14 +0200 Message-Id: <20241220132419.1027206-5-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241220132419.1027206-1-sakari.ailus@linux.intel.com> References: <20241220132419.1027206-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 --- .../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 Fri Dec 20 13:24:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13916749 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (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 4E0A6215F5D for ; Fri, 20 Dec 2024 13:24:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734701092; cv=none; b=I0vUO0v0bJCUKX4NBJPvxoczsbb2sm1ButgjH83NYJMHF78toMJO8z/pzJoBcaaHW5JIhFn4i6N+5E4OUIqG5ivvaehhTKRWVf9ICF7n1vuvLjbTEnDSxXlLHjBdeWMjNpWxUhABcgw9I5qqqT6PW8FiDT4GC8ETY2TdD5mTWKQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734701092; c=relaxed/simple; bh=EqS8HsotZO5ElRikzcpalqye+HQyEZNIAk/pAvJ7Qb8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mCgKNadhQTEpOPJIGGWc30kL0UsfobGOBbzrcVSZpBrMcmmUdUaLuJkW4cOX2DKwwIX/7hxc6HWef49K69/LL9GudARg5ekTbjhbe+sSG9CuA/AAxEqBixTXf6sIHt/UhuOjQdlznEngzhIRx3Qcl+pdKT3gNicl9TCfB+JJ//Q= 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=mstwKA6P; arc=none smtp.client-ip=192.198.163.9 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="mstwKA6P" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1734701091; x=1766237091; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EqS8HsotZO5ElRikzcpalqye+HQyEZNIAk/pAvJ7Qb8=; b=mstwKA6Pmox4z31LNu/UVbIZd+WdkVlAO7UukZ2Zre085MsglZCxpJSh QZbGAU7d9uQNrBdPUbaJR+kfz+A3NK//7FbAZFNxq3z9382DjBjzfcS9k F1itC0TDnRL4un14e1K0XsOop23N9yFtj9kwrjB7KEwqbG826G6ld/Gm2 Ib3MoOyS46j6iYBaGwEFBBsYznrt4wxNV8gioM2cb79X4n2z5zDTrpdUC D8dyu9uCPGLsscWcBm8kl8Z7C+U51JyG1sWGylhlWFKzrEInxg9oLqrh/ 6E7S5NYEfYFNPVp1LfXr0R0rcykDqTlyQ0F8XveAId0r849Yp//9WB2jX w==; X-CSE-ConnectionGUID: GNwkHudCQPuBiGj43COLmg== X-CSE-MsgGUID: 1sk2vSKyTnq6LoeOdqYf/g== X-IronPort-AV: E=McAfee;i="6700,10204,11292"; a="45937612" X-IronPort-AV: E=Sophos;i="6.12,250,1728975600"; d="scan'208";a="45937612" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2024 05:24:51 -0800 X-CSE-ConnectionGUID: jj7oxGHJSi26vORCbE1Qrg== X-CSE-MsgGUID: iq2NlmfPRK+ugVmfPb8GVg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,250,1728975600"; d="scan'208";a="98333276" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2024 05:24:44 -0800 Received: from svinhufvud.intel.com (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 2FEEC11FADB; Fri, 20 Dec 2024 15:24:39 +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 Subject: [RFC v4 5/9] media: Documentation: Add scaling and post-scaler crop for common raw Date: Fri, 20 Dec 2024 15:24:15 +0200 Message-Id: <20241220132419.1027206-6-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241220132419.1027206-1-sakari.ailus@linux.intel.com> References: <20241220132419.1027206-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. Signedg-off-by: Sakari Ailus --- .../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 Fri Dec 20 13:24:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13916750 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (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 0031B215F5D for ; Fri, 20 Dec 2024 13:24:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734701095; cv=none; b=Ybc35pzNg5jbDAo8EztPm08KTWisw0cq9T8Xsadv0Avl4g5ySPd+ofbPmOnETCuIeorzZ8oGvMYt2fs24t8PJI3ZEoVHFnMc1oW8GWiL8Fj05rw1ASEtCb5GO4vy7VmXG05SzfLxsFs730RzfGN6DqBubDj4n/YqrYlT7jQs0QY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734701095; c=relaxed/simple; bh=abredqzWLTcA9iYvxbKWSa6SNaJDYXctsU89L9PE1kM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BTqI0D7a1iUhmFF4wX9EuvEjVVw2uI1Dc/RW1KaKJF15k17QZ4VEL1rabSqdfk+nP7fgxZ8UfNNOVSLRjVElq4KfijQTkncibX52RxDkR98/jSp7VFZkG2ve+aqHsLcAGiTzBWLrSv6gJz0jNNfx4S+eskoh1PbwjJMDVfetkAQ= 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=n6bTBico; arc=none smtp.client-ip=192.198.163.9 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="n6bTBico" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1734701094; x=1766237094; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=abredqzWLTcA9iYvxbKWSa6SNaJDYXctsU89L9PE1kM=; b=n6bTBicohlzz+zBLqtA5Io5KTcdsfZljYzmyLan6huQ1dHvrciMqa/zP LYF5hocbu+HpTM0qKVNObLBEhqg3lqOERCrUlyC5iv/HVCO2+TVIAUHqu wlrVIUQjQxwp0kmJGKuEAxAMwedIy98ryPaYLkS/1DEscHPJsCZX+jWwg oze1lnqDWKUEre8Nbf7I6N4ZnOWWeVqtZLbwMY24CW3MiaQC5heCAb84f K1G8UaRCUO/dEiMyW/7b/WpNjuxtNUq/kQFx+11bmN1CAnW8eHDZsqJT7 fOaca/XVKwux1yEaLAxUeNcuvYtYd6Qhk2vtKefVzVTXP6ouZRt2wi3v2 w==; X-CSE-ConnectionGUID: quUj0IpRRWC8Ltu8pyQC5w== X-CSE-MsgGUID: P7CSor7WQp6Zw7nUmhfKNw== X-IronPort-AV: E=McAfee;i="6700,10204,11292"; a="45937628" X-IronPort-AV: E=Sophos;i="6.12,250,1728975600"; d="scan'208";a="45937628" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2024 05:24:54 -0800 X-CSE-ConnectionGUID: Di+0mVdLTSqDNwkfKBGjJA== X-CSE-MsgGUID: 6t3+QHIMRBCI1vTOn+nLEw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,250,1728975600"; d="scan'208";a="98333287" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2024 05:24:48 -0800 Received: from svinhufvud.intel.com (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id B5DB6120867; Fri, 20 Dec 2024 15:24:42 +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 Subject: [RFC v4 6/9] media: uapi: Add V4L2_CID_CONFIG_MODEL control Date: Fri, 20 Dec 2024 15:24:16 +0200 Message-Id: <20241220132419.1027206-7-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241220132419.1027206-1-sakari.ailus@linux.intel.com> References: <20241220132419.1027206-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 --- .../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..0152240229ab 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 (1ULL << 0) /* DV-class control IDs defined by V4L2 */ #define V4L2_CID_DV_CLASS_BASE (V4L2_CTRL_CLASS_DV | 0x900) From patchwork Fri Dec 20 13:24:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13916751 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (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 676EB215F76 for ; Fri, 20 Dec 2024 13:24:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734701099; cv=none; b=SsCLenO7eJl6HpCsrS6pzuqUY1JFqRRVIjh3QK7JLqRAgichNboZteyvVKMKnB96CpUCItRSrbbWN8+6mkAHnz0W/BIkLGvD6QRPvMFyQ6KcxDHaX7GnyXQ7a9taNG0tmrRqV6fUS9x5/H0qhThOko3IoANRfcjxON3UXJSIgTo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734701099; c=relaxed/simple; bh=0iC0lQyNBuxKm1TUD7DF+PD53HARIMHVyuMWdRyh7Is=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SgFKqMRNE/Ue5DWLQadieqHDQPXHitvzBMLHtb4jaJrHzPnGphmS2YwcLFglyzKfcnq1LBJosRBb4wuRChMV1LX3oR56cyGYKMhui/Kv0nif2QYrKuGSHzpGXNp0cBpPWyUWxqgB4R7Mu2hEHEjIucSo7MdqK87l6tbCr+fB1TU= 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=HzRVRXQ7; arc=none smtp.client-ip=192.198.163.9 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="HzRVRXQ7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1734701097; x=1766237097; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0iC0lQyNBuxKm1TUD7DF+PD53HARIMHVyuMWdRyh7Is=; b=HzRVRXQ7w/rHLLuXtZNkazCLH6s7gqKkwGhYJc0SFumOm+ZAfbLoqVrj LyhVPgl7baThZf21t50i+gvhTAiB+GusLjw82LZkkBLvcG4MFTM3kPB2d YZInGxBdfYGlfCFcgUQ+Li9jLxMF9naqmO511w8gTsXFVkXa66hrJBklu ZmQyAWUa9FFElf1BDTck0auBc4Cj5qWHfBo3tUc0uXsWtEBO/lvidRVNF B7LsNPmkMtAoeG2p8Y3JYqS9z6Wulq/xg3Bq/HgrZkUe3FcDDVRU+4K7B hagqH6NX7dwSYpNMslppSLhWPCx75JU2GyXKXR80flx1Bzi0nPSGgumfu Q==; X-CSE-ConnectionGUID: hMjtoktdTNyNcTyrLMving== X-CSE-MsgGUID: I/W/HXWcTDqN19tVBgu2GQ== X-IronPort-AV: E=McAfee;i="6700,10204,11292"; a="45937645" X-IronPort-AV: E=Sophos;i="6.12,250,1728975600"; d="scan'208";a="45937645" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2024 05:24:57 -0800 X-CSE-ConnectionGUID: FoWtpdc4S2qM8Qj2Q71SfQ== X-CSE-MsgGUID: wUYBYwE/QZiESJt4HXFJJQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,250,1728975600"; d="scan'208";a="98333295" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2024 05:24:51 -0800 Received: from svinhufvud.intel.com (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 5F17C120B3E; Fri, 20 Dec 2024 15:24:46 +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 Subject: [RFC v4 7/9] media: uapi: Add V4L2_CID_BINNING control for binning configuration Date: Fri, 20 Dec 2024 15:24:17 +0200 Message-Id: <20241220132419.1027206-8-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241220132419.1027206-1-sakari.ailus@linux.intel.com> References: <20241220132419.1027206-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 configuting 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 --- .../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 5bc4c79d230c..c6167c91f46c 100644 --- a/Documentation/userspace-api/media/drivers/camera-sensor.rst +++ b/Documentation/userspace-api/media/drivers/camera-sensor.rst @@ -107,6 +107,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 24c9c25e20d1..5945976b841f 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! */ @@ -1424,6 +1425,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 0152240229ab..8d5815a058d7 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 Fri Dec 20 13:24:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13916752 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (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 683D4215F74 for ; Fri, 20 Dec 2024 13:25:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734701103; cv=none; b=VK37LGcJk8nG9A5X1fpXk082hRTmtps0/CZ6VYKGmz8m+q65MjK/RUwXIrFSg+yyD/Z7d4/w+EDbBLuOSJUP3/Y6k5qLd/hYyiWm5CW9JFPOWg98YxTwZ3TB6jJe3NvaV8YvljM3fuklZdUVURwumWCIdT9/mH6QPV4fhh0vxHc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734701103; c=relaxed/simple; bh=HTyCnoWk1tOz72CfpazuPbpDpgl7NgjnENNbzgKusig=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sGww83+sotjln8FWXmU45e+Oqljpjo8Qcfi3RZ4pNWycTOQVpuXu84t2l+7GhdarzLnjddlxJRdXWx52zvSesRUGHno9v/DtSZainjHZ26XkvaZcQH5dRKR35f9ioPvQRBItR6CrjRyUVhX+FKDs5BucWt++ONPPUnE9KQ5opZE= 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=N8RSn8zp; arc=none smtp.client-ip=192.198.163.9 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="N8RSn8zp" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1734701102; x=1766237102; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HTyCnoWk1tOz72CfpazuPbpDpgl7NgjnENNbzgKusig=; b=N8RSn8zp1ddgpIN5u8DMXKVD3V/UvHDzZWLBVarR8mKAc0N4iE68RXPr 2leOUTH28PvlElfeYCr0Cec66fbT5dCOygHujCbNk9n2GVKmm7/jw6jMh PCWs1S6IiqztFjGEhQEOm8qH0hCT06rxrBExtmXt/GsLGMk4fJ1b8nYkS qL2cBu9XpZ6CgMSNTUy53ebQatlu3kLNKM15Y7KVZsUj0/3mZHMb+raSC m7QsTAEF9x76xC1xiWJdhd3L3EtGas9CnRsfRoNh8T+akJPVrLRK4WT+c 3HePpH+wfcNKbiTee5YwDRQ5t9wpOQJYMmgc4R74qjx26ZU28r1QWDIA9 A==; X-CSE-ConnectionGUID: XtAnTlocQ26F0WBtxZfocg== X-CSE-MsgGUID: ZIpWVtZIQYGjvDPsWvp8Nw== X-IronPort-AV: E=McAfee;i="6700,10204,11292"; a="45937666" X-IronPort-AV: E=Sophos;i="6.12,250,1728975600"; d="scan'208";a="45937666" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2024 05:25:02 -0800 X-CSE-ConnectionGUID: CZYDqQ0tRtOdKFXr5VP1EQ== X-CSE-MsgGUID: 2ojxIa/zS5Ko6ciXVON7IA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="103132530" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2024 05:24:57 -0800 Received: from svinhufvud.intel.com (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id DCE5311F984; Fri, 20 Dec 2024 15:24: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 Subject: [RFC v4 8/9] media: uapi: Add controls for sub-sampling configuration Date: Fri, 20 Dec 2024 15:24:18 +0200 Message-Id: <20241220132419.1027206-9-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241220132419.1027206-1-sakari.ailus@linux.intel.com> References: <20241220132419.1027206-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 --- .../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 c6167c91f46c..e65e82c5940a 100644 --- a/Documentation/userspace-api/media/drivers/camera-sensor.rst +++ b/Documentation/userspace-api/media/drivers/camera-sensor.rst @@ -107,8 +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. -Binning -------- +Binning and sub-sampling +------------------------ Binning has traditionally been configured using :ref:`the compose selection rectangle `. The :ref:`V4L2_CID_BINNING @@ -117,6 +117,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 5945976b841f..cddece2876ce 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 8d5815a058d7..e85747e2181b 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 Fri Dec 20 13:24:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13916753 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (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 F24D0215F7E for ; Fri, 20 Dec 2024 13:25:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734701107; cv=none; b=Co/GWbTzM38G8Ud7WVFBuuz3n3lil0UgFS2j1OII7oBV1SF8eSpM5C8OFwNfotHJLpVCovbybpVVux4Ue35xePAzEcEkGNYHqUT5T5NPe1OHjYgl2hVE8dzbkwLW7Rqm2D5Tv4d/1BKjl9iZUh+04D67ixsGGS2iVl/4C1pplok= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734701107; c=relaxed/simple; bh=APCMTulVGvl/4oU3GCTZx2R+6M3HjalCZobgdjNcH2g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eQNar1P/xX9Yxb6otFf4zamSAqBZNluEfoXEPXhu4vV4Yb7yT75mYkfWE+jqGbd3xGC5Qk0zZ6w63s7h1vl2G0hG/To2AXA/kedPKoUbCXSGfjOGmAhqTOJKjwo+akWVAPu0vcUWNls+uIHxBDZaHjtp4S1AgphejquREnFhaoE= 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=itNlfKMs; arc=none smtp.client-ip=192.198.163.9 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="itNlfKMs" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1734701106; x=1766237106; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=APCMTulVGvl/4oU3GCTZx2R+6M3HjalCZobgdjNcH2g=; b=itNlfKMsuEDhOq7oXqtNtibV7BpgpegCc0/QTPhh8G10G9aySpva4MOX mPr4zwRZ+O58y8h0/qIKqyFNfB53S0Ax58oVEYfrM1gxYuU2bwZZcn02n B1WRZbARe9mUV4t9DbBh/mt/Q2MlI193GYOpTAPiX79+SE6ugQIt/4xtW TNe4z+5NdcgM9SF07Fm0L0XQyOhpMrjiPZmIudznq4XdRfqg412a+ox9Q pQmKHSK8375QZXzIeFegxtwdi+IQ2nAaju3R29ydhz/JULSj8B43U7hY5 AndXiz9olvDeADRL0uJXQWWx7JFcy+3kAHh68HbGeTsrbbz5yUbT5hKzM g==; X-CSE-ConnectionGUID: rou9pJEyT+WUypIdJe1z8w== X-CSE-MsgGUID: wMDnfltgSMe99C5BdaUEFA== X-IronPort-AV: E=McAfee;i="6700,10204,11292"; a="45937679" X-IronPort-AV: E=Sophos;i="6.12,250,1728975600"; d="scan'208";a="45937679" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2024 05:25:06 -0800 X-CSE-ConnectionGUID: A+iEhH4YTaCw1TI9T4YXfA== X-CSE-MsgGUID: Vuq7adqdTdylIbYkOAsTmQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="103132536" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2024 05:25:00 -0800 Received: from svinhufvud.intel.com (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id D164711FADB; Fri, 20 Dec 2024 15:24:54 +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 Subject: [RFC v4 9/9] media: Documentation: Add binning and sub-sampling controls Date: Fri, 20 Dec 2024 15:24:19 +0200 Message-Id: <20241220132419.1027206-10-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241220132419.1027206-1-sakari.ailus@linux.intel.com> References: <20241220132419.1027206-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 --- .../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