Patch Detail
Show a patch.
GET /api/patches/1886/?format=api
{ "id": 1886, "url": "https://patchwork.libcamera.org/api/patches/1886/?format=api", "web_url": "https://patchwork.libcamera.org/patch/1886/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20190829165311.29196-5-jacopo@jmondi.org>", "date": "2019-08-29T16:53:11", "name": "[libcamera-devel,v2,4/4] android: camera_device: Rework template generation", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "838cb8cd90da9534179e1731cf6435b9adec77b0", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/1886/mbox/", "series": [ { "id": 474, "url": "https://patchwork.libcamera.org/api/series/474/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=474", "date": "2019-08-29T16:53:07", "name": "android: Rework metadata tags", "version": 2, "mbox": "https://patchwork.libcamera.org/series/474/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/1886/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/1886/checks/", "tags": {}, "headers": { "Return-Path": "<jacopo@jmondi.org>", "Received": [ "from relay12.mail.gandi.net (relay12.mail.gandi.net\n\t[217.70.178.232])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3410C60E2A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 29 Aug 2019 18:51:52 +0200 (CEST)", "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay12.mail.gandi.net (Postfix) with ESMTPSA id 239B7200012;\n\tThu, 29 Aug 2019 16:51:51 +0000 (UTC)" ], "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Jacopo Mondi <jacopo@jmondi.org>, kamesan@google.com, jcliang@google.com,\n\tshik@google.com, wtlee@google.com", "Date": "Thu, 29 Aug 2019 18:53:11 +0200", "Message-Id": "<20190829165311.29196-5-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.23.0", "In-Reply-To": "<20190829165311.29196-1-jacopo@jmondi.org>", "References": "<20190829165311.29196-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 4/4] android: camera_device: Rework\n\ttemplate generation", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.23", "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>", "X-List-Received-Date": "Thu, 29 Aug 2019 16:51:52 -0000" }, "content": "Rework the template generation procedure by adding two missing requested\nkeys, fixing the capture intent to update it based on the requested\ntemplate type, and removing static metadata keys which didn't belong\nthere.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/android/camera_device.cpp | 110 ++++++++--------------------------\n 1 file changed, 24 insertions(+), 86 deletions(-)", "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 0163e8c4e39a..99a542185d09 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -641,14 +641,24 @@ const camera_metadata_t *CameraDevice::constructDefaultRequestSettings(int type)\n \t\treturn nullptr;\n \t}\n \n-\tif (requestTemplate_)\n+\tif (requestTemplate_) {\n+\t\tcamera_metadata_entry_t captureIntentEntry;\n+\n+\t\tfind_camera_metadata_entry(requestTemplate_,\n+\t\t\tANDROID_CONTROL_CAPTURE_INTENT, &captureIntentEntry);\n+\t\tret = update_camera_metadata_entry(requestTemplate_,\n+\t\t\t\tcaptureIntentEntry.index,\n+\t\t\t\t&captureIntent, 1, &captureIntentEntry);\n+\t\tMETADATA_ASSERT(ret);\n+\n \t\treturn requestTemplate_;\n+\t}\n \n-\t/* \\todo Use correct sizes */\n-\t#define REQUEST_TEMPLATE_ENTRIES\t 30\n-\t#define REQUEST_TEMPLATE_DATA\t\t2048\n-\trequestTemplate_ = allocate_camera_metadata(REQUEST_TEMPLATE_ENTRIES,\n-\t\t\t\t\t\t REQUEST_TEMPLATE_DATA);\n+\t/*\n+\t * \\todo Keep this in sync with the actual number of entries.\n+\t * Currently: 14 entries, 22 bytes\n+\t */\n+\trequestTemplate_ = allocate_camera_metadata(15, 30);\n \tif (!requestTemplate_) {\n \t\tLOG(HAL, Error) << \"Failed to allocate template metadata\";\n \t\treturn nullptr;\n@@ -661,32 +671,12 @@ const camera_metadata_t *CameraDevice::constructDefaultRequestSettings(int type)\n \t\t\tmaxOutStream, 3);\n \tMETADATA_ASSERT(ret);\n \n-\tuint8_t maxPipelineDepth = 5;\n-\tret = add_camera_metadata_entry(requestTemplate_,\n-\t\t\tANDROID_REQUEST_PIPELINE_MAX_DEPTH,\n-\t\t\t&maxPipelineDepth, 1);\n-\tMETADATA_ASSERT(ret);\n-\n \tint32_t inputStreams = 0;\n \tret = add_camera_metadata_entry(requestTemplate_,\n \t\t\tANDROID_REQUEST_MAX_NUM_INPUT_STREAMS,\n \t\t\t&inputStreams, 1);\n \tMETADATA_ASSERT(ret);\n \n-\tint32_t partialResultCount = 1;\n-\tret = add_camera_metadata_entry(requestTemplate_,\n-\t\t\tANDROID_REQUEST_PARTIAL_RESULT_COUNT,\n-\t\t\t&partialResultCount, 1);\n-\tMETADATA_ASSERT(ret);\n-\n-\tuint8_t availableCapabilities[] = {\n-\t\tANDROID_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE,\n-\t};\n-\tret = add_camera_metadata_entry(requestTemplate_,\n-\t\t\tANDROID_REQUEST_AVAILABLE_CAPABILITIES,\n-\t\t\tavailableCapabilities, 1);\n-\tMETADATA_ASSERT(ret);\n-\n \tuint8_t aeMode = ANDROID_CONTROL_AE_MODE_ON;\n \tret = add_camera_metadata_entry(requestTemplate_,\n \t\t\tANDROID_CONTROL_AE_MODE,\n@@ -729,12 +719,6 @@ const camera_metadata_t *CameraDevice::constructDefaultRequestSettings(int type)\n \t\t\t&awbLock, 1);\n \tMETADATA_ASSERT(ret);\n \n-\tuint8_t awbLockAvailable = ANDROID_CONTROL_AWB_LOCK_AVAILABLE_FALSE;\n-\tret = add_camera_metadata_entry(requestTemplate_,\n-\t\t\tANDROID_CONTROL_AWB_LOCK_AVAILABLE,\n-\t\t\t&awbLockAvailable, 1);\n-\tMETADATA_ASSERT(ret);\n-\n \tuint8_t flashMode = ANDROID_FLASH_MODE_OFF;\n \tret = add_camera_metadata_entry(requestTemplate_,\n \t\t\tANDROID_FLASH_MODE,\n@@ -747,67 +731,21 @@ const camera_metadata_t *CameraDevice::constructDefaultRequestSettings(int type)\n \t\t\t&faceDetectMode, 1);\n \tMETADATA_ASSERT(ret);\n \n+\tuint8_t noiseReduction = ANDROID_NOISE_REDUCTION_MODE_OFF;\n \tret = add_camera_metadata_entry(requestTemplate_,\n-\t\t\tANDROID_CONTROL_CAPTURE_INTENT,\n-\t\t\t&captureIntent, 1);\n+\t\t\tANDROID_NOISE_REDUCTION_MODE, &noiseReduction, 1);\n \tMETADATA_ASSERT(ret);\n \n-\t/*\n-\t * This is quite hard to list at the moment wihtout knowing what\n-\t * we could control.\n-\t *\n-\t * For now, just list in the available Request keys and in the available\n-\t * result keys the control and reporting of the AE algorithm.\n-\t */\n-\tstd::vector<int32_t> availableRequestKeys = {\n-\t\tANDROID_CONTROL_AE_MODE,\n-\t\tANDROID_CONTROL_AE_EXPOSURE_COMPENSATION,\n-\t\tANDROID_CONTROL_AE_PRECAPTURE_TRIGGER,\n-\t\tANDROID_CONTROL_AE_LOCK,\n-\t\tANDROID_CONTROL_AF_TRIGGER,\n-\t\tANDROID_CONTROL_AWB_MODE,\n-\t\tANDROID_CONTROL_AWB_LOCK,\n-\t\tANDROID_CONTROL_AWB_LOCK_AVAILABLE,\n-\t\tANDROID_CONTROL_CAPTURE_INTENT,\n-\t\tANDROID_FLASH_MODE,\n-\t\tANDROID_STATISTICS_FACE_DETECT_MODE,\n-\t};\n-\n-\tret = add_camera_metadata_entry(requestTemplate_,\n-\t\t\tANDROID_REQUEST_AVAILABLE_REQUEST_KEYS,\n-\t\t\tavailableRequestKeys.data(),\n-\t\t\tavailableRequestKeys.size());\n-\tMETADATA_ASSERT(ret);\n-\n-\tstd::vector<int32_t> availableResultKeys = {\n-\t\tANDROID_CONTROL_AE_MODE,\n-\t\tANDROID_CONTROL_AE_EXPOSURE_COMPENSATION,\n-\t\tANDROID_CONTROL_AE_PRECAPTURE_TRIGGER,\n-\t\tANDROID_CONTROL_AE_LOCK,\n-\t\tANDROID_CONTROL_AF_TRIGGER,\n-\t\tANDROID_CONTROL_AWB_MODE,\n-\t\tANDROID_CONTROL_AWB_LOCK,\n-\t\tANDROID_CONTROL_AWB_LOCK_AVAILABLE,\n-\t\tANDROID_CONTROL_CAPTURE_INTENT,\n-\t\tANDROID_FLASH_MODE,\n-\t\tANDROID_STATISTICS_FACE_DETECT_MODE,\n-\t};\n+\tuint8_t aberrationMode = ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF;\n \tret = add_camera_metadata_entry(requestTemplate_,\n-\t\t\tANDROID_REQUEST_AVAILABLE_RESULT_KEYS,\n-\t\t\tavailableResultKeys.data(),\n-\t\t\tavailableResultKeys.size());\n+\t\t\tANDROID_COLOR_CORRECTION_ABERRATION_MODE,\n+\t\t\t&aberrationMode, 1);\n \tMETADATA_ASSERT(ret);\n \n-\t/*\n-\t * \\todo The available characteristics are be the tags reported\n-\t * as part of the static metadata reported at hal_get_camera_info()\n-\t * time. As of now, report an empty list.\n-\t */\n-\tstd::vector<int32_t> availableCharacteristicsKeys = {};\n+\t/* Use the capture matching the requested template type. */\n \tret = add_camera_metadata_entry(requestTemplate_,\n-\t\t\tANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS,\n-\t\t\tavailableCharacteristicsKeys.data(),\n-\t\t\tavailableCharacteristicsKeys.size());\n+\t\t\tANDROID_CONTROL_CAPTURE_INTENT,\n+\t\t\t&captureIntent, 1);\n \tMETADATA_ASSERT(ret);\n \n \treturn requestTemplate_;\n", "prefixes": [ "libcamera-devel", "v2", "4/4" ] }