{"id":11826,"url":"https://patchwork.libcamera.org/api/1.1/patches/11826/?format=json","web_url":"https://patchwork.libcamera.org/patch/11826/","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":"<20210403131015.1590399-2-hiroh@chromium.org>","date":"2021-04-03T13:10:13","name":"[libcamera-devel,v4,2/4] android: CameraDevice: Validate crop_rotate_scale_degrees in configuration","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"cc04747064eec032191e0b67c4ae0b7e7e42af9f","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/11826/mbox/","series":[{"id":1885,"url":"https://patchwork.libcamera.org/api/1.1/series/1885/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1885","date":"2021-04-03T13:10:13","name":null,"version":4,"mbox":"https://patchwork.libcamera.org/series/1885/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11826/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11826/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 E66F7C0DA3\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat,  3 Apr 2021 13:10:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A22EC6877E;\n\tSat,  3 Apr 2021 15:10:25 +0200 (CEST)","from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com\n\t[IPv6:2607:f8b0:4864:20::62e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CAC39602CF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  3 Apr 2021 15:10:23 +0200 (CEST)","by mail-pl1-x62e.google.com with SMTP id t20so3635720plr.13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 03 Apr 2021 06:10:23 -0700 (PDT)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:d1f5:1b96:f027:f646])\n\tby smtp.gmail.com with ESMTPSA id\n\th6sm11303271pfb.157.2021.04.03.06.10.20\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSat, 03 Apr 2021 06:10:21 -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=\"ePrKsf3T\"; 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=O9gdRyPR1TApuPAMGULeLbUsGyF31phekVniyKsKgAU=;\n\tb=ePrKsf3T7cpjLgJWCqmLkFAqKmHZAf/C0RKf+KO5Cw2w2ItkqvfYOJEtDID2oWL3oL\n\t4Zpfx51qBldXSO0o5GKqXJ8A/SmipO4kGn0b0BIPhOjwgUa8ZpZ1JGZdwcB58biSExuk\n\tcHMKqq4G67+1ch3jxYNJf4/o1glqK/uCchhVU=","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=O9gdRyPR1TApuPAMGULeLbUsGyF31phekVniyKsKgAU=;\n\tb=eXWnv+UKCeVAnuIH8utiijIk24dp/wnbGILhWkLWuCvFHc0URp7ydMnkp5XL5Z/QBd\n\tFnZJyD2yhuSGmTDznr/doIgV67q6aTwnQ3mdOCRZwhjCuMtF1XUXBB7w5NKUcsfvk7hd\n\tO9YjLQ2z8Nu3BxemYb/QB/tqe8Mgua8iXlDwcJ2hF8rdZvbxIJDAgUNDIrNqr9ZMlvMr\n\tTeTsvlR/G2ArZ35GqGRxe73K1h10JZoZLt2IijOhaqGfEJSkcI8xuCRcD9a2TEcMJMNi\n\tCBzoou/E1OoXrX6AdFZdCrRgDoNGcXEe3dtUr07LFXIJ8zx7BSyoRcxjpm4jiofzqhtt\n\t63yA==","X-Gm-Message-State":"AOAM531Rc+97tTA9XpukNHWjl9zl2LwfrZdRDT9v7586LHpULbqePUa6\n\tAVaLdRN96Vy5Weha8XpWThkyhRUEJIN8Ww==","X-Google-Smtp-Source":"ABdhPJwUxCFeYbTU9/2ga+8LX1XGjlcNh0c48SUUF72SxifG4vJ4vU79cXAcKwPVTiAdNr61YKGLQg==","X-Received":"by 2002:a17:90b:100a:: with SMTP id\n\tgm10mr18166568pjb.0.1617455422240; \n\tSat, 03 Apr 2021 06:10:22 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Sat,  3 Apr 2021 22:10:13 +0900","Message-Id":"<20210403131015.1590399-2-hiroh@chromium.org>","X-Mailer":"git-send-email 2.31.0.208.g409f899ff0-goog","In-Reply-To":"<20210403131015.1590399-1-hiroh@chromium.org>","References":"<20210403131015.1590399-1-hiroh@chromium.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v4 2/4] 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=\"utf-8\"","Content-Transfer-Encoding":"base64","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>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/android/camera_device.cpp | 43 +++++++++++++++++++++++++++++++++++\n 1 file changed, 43 insertions(+)","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex eb327978..3f7cce8e 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -256,6 +256,44 @@ void sortCamera3StreamConfigs(std::vector<Camera3StreamConfig> &unsortedConfigs,\n \tunsortedConfigs = sortedConfigs;\n }\n \n+#if defined(OS_CHROMEOS)\n+/*\n+ * Check whether the crop_rotate_scale_degrees values for all streams in\n+ * the list are valid according to the Chrome OS camera HAL API.\n+ */\n+bool validateCropRotate(const camera3_stream_configuration_t &streamList)\n+{\n+\tASSERT(streamList.num_streams > 0);\n+\tconst int cropRotateScaleDegrees =\n+\t\tstreamList.streams[0]->crop_rotate_scale_degrees;\n+\tfor (unsigned int i = 0; i < streamList.num_streams; ++i) {\n+\t\tconst camera3_stream_t &stream = *streamList.streams[i];\n+\n+\t\tswitch (stream.crop_rotate_scale_degrees) {\n+\t\tcase CAMERA3_STREAM_ROTATION_0:\n+\t\tcase CAMERA3_STREAM_ROTATION_90:\n+\t\tcase CAMERA3_STREAM_ROTATION_270:\n+\t\t\tbreak;\n+\n+\t\t/* 180° rotation is specified by Chrome OS as invalid. */\n+\t\tcase CAMERA3_STREAM_ROTATION_180:\n+\t\tdefault:\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+\n+\t\tif (cropRotateScaleDegrees != 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+\n+\treturn true;\n+}\n+#endif\n+\n } /* namespace */\n \n /*\n@@ -1554,6 +1592,11 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \t\trunning_ = false;\n \t}\n \n+#if defined(OS_CHROMEOS)\n+\tif (!validateCropRotate(*stream_list))\n+\t\treturn -EINVAL;\n+#endif\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","v4","2/4"]}