From patchwork Tue Jun 22 02:36:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 12676 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 89F36C321B for ; Tue, 22 Jun 2021 02:37:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 437A868EA1; Tue, 22 Jun 2021 04:37:09 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="c4RDou7u"; dkim-atps=neutral Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C9CFA68940 for ; Tue, 22 Jun 2021 04:37:06 +0200 (CEST) Received: by mail-pj1-x1031.google.com with SMTP id g24so11201363pji.4 for ; Mon, 21 Jun 2021 19:37:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=B0s4KHmAp6nPmFW5JVa7GT7U2/8B2OuqQN0WjCdQu0w=; b=c4RDou7uyXfiPl+OBPgwmAKCy0TS/npf9SF+XeesvNrzndxZMJTtF56zVdKcuQY9oc samANHaTZsZGJY4aw8+cMr+Li34DiEL93heQNjXZIxXg/UpCtmvO/vHF0T33I8yMeUUJ jd8ZK7YbeRwk18kB0QHD1XaMfBGUg54cj9E1M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=B0s4KHmAp6nPmFW5JVa7GT7U2/8B2OuqQN0WjCdQu0w=; b=ADctxWmkPhij8DV1sD05o0ohWyt3yGShfeKMVO1Yf4rfPtXGnPpHihavpSjnUhTfGj Ow1JVJQ8aw/WfH8SoPPsobeeizOeGCNBH69B6FaBTOTVbj9J3HhAmHNiwqZYL/RlFG1f yv3rt2kroWSvzSOqbBo4k76YFtII5+tVdkp4hhuD8Xevr9Je+MfTcQkl6AhqvnEB0iJl lwK4LS1FFcnq+GfqPrNQg7mnTfAYAt/h9Xl5d4IX5ImPtsM2q8R+E9qyBKV1QveUvPfz FS7FTCRLcBY5g1BzKgGugGRNLFJf85IPwngKz4wbUI7o3sX5Oxno6/bVlkx7SHqXHilP XT9w== X-Gm-Message-State: AOAM533shgcz8PGd7D2KVIQZZlN1A7efoLvGp/3xsn/wiWciUxg2LmRw iV26ZccMj5vfw1x8y+FIpHitCN6vP3bQ0A== X-Google-Smtp-Source: ABdhPJz9lzaLbMQ/ryqpuRLrS6uQ8ovzBH/GVMVx02TuChOICy/71EOsv5hgv9nnKJ+euS2aykLqow== X-Received: by 2002:a17:902:868d:b029:11e:6556:acea with SMTP id g13-20020a170902868db029011e6556aceamr20453907plo.59.1624329425245; Mon, 21 Jun 2021 19:37:05 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:203:a025:f98b:b63b:e6b2]) by smtp.gmail.com with ESMTPSA id o7sm18947145pgs.45.2021.06.21.19.37.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Jun 2021 19:37:04 -0700 (PDT) From: Hirokazu Honda 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 Subject: [libcamera-devel] [RFC PATCH v2 5/5] android: camera_device: Propagate the requested test pattern mode X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Propagate the requested test pattern mode to libcamera::Camera through libcamera::Request and also set the android metadata to the test pattern mode contained by the complete Request. Signed-off-by: Hirokazu Honda Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/android/camera_device.cpp | 50 ++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 8c71fd06..5c2100ad 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1933,16 +1933,57 @@ int CameraDevice::processControls(Camera3RequestDescriptor *descriptor) return 0; /* Translate the Android request settings to libcamera controls. */ + ControlList &controls = descriptor->request_->controls(); camera_metadata_ro_entry_t entry; if (settings.getEntry(ANDROID_SCALER_CROP_REGION, &entry)) { const int32_t *data = entry.data.i32; Rectangle cropRegion{ data[0], data[1], static_cast(data[2]), static_cast(data[3]) }; - ControlList &controls = descriptor->request_->controls(); controls.set(controls::ScalerCrop, cropRegion); } + if (settings.getEntry(ANDROID_SENSOR_TEST_PATTERN_MODE, &entry)) { + const int32_t data = *entry.data.i32; + switch (data) { + case ANDROID_SENSOR_TEST_PATTERN_MODE_OFF: + controls.set(controls::draft::TestPatternMode, + controls::draft::TestPatternModeOff); + break; + + case ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR: + controls.set(controls::draft::TestPatternMode, + controls::draft::TestPatternModeSolidColor); + break; + + case ANDROID_SENSOR_TEST_PATTERN_MODE_COLOR_BARS: + controls.set(controls::draft::TestPatternMode, + controls::draft::TestPatternModeColorBars); + break; + + case ANDROID_SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY: + controls.set(controls::draft::TestPatternMode, + controls::draft::TestPatternModeColorBarsFadeToGray); + break; + + case ANDROID_SENSOR_TEST_PATTERN_MODE_PN9: + controls.set(controls::draft::TestPatternMode, + controls::draft::TestPatternModePn9); + break; + + case ANDROID_SENSOR_TEST_PATTERN_MODE_CUSTOM1: + controls.set(controls::draft::TestPatternMode, + controls::draft::TestPatternModeCustom1); + break; + + default: + LOG(HAL, Error) + << "Unknown test pattern mode: " << data; + + return -EINVAL; + } + } + return 0; } @@ -2429,6 +2470,13 @@ CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor) cons resultMetadata->addEntry(ANDROID_SCALER_CROP_REGION, cropRect); } + if (metadata.contains(controls::draft::TestPatternMode)) { + const int32_t testPatternMode = + metadata.get(controls::draft::TestPatternMode); + resultMetadata->addEntry(ANDROID_SENSOR_TEST_PATTERN_MODE, + testPatternMode); + } + /* * Return the result metadata pack even is not valid: get() will return * nullptr.