1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef HARDWARE_GOOGLE_CAMERA_HAL_HWL_MULTICAM_COORDINATOR_HWL_H_
18 #define HARDWARE_GOOGLE_CAMERA_HAL_HWL_MULTICAM_COORDINATOR_HWL_H_
19 
20 #include "hal_types.h"
21 
22 namespace android {
23 namespace google_camera_hal {
24 
25 // This structure is used to update info on a physical pipelines.
26 struct MultiCamPhysicalUpdate {
27   uint32_t current_camera_id;  // The physical camera id of the pipeline
28   uint32_t logical_camera_id;  // The logical camera id for the usecase
29   uint32_t lead_camera_id;     // The physical camera id of the lead pipeline
30   bool sync_active;            // Should synchronize the two sensors
31   bool lpm_enabled;            // Should shut off the inactive pipeline
32   bool active;                 // Is this pipeline active.
33 };
34 
35 // This is used to send current crop info and possibly update the physical crop
36 // if needed.
37 struct MultiCamPhysicalCropInfo {
38   const Rect* logical_crop;  // logical user crop
39   Rect* crop;                // physical crop
40 };
41 
42 class IMulticamCoordinatorHwl {
43  public:
44   // Get lead camera id from metadata
45   virtual status_t GetLeadCameraId(HalCameraMetadata* result_metadata,
46                                    uint32_t* lead_camera_id) const = 0;
47   // Is follower's metadata or not.
48   virtual bool IsFollowerMetadata(HalCameraMetadata* result_metadata) const = 0;
49 
50   // Do any required adjustment on the physical crop for realtime pipeline
51   virtual status_t DoPhysicalCropAdjustment(
52       MultiCamPhysicalCropInfo* crop_info) = 0;
53   // Undo any adjustment done on the physical crop in the realtime pipeline
54   virtual status_t UndoPhysicalCropAdjustment(
55       MultiCamPhysicalCropInfo* crop_info) = 0;
56   // Set all the required multicam info based on the update
57   virtual status_t UpdatePhysicalInfo(
58       HalCameraMetadata* request_metadata,
59       const MultiCamPhysicalUpdate* physical_update) = 0;
60 
61   virtual ~IMulticamCoordinatorHwl() = default;
62 };
63 
64 }  // namespace google_camera_hal
65 }  // namespace android
66 
67 #endif  // HARDWARE_GOOGLE_CAMERA_HAL_HWL_MULTICAM_COORDINATOR_HWL_H_
68