{"id":8808,"url":"https://patchwork.libcamera.org/api/1.1/patches/8808/?format=json","web_url":"https://patchwork.libcamera.org/patch/8808/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200715011833.24600-3-laurent.pinchart@ideasonboard.com>","date":"2020-07-15T01:18:22","name":"[libcamera-devel,v2,02/13] media: dt-bindings: video-interface: Replace 'rotation' description","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"7fc4ed02eb6d2b5cc893701ae9de87368e17b3ad","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":{"id":14,"url":"https://patchwork.libcamera.org/api/1.1/users/14/?format=json","username":"pinchartl","first_name":"Laurent","last_name":"Pinchart","email":"laurent.pinchart@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/patch/8808/mbox/","series":[{"id":1108,"url":"https://patchwork.libcamera.org/api/1.1/series/1108/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1108","date":"2020-07-15T01:18:21","name":"raspberrypi: Report sensor orientation through DT","version":2,"mbox":"https://patchwork.libcamera.org/series/1108/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/8808/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/8808/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 99784BD790\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 15 Jul 2020 01:18:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AB2856093E;\n\tWed, 15 Jul 2020 03:18:48 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6CBAA60923\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 15 Jul 2020 03:18:45 +0200 (CEST)","from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5AE8111C7;\n\tWed, 15 Jul 2020 03:18:44 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Solk1oEV\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1594775924;\n\tbh=AUwfr8i2FRhcBhHizkHc1B2+0ArBgwUBP7nBye5fFSk=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Solk1oEVWQuXnopzKl3kHTvtIDRfNrM6E5qhCvdUkD9EC5v+UV103f5e9T3zYnyei\n\tN5lec1udZICISoTeVrI1YYa8YmgvMGT5xwk668zrZ9Cmt4LJfFwxwkRZjO9hXD1dK2\n\tM5QTkozp5DhwsUcc2PUXDwRMG9rKhtcwgPeSZEm0=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Dave Stevenson <dave.stevenson@raspberrypi.com>","Date":"Wed, 15 Jul 2020 04:18:22 +0300","Message-Id":"<20200715011833.24600-3-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20200715011833.24600-1-laurent.pinchart@ideasonboard.com>","References":"<20200715011833.24600-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v2 02/13] media: dt-bindings:\n\tvideo-interface: Replace 'rotation' description","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"From: Jacopo Mondi <jacopo@jmondi.org>\n\nReplace the 'rotation' property description by providing a definition\nrelative to the camera sensor pixel array coordinate system and the\ncaptured scene.\n\nAcked-by: Rob Herring <robh@kernel.org>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\nSigned-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>\n\nCommit 915bd31ce9ed328535e5ecf3ca730c5764ec1a38 upstream\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n .../bindings/media/video-interfaces.txt       | 359 +++++++++++++++++-\n 1 file changed, 356 insertions(+), 3 deletions(-)","diff":"diff --git a/Documentation/devicetree/bindings/media/video-interfaces.txt b/Documentation/devicetree/bindings/media/video-interfaces.txt\nindex b1ff492c7da7..3920f25a9123 100644\n--- a/Documentation/devicetree/bindings/media/video-interfaces.txt\n+++ b/Documentation/devicetree/bindings/media/video-interfaces.txt\n@@ -85,9 +85,362 @@ Optional properties\n \n - lens-focus: A phandle to the node of the focus lens controller.\n \n-- rotation: The device, typically an image sensor, is not mounted upright,\n-  but a number of degrees counter clockwise. Typical values are 0 and 180\n-  (upside down).\n+- rotation: The camera rotation is expressed as the angular difference in\n+  degrees between two reference systems, one relative to the camera module, and\n+  one defined on the external world scene to be captured when projected on the\n+  image sensor pixel array.\n+\n+  A camera sensor has a 2-dimensional reference system 'Rc' defined by\n+  its pixel array read-out order. The origin is set to the first pixel\n+  being read out, the X-axis points along the column read-out direction\n+  towards the last columns, and the Y-axis along the row read-out\n+  direction towards the last row.\n+\n+  A typical example for a sensor with a 2592x1944 pixel array matrix\n+  observed from the front is:\n+\n+              2591       X-axis          0\n+                <------------------------+ 0\n+                .......... ... ..........!\n+                .......... ... ..........! Y-axis\n+                           ...           !\n+                .......... ... ..........!\n+                .......... ... ..........! 1943\n+                                         V\n+\n+  The external world scene reference system 'Rs' is a 2-dimensional\n+  reference system on the focal plane of the camera module. The origin is\n+  placed on the top-left corner of the visible scene, the X-axis points\n+  towards the right, and the Y-axis points towards the bottom of the\n+  scene. The top, bottom, left and right directions are intentionally not\n+  defined and depend on the environment in which the camera is used.\n+\n+  A typical example of a (very common) picture of a shark swimming from\n+  left to right, as seen from the camera, is:\n+\n+               0               X-axis\n+             0 +------------------------------------->\n+               !\n+               !\n+               !\n+               !           |\\____)\\___\n+               !           ) _____  __`<\n+               !           |/     )/\n+               !\n+               !\n+               !\n+               V\n+             Y-axis\n+\n+  with the reference system 'Rs' placed on the camera focal plane:\n+\n+                                  ¸.·˙!\n+                              ¸.·˙    !\n+                  _       ¸.·˙        !\n+               +-/ \\-+¸.·˙            !\n+               | (o) |                ! Camera focal plane\n+               +-----+˙·.¸            !\n+                          ˙·.¸        !\n+                              ˙·.¸    !\n+                                  ˙·.¸!\n+\n+  When projected on the sensor's pixel array, the image and the associated\n+  reference system 'Rs' are typically (but not always) inverted, due to\n+  the camera module's lens optical inversion effect.\n+\n+  Assuming the above represented scene of the swimming shark, the lens\n+  inversion projects the scene and its reference system onto the sensor\n+  pixel array, seen from the front of the camera sensor, as follows:\n+\n+            Y-axis\n+               ^\n+               !\n+               !\n+               !\n+               !            |\\_____)\\__\n+               !            ) ____  ___.<\n+               !            |/    )/\n+               !\n+               !\n+               !\n+             0 +------------------------------------->\n+               0               X-axis\n+\n+  Note the shark being upside-down.\n+\n+  The resulting projected reference system is named 'Rp'.\n+\n+  The camera rotation property is then defined as the angular difference\n+  in the counter-clockwise direction between the camera reference system\n+  'Rc' and the projected scene reference system 'Rp'. It is expressed in\n+  degrees as a number in the range [0, 360[.\n+\n+  Examples\n+\n+  0 degrees camera rotation:\n+\n+\n+                    Y-Rp\n+                     ^\n+              Y-Rc   !\n+               ^     !\n+               !     !\n+               !     !\n+               !     !\n+               !     !\n+               !     !\n+               !     !\n+               !     !\n+               !   0 +------------------------------------->\n+               !     0               X-Rp\n+             0 +------------------------------------->\n+               0               X-Rc\n+\n+\n+                                X-Rc                0\n+               <------------------------------------+ 0\n+                           X-Rp                 0   !\n+           <------------------------------------+ 0 !\n+                                                !   !\n+                                                !   !\n+                                                !   !\n+                                                !   !\n+                                                !   !\n+                                                !   !\n+                                                !   !\n+                                                !   V\n+                                                !  Y-Rc\n+                                                V\n+                                               Y-Rp\n+\n+  90 degrees camera rotation:\n+\n+               0        Y-Rc\n+             0 +-------------------->\n+               !   Y-Rp\n+               !    ^\n+               !    !\n+               !    !\n+               !    !\n+               !    !\n+               !    !\n+               !    !\n+               !    !\n+               !    !\n+               !    !\n+               !  0 +------------------------------------->\n+               !    0              X-Rp\n+               !\n+               !\n+               !\n+               !\n+               V\n+              X-Rc\n+\n+  180 degrees camera rotation:\n+\n+                                            0\n+       <------------------------------------+ 0\n+                        X-Rc                !\n+              Y-Rp                          !\n+               ^                            !\n+               !                            !\n+               !                            !\n+               !                            !\n+               !                            !\n+               !                            !\n+               !                            !\n+               !                            V\n+               !                           Y-Rc\n+             0 +------------------------------------->\n+               0              X-Rp\n+\n+  270 degrees camera rotation:\n+\n+               0        Y-Rc\n+             0 +-------------------->\n+               !                                        0\n+               !    <-----------------------------------+ 0\n+               !                    X-Rp                !\n+               !                                        !\n+               !                                        !\n+               !                                        !\n+               !                                        !\n+               !                                        !\n+               !                                        !\n+               !                                        !\n+               !                                        !\n+               !                                        V\n+               !                                       Y-Rp\n+               !\n+               !\n+               !\n+               !\n+               V\n+              X-Rc\n+\n+\n+  Example one - Webcam\n+\n+  A camera module installed on the user facing part of a laptop screen\n+  casing used for video calls. The captured images are meant to be\n+  displayed in landscape mode (width > height) on the laptop screen.\n+\n+  The camera is typically mounted upside-down to compensate the lens\n+  optical inversion effect:\n+\n+                    Y-Rp\n+              Y-Rc   ^\n+               ^     !\n+               !     !\n+               !     !       |\\_____)\\__\n+               !     !       ) ____  ___.<\n+               !     !       |/    )/\n+               !     !\n+               !     !\n+               !     !\n+               !   0 +------------------------------------->\n+               !     0           X-Rp\n+             0 +------------------------------------->\n+               0            X-Rc\n+\n+  The two reference systems are aligned, the resulting camera rotation is\n+  0 degrees, no rotation correction needs to be applied to the resulting\n+  image once captured to memory buffers to correctly display it to users:\n+\n+               +--------------------------------------+\n+               !                                      !\n+               !                                      !\n+               !                                      !\n+               !             |\\____)\\___              !\n+               !             ) _____  __`<            !\n+               !             |/     )/                !\n+               !                                      !\n+               !                                      !\n+               !                                      !\n+               +--------------------------------------+\n+\n+  If the camera sensor is not mounted upside-down to compensate for the\n+  lens optical inversion, the two reference systems will not be aligned,\n+  with 'Rp' being rotated 180 degrees relatively to 'Rc':\n+\n+\n+                        X-Rc                0\n+       <------------------------------------+ 0\n+                                            !\n+              Y-Rp                          !\n+               ^                            !\n+               !                            !\n+               !       |\\_____)\\__          !\n+               !       ) ____  ___.<        !\n+               !       |/    )/             !\n+               !                            !\n+               !                            !\n+               !                            V\n+               !                           Y-Rc\n+             0 +------------------------------------->\n+               0            X-Rp\n+\n+  The image once captured to memory will then be rotated by 180 degrees:\n+\n+               +--------------------------------------+\n+               !                                      !\n+               !                                      !\n+               !                                      !\n+               !              __/(_____/|             !\n+               !            >.___  ____ (             !\n+               !                 \\(    \\|             !\n+               !                                      !\n+               !                                      !\n+               !                                      !\n+               +--------------------------------------+\n+\n+  A software rotation correction of 180 degrees should be applied to\n+  correctly display the image:\n+\n+               +--------------------------------------+\n+               !                                      !\n+               !                                      !\n+               !                                      !\n+               !             |\\____)\\___              !\n+               !             ) _____  __`<            !\n+               !             |/     )/                !\n+               !                                      !\n+               !                                      !\n+               !                                      !\n+               +--------------------------------------+\n+\n+  Example two - Phone camera\n+\n+  A camera installed on the back side of a mobile device facing away from\n+  the user. The captured images are meant to be displayed in portrait mode\n+  (height > width) to match the device screen orientation and the device\n+  usage orientation used when taking the picture.\n+\n+  The camera sensor is typically mounted with its pixel array longer side\n+  aligned to the device longer side, upside-down mounted to compensate for\n+  the lens optical inversion effect:\n+\n+               0        Y-Rc\n+             0 +-------------------->\n+               !   Y-Rp\n+               !    ^\n+               !    !\n+               !    !\n+               !    !\n+               !    !            |\\_____)\\__\n+               !    !            ) ____  ___.<\n+               !    !            |/    )/\n+               !    !\n+               !    !\n+               !    !\n+               !  0 +------------------------------------->\n+               !    0                X-Rp\n+               !\n+               !\n+               !\n+               !\n+               V\n+              X-Rc\n+\n+  The two reference systems are not aligned and the 'Rp' reference\n+  system is rotated by 90 degrees in the counter-clockwise direction\n+  relatively to the 'Rc' reference system.\n+\n+  The image once captured to memory will be rotated:\n+\n+               +-------------------------------------+\n+               |                 _ _                 |\n+               |                \\   /                |\n+               |                 | |                 |\n+               |                 | |                 |\n+               |                 |  >                |\n+               |                <  |                 |\n+               |                 | |                 |\n+               |                   .                 |\n+               |                  V                  |\n+               +-------------------------------------+\n+\n+  A correction of 90 degrees in counter-clockwise direction has to be\n+  applied to correctly display the image in portrait mode on the device\n+  screen:\n+\n+                        +--------------------+\n+                        |                    |\n+                        |                    |\n+                        |                    |\n+                        |                    |\n+                        |                    |\n+                        |                    |\n+                        |   |\\____)\\___      |\n+                        |   ) _____  __`<    |\n+                        |   |/     )/        |\n+                        |                    |\n+                        |                    |\n+                        |                    |\n+                        |                    |\n+                        |                    |\n+                        +--------------------+\n \n - orientation: The orientation of a device (typically an image sensor or a flash\n   LED) describing its mounting position relative to the usage orientation of the\n","prefixes":["libcamera-devel","v2","02/13"]}