{"id":12676,"url":"https://patchwork.libcamera.org/api/patches/12676/?format=json","web_url":"https://patchwork.libcamera.org/patch/12676/","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":"<20210622023654.969162-5-hiroh@chromium.org>","date":"2021-06-22T02:36:54","name":"[libcamera-devel,RFC,v2,5/5] android: camera_device: Propagate the requested test pattern mode","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"84edba8835ae0a12b5aaaa1f05157d14ac59bff7","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/12676/mbox/","series":[{"id":2164,"url":"https://patchwork.libcamera.org/api/series/2164/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2164","date":"2021-06-22T02:36:50","name":"[libcamera-devel,RFC,v2,1/5] libcamera: camera_sensor: Reverse the key and value of test pattern mode map","version":2,"mbox":"https://patchwork.libcamera.org/series/2164/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12676/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12676/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 89F36C321B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 22 Jun 2021 02:37:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 437A868EA1;\n\tTue, 22 Jun 2021 04:37:09 +0200 (CEST)","from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com\n\t[IPv6:2607:f8b0:4864:20::1031])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C9CFA68940\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Jun 2021 04:37:06 +0200 (CEST)","by mail-pj1-x1031.google.com with SMTP id g24so11201363pji.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 21 Jun 2021 19:37:06 -0700 (PDT)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:a025:f98b:b63b:e6b2])\n\tby smtp.gmail.com with ESMTPSA id\n\to7sm18947145pgs.45.2021.06.21.19.37.04\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 21 Jun 2021 19:37:04 -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=\"c4RDou7u\"; 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=B0s4KHmAp6nPmFW5JVa7GT7U2/8B2OuqQN0WjCdQu0w=;\n\tb=c4RDou7uyXfiPl+OBPgwmAKCy0TS/npf9SF+XeesvNrzndxZMJTtF56zVdKcuQY9oc\n\tsamANHaTZsZGJY4aw8+cMr+Li34DiEL93heQNjXZIxXg/UpCtmvO/vHF0T33I8yMeUUJ\n\tjd8ZK7YbeRwk18kB0QHD1XaMfBGUg54cj9E1M=","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=B0s4KHmAp6nPmFW5JVa7GT7U2/8B2OuqQN0WjCdQu0w=;\n\tb=ADctxWmkPhij8DV1sD05o0ohWyt3yGShfeKMVO1Yf4rfPtXGnPpHihavpSjnUhTfGj\n\tOw1JVJQ8aw/WfH8SoPPsobeeizOeGCNBH69B6FaBTOTVbj9J3HhAmHNiwqZYL/RlFG1f\n\tyv3rt2kroWSvzSOqbBo4k76YFtII5+tVdkp4hhuD8Xevr9Je+MfTcQkl6AhqvnEB0iJl\n\tlwK4LS1FFcnq+GfqPrNQg7mnTfAYAt/h9Xl5d4IX5ImPtsM2q8R+E9qyBKV1QveUvPfz\n\tFS7FTCRLcBY5g1BzKgGugGRNLFJf85IPwngKz4wbUI7o3sX5Oxno6/bVlkx7SHqXHilP\n\tXT9w==","X-Gm-Message-State":"AOAM533shgcz8PGd7D2KVIQZZlN1A7efoLvGp/3xsn/wiWciUxg2LmRw\n\tiV26ZccMj5vfw1x8y+FIpHitCN6vP3bQ0A==","X-Google-Smtp-Source":"ABdhPJz9lzaLbMQ/ryqpuRLrS6uQ8ovzBH/GVMVx02TuChOICy/71EOsv5hgv9nnKJ+euS2aykLqow==","X-Received":"by 2002:a17:902:868d:b029:11e:6556:acea with SMTP id\n\tg13-20020a170902868db029011e6556aceamr20453907plo.59.1624329425245; \n\tMon, 21 Jun 2021 19:37:05 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 22 Jun 2021 11:36:54 +0900","Message-Id":"<20210622023654.969162-5-hiroh@chromium.org>","X-Mailer":"git-send-email 2.32.0.288.g62a8d224e6-goog","In-Reply-To":"<20210622023654.969162-1-hiroh@chromium.org>","References":"<20210622023654.969162-1-hiroh@chromium.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [RFC PATCH v2 5/5] android: camera_device:\n\tPropagate the requested test pattern mode","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Propagate the requested test pattern mode to libcamera::Camera\nthrough libcamera::Request and also set the android metadata to\nthe test pattern mode contained by the complete Request.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n src/android/camera_device.cpp | 50 ++++++++++++++++++++++++++++++++++-\n 1 file changed, 49 insertions(+), 1 deletion(-)","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 8c71fd06..5c2100ad 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -1933,16 +1933,57 @@ int CameraDevice::processControls(Camera3RequestDescriptor *descriptor)\n \t\treturn 0;\n \n \t/* Translate the Android request settings to libcamera controls. */\n+\tControlList &controls = descriptor->request_->controls();\n \tcamera_metadata_ro_entry_t entry;\n \tif (settings.getEntry(ANDROID_SCALER_CROP_REGION, &entry)) {\n \t\tconst int32_t *data = entry.data.i32;\n \t\tRectangle cropRegion{ data[0], data[1],\n \t\t\t\t      static_cast<unsigned int>(data[2]),\n \t\t\t\t      static_cast<unsigned int>(data[3]) };\n-\t\tControlList &controls = descriptor->request_->controls();\n \t\tcontrols.set(controls::ScalerCrop, cropRegion);\n \t}\n \n+\tif (settings.getEntry(ANDROID_SENSOR_TEST_PATTERN_MODE, &entry)) {\n+\t\tconst int32_t data = *entry.data.i32;\n+\t\tswitch (data) {\n+\t\tcase ANDROID_SENSOR_TEST_PATTERN_MODE_OFF:\n+\t\t\tcontrols.set(controls::draft::TestPatternMode,\n+\t\t\t\t     controls::draft::TestPatternModeOff);\n+\t\t\tbreak;\n+\n+\t\tcase ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR:\n+\t\t\tcontrols.set(controls::draft::TestPatternMode,\n+\t\t\t\t     controls::draft::TestPatternModeSolidColor);\n+\t\t\tbreak;\n+\n+\t\tcase ANDROID_SENSOR_TEST_PATTERN_MODE_COLOR_BARS:\n+\t\t\tcontrols.set(controls::draft::TestPatternMode,\n+\t\t\t\t     controls::draft::TestPatternModeColorBars);\n+\t\t\tbreak;\n+\n+\t\tcase ANDROID_SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY:\n+\t\t\tcontrols.set(controls::draft::TestPatternMode,\n+\t\t\t\t     controls::draft::TestPatternModeColorBarsFadeToGray);\n+\t\t\tbreak;\n+\n+\t\tcase ANDROID_SENSOR_TEST_PATTERN_MODE_PN9:\n+\t\t\tcontrols.set(controls::draft::TestPatternMode,\n+\t\t\t\t     controls::draft::TestPatternModePn9);\n+\t\t\tbreak;\n+\n+\t\tcase ANDROID_SENSOR_TEST_PATTERN_MODE_CUSTOM1:\n+\t\t\tcontrols.set(controls::draft::TestPatternMode,\n+\t\t\t\t     controls::draft::TestPatternModeCustom1);\n+\t\t\tbreak;\n+\n+\t\tdefault:\n+\t\t\tLOG(HAL, Error)\n+\t\t\t\t<< \"Unknown test pattern mode: \" << data;\n+\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t}\n+\n \treturn 0;\n }\n \n@@ -2429,6 +2470,13 @@ CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor) cons\n \t\tresultMetadata->addEntry(ANDROID_SCALER_CROP_REGION, cropRect);\n \t}\n \n+\tif (metadata.contains(controls::draft::TestPatternMode)) {\n+\t\tconst int32_t testPatternMode =\n+\t\t\tmetadata.get(controls::draft::TestPatternMode);\n+\t\tresultMetadata->addEntry(ANDROID_SENSOR_TEST_PATTERN_MODE,\n+\t\t\t\t\t testPatternMode);\n+\t}\n+\n \t/*\n \t * Return the result metadata pack even is not valid: get() will return\n \t * nullptr.\n","prefixes":["libcamera-devel","RFC","v2","5/5"]}