From 7609cce998b9726c11f4d8cdcf6d1640ed4a7252 Mon Sep 17 00:00:00 2001 From: Vachounet Date: Fri, 28 Apr 2017 11:53:23 +0200 Subject: [PATCH] Revert "potter: camera: import some QC and Moto params" And set the wrapper verbose (reverted from commit d5f2e7114631297868bd6fa12dddab0449b7230c) --- camera/CameraWrapper.cpp | 183 ++++++++++++++------------------------- 1 file changed, 66 insertions(+), 117 deletions(-) diff --git a/camera/CameraWrapper.cpp b/camera/CameraWrapper.cpp index d606e0d..53467be 100644 --- a/camera/CameraWrapper.cpp +++ b/camera/CameraWrapper.cpp @@ -1,18 +1,18 @@ /* -* Copyright (C) 2017 The LineageOS Project -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright (C) 2017 The LineageOS Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /** * @file CameraWrapper.cpp @@ -41,40 +41,6 @@ using namespace android; -// Wrapper specific parameters names -static const char KEY_QC_LONGSHOT_SUPPORTED[] = "longshot-supported"; - -static const char KEY_QC_SUPPORTED_TOUCH_AF_AEC[] = "touch-af-aec-values"; -static const char KEY_QC_TOUCH_AF_AEC[] = "touch-af-aec"; - - -static const char KEY_MOT_SUPPORTED_AF_ROI_ENABLED[] = "af-roi-enabled-values"; -static const char KEY_MOT_AF_ROI_ENABLED[] = "af-roi-enabled"; - -static const char KEY_QC_ZSL[] = "zsl"; -static const char KEY_QC_SUPPORTED_ZSL_MODES[] = "zsl-values"; - -static const char KEY_QC_SUPPORTED_REDEYE_REDUCTION[] = "redeye-reduction-values"; -static const char KEY_QC_SUPPORTED_FACE_DETECTION[] = "face-detection-values"; - -static const char KEY_QC_SUPPORTED_RE_FOCUS_MODES[] = "re-focus-values"; -static const char KEY_QC_RE_FOCUS[] = "re-focus"; - -static const char KEY_MOT_SUPPORTED_BACKGROUND_PROC[] = "background-proc"; - -static const char KEY_QC_VISIONFW[] = "visionfw"; -static const char KEY_QC_SUPPORTED_VISIONFW[] = "visionfw-values"; - -static const char KEY_QC_PDAF_CONTROL_MODE[] = "pdaf-control-mode"; -static const char KEY_QC_SUPPORTED_PDAF_CONTROL_MODE[] = "pdaf-control-mode-values"; - -static const char KEY_QC_SUPPORTED_CDS_MODES[] = "cds-mode-values"; -static const char KEY_QC_CDS_MODE[] = "cds-mode"; - -static const char KEY_QC_SUPPORTED_VIDEO_CDS_MODES[] = "video-cds-mode-values"; -static const char KEY_QC_VIDEO_CDS_MODE[] = "video-cds-mode"; - - static Mutex gCameraWrapperLock; static camera_module_t *gVendorModule = 0; @@ -128,7 +94,7 @@ typedef struct wrapper_camera_device { static int check_vendor_module() { int rv = 0; - ALOGE("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); if (gVendorModule) return 0; @@ -145,35 +111,18 @@ static char *camera_fixup_getparams(int id, const char *settings) CameraParameters params; params.unflatten(String8(settings)); - ALOGE("%s: original parameters:", __FUNCTION__); +#if !LOG_NDEBUG + ALOGV("%s: original parameters:", __FUNCTION__); params.dump(); +#endif - params.set(KEY_QC_LONGSHOT_SUPPORTED, "false"); - params.set(CameraParameters::KEY_VIDEO_STABILIZATION_SUPPORTED, "false"); + params.set("longshot-supported", "false"); + params.set("video-stabilization-supported", "false"); - params.set(KEY_QC_PDAF_CONTROL_MODE, "off"); - //params.set(KEY_QC_SUPPORTED_ZSL_MODES, "off,on"); - //params.set(KEY_QC_SUPPORTED_DENOISE, "denoise-on,denoise-off"); - //params.set(KEY_QC_SUPPORTED_FACE_DETECTION, "on,off"); - //params.set(KEY_QC_SUPPORTED_REDEYE_REDUCTION, "enable,disable"); - - //params.set(KEY_QC_SUPPORTED_VISIONFW, "on,off"); - - //params.set(KEY_QC_SUPPORTED_RE_FOCUS_MODES, "re-focus-on,re-focus-off"); - - if (id == BACK_CAMERA) { - //params.set(KEY_QC_SUPPORTED_TOUCH_AF_AEC, "touch-on,touch-off"); - - params.set(KEY_MOT_SUPPORTED_AF_ROI_ENABLED, "on,off"); - - //params.set(CameraParameters::KEY_SUPPORTED_SCENE_MODES, - // "auto,landscape,snow,beach,sunset,night," - // "portrait,sports,steadyphoto,candlelight," - // "fireworks,party,night-portrait,theatre,action"); - } - - ALOGE("%s: fixed parameters:", __FUNCTION__); +#if !LOG_NDEBUG + ALOGV("%s: fixed parameters:", __FUNCTION__); params.dump(); +#endif String8 strParams = params.flatten(); char *ret = strdup(strParams.string()); @@ -186,15 +135,15 @@ static char *camera_fixup_setparams(int id, const char *settings) CameraParameters params; params.unflatten(String8(settings)); - - ALOGE("%s: original parameters:", __FUNCTION__); +#if !LOG_NDEBUG + ALOGV("%s: original parameters:", __FUNCTION__); params.dump(); +#endif - params.set(KEY_QC_PDAF_CONTROL_MODE, "off"); - - ALOGE("%s: fixed parameters:", __FUNCTION__); +#if !LOG_NDEBUG + ALOGV("%s: fixed parameters:", __FUNCTION__); params.dump(); - +#endif String8 strParams = params.flatten(); if (fixed_set_params[id]) @@ -206,8 +155,8 @@ static char *camera_fixup_setparams(int id, const char *settings) } /******************************************************************* -* implementation of camera_device_ops functions -*******************************************************************/ + * implementation of camera_device_ops functions + *******************************************************************/ static int camera_set_preview_window(struct camera_device *device, struct preview_stream_ops *window) @@ -215,7 +164,7 @@ static int camera_set_preview_window(struct camera_device *device, if (!device) return -EINVAL; - ALOGE("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); return VENDOR_CALL(device, set_preview_window, window); @@ -231,7 +180,7 @@ static void camera_set_callbacks(struct camera_device *device, if (!device) return; - ALOGE("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); VENDOR_CALL(device, set_callbacks, notify_cb, data_cb, data_cb_timestamp, @@ -244,7 +193,7 @@ static void camera_enable_msg_type(struct camera_device *device, if (!device) return; - ALOGE("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); VENDOR_CALL(device, enable_msg_type, msg_type); @@ -256,7 +205,7 @@ static void camera_disable_msg_type(struct camera_device *device, if (!device) return; - ALOGE("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); VENDOR_CALL(device, disable_msg_type, msg_type); @@ -268,7 +217,7 @@ static int camera_msg_type_enabled(struct camera_device *device, if (!device) return 0; - ALOGE("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); return VENDOR_CALL(device, msg_type_enabled, msg_type); @@ -279,7 +228,7 @@ static int camera_start_preview(struct camera_device *device) if (!device) return -EINVAL; - ALOGE("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); return VENDOR_CALL(device, start_preview); @@ -290,7 +239,7 @@ static void camera_stop_preview(struct camera_device *device) if (!device) return; - ALOGE("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); VENDOR_CALL(device, stop_preview); @@ -301,7 +250,7 @@ static int camera_preview_enabled(struct camera_device *device) if (!device) return -EINVAL; - ALOGE("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); return VENDOR_CALL(device, preview_enabled); @@ -313,7 +262,7 @@ static int camera_store_meta_data_in_buffers(struct camera_device *device, if (!device) return -EINVAL; - ALOGE("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); return VENDOR_CALL(device, store_meta_data_in_buffers, enable); @@ -324,7 +273,7 @@ static int camera_start_recording(struct camera_device *device) if (!device) return EINVAL; - ALOGE("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); return VENDOR_CALL(device, start_recording); @@ -335,7 +284,7 @@ static void camera_stop_recording(struct camera_device *device) if (!device) return; - ALOGE("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); VENDOR_CALL(device, stop_recording); @@ -346,7 +295,7 @@ static int camera_recording_enabled(struct camera_device *device) if (!device) return -EINVAL; - ALOGE("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); return VENDOR_CALL(device, recording_enabled); @@ -358,7 +307,7 @@ static void camera_release_recording_frame(struct camera_device *device, if (!device) return; - ALOGE("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); VENDOR_CALL(device, release_recording_frame, opaque); @@ -369,7 +318,7 @@ static int camera_auto_focus(struct camera_device *device) if (!device) return -EINVAL; - ALOGE("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); return VENDOR_CALL(device, auto_focus); @@ -380,7 +329,7 @@ static int camera_cancel_auto_focus(struct camera_device *device) if (!device) return -EINVAL; - ALOGE("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); return VENDOR_CALL(device, cancel_auto_focus); @@ -391,7 +340,7 @@ static int camera_take_picture(struct camera_device *device) if (!device) return -EINVAL; - ALOGE("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); return VENDOR_CALL(device, take_picture); @@ -402,7 +351,7 @@ static int camera_cancel_picture(struct camera_device *device) if (!device) return -EINVAL; - ALOGE("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); return VENDOR_CALL(device, cancel_picture); @@ -414,7 +363,7 @@ static int camera_set_parameters(struct camera_device *device, if (!device) return -EINVAL; - ALOGE("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); char *tmp = NULL; @@ -429,7 +378,7 @@ static char *camera_get_parameters(struct camera_device *device) if (!device) return NULL; - ALOGE("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); char *params = VENDOR_CALL(device, get_parameters); @@ -452,7 +401,7 @@ static int camera_send_command(struct camera_device *device, if (!device) return -EINVAL; - ALOGE("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); return VENDOR_CALL(device, send_command, cmd, arg1, arg2); @@ -463,7 +412,7 @@ static void camera_release(struct camera_device *device) if (!device) return; - ALOGE("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); VENDOR_CALL(device, release); @@ -474,7 +423,7 @@ static int camera_dump(struct camera_device *device, int fd) if (!device) return -EINVAL; - ALOGE("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, + ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor)); return VENDOR_CALL(device, dump, fd); @@ -487,7 +436,7 @@ static int camera_device_close(hw_device_t *device) int ret = 0; wrapper_camera_device_t *wrapper_dev = NULL; - ALOGE("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); Mutex::Autolock lock(gCameraWrapperLock); @@ -515,14 +464,14 @@ done: } /******************************************************************* -* implementation of camera_module functions -*******************************************************************/ + * implementation of camera_module functions + *******************************************************************/ /* open device handle to one of the cameras -* -* assume camera service will keep singleton of each camera -* so this function will always only be called once per camera instance -*/ + * + * assume camera service will keep singleton of each camera + * so this function will always only be called once per camera instance + */ static int camera_device_open(const hw_module_t *module, const char *name, hw_device_t **device) @@ -535,7 +484,7 @@ static int camera_device_open(const hw_module_t *module, const char *name, Mutex::Autolock lock(gCameraWrapperLock); - ALOGE("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); if (name != NULL) { if (check_vendor_module()) @@ -583,7 +532,7 @@ static int camera_device_open(const hw_module_t *module, const char *name, ALOGE("vendor camera open fail"); goto fail; } - ALOGE("%s: got vendor camera device 0x%08X", + ALOGV("%s: got vendor camera device 0x%08X", __FUNCTION__, (uintptr_t)(camera_device->vendor)); camera_ops = (camera_device_ops_t*)malloc(sizeof(*camera_ops)); @@ -636,7 +585,7 @@ fail: camera_device = NULL; } if (camera_ops) { - free(camera_ops); + free(camera_ops); camera_ops = NULL; } *device = NULL; @@ -645,7 +594,7 @@ fail: static int camera_get_number_of_cameras(void) { - ALOGE("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); if (check_vendor_module()) return 0; return gVendorModule->get_number_of_cameras(); @@ -653,8 +602,8 @@ static int camera_get_number_of_cameras(void) static int camera_get_camera_info(int camera_id, struct camera_info *info) { - ALOGE("%s", __FUNCTION__); + ALOGV("%s", __FUNCTION__); if (check_vendor_module()) return 0; return gVendorModule->get_camera_info(camera_id, info); -} \ No newline at end of file +}