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_INTERFACE_CAMERA_DEVICE_HWL_H_ 18 #define HARDWARE_GOOGLE_CAMERA_HAL_HWL_INTERFACE_CAMERA_DEVICE_HWL_H_ 19 20 #include <utils/Errors.h> 21 22 #include "camera_buffer_allocator_hwl.h" 23 #include "camera_device_session_hwl.h" 24 #include "hal_camera_metadata.h" 25 #include "hal_types.h" 26 27 namespace android { 28 namespace google_camera_hal { 29 30 // Camera device HWL, which is associated with a certain camera ID. The camera 31 // device can be a logical camera that contains multiple physical camera, or 32 // a single physical camera. It provides methods to query static information 33 // about the associated camera devices. It does not hold any states of the 34 // camera device. 35 class CameraDeviceHwl { 36 public: 37 virtual ~CameraDeviceHwl() = default; 38 39 // Get the camera ID of this camera device HWL. 40 virtual uint32_t GetCameraId() const = 0; 41 42 // Get the resource cost of this camera device HWL. 43 virtual status_t GetResourceCost(CameraResourceCost* cost) const = 0; 44 45 // Get the characteristics of this camera device HWL. 46 // characteristics will be filled by CameraDeviceHwl. 47 virtual status_t GetCameraCharacteristics( 48 std::unique_ptr<HalCameraMetadata>* characteristics) const = 0; 49 50 // Get the characteristics of the physical camera of this camera device. 51 // characteristics will be filled by CameraDeviceHwl. 52 virtual status_t GetPhysicalCameraCharacteristics( 53 uint32_t physical_camera_id, 54 std::unique_ptr<HalCameraMetadata>* characteristics) const = 0; 55 56 // Set the torch mode of the camera device. The torch mode status remains 57 // unchanged after this CameraDevice instance is destroyed. 58 virtual status_t SetTorchMode(TorchMode mode) = 0; 59 60 // Dump the camera device states in fd, using dprintf() or write(). 61 virtual status_t DumpState(int fd) = 0; 62 63 // Create a camera device session for this device. This method will not be 64 // called before previous session has been destroyed. 65 // Created CameraDeviceSession remain valid even after this CameraDevice 66 // instance is destroyed. 67 // camera_allocator_hwl will be used by the HWL session when create HW 68 // pipeline, it should be valid during the lifetime of the HWL session. 69 virtual status_t CreateCameraDeviceSessionHwl( 70 CameraBufferAllocatorHwl* camera_allocator_hwl, 71 std::unique_ptr<CameraDeviceSessionHwl>* session) = 0; 72 73 // Query whether a particular logical and physical streams combination are 74 // supported. stream_config contains the stream configurations. 75 virtual bool IsStreamCombinationSupported( 76 const StreamConfiguration& stream_config) = 0; 77 }; 78 79 } // namespace google_camera_hal 80 } // namespace android 81 82 #endif // HARDWARE_GOOGLE_CAMERA_HAL_HWL_INTERFACE_CAMERA_DEVICE_HWL_H_