{"id":11703,"url":"https://patchwork.libcamera.org/api/1.1/patches/11703/?format=json","web_url":"https://patchwork.libcamera.org/patch/11703/","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":"<20210325051931.3748204-2-hiroh@chromium.org>","date":"2021-03-25T05:19:29","name":"[libcamera-devel,1/3] android: CameraDevice: Validate crop_rotate_scale_degrees in configuration","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"f569e16ad563e46a38141d1ad925b2692a4f1c5d","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/1.1/people/63/?format=json","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11703/mbox/","series":[{"id":1830,"url":"https://patchwork.libcamera.org/api/1.1/series/1830/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1830","date":"2021-03-25T05:19:28","name":"Regard crop_rotate_scale_degrees in configuration","version":1,"mbox":"https://patchwork.libcamera.org/series/1830/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11703/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11703/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 7BA8AC32E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 25 Mar 2021 05:19:45 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9358968D5E;\n\tThu, 25 Mar 2021 06:19:44 +0100 (CET)","from mail-pg1-x536.google.com (mail-pg1-x536.google.com\n\t[IPv6:2607:f8b0:4864:20::536])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6ACE5602D7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 25 Mar 2021 06:19:43 +0100 (CET)","by mail-pg1-x536.google.com with SMTP id f10so632594pgl.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 24 Mar 2021 22:19:43 -0700 (PDT)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:7c07:24cd:c637:7fab])\n\tby smtp.gmail.com with ESMTPSA id\n\tfs9sm3999250pjb.40.2021.03.24.22.19.40\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 24 Mar 2021 22:19:41 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"BtD4JuMg\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=JA45d1nxGZzoAYuR5Vt+C+TDUKQUzaepsHQRv/+izzg=;\n\tb=BtD4JuMgtsQs4PxjDhvViefJQykULHpbkwkhIXOVmjMYR7d+m4sb6JS6Xgqu6H4BXJ\n\t2s3mqsSZUIR8rpaEvf9rWjCE8Fq6PdSU3AlqaY4AEcEU8OafXSQ0Pr3osa/EB6vsguC8\n\tOCLFhW838vPbXWrLKYDHQO2qDiWBjO4nHnsbs=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=JA45d1nxGZzoAYuR5Vt+C+TDUKQUzaepsHQRv/+izzg=;\n\tb=p5Rquw6MOOKqUrFRc8SnD9oE8iwh1Pj+iH+9yAK8/lnXvju65bGR4ZTLqAUWTfxgIG\n\t4wbyGjc0ynnlRIaZ6gUw1mvx1KWCNocuzSTcme/E8xG78wd4LwzDFM6eXJE01sxXKSL4\n\tyrYLQGTe8LES9ywHNwgTYMFkBb5qnhGFTsAHBviJP3RNOlKsJdFcMz0A4cBCf8Ux3PS4\n\tNQWHY+trFAWGzD+RKYFAsKfYxgtH4gFk/wX6AKSxDQG+WurURfCBxcz1BDqotIK1q8No\n\tQJHarDB6rmNmiLfHRHOjRZ/u6fG+dQD8nxxV650PqbmgeD4ahN2fkstIFADeKaFXA/U/\n\t1L+w==","X-Gm-Message-State":"AOAM533bh3qevda0cZIhmotM3P8uowkrgWiK1zTlFM4aUtg7ipc2M/f9\n\tGhQTVmBRIxy99snxtnKlftaKl7ZJWChu3w==","X-Google-Smtp-Source":"ABdhPJz7iSjwGheOrL/IuxrDEUqLs7DExuL6rrEGnD8myKqbCvX76ToO6B2H+YVvDi/CqFbiJ1wWew==","X-Received":"by 2002:a17:902:e54c:b029:e6:42ee:18ae with SMTP id\n\tn12-20020a170902e54cb02900e642ee18aemr7401856plf.68.1616649581653; \n\tWed, 24 Mar 2021 22:19:41 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 25 Mar 2021 14:19:29 +0900","Message-Id":"<20210325051931.3748204-2-hiroh@chromium.org>","X-Mailer":"git-send-email 2.31.0.291.g576ba9dcdaf-goog","In-Reply-To":"<20210325051931.3748204-1-hiroh@chromium.org>","References":"<20210325051931.3748204-1-hiroh@chromium.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 1/3] android: CameraDevice: Validate\n\tcrop_rotate_scale_degrees in configuration","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>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Libcamera doesn't handle |crop_rotate_scale_degrees| in\ncamera3_stream at all. This adds the validation of the requested\n|crop_rotate_scale_degrees| in configuration, but still not\nhandle the specified values.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n src/android/camera_device.cpp | 35 +++++++++++++++++++++++++++++++++++\n 1 file changed, 35 insertions(+)\n\n--\n2.31.0.291.g576ba9dcdaf-goog","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 72a89258..1414bfef 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -256,6 +256,38 @@ void sortCamera3StreamConfigs(std::vector<Camera3StreamConfig> &unsortedConfigs,\n \tunsortedConfigs = sortedConfigs;\n }\n\n+/*\n+ *  verifyCropRotateScaleDegrees returns where |crop_rotate_scale_degrees| in\n+ * all camera3_stream in stream_list are valid.\n+ */\n+bool verifyCropRotateScaleDegrees(const camera3_stream_configuration_t &stream_list)\n+{\n+\tif (stream_list.num_streams == 0)\n+\t\treturn true;\n+\tconst int crop_rotate_scale_degrees =\n+\t\tstream_list.streams[0]->crop_rotate_scale_degrees;\n+\tfor (unsigned int i = 0; i < stream_list.num_streams; ++i) {\n+\t\tconst camera3_stream_t &stream = *stream_list.streams[i];\n+\t\tif (CAMERA3_STREAM_ROTATION_0 > stream.crop_rotate_scale_degrees ||\n+\t\t    CAMERA3_STREAM_ROTATION_270 < stream.crop_rotate_scale_degrees) {\n+\t\t\tLOG(HAL, Error) << \"invalid crop_rotate_scale_degrees: \"\n+\t\t\t\t\t<< stream.crop_rotate_scale_degrees;\n+\t\t\treturn false;\n+\t\t}\n+\t\tif (stream.crop_rotate_scale_degrees == CAMERA3_STREAM_ROTATION_180) {\n+\t\t\tLOG(HAL, Error) << \"crop_rotate_scale_degrees should \"\n+\t\t\t\t\t<< \"not be CAMERA3_STREAM_ROTATION_180\";\n+\t\t\treturn false;\n+\t\t}\n+\t\tif (crop_rotate_scale_degrees != stream.crop_rotate_scale_degrees) {\n+\t\t\tLOG(HAL, Error) << \"crop_rotate_scale_degrees in all \"\n+\t\t\t\t\t<< \"streams are not identical\";\n+\t\t\treturn false;\n+\t\t}\n+\t}\n+\treturn true;\n+}\n+\n } /* namespace */\n\n /*\n@@ -1566,6 +1598,9 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \t\trunning_ = false;\n \t}\n\n+\tif (!verifyCropRotateScaleDegrees(*stream_list))\n+\t\treturn -EINVAL;\n+\n \t/*\n \t * Generate an empty configuration, and construct a StreamConfiguration\n \t * for each camera3_stream to add to it.\n","prefixes":["libcamera-devel","1/3"]}