• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
2 *
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are
5 * met:
6 *     * Redistributions of source code must retain the above copyright
7 *       notice, this list of conditions and the following disclaimer.
8 *     * Redistributions in binary form must reproduce the above
9 *       copyright notice, this list of conditions and the following
10 *       disclaimer in the documentation and/or other materials provided
11 *       with the distribution.
12 *     * Neither the name of The Linux Foundation nor the names of its
13 *       contributors may be used to endorse or promote products derived
14 *       from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19 * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 */
29 
30 #ifndef __QCAMERA3HARDWAREINTERFACE_H__
31 #define __QCAMERA3HARDWAREINTERFACE_H__
32 
33 // System dependencies
34 #include <camera/CameraMetadata.h>
35 #include <pthread.h>
36 #include <utils/KeyedVector.h>
37 #include <utils/List.h>
38 #include <map>
39 // Camera dependencies
40 #include "hardware/camera3.h"
41 #include "QCamera3Channel.h"
42 #include "QCamera3CropRegionMapper.h"
43 #include "QCamera3HALHeader.h"
44 #include "QCamera3Mem.h"
45 #include "QCameraPerf.h"
46 #include "QCameraCommon.h"
47 #include "QCamera3VendorTags.h"
48 
49 extern "C" {
50 #include "mm_camera_interface.h"
51 #include "mm_jpeg_interface.h"
52 }
53 
54 using namespace android;
55 
56 namespace qcamera {
57 
58 #ifndef TRUE
59 #define TRUE 1
60 #endif
61 
62 #ifndef FALSE
63 #define FALSE 0
64 #endif
65 
66 /* Time related macros */
67 typedef int64_t nsecs_t;
68 #define NSEC_PER_SEC 1000000000LLU
69 #define NSEC_PER_USEC 1000LLU
70 #define NSEC_PER_33MSEC 33000000LLU
71 
72 /*Orchestrate Macros */
73 #define EV_COMP_SETTLE_DELAY   2
74 #define GB_HDR_HALF_STEP_EV -6
75 #define GB_HDR_2X_STEP_EV 6
76 
77 #define FRAME_REGISTER_LRU_SIZE 256
78 #define INTERNAL_FRAME_STARTING_NUMBER 800
79 #define EMPTY_FRAMEWORK_FRAME_NUMBER 0xFFFFFFFF
80 
81 typedef enum {
82     SET_ENABLE,
83     SET_CONTROLENABLE,
84     SET_RELOAD_CHROMATIX,
85     SET_STATUS,
86 } optype_t;
87 
88 #define MODULE_ALL 0
89 
90 extern volatile uint32_t gCamHal3LogLevel;
91 
92 class QCamera3MetadataChannel;
93 class QCamera3PicChannel;
94 class QCamera3HeapMemory;
95 class QCamera3Exif;
96 
97 typedef struct {
98     camera3_stream_t *stream;
99     camera3_stream_buffer_set_t buffer_set;
100     stream_status_t status;
101     int registered;
102     QCamera3ProcessingChannel *channel;
103 } stream_info_t;
104 
105 typedef struct {
106     // Stream handle
107     camera3_stream_t *stream;
108     // Buffer handle
109     buffer_handle_t *buffer;
110     // Buffer status
111     camera3_buffer_status_t bufStatus = CAMERA3_BUFFER_STATUS_OK;
112 } PendingBufferInfo;
113 
114 typedef struct {
115     // Frame number corresponding to request
116     uint32_t frame_number;
117     // Time when request queued into system
118     nsecs_t timestamp;
119     List<PendingBufferInfo> mPendingBufferList;
120 } PendingBuffersInRequest;
121 
122 class PendingBuffersMap {
123 public:
124     // Number of outstanding buffers at flush
125     uint32_t numPendingBufsAtFlush;
126     // List of pending buffers per request
127     List<PendingBuffersInRequest> mPendingBuffersInRequest;
128     uint32_t get_num_overall_buffers();
129     void removeBuf(buffer_handle_t *buffer);
130     int32_t getBufErrStatus(buffer_handle_t *buffer);
131 };
132 
133 class FrameNumberRegistry {
134 public:
135 
136     FrameNumberRegistry();
137     ~FrameNumberRegistry();
138     int32_t allocStoreInternalFrameNumber(uint32_t frameworkFrameNumber,
139             uint32_t &internalFrameNumber);
140     int32_t generateStoreInternalFrameNumber(uint32_t &internalFrameNumber);
141     int32_t freeInternalFrameNumber(uint32_t internalFrameNumber);
142     int32_t getFrameworkFrameNumber(uint32_t internalFrameNumber, uint32_t &frameworkFrameNumber);
143     void purgeOldEntriesLocked();
144 
145 private:
146     std::map<uint32_t, uint32_t> _register;
147     uint32_t _nextFreeInternalNumber;
148     Mutex mRegistryLock;
149 };
150 
151 class QCamera3HardwareInterface {
152 public:
153     /* static variable and functions accessed by camera service */
154     static camera3_device_ops_t mCameraOps;
155     //Id of each session in bundle/link
156     static uint32_t sessionId[MM_CAMERA_MAX_NUM_SENSORS];
157     static int initialize(const struct camera3_device *,
158                 const camera3_callback_ops_t *callback_ops);
159     static int configure_streams(const struct camera3_device *,
160                 camera3_stream_configuration_t *stream_list);
161     static const camera_metadata_t* construct_default_request_settings(
162                                 const struct camera3_device *, int type);
163     static int process_capture_request(const struct camera3_device *,
164                                 camera3_capture_request_t *request);
165 
166     static void dump(const struct camera3_device *, int fd);
167     static int flush(const struct camera3_device *);
168     static int close_camera_device(struct hw_device_t* device);
169 
170 public:
171     QCamera3HardwareInterface(uint32_t cameraId,
172             const camera_module_callbacks_t *callbacks);
173     virtual ~QCamera3HardwareInterface();
174     static void camEvtHandle(uint32_t camera_handle, mm_camera_event_t *evt,
175                                           void *user_data);
176     int openCamera(struct hw_device_t **hw_device);
177     camera_metadata_t* translateCapabilityToMetadata(int type);
178 
179     typedef struct {
180         camera3_stream_t *stream;
181         bool need_metadata;
182         bool meteringOnly;
183     } InternalRequest;
184 
185     static int getCamInfo(uint32_t cameraId, struct camera_info *info);
186     static cam_capability_t *getCapabilities(mm_camera_ops_t *ops,
187             uint32_t cam_handle);
188     static int initCapabilities(uint32_t cameraId);
189     static int initStaticMetadata(uint32_t cameraId);
190     static void makeTable(cam_dimension_t *dimTable, size_t size,
191             size_t max_size, int32_t *sizeTable);
192     static void makeFPSTable(cam_fps_range_t *fpsTable, size_t size,
193             size_t max_size, int32_t *fpsRangesTable);
194     static void makeOverridesList(cam_scene_mode_overrides_t *overridesTable,
195             size_t size, size_t max_size, uint8_t *overridesList,
196             uint8_t *supported_indexes, uint32_t camera_id);
197     static size_t filterJpegSizes(int32_t *jpegSizes, int32_t *processedSizes,
198             size_t processedSizesCnt, size_t maxCount, cam_rect_t active_array_size,
199             uint8_t downscale_factor);
200     static void convertToRegions(cam_rect_t rect, int32_t* region, int weight);
201     static void convertFromRegions(cam_area_t &roi, const camera_metadata_t *settings,
202                                    uint32_t tag);
203     static bool resetIfNeededROI(cam_area_t* roi, const cam_crop_region_t* scalerCropRegion);
204     static int32_t getSensorSensitivity(int32_t iso_mode);
205 
206     double computeNoiseModelEntryS(int32_t sensitivity);
207     double computeNoiseModelEntryO(int32_t sensitivity);
208 
209     static void captureResultCb(mm_camera_super_buf_t *metadata,
210                 camera3_stream_buffer_t *buffer, uint32_t frame_number,
211                 bool isInputBuffer, void *userdata);
212 
213     int initialize(const camera3_callback_ops_t *callback_ops);
214     int configureStreams(camera3_stream_configuration_t *stream_list);
215     int configureStreamsPerfLocked(camera3_stream_configuration_t *stream_list);
216     int processCaptureRequest(camera3_capture_request_t *request,
217                               List<InternalRequest> &internalReqs);
218     int orchestrateRequest(camera3_capture_request_t *request);
219     void orchestrateResult(camera3_capture_result_t *result);
220     void orchestrateNotify(camera3_notify_msg_t *notify_msg);
221 
222     void dump(int fd);
223     int flushPerf();
224 
225     int setFrameParameters(camera3_capture_request_t *request,
226             cam_stream_ID_t streamID, int blob_request, uint32_t snapshotStreamId);
227     int32_t setReprocParameters(camera3_capture_request_t *request,
228             metadata_buffer_t *reprocParam, uint32_t snapshotStreamId);
229     int translateToHalMetadata(const camera3_capture_request_t *request,
230             metadata_buffer_t *parm, uint32_t snapshotStreamId);
231     camera_metadata_t* translateCbUrgentMetadataToResultMetadata (
232                              metadata_buffer_t *metadata);
233     camera_metadata_t* translateFromHalMetadata(metadata_buffer_t *metadata,
234                             nsecs_t timestamp, int32_t request_id,
235                             const CameraMetadata& jpegMetadata, uint8_t pipeline_depth,
236                             uint8_t capture_intent,
237                             /* DevCamDebug metadata translateFromHalMetadata augment .h */
238                             uint8_t DevCamDebug_meta_enable,
239                             /* DevCamDebug metadata end */
240                             bool pprocDone, uint8_t fwk_cacMode,
241                             bool firstMetadataInBatch);
242     camera_metadata_t* saveRequestSettings(const CameraMetadata& jpegMetadata,
243                             camera3_capture_request_t *request);
244     int initParameters();
245     void deinitParameters();
246     QCamera3ReprocessChannel *addOfflineReprocChannel(const reprocess_config_t &config,
247             QCamera3ProcessingChannel *inputChHandle);
248     bool needRotationReprocess();
249     bool needJpegExifRotation();
250     bool needReprocess(cam_feature_mask_t postprocess_mask);
251     bool needJpegRotation();
252     cam_denoise_process_type_t getWaveletDenoiseProcessPlate();
253     cam_denoise_process_type_t getTemporalDenoiseProcessPlate();
254 
255     void captureResultCb(mm_camera_super_buf_t *metadata,
256                 camera3_stream_buffer_t *buffer, uint32_t frame_number,
257                 bool isInputBuffer);
258     cam_dimension_t calcMaxJpegDim();
259     bool needOnlineRotation();
260     uint32_t getJpegQuality();
261     QCamera3Exif *getExifData();
262     mm_jpeg_exif_params_t get3AExifParams();
263     uint8_t getMobicatMask();
264     static void getFlashInfo(const int cameraId,
265             bool& hasFlash,
266             char (&flashNode)[QCAMERA_MAX_FILEPATH_LENGTH]);
267     const char *getEepromVersionInfo();
268     const uint32_t *getLdafCalib();
269     void get3AVersion(cam_q3a_version_t &swVersion);
270     static void setBufferErrorStatus(QCamera3Channel*, uint32_t frameNumber,
271             camera3_buffer_status_t err, void *userdata);
272     void setBufferErrorStatus(QCamera3Channel*, uint32_t frameNumber,
273             camera3_buffer_status_t err);
274 
275     // Get dual camera related info
isDeviceLinked()276     bool isDeviceLinked() {return mIsDeviceLinked;}
isMainCamera()277     bool isMainCamera() {return mIsMainCamera;}
278     uint32_t getSensorMountAngle();
279     const cam_related_system_calibration_data_t *getRelatedCalibrationData();
280 
281     template <typename fwkType, typename halType> struct QCameraMap {
282         fwkType fwk_name;
283         halType hal_name;
284     };
285 
286     typedef struct {
287         const char *const desc;
288         cam_cds_mode_type_t val;
289     } QCameraPropMap;
290 
291 
292 private:
293 
294     // State transition conditions:
295     // "\" means not applicable
296     // "x" means not valid
297     // +------------+----------+----------+-------------+------------+---------+-------+--------+
298     // |            |  CLOSED  |  OPENED  | INITIALIZED | CONFIGURED | STARTED | ERROR | DEINIT |
299     // +------------+----------+----------+-------------+------------+---------+-------+--------+
300     // |  CLOSED    |    \     |   open   |     x       |    x       |    x    |   x   |   x    |
301     // +------------+----------+----------+-------------+------------+---------+-------+--------+
302     // |  OPENED    |  close   |    \     | initialize  |    x       |    x    | error |   x    |
303     // +------------+----------+----------+-------------+------------+---------+-------+--------+
304     // |INITIALIZED |  close   |    x     |     \       | configure  |   x     | error |   x    |
305     // +------------+----------+----------+-------------+------------+---------+-------+--------+
306     // | CONFIGURED |  close   |    x     |     x       | configure  | request | error |   x    |
307     // +------------+----------+----------+-------------+------------+---------+-------+--------+
308     // |  STARTED   |  close   |    x     |     x       | configure  |    \    | error |   x    |
309     // +------------+----------+----------+-------------+------------+---------+-------+--------+
310     // |   ERROR    |  close   |    x     |     x       |     x      |    x    |   \   |  any   |
311     // +------------+----------+----------+-------------+------------+---------+-------+--------+
312     // |   DEINIT   |  close   |    x     |     x       |     x      |    x    |   x   |   \    |
313     // +------------+----------+----------+-------------+------------+---------+-------+--------+
314 
315     typedef enum {
316         CLOSED,
317         OPENED,
318         INITIALIZED,
319         CONFIGURED,
320         STARTED,
321         ERROR,
322         DEINIT
323     } State;
324 
325     int openCamera();
326     int closeCamera();
327     int flush(bool restartChannels);
328     static size_t calcMaxJpegSize(uint32_t camera_id);
329     cam_dimension_t getMaxRawSize(uint32_t camera_id);
330     static void addStreamConfig(Vector<int32_t> &available_stream_configs,
331             int32_t scalar_format, const cam_dimension_t &dim,
332             int32_t config_type);
333 
334     int validateCaptureRequest(camera3_capture_request_t *request,
335                                List<InternalRequest> &internallyRequestedStreams);
336     int validateStreamDimensions(camera3_stream_configuration_t *streamList);
337     int validateStreamRotations(camera3_stream_configuration_t *streamList);
338     void deriveMinFrameDuration();
339     void handleBuffersDuringFlushLock(camera3_stream_buffer_t *buffer);
340     int32_t handlePendingReprocResults(uint32_t frame_number);
341     int64_t getMinFrameDuration(const camera3_capture_request_t *request);
342     void handleMetadataWithLock(mm_camera_super_buf_t *metadata_buf,
343             bool free_and_bufdone_meta_buf,
344             bool firstMetadataInBatch);
345     void handleBatchMetadata(mm_camera_super_buf_t *metadata_buf,
346             bool free_and_bufdone_meta_buf);
347     void handleBufferWithLock(camera3_stream_buffer_t *buffer,
348             uint32_t frame_number);
349     void handleInputBufferWithLock(uint32_t frame_number);
350     void unblockRequestIfNecessary();
351     void dumpMetadataToFile(tuning_params_t &meta, uint32_t &dumpFrameCount,
352             bool enabled, const char *type, uint32_t frameNumber);
353     static void getLogLevel();
354 
355     void cleanAndSortStreamInfo();
356     void extractJpegMetadata(CameraMetadata& jpegMetadata,
357             const camera3_capture_request_t *request);
358 
359     bool isSupportChannelNeeded(camera3_stream_configuration_t *streamList,
360             cam_stream_size_info_t stream_config_info);
361     bool isHdrSnapshotRequest(camera3_capture_request *request);
362     int32_t setMobicat();
363 
364     int32_t getSensorOutputSize(cam_dimension_t &sensor_dim);
365     int32_t setHalFpsRange(const CameraMetadata &settings,
366             metadata_buffer_t *hal_metadata);
367     int32_t extractSceneMode(const CameraMetadata &frame_settings, uint8_t metaMode,
368             metadata_buffer_t *hal_metadata);
369     int32_t setVideoHdrMode(metadata_buffer_t *hal_metadata,
370             cam_video_hdr_mode_t vhdr);
371     int32_t numOfSizesOnEncoder(const camera3_stream_configuration_t *streamList,
372             const cam_dimension_t &maxViewfinderSize);
373 
374     void addToPPFeatureMask(int stream_format, uint32_t stream_idx);
375     void updateFpsInPreviewBuffer(metadata_buffer_t *metadata, uint32_t frame_number);
376     void updateTimeStampInPendingBuffers(uint32_t frameNumber, nsecs_t timestamp);
377 
378     void enablePowerHint();
379     void disablePowerHint();
380     int32_t dynamicUpdateMetaStreamInfo();
381     int32_t startAllChannels();
382     int32_t stopAllChannels();
383     int32_t notifyErrorForPendingRequests();
384     void notifyError(uint32_t frameNumber,
385             camera3_error_msg_code_t errorCode);
386     int32_t getReprocessibleOutputStreamId(uint32_t &id);
387     int32_t handleCameraDeviceError();
388 
389     bool isOnEncoder(const cam_dimension_t max_viewfinder_size,
390             uint32_t width, uint32_t height);
391     void hdrPlusPerfLock(mm_camera_super_buf_t *metadata_buf);
392 
393     static bool supportBurstCapture(uint32_t cameraId);
394     int32_t setBundleInfo();
395     int32_t setInstantAEC(const CameraMetadata &meta);
396 
397     static void convertLandmarks(cam_face_landmarks_info_t face, int32_t* landmarks);
398     static void setInvalidLandmarks(int32_t* landmarks);
399 
400     static void setPAAFSupport(cam_feature_mask_t& feature_mask,
401             cam_stream_type_t stream_type,
402             cam_color_filter_arrangement_t filter_arrangement);
403 
404     camera3_device_t   mCameraDevice;
405     uint32_t           mCameraId;
406     mm_camera_vtbl_t  *mCameraHandle;
407     bool               mCameraInitialized;
408     camera_metadata_t *mDefaultMetadata[CAMERA3_TEMPLATE_COUNT];
409     const camera3_callback_ops_t *mCallbackOps;
410 
411     QCamera3MetadataChannel *mMetadataChannel;
412     QCamera3PicChannel *mPictureChannel;
413     QCamera3RawChannel *mRawChannel;
414     QCamera3SupportChannel *mSupportChannel;
415     QCamera3SupportChannel *mAnalysisChannel;
416     QCamera3RawDumpChannel *mRawDumpChannel;
417     QCamera3RegularChannel *mDummyBatchChannel;
418     QCameraPerfLockMgr mPerfLockMgr;
419     QCameraCommon   mCommon;
420 
421     uint32_t mChannelHandle;
422 
423     void saveExifParams(metadata_buffer_t *metadata);
424     mm_jpeg_exif_params_t mExifParams;
425 
426      //First request yet to be processed after configureStreams
427     bool mFirstConfiguration;
428     bool mFlush;
429     bool mFlushPerf;
430     bool mEnableRawDump;
431     bool mForceHdrSnapshot;
432     QCamera3HeapMemory *mParamHeap;
433     metadata_buffer_t* mParameters;
434     metadata_buffer_t* mPrevParameters;
435     CameraMetadata mCurJpegMeta;
436     bool m_bIsVideo;
437     bool m_bIs4KVideo;
438     bool m_bEisSupportedSize;
439     bool m_bEisEnable;
440     bool m_bEisSupported;
441     typedef struct {
442         cam_dimension_t dim;
443         int format;
444         uint32_t usage;
445     } InputStreamInfo;
446 
447     InputStreamInfo mInputStreamInfo;
448     uint8_t m_MobicatMask;
449     uint8_t m_bTnrEnabled;
450     int8_t  mSupportedFaceDetectMode;
451     uint8_t m_bTnrPreview;
452     uint8_t m_bSwTnrPreview;
453     uint8_t m_bTnrVideo;
454     uint8_t m_debug_avtimer;
455 
456     /* Data structure to store pending request */
457     typedef struct {
458         camera3_stream_t *stream;
459         camera3_stream_buffer_t *buffer;
460         // metadata needs to be consumed by the corresponding stream
461         // in order to generate the buffer.
462         bool need_metadata;
463     } RequestedBufferInfo;
464 
465     typedef struct {
466         uint32_t frame_number;
467         uint32_t num_buffers;
468         int32_t request_id;
469         List<RequestedBufferInfo> buffers;
470         List<InternalRequest> internalRequestList;
471         int blob_request;
472         uint8_t bUrgentReceived;
473         nsecs_t timestamp;
474         camera3_stream_buffer_t *input_buffer;
475         const camera_metadata_t *settings;
476         CameraMetadata jpegMetadata;
477         uint8_t pipeline_depth;
478         uint32_t partial_result_cnt;
479         uint8_t capture_intent;
480         uint8_t fwkCacMode;
481         bool shutter_notified;
482         /* DevCamDebug metadata PendingRequestInfo */
483         uint8_t DevCamDebug_meta_enable;
484         /* DevCamDebug metadata end */
485     } PendingRequestInfo;
486     typedef struct {
487         uint32_t frame_number;
488         uint32_t stream_ID;
489     } PendingFrameDropInfo;
490 
491     typedef struct {
492         camera3_notify_msg_t notify_msg;
493         camera3_stream_buffer_t buffer;
494         uint32_t frame_number;
495     } PendingReprocessResult;
496 
497     class FrameNumberRegistry _orchestrationDb;
498     typedef KeyedVector<uint32_t, Vector<PendingBufferInfo> > FlushMap;
499     typedef List<QCamera3HardwareInterface::PendingRequestInfo>::iterator
500             pendingRequestIterator;
501     typedef List<QCamera3HardwareInterface::RequestedBufferInfo>::iterator
502             pendingBufferIterator;
503 
504     List<PendingReprocessResult> mPendingReprocessResultList;
505     List<PendingRequestInfo> mPendingRequestsList;
506     List<PendingFrameDropInfo> mPendingFrameDropList;
507     /* Use last frame number of the batch as key and first frame number of the
508      * batch as value for that key */
509     KeyedVector<uint32_t, uint32_t> mPendingBatchMap;
510     cam_stream_ID_t mBatchedStreamsArray;
511 
512     PendingBuffersMap mPendingBuffersMap;
513     pthread_cond_t mRequestCond;
514     uint32_t mPendingLiveRequest;
515     bool mWokenUpByDaemon;
516     int32_t mCurrentRequestId;
517     cam_stream_size_info_t mStreamConfigInfo;
518 
519     //mutex for serialized access to camera3_device_ops_t functions
520     pthread_mutex_t mMutex;
521 
522     //condition used to signal flush after buffers have returned
523     pthread_cond_t mBuffersCond;
524 
525     List<stream_info_t*> mStreamInfo;
526 
527     int64_t mMinProcessedFrameDuration;
528     int64_t mMinJpegFrameDuration;
529     int64_t mMinRawFrameDuration;
530 
531     uint32_t mMetaFrameCount;
532     bool    mUpdateDebugLevel;
533     const camera_module_callbacks_t *mCallbacks;
534 
535     uint8_t mCaptureIntent;
536     uint8_t mCacMode;
537     // DevCamDebug metadata internal variable
538     uint8_t mDevCamDebugMetaEnable;
539     /* DevCamDebug metadata end */
540 
541     metadata_buffer_t mReprocMeta; //scratch meta buffer
542     /* 0: Not batch, non-zero: Number of image buffers in a batch */
543     uint8_t mBatchSize;
544     // Used only in batch mode
545     uint8_t mToBeQueuedVidBufs;
546     // Fixed video fps
547     float mHFRVideoFps;
548 public:
549     uint8_t mOpMode;
550 private:
551     uint32_t mFirstFrameNumberInBatch;
552     camera3_stream_t mDummyBatchStream;
553     bool mNeedSensorRestart;
554     bool mPreviewStarted;
555     uint32_t mMinInFlightRequests;
556     uint32_t mMaxInFlightRequests;
557     // Param to trigger instant AEC.
558     bool mInstantAEC;
559     // Param to know when to reset AEC
560     bool mResetInstantAEC;
561     // Frame number, untill which we need to drop the frames.
562     uint32_t mInstantAECSettledFrameNumber;
563     // Max number of frames, that HAL will hold without displaying, for instant AEC mode.
564     uint8_t mAecSkipDisplayFrameBound;
565     // Counter to keep track of number of frames that took for AEC convergence.
566     uint8_t mInstantAecFrameIdxCount;
567     /* sensor output size with current stream configuration */
568     QCamera3CropRegionMapper mCropRegionMapper;
569 
570     /* Ldaf calibration data */
571     bool mLdafCalibExist;
572     uint32_t mLdafCalib[2];
573     int32_t mLastCustIntentFrmNum;
574     CameraMetadata  mCachedMetadata;
575 
576     static const QCameraMap<camera_metadata_enum_android_control_effect_mode_t,
577             cam_effect_mode_type> EFFECT_MODES_MAP[];
578     static const QCameraMap<camera_metadata_enum_android_control_awb_mode_t,
579             cam_wb_mode_type> WHITE_BALANCE_MODES_MAP[];
580     static const QCameraMap<camera_metadata_enum_android_control_scene_mode_t,
581             cam_scene_mode_type> SCENE_MODES_MAP[];
582     static const QCameraMap<camera_metadata_enum_android_control_af_mode_t,
583             cam_focus_mode_type> FOCUS_MODES_MAP[];
584     static const QCameraMap<camera_metadata_enum_android_color_correction_aberration_mode_t,
585             cam_aberration_mode_t> COLOR_ABERRATION_MAP[];
586     static const QCameraMap<camera_metadata_enum_android_control_ae_antibanding_mode_t,
587             cam_antibanding_mode_type> ANTIBANDING_MODES_MAP[];
588     static const QCameraMap<camera_metadata_enum_android_lens_state_t,
589             cam_af_lens_state_t> LENS_STATE_MAP[];
590     static const QCameraMap<camera_metadata_enum_android_control_ae_mode_t,
591             cam_flash_mode_t> AE_FLASH_MODE_MAP[];
592     static const QCameraMap<camera_metadata_enum_android_flash_mode_t,
593             cam_flash_mode_t> FLASH_MODES_MAP[];
594     static const QCameraMap<camera_metadata_enum_android_statistics_face_detect_mode_t,
595             cam_face_detect_mode_t> FACEDETECT_MODES_MAP[];
596     static const QCameraMap<camera_metadata_enum_android_lens_info_focus_distance_calibration_t,
597             cam_focus_calibration_t> FOCUS_CALIBRATION_MAP[];
598     static const QCameraMap<camera_metadata_enum_android_sensor_test_pattern_mode_t,
599             cam_test_pattern_mode_t> TEST_PATTERN_MAP[];
600     static const QCameraMap<camera_metadata_enum_android_video_hdr_mode_t,
601             cam_video_hdr_mode_t> VIDEO_HDR_MODES_MAP[];
602     static const QCameraMap<camera_metadata_enum_android_sensor_reference_illuminant1_t,
603             cam_illuminat_t> REFERENCE_ILLUMINANT_MAP[];
604     static const QCameraMap<int32_t,
605             cam_hfr_mode_t> HFR_MODE_MAP[];
606     static const QCameraMap<camera_metadata_enum_android_ir_mode_t,
607             cam_ir_mode_type_t> IR_MODES_MAP[];
608     static const QCameraMap<qcamera3_ext_instant_aec_mode_t,
609             cam_aec_convergence_type> INSTANT_AEC_MODES_MAP[];
610     static const QCameraPropMap CDS_MAP[];
611 
612     pendingRequestIterator erasePendingRequest(pendingRequestIterator i);
613     //GPU library to read buffer padding details.
614     void *lib_surface_utils;
615     int (*LINK_get_surface_pixel_alignment)();
616     uint32_t mSurfaceStridePadding;
617 
618     State mState;
619     //Dual camera related params
620     bool mIsDeviceLinked;
621     bool mIsMainCamera;
622     uint8_t mLinkedCameraId;
623     QCamera3HeapMemory *m_pDualCamCmdHeap;
624     cam_dual_camera_cmd_info_t *m_pDualCamCmdPtr;
625     cam_sync_related_sensors_event_info_t m_relCamSyncInfo;
626     Mutex mFlushLock;
627 };
628 
629 }; // namespace qcamera
630 
631 #endif /* __QCAMERA2HARDWAREINTERFACE_H__ */
632