{"id":11747,"url":"https://patchwork.libcamera.org/api/patches/11747/?format=json","web_url":"https://patchwork.libcamera.org/patch/11747/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20210328224528.55468-2-hiroh@chromium.org>","date":"2021-03-28T22:45:26","name":"[libcamera-devel,v2,1/3] android: CameraDevice: Validate crop_rotate_scale_degrees in configuration","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"42eb0e2786cb897eb6f08b3769ec387a68c3045f","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/?format=json","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11747/mbox/","series":[{"id":1855,"url":"https://patchwork.libcamera.org/api/series/1855/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1855","date":"2021-03-28T22:45:25","name":"Regard crop_rotate_scale_degrees in configuration","version":2,"mbox":"https://patchwork.libcamera.org/series/1855/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11747/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11747/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 5B2DBC32EA\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 28 Mar 2021 22:45:39 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 19DC068788;\n\tMon, 29 Mar 2021 00:45:39 +0200 (CEST)","from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com\n\t[IPv6:2607:f8b0:4864:20::102f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5C7776877C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Mar 2021 00:45:37 +0200 (CEST)","by mail-pj1-x102f.google.com with SMTP id\n\tf2-20020a17090a4a82b02900c67bf8dc69so6808554pjh.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 28 Mar 2021 15:45:37 -0700 (PDT)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:1db7:ae60:9288:b906])\n\tby smtp.gmail.com with ESMTPSA id\n\tq25sm14814244pff.104.2021.03.28.15.45.34\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSun, 28 Mar 2021 15:45:35 -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=\"QpaszsmQ\"; 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=zk4sjHPGuv7zXqT8sfjgx4K+iKxGU2Nrb0XJoo3SUQ8=;\n\tb=QpaszsmQntqgX0/oW8ppqsfnW8qkUkYzC2xz7uQqZKXL9GCmeqUxHYF3E5Xe67fMLS\n\tTN/1pU9WgRum0PQCz6KKKTajZ+khXyqxgcNHiFOgUGqrNB11GdeST3+8O7aEIcWCoJqj\n\tg5tdyYyfMb7HHKwVCq8tIUrGA+kXs3tHxT338=","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=zk4sjHPGuv7zXqT8sfjgx4K+iKxGU2Nrb0XJoo3SUQ8=;\n\tb=hTdIno1SbFMrl6X0b/gpiYZ04ogN3H4kcR0s12xWIV8nZA9N2ZpJnGKkJTa/suDI/m\n\tHqg7IVd5M0X3zXWDh5WLAMqOUgIWS1GejRvF7bJqXmL4k2B8LShSV6baEEvzroCo7udh\n\tnKrKM7NrWzW/4+mw5NdKvyZ4UsoCFAwSoBjapEmgzDz9WkL86/6RDfzwpHaqSwuysr17\n\t23DF+OEUIjm8D5lUdtFJMSVzK6J22QmuDFhNo5vLrPmkYoRQndK1yUj/b2eq+/OUY1sv\n\tbTQ5ysdV0otBzwVcg88eyde83ECWkKkCC9ztZGObyz9MOOGZ1QNuHJ0im/06+ziRHpbX\n\t5R/Q==","X-Gm-Message-State":"AOAM532ubP+cmArSGSDLLzu6QHyCxtVCSvDAUJnpM+xATbZHcml1LVkh\n\tJnlEGX7HVoRa96ornwGSZKLm02gah/yblQ==","X-Google-Smtp-Source":"ABdhPJyakDNRg1ggJxTUl2N8uJ7GBk8LHpb8B9qEwjp0P7tJeX/L+tq3BivPgYbpR5Y7hUWxGQx2RA==","X-Received":"by 2002:a17:90a:7a8b:: with SMTP id\n\tq11mr24043699pjf.215.1616971535869; \n\tSun, 28 Mar 2021 15:45:35 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 29 Mar 2021 07:45:26 +0900","Message-Id":"<20210328224528.55468-2-hiroh@chromium.org>","X-Mailer":"git-send-email 2.31.0.291.g576ba9dcdaf-goog","In-Reply-To":"<20210328224528.55468-1-hiroh@chromium.org>","References":"<20210328224528.55468-1-hiroh@chromium.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v2 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 | 39 +++++++++++++++++++++++++++++++++++\n 1 file changed, 39 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 ae693664..c5e55a18 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -256,6 +256,39 @@ void sortCamera3StreamConfigs(std::vector<Camera3StreamConfig> &unsortedConfigs,\n \tunsortedConfigs = sortedConfigs;\n }\n\n+/*\n+ * Returns where crop_rotate_scale_degrees in all camera3_stream in stream_list\n+ * are valid.\n+ */\n+bool validateCropRotate(const camera3_stream_configuration_t &stream_list)\n+{\n+\tASSERT(stream_list.num_streams > 0);\n+\n+\tconst int cropRotateScaleDegrees =\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 (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+\n } /* namespace */\n\n /*\n@@ -1552,6 +1585,12 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \t\trunning_ = false;\n \t}\n\n+\tif (stream_list->num_streams == 0)\n+\t\treturn -EINVAL;\n+\n+\tif (!validateCropRotate(*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","v2","1/3"]}