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 <CameraMetadata.h>
35#include <pthread.h>
36#include <utils/KeyedVector.h>
37#include <utils/List.h>
38
39// Camera dependencies
40#include "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
48extern "C" {
49#include "mm_camera_interface.h"
50#include "mm_jpeg_interface.h"
51}
52
53using ::android::hardware::camera::common::V1_0::helper::CameraMetadata;
54using namespace android;
55
56namespace 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 */
67typedef int64_t nsecs_t;
68#define NSEC_PER_SEC 1000000000LLU
69#define NSEC_PER_USEC 1000LLU
70#define NSEC_PER_33MSEC 33000000LLU
71
72typedef enum {
73    SET_ENABLE,
74    SET_CONTROLENABLE,
75    SET_RELOAD_CHROMATIX,
76    SET_STATUS,
77} optype_t;
78
79#define MODULE_ALL 0
80
81extern volatile uint32_t gCamHal3LogLevel;
82
83class QCamera3MetadataChannel;
84class QCamera3PicChannel;
85class QCamera3HeapMemory;
86class QCamera3Exif;
87
88typedef struct {
89    camera3_stream_t *stream;
90    camera3_stream_buffer_set_t buffer_set;
91    stream_status_t status;
92    int registered;
93    QCamera3ProcessingChannel *channel;
94} stream_info_t;
95
96typedef struct {
97    // Stream handle
98    camera3_stream_t *stream;
99    // Buffer handle
100    buffer_handle_t *buffer;
101    // Buffer status
102    camera3_buffer_status_t bufStatus = CAMERA3_BUFFER_STATUS_OK;
103} PendingBufferInfo;
104
105typedef struct {
106    // Frame number corresponding to request
107    uint32_t frame_number;
108    // Time when request queued into system
109    nsecs_t timestamp;
110    List<PendingBufferInfo> mPendingBufferList;
111} PendingBuffersInRequest;
112
113class PendingBuffersMap {
114public:
115    // Number of outstanding buffers at flush
116    uint32_t numPendingBufsAtFlush;
117    // List of pending buffers per request
118    List<PendingBuffersInRequest> mPendingBuffersInRequest;
119    uint32_t get_num_overall_buffers();
120    void removeBuf(buffer_handle_t *buffer);
121    int32_t getBufErrStatus(buffer_handle_t *buffer);
122};
123
124
125class QCamera3HardwareInterface {
126public:
127    /* static variable and functions accessed by camera service */
128    static camera3_device_ops_t mCameraOps;
129    //Id of each session in bundle/link
130    static uint32_t sessionId[MM_CAMERA_MAX_NUM_SENSORS];
131    static int initialize(const struct camera3_device *,
132                const camera3_callback_ops_t *callback_ops);
133    static int configure_streams(const struct camera3_device *,
134                camera3_stream_configuration_t *stream_list);
135    static const camera_metadata_t* construct_default_request_settings(
136                                const struct camera3_device *, int type);
137    static int process_capture_request(const struct camera3_device *,
138                                camera3_capture_request_t *request);
139
140    static void dump(const struct camera3_device *, int fd);
141    static int flush(const struct camera3_device *);
142    static int close_camera_device(struct hw_device_t* device);
143
144public:
145    QCamera3HardwareInterface(uint32_t cameraId,
146            const camera_module_callbacks_t *callbacks);
147    virtual ~QCamera3HardwareInterface();
148    static void camEvtHandle(uint32_t camera_handle, mm_camera_event_t *evt,
149                                          void *user_data);
150    int openCamera(struct hw_device_t **hw_device);
151    camera_metadata_t* translateCapabilityToMetadata(int type);
152
153    static int getCamInfo(uint32_t cameraId, struct camera_info *info);
154    static int initCapabilities(uint32_t cameraId);
155    static int initStaticMetadata(uint32_t cameraId);
156    static void makeTable(cam_dimension_t *dimTable, size_t size,
157            size_t max_size, int32_t *sizeTable);
158    static void makeFPSTable(cam_fps_range_t *fpsTable, size_t size,
159            size_t max_size, int32_t *fpsRangesTable);
160    static void makeOverridesList(cam_scene_mode_overrides_t *overridesTable,
161            size_t size, size_t max_size, uint8_t *overridesList,
162            uint8_t *supported_indexes, uint32_t camera_id);
163    static size_t filterJpegSizes(int32_t *jpegSizes, int32_t *processedSizes,
164            size_t processedSizesCnt, size_t maxCount, cam_rect_t active_array_size,
165            uint8_t downscale_factor);
166    static void convertToRegions(cam_rect_t rect, int32_t* region, int weight);
167    static void convertFromRegions(cam_area_t &roi, const camera_metadata_t *settings,
168                                   uint32_t tag);
169    static bool resetIfNeededROI(cam_area_t* roi, const cam_crop_region_t* scalerCropRegion);
170    static void convertLandmarks(cam_face_landmarks_info_t face, int32_t* landmarks);
171    static int32_t getSensorSensitivity(int32_t iso_mode);
172
173    double computeNoiseModelEntryS(int32_t sensitivity);
174    double computeNoiseModelEntryO(int32_t sensitivity);
175
176    static void captureResultCb(mm_camera_super_buf_t *metadata,
177                camera3_stream_buffer_t *buffer, uint32_t frame_number,
178                bool isInputBuffer, void *userdata);
179
180    int initialize(const camera3_callback_ops_t *callback_ops);
181    int configureStreams(camera3_stream_configuration_t *stream_list);
182    int configureStreamsPerfLocked(camera3_stream_configuration_t *stream_list);
183    int processCaptureRequest(camera3_capture_request_t *request);
184    void dump(int fd);
185    int flushPerf();
186
187    int setFrameParameters(camera3_capture_request_t *request,
188            cam_stream_ID_t streamID, int blob_request, uint32_t snapshotStreamId);
189    int32_t setReprocParameters(camera3_capture_request_t *request,
190            metadata_buffer_t *reprocParam, uint32_t snapshotStreamId);
191    int translateToHalMetadata(const camera3_capture_request_t *request,
192            metadata_buffer_t *parm, uint32_t snapshotStreamId);
193    camera_metadata_t* translateCbUrgentMetadataToResultMetadata (
194            metadata_buffer_t *metadata, bool lastUrgentMetadataInBatch,
195            uint32_t frame_number);
196
197    camera_metadata_t* saveRequestSettings(const CameraMetadata& jpegMetadata,
198                            camera3_capture_request_t *request);
199    int initParameters();
200    void deinitParameters();
201    QCamera3ReprocessChannel *addOfflineReprocChannel(const reprocess_config_t &config,
202            QCamera3ProcessingChannel *inputChHandle);
203    bool needRotationReprocess();
204    bool needJpegExifRotation();
205    bool needReprocess(cam_feature_mask_t postprocess_mask);
206    bool needJpegRotation();
207    cam_denoise_process_type_t getWaveletDenoiseProcessPlate();
208    cam_denoise_process_type_t getTemporalDenoiseProcessPlate();
209
210    void captureResultCb(mm_camera_super_buf_t *metadata,
211                camera3_stream_buffer_t *buffer, uint32_t frame_number,
212                bool isInputBuffer);
213    cam_dimension_t calcMaxJpegDim();
214    bool needOnlineRotation();
215    uint32_t getJpegQuality();
216    QCamera3Exif *getExifData();
217    mm_jpeg_exif_params_t get3AExifParams();
218    uint8_t getMobicatMask();
219    static void getFlashInfo(const int cameraId,
220            bool& hasFlash,
221            char (&flashNode)[QCAMERA_MAX_FILEPATH_LENGTH]);
222    const char *getEepromVersionInfo();
223    const uint32_t *getLdafCalib();
224    void get3AVersion(cam_q3a_version_t &swVersion);
225    static void setBufferErrorStatus(QCamera3Channel*, uint32_t frameNumber,
226            camera3_buffer_status_t err, void *userdata);
227    void setBufferErrorStatus(QCamera3Channel*, uint32_t frameNumber,
228            camera3_buffer_status_t err);
229    bool is60HzZone();
230
231    template <typename fwkType, typename halType> struct QCameraMap {
232        fwkType fwk_name;
233        halType hal_name;
234    };
235
236    typedef struct {
237        const char *const desc;
238        cam_cds_mode_type_t val;
239    } QCameraPropMap;
240
241private:
242
243    // State transition conditions:
244    // "\" means not applicable
245    // "x" means not valid
246    // +------------+----------+----------+-------------+------------+---------+-------+--------+
247    // |            |  CLOSED  |  OPENED  | INITIALIZED | CONFIGURED | STARTED | ERROR | DEINIT |
248    // +------------+----------+----------+-------------+------------+---------+-------+--------+
249    // |  CLOSED    |    \     |   open   |     x       |    x       |    x    |   x   |   x    |
250    // +------------+----------+----------+-------------+------------+---------+-------+--------+
251    // |  OPENED    |  close   |    \     | initialize  |    x       |    x    | error |   x    |
252    // +------------+----------+----------+-------------+------------+---------+-------+--------+
253    // |INITIALIZED |  close   |    x     |     \       | configure  |   x     | error |   x    |
254    // +------------+----------+----------+-------------+------------+---------+-------+--------+
255    // | CONFIGURED |  close   |    x     |     x       | configure  | request | error |   x    |
256    // +------------+----------+----------+-------------+------------+---------+-------+--------+
257    // |  STARTED   |  close   |    x     |     x       | configure  |    \    | error |   x    |
258    // +------------+----------+----------+-------------+------------+---------+-------+--------+
259    // |   ERROR    |  close   |    x     |     x       |     x      |    x    |   \   |  any   |
260    // +------------+----------+----------+-------------+------------+---------+-------+--------+
261    // |   DEINIT   |  close   |    x     |     x       |     x      |    x    |   x   |   \    |
262    // +------------+----------+----------+-------------+------------+---------+-------+--------+
263
264    typedef enum {
265        CLOSED,
266        OPENED,
267        INITIALIZED,
268        CONFIGURED,
269        STARTED,
270        ERROR,
271        DEINIT
272    } State;
273
274    int openCamera();
275    int closeCamera();
276    int flush(bool restartChannels);
277    static size_t calcMaxJpegSize(uint32_t camera_id);
278    cam_dimension_t getMaxRawSize(uint32_t camera_id);
279    static void addStreamConfig(Vector<int32_t> &available_stream_configs,
280            int32_t scalar_format, const cam_dimension_t &dim,
281            int32_t config_type);
282
283    int validateCaptureRequest(camera3_capture_request_t *request);
284    int validateStreamDimensions(camera3_stream_configuration_t *streamList);
285    int validateStreamRotations(camera3_stream_configuration_t *streamList);
286    int validateUsageFlags(const camera3_stream_configuration_t *streamList);
287    int validateUsageFlagsForEis(const camera3_stream_configuration_t *streamList);
288    void deriveMinFrameDuration();
289    void handleBuffersDuringFlushLock(camera3_stream_buffer_t *buffer);
290    int32_t handlePendingReprocResults(uint32_t frame_number);
291    int64_t getMinFrameDuration(const camera3_capture_request_t *request);
292    void handleMetadataWithLock(mm_camera_super_buf_t *metadata_buf,
293            bool free_and_bufdone_meta_buf,
294            bool lastUrgentMetadataInBatch,
295            bool lastMetadataInBatch);
296    void handleBatchMetadata(mm_camera_super_buf_t *metadata_buf,
297            bool free_and_bufdone_meta_buf);
298    void handleBufferWithLock(camera3_stream_buffer_t *buffer,
299            uint32_t frame_number);
300    void handleInputBufferWithLock(uint32_t frame_number);
301    void unblockRequestIfNecessary();
302    void dumpMetadataToFile(tuning_params_t &meta, uint32_t &dumpFrameCount,
303            bool enabled, const char *type, uint32_t frameNumber);
304    static void getLogLevel();
305
306    void cleanAndSortStreamInfo();
307    void extractJpegMetadata(CameraMetadata& jpegMetadata,
308            const camera3_capture_request_t *request);
309
310    bool isSupportChannelNeeded(camera3_stream_configuration_t *streamList,
311            cam_stream_size_info_t stream_config_info);
312    int32_t setMobicat();
313
314    int32_t getSensorOutputSize(cam_dimension_t &sensor_dim);
315    int32_t setHalFpsRange(const CameraMetadata &settings,
316            metadata_buffer_t *hal_metadata);
317    int32_t extractSceneMode(const CameraMetadata &frame_settings, uint8_t metaMode,
318            metadata_buffer_t *hal_metadata);
319    int32_t numOfSizesOnEncoder(const camera3_stream_configuration_t *streamList,
320            const cam_dimension_t &maxViewfinderSize);
321
322    void addToPPFeatureMask(int stream_format, uint32_t stream_idx);
323    void updateFpsInPreviewBuffer(metadata_buffer_t *metadata, uint32_t frame_number);
324    void updateTimeStampInPendingBuffers(uint32_t frameNumber, nsecs_t timestamp);
325
326    void enablePowerHint();
327    void disablePowerHint();
328    int32_t dynamicUpdateMetaStreamInfo();
329    int32_t startAllChannels();
330    int32_t stopAllChannels();
331    int32_t notifyErrorForPendingRequests();
332    void notifyError(uint32_t frameNumber,
333            camera3_error_msg_code_t errorCode);
334    int32_t getReprocessibleOutputStreamId(uint32_t &id);
335    int32_t handleCameraDeviceError();
336
337    bool isOnEncoder(const cam_dimension_t max_viewfinder_size,
338            uint32_t width, uint32_t height);
339    void hdrPlusPerfLock(mm_camera_super_buf_t *metadata_buf);
340
341    static bool supportBurstCapture(uint32_t cameraId);
342    int32_t setBundleInfo();
343
344    static void setPAAFSupport(cam_feature_mask_t& feature_mask,
345            cam_stream_type_t stream_type,
346            cam_color_filter_arrangement_t filter_arrangement);
347
348    template <typename T>
349    static void adjustBlackLevelForCFA(T input[BLACK_LEVEL_PATTERN_CNT],
350            T output[BLACK_LEVEL_PATTERN_CNT],
351            cam_color_filter_arrangement_t color_arrangement);
352
353    camera3_device_t   mCameraDevice;
354    uint32_t           mCameraId;
355    mm_camera_vtbl_t  *mCameraHandle;
356    bool               mCameraInitialized;
357    camera_metadata_t *mDefaultMetadata[CAMERA3_TEMPLATE_COUNT];
358    const camera3_callback_ops_t *mCallbackOps;
359
360    QCamera3MetadataChannel *mMetadataChannel;
361    QCamera3PicChannel *mPictureChannel;
362    QCamera3RawChannel *mRawChannel;
363    QCamera3SupportChannel *mSupportChannel;
364    QCamera3SupportChannel *mAnalysisChannel;
365    QCamera3RawDumpChannel *mRawDumpChannel;
366    QCamera3RegularChannel *mDummyBatchChannel;
367    QCameraPerfLock m_perfLock;
368    QCameraCommon   mCommon;
369
370    uint32_t mChannelHandle;
371
372    void saveExifParams(metadata_buffer_t *metadata);
373    mm_jpeg_exif_params_t mExifParams;
374
375     //First request yet to be processed after configureStreams
376    bool mFirstConfiguration;
377    bool mFlush;
378    bool mFlushPerf;
379    bool mEnableRawDump;
380    QCamera3HeapMemory *mParamHeap;
381    metadata_buffer_t* mParameters;
382    metadata_buffer_t* mPrevParameters;
383    CameraMetadata mCurJpegMeta;
384    bool m_bIsVideo;
385    bool m_bIs4KVideo;
386    bool m_bEisSupportedSize;
387    bool m_bEisEnable;
388    typedef struct {
389        cam_dimension_t dim;
390        int format;
391        uint32_t usage;
392    } InputStreamInfo;
393
394    InputStreamInfo mInputStreamInfo;
395    uint8_t m_MobicatMask;
396    uint8_t m_bTnrEnabled;
397    int8_t  mSupportedFaceDetectMode;
398    uint8_t m_bTnrPreview;
399    uint8_t m_bTnrVideo;
400    uint8_t m_debug_avtimer;
401
402    /* Data structure to store pending request */
403    typedef struct {
404        camera3_stream_t *stream;
405        camera3_stream_buffer_t *buffer;
406        // metadata needs to be consumed by the corresponding stream
407        // in order to generate the buffer.
408        bool need_metadata;
409    } RequestedBufferInfo;
410    typedef struct {
411        uint32_t frame_number;
412        uint32_t num_buffers;
413        int32_t request_id;
414        List<RequestedBufferInfo> buffers;
415        int blob_request;
416        uint8_t bUrgentReceived;
417        nsecs_t timestamp;
418        camera3_stream_buffer_t *input_buffer;
419        const camera_metadata_t *settings;
420        CameraMetadata jpegMetadata;
421        uint8_t pipeline_depth;
422        uint32_t partial_result_cnt;
423        uint8_t capture_intent;
424        uint8_t fwkCacMode;
425        bool shutter_notified;
426        uint8_t hybrid_ae_enable;
427        /* DevCamDebug metadata PendingRequestInfo */
428        uint8_t DevCamDebug_meta_enable;
429        /* DevCamDebug metadata end */
430
431        bool focusStateSent = false;
432        bool focusStateValid = false;
433        uint8_t focusState = ANDROID_CONTROL_AF_STATE_INACTIVE;
434        bool partialResultDropped; // Whether partial metadata is dropped.
435    } PendingRequestInfo;
436    typedef struct {
437        uint32_t frame_number;
438        uint32_t stream_ID;
439    } PendingFrameDropInfo;
440
441    typedef struct {
442        camera3_notify_msg_t notify_msg;
443        camera3_stream_buffer_t buffer;
444        uint32_t frame_number;
445    } PendingReprocessResult;
446
447    typedef KeyedVector<uint32_t, Vector<PendingBufferInfo> > FlushMap;
448    typedef List<QCamera3HardwareInterface::PendingRequestInfo>::iterator
449            pendingRequestIterator;
450    typedef List<QCamera3HardwareInterface::RequestedBufferInfo>::iterator
451            pendingBufferIterator;
452
453    List<PendingReprocessResult> mPendingReprocessResultList;
454    List<PendingRequestInfo> mPendingRequestsList;
455    List<PendingFrameDropInfo> mPendingFrameDropList;
456    /* Use last frame number of the batch as key and first frame number of the
457     * batch as value for that key */
458    KeyedVector<uint32_t, uint32_t> mPendingBatchMap;
459    cam_stream_ID_t mBatchedStreamsArray;
460
461    PendingBuffersMap mPendingBuffersMap;
462    pthread_cond_t mRequestCond;
463    uint32_t mPendingLiveRequest;
464    bool mWokenUpByDaemon;
465    int32_t mCurrentRequestId;
466    cam_stream_size_info_t mStreamConfigInfo;
467
468    //mutex for serialized access to camera3_device_ops_t functions
469    pthread_mutex_t mMutex;
470
471    //condition used to signal flush after buffers have returned
472    pthread_cond_t mBuffersCond;
473
474    List<stream_info_t*> mStreamInfo;
475
476    int64_t mMinProcessedFrameDuration;
477    int64_t mMinJpegFrameDuration;
478    int64_t mMinRawFrameDuration;
479
480    uint32_t mMetaFrameCount;
481    bool    mUpdateDebugLevel;
482    const camera_module_callbacks_t *mCallbacks;
483
484    uint8_t mCaptureIntent;
485    uint8_t mCacMode;
486    uint8_t mHybridAeEnable;
487    // DevCamDebug metadata internal variable
488    uint8_t mDevCamDebugMetaEnable;
489    /* DevCamDebug metadata end */
490
491    metadata_buffer_t mReprocMeta; //scratch meta buffer
492    /* 0: Not batch, non-zero: Number of image buffers in a batch */
493    uint8_t mBatchSize;
494    // Used only in batch mode
495    uint8_t mToBeQueuedVidBufs;
496    // Fixed video fps
497    float mHFRVideoFps;
498public:
499    uint8_t mOpMode;
500private:
501    uint32_t mFirstFrameNumberInBatch;
502    camera3_stream_t mDummyBatchStream;
503    bool mNeedSensorRestart;
504    uint32_t mMinInFlightRequests;
505    uint32_t mMaxInFlightRequests;
506
507    /* sensor output size with current stream configuration */
508    QCamera3CropRegionMapper mCropRegionMapper;
509
510    /* Ldaf calibration data */
511    bool mLdafCalibExist;
512    uint32_t mLdafCalib[2];
513    bool mPowerHintEnabled;
514    int32_t mLastCustIntentFrmNum;
515
516    static const QCameraMap<camera_metadata_enum_android_control_effect_mode_t,
517            cam_effect_mode_type> EFFECT_MODES_MAP[];
518    static const QCameraMap<camera_metadata_enum_android_control_awb_mode_t,
519            cam_wb_mode_type> WHITE_BALANCE_MODES_MAP[];
520    static const QCameraMap<camera_metadata_enum_android_control_scene_mode_t,
521            cam_scene_mode_type> SCENE_MODES_MAP[];
522    static const QCameraMap<camera_metadata_enum_android_control_af_mode_t,
523            cam_focus_mode_type> FOCUS_MODES_MAP[];
524    static const QCameraMap<camera_metadata_enum_android_color_correction_aberration_mode_t,
525            cam_aberration_mode_t> COLOR_ABERRATION_MAP[];
526    static const QCameraMap<camera_metadata_enum_android_control_ae_antibanding_mode_t,
527            cam_antibanding_mode_type> ANTIBANDING_MODES_MAP[];
528    static const QCameraMap<camera_metadata_enum_android_lens_state_t,
529            cam_af_lens_state_t> LENS_STATE_MAP[];
530    static const QCameraMap<camera_metadata_enum_android_control_ae_mode_t,
531            cam_flash_mode_t> AE_FLASH_MODE_MAP[];
532    static const QCameraMap<camera_metadata_enum_android_flash_mode_t,
533            cam_flash_mode_t> FLASH_MODES_MAP[];
534    static const QCameraMap<camera_metadata_enum_android_statistics_face_detect_mode_t,
535            cam_face_detect_mode_t> FACEDETECT_MODES_MAP[];
536    static const QCameraMap<camera_metadata_enum_android_lens_info_focus_distance_calibration_t,
537            cam_focus_calibration_t> FOCUS_CALIBRATION_MAP[];
538    static const QCameraMap<camera_metadata_enum_android_sensor_test_pattern_mode_t,
539            cam_test_pattern_mode_t> TEST_PATTERN_MAP[];
540    static const QCameraMap<camera_metadata_enum_android_sensor_reference_illuminant1_t,
541            cam_illuminat_t> REFERENCE_ILLUMINANT_MAP[];
542    static const QCameraMap<int32_t,
543            cam_hfr_mode_t> HFR_MODE_MAP[];
544
545    static const QCameraPropMap CDS_MAP[];
546
547    pendingRequestIterator erasePendingRequest(pendingRequestIterator i);
548    //GPU library to read buffer padding details.
549    void *lib_surface_utils;
550    int (*LINK_get_surface_pixel_alignment)();
551    uint32_t mSurfaceStridePadding;
552
553    camera_metadata_t* translateFromHalMetadata(metadata_buffer_t *metadata,
554                            const PendingRequestInfo& pendingRequest,
555                            bool pprocDone,
556                            bool lastMetadataInBatch);
557
558    State mState;
559    //Dual camera related params
560    bool mIsDeviceLinked;
561    bool mIsMainCamera;
562    uint8_t mLinkedCameraId;
563    QCamera3HeapMemory *m_pRelCamSyncHeap;
564    cam_sync_related_sensors_event_info_t *m_pRelCamSyncBuf;
565    cam_sync_related_sensors_event_info_t m_relCamSyncInfo;
566    bool m60HzZone;
567
568    cam_trigger_t mAfTrigger;
569};
570
571}; // namespace qcamera
572
573#endif /* __QCAMERA2HARDWAREINTERFACE_H__ */
574