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_GOOGLE_CAMERA_HAL_HDRPLUS_PROCESS_BLOCK_H_ 18 #define HARDWARE_GOOGLE_CAMERA_HAL_GOOGLE_CAMERA_HAL_HDRPLUS_PROCESS_BLOCK_H_ 19 20 #include "process_block.h" 21 22 namespace android { 23 namespace google_camera_hal { 24 25 // HdrplusProcessBlock implements a offline ProcessBlock. 26 // It can process offline capture requests for a single physical camera. 27 class HdrplusProcessBlock : public ProcessBlock { 28 public: 29 // Create a HdrplusProcessBlock. 30 // device_session_hwl is owned by the caller and must be valid during the 31 // lifetime of this HdrplusProcessBlock. 32 static std::unique_ptr<HdrplusProcessBlock> Create( 33 CameraDeviceSessionHwl* device_session_hwl, uint32_t cameraId); 34 35 virtual ~HdrplusProcessBlock() = default; 36 37 // Override functions of ProcessBlock start. 38 // All output streams must be physical streams. HdrplusProcessBlock does not 39 // support logical output streams. 40 status_t ConfigureStreams(const StreamConfiguration& stream_config, 41 const StreamConfiguration& overall_config) override; 42 43 status_t SetResultProcessor( 44 std::unique_ptr<ResultProcessor> result_processor) override; 45 46 status_t GetConfiguredHalStreams( 47 std::vector<HalStream>* hal_streams) const override; 48 49 status_t ProcessRequests( 50 const std::vector<ProcessBlockRequest>& process_block_requests, 51 const CaptureRequest& remaining_session_request) override; 52 53 status_t Flush() override; 54 // Override functions of ProcessBlock end. 55 56 protected: 57 HdrplusProcessBlock(uint32_t cameraId, 58 CameraDeviceSessionHwl* device_session_hwl); 59 60 private: 61 // Camera ID of this process block. 62 const uint32_t kCameraId; 63 64 // If the process block supports the device session. 65 static bool IsSupported(CameraDeviceSessionHwl* device_session_hwl); 66 67 // Invoked when the HWL pipeline sends a result. 68 void NotifyHwlPipelineResult(std::unique_ptr<HwlPipelineResult> hwl_result); 69 70 // Invoked when the HWL pipeline sends a message. 71 void NotifyHwlPipelineMessage(uint32_t pipeline_id, 72 const NotifyMessage& message); 73 74 HwlPipelineCallback hwl_pipeline_callback_; 75 CameraDeviceSessionHwl* device_session_hwl_ = nullptr; 76 77 mutable std::mutex configure_lock_; 78 79 // If streams are configured. Must be protected by configure_lock_. 80 bool is_configured_ = false; 81 82 // HWL pipeline ID. Must be protected by configure_lock_. 83 uint32_t pipeline_id_ = 0; 84 85 std::mutex result_processor_lock_; 86 87 // Result processor. Must be protected by result_processor_lock_. 88 std::unique_ptr<ResultProcessor> result_processor_ = nullptr; 89 }; 90 91 } // namespace google_camera_hal 92 } // namespace android 93 94 #endif // HARDWARE_GOOGLE_CAMERA_HAL_GOOGLE_CAMERA_HAL_HDRPLUS_PROCESS_BLOCK_H_ 95