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