libcamera2: Enable video stabilization
[GitHub/LineageOS/android_hardware_samsung_slsi_exynos5.git] / libcamera2 / ExynosCameraHWInterface2.h
1 /*
2 **
3 ** Copyright 2008, The Android Open Source Project
4 ** Copyright 2012, Samsung Electronics Co. LTD
5 **
6 ** Licensed under the Apache License, Version 2.0 (the "License");
7 ** you may not use this file except in compliance with the License.
8 ** You may obtain a copy of the License at
9 **
10 ** http://www.apache.org/licenses/LICENSE-2.0
11 **
12 ** Unless required by applicable law or agreed to in writing, software
13 ** distributed under the License is distributed on an "AS IS" BASIS,
14 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 ** See the License for the specific language governing permissions and
16 ** limitations under the License.
17 */
18
19 /*!
20 * \file ExynosCameraHWInterface2.h
21 * \brief header file for Android Camera API 2.0 HAL
22 * \author Sungjoong Kang(sj3.kang@samsung.com)
23 * \date 2012/07/10
24 *
25 * <b>Revision History: </b>
26 * - 2012/05/31 : Sungjoong Kang(sj3.kang@samsung.com) \n
27 * Initial Release
28 *
29 * - 2012/07/10 : Sungjoong Kang(sj3.kang@samsung.com) \n
30 * 2nd Release
31 *
32 */
33
34 #ifndef EXYNOS_CAMERA_HW_INTERFACE_2_H
35 #define EXYNOS_CAMERA_HW_INTERFACE_2_H
36
37 #include <hardware/camera2.h>
38 #include <camera/Camera.h>
39 #include <camera/CameraParameters.h>
40 #include <utils/List.h>
41 #include "SignalDrivenThread.h"
42 #include "MetadataConverter.h"
43 #include "exynos_v4l2.h"
44 #include "ExynosRect.h"
45 #include "ExynosBuffer.h"
46 #include "videodev2_exynos_camera.h"
47 #include "gralloc_priv.h"
48 #include "ExynosJpegEncoderForCamera.h"
49 #include <fcntl.h>
50 #include "fimc-is-metadata.h"
51 #include "ion.h"
52 #include "ExynosExif.h"
53 #include "csc.h"
54 #include "ExynosCamera2.h"
55 #include "cutils/properties.h"
56
57 namespace android {
58
59 //#define EXYNOS_CAMERA_LOG
60 #define ENABLE_FRAME_SYNC
61 #define NODE_PREFIX "/dev/video"
62
63 #define NUM_MAX_STREAM_THREAD (5)
64 #define NUM_MAX_REQUEST_MGR_ENTRY (4)
65 #define NUM_MAX_CAMERA_BUFFERS (16)
66 #define NUM_BAYER_BUFFERS (8)
67 #define NUM_SCC_BUFFERS (8)
68 #define NUM_SCP_BUFFERS (8)
69 #define NUM_MIN_SENSOR_QBUF (3)
70 #define NUM_MAX_SUBSTREAM (4)
71
72 #define PICTURE_GSC_NODE_NUM (2)
73 #define VIDEO_GSC_NODE_NUM (1)
74
75 #define STREAM_TYPE_DIRECT (0)
76 #define STREAM_TYPE_INDIRECT (1)
77
78 #define SIGNAL_MAIN_REQ_Q_NOT_EMPTY (SIGNAL_THREAD_COMMON_LAST<<1)
79
80 #define SIGNAL_MAIN_STREAM_OUTPUT_DONE (SIGNAL_THREAD_COMMON_LAST<<3)
81 #define SIGNAL_SENSOR_START_REQ_PROCESSING (SIGNAL_THREAD_COMMON_LAST<<4)
82
83 #define SIGNAL_THREAD_RELEASE (SIGNAL_THREAD_COMMON_LAST<<8)
84
85 #define SIGNAL_STREAM_REPROCESSING_START (SIGNAL_THREAD_COMMON_LAST<<14)
86 #define SIGNAL_STREAM_DATA_COMING (SIGNAL_THREAD_COMMON_LAST<<15)
87
88 #define NO_TRANSITION (0)
89 #define HAL_AFSTATE_INACTIVE (1)
90 #define HAL_AFSTATE_NEEDS_COMMAND (2)
91 #define HAL_AFSTATE_STARTED (3)
92 #define HAL_AFSTATE_SCANNING (4)
93 #define HAL_AFSTATE_LOCKED (5)
94 #define HAL_AFSTATE_FAILED (6)
95 #define HAL_AFSTATE_NEEDS_DETERMINATION (7)
96 #define HAL_AFSTATE_PASSIVE_FOCUSED (8)
97
98 #define STREAM_ID_PREVIEW (0)
99 #define STREAM_MASK_PREVIEW (1<<STREAM_ID_PREVIEW)
100 #define STREAM_ID_RECORD (1)
101 #define STREAM_MASK_RECORD (1<<STREAM_ID_RECORD)
102 #define STREAM_ID_PRVCB (2)
103 #define STREAM_MASK_PRVCB (1<<STREAM_ID_PRVCB)
104 #define STREAM_ID_JPEG (4)
105 #define STREAM_MASK_JPEG (1<<STREAM_ID_JPEG)
106 #define STREAM_ID_ZSL (5)
107 #define STREAM_MASK_ZSL (1<<STREAM_ID_ZSL)
108
109 #define STREAM_ID_JPEG_REPROCESS (8)
110 #define STREAM_ID_LAST STREAM_ID_JPEG_REPROCESS
111
112 #define MASK_OUTPUT_SCP (STREAM_MASK_PREVIEW|STREAM_MASK_RECORD|STREAM_MASK_PRVCB)
113 #define MASK_OUTPUT_SCC (STREAM_MASK_JPEG|STREAM_MASK_ZSL)
114
115 #define SUBSTREAM_TYPE_NONE (0)
116 #define SUBSTREAM_TYPE_JPEG (1)
117 #define SUBSTREAM_TYPE_RECORD (2)
118 #define SUBSTREAM_TYPE_PRVCB (3)
119 #define FLASH_STABLE_WAIT_TIMEOUT (10)
120
121 #ifdef EXYNOS_CAMERA_LOG
122 #define CAM_LOGV(...) ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
123 #define CAM_LOGD(...) ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__))
124 #define CAM_LOGW(...) ((void)ALOG(LOG_WARN, LOG_TAG, __VA_ARGS__))
125 #define CAM_LOGE(...) ((void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__))
126 #else
127 #define CAM_LOGV(...) ((void)0)
128 #define CAM_LOGD(...) ((void)0)
129 #define CAM_LOGW(...) ((void)0)
130 #define CAM_LOGE(...) ((void)0)
131 #endif
132
133 enum sensor_name {
134 SENSOR_NAME_S5K3H2 = 1,
135 SENSOR_NAME_S5K6A3 = 2,
136 SENSOR_NAME_S5K4E5 = 3,
137 SENSOR_NAME_S5K3H7 = 4,
138 SENSOR_NAME_CUSTOM = 5,
139 SENSOR_NAME_END
140 };
141
142 enum is_subscenario_id {
143 ISS_SUB_SCENARIO_STILL,
144 ISS_SUB_SCENARIO_VIDEO,
145 ISS_SUB_SCENARIO_SCENE1,
146 ISS_SUB_SCENARIO_SCENE2,
147 ISS_SUB_SCENARIO_SCENE3,
148 ISS_SUB_END
149 };
150
151 int SUPPORT_THUMBNAIL_REAR_SIZE[][2] =
152 {
153 {160, 120},
154 {160, 90},
155 {144, 96}
156 };
157
158 int SUPPORT_THUMBNAIL_FRONT_SIZE[][2] =
159 {
160 {160, 120},
161 {160, 160},
162 {160, 90},
163 {144, 96}
164 };
165
166 enum is_set_flash_command_state {
167 IS_FLASH_STATE_NONE = 0,
168 IS_FLASH_STATE_ON = 1,
169 IS_FLASH_STATE_ON_WAIT,
170 IS_FLASH_STATE_ON_DONE,
171 IS_FLASH_STATE_AUTO_AE_AWB_LOCK,
172 IS_FLASH_STATE_AE_AWB_LOCK_WAIT,
173 IS_FLASH_STATE_AUTO_WAIT,
174 IS_FLASH_STATE_AUTO_DONE,
175 IS_FLASH_STATE_AUTO_OFF,
176 IS_FLASH_STATE_CAPTURE,
177 IS_FLASH_STATE_CAPTURE_WAIT,
178 IS_FLASH_STATE_CAPTURE_JPEG,
179 IS_FLASH_STATE_CAPTURE_END,
180 IS_FALSH_STATE_MAX
181 };
182
183 enum is_set_command_state {
184 IS_COMMAND_NONE = 0,
185 IS_COMMAND_EXECUTION,
186 IS_COMMAND_CLEAR,
187 IS_COMMAND_MAX
188 };
189
190 typedef struct node_info {
191 int fd;
192 int width;
193 int height;
194 int format;
195 int planes;
196 int buffers;
197 enum v4l2_memory memory;
198 enum v4l2_buf_type type;
199 ExynosBuffer buffer[NUM_MAX_CAMERA_BUFFERS];
200 int status;
201 } node_info_t;
202
203
204 typedef struct camera_hw_info {
205 int sensor_id;
206
207 node_info_t sensor;
208 node_info_t isp;
209 node_info_t capture;
210 node_info_t scp;
211
212 /*shot*/ // temp
213 struct camera2_shot_ext dummy_shot;
214
215 } camera_hw_info_t;
216
217 typedef enum request_entry_status {
218 EMPTY,
219 REGISTERED,
220 REQUESTED,
221 CAPTURED,
222 METADONE
223 } request_entry_status_t;
224
225 typedef struct request_manager_entry {
226 request_entry_status_t status;
227 camera_metadata_t *original_request;
228 struct camera2_shot_ext internal_shot;
229 int output_stream_count;
230 } request_manager_entry_t;
231
232 // structure related to a specific function of camera
233 typedef struct af_control_info {
234 int m_afTriggerTimeOut;
235 } ctl_af_info_t;
236
237 typedef struct flash_control_info {
238 // UI flash mode indicator
239 enum aa_aemode i_flashMode;
240 // AF flash
241 bool m_afFlashDoneFlg;
242 // Capture flash
243 bool m_flashEnableFlg;
244 int m_flashFrameCount;
245 int m_flashCnt;
246 int m_flashTimeOut;
247 // Flash decision
248 // At flash auto mode only : 1 -> flash is needed, 0 -> normal case
249 bool m_flashDecisionResult;
250 // torch indicator. this will be replaced by flashMode meta
251 bool m_flashTorchMode;
252 // for precapture metering
253 int m_precaptureState;
254 int m_precaptureTriggerId;
255 } ctl_flash_info_t;
256
257 typedef struct awb_control_info {
258 // UI awb mode indicator
259 enum aa_awbmode i_awbMode;
260 } ctl_awb_info_t;
261
262 typedef struct ae_control_info {
263 // pre-capture notification state
264 enum ae_state aeStateNoti;
265 } ctl_ae_info_t;
266
267 typedef struct request_control_info {
268 ctl_flash_info_t flash;
269 ctl_awb_info_t awb;
270 ctl_ae_info_t ae;
271 ctl_af_info_t af;
272 } ctl_request_info_t;
273
274 class RequestManager {
275 public:
276 RequestManager(SignalDrivenThread* main_thread);
277 ~RequestManager();
278 void ResetEntry();
279 int GetNumEntries();
280 bool IsRequestQueueFull();
281
282 void RegisterRequest(camera_metadata_t *new_request);
283 void DeregisterRequest(camera_metadata_t **deregistered_request);
284 bool PrepareFrame(size_t *num_entries, size_t *frame_size,
285 camera_metadata_t **prepared_frame, int afState);
286 int MarkProcessingRequest(ExynosBuffer * buf, int *afMode);
287 void NotifyStreamOutput(int frameCnt);
288 void ApplyDynamicMetadata(struct camera2_shot_ext *shot_ext);
289 void CheckCompleted(int index);
290 void UpdateIspParameters(struct camera2_shot_ext *shot_ext, int frameCnt, ctl_request_info_t *ctl_info);
291 void RegisterTimestamp(int frameCnt, nsecs_t *frameTime);
292 nsecs_t GetTimestampByFrameCnt(int frameCnt);
293 nsecs_t GetTimestamp(int index);
294 uint8_t GetOutputStreamByFrameCnt(int frameCnt);
295 uint8_t GetOutputStream(int index);
296 int FindFrameCnt(struct camera2_shot_ext * shot_ext);
297 bool IsVdisEnable(void);
298 int FindEntryIndexByFrameCnt(int frameCnt);
299 void Dump(void);
300 int GetNextIndex(int index);
301 void SetDefaultParameters(int cropX);
302 void SetInitialSkip(int count);
303 int GetSkipCnt();
304 void SetFrameIndex(int index);
305 int GetFrameIndex();
306 void pushSensorQ(int index);
307 int popSensorQ();
308 void releaseSensorQ();
309 private:
310
311 MetadataConverter *m_metadataConverter;
312 SignalDrivenThread *m_mainThread;
313 int m_numOfEntries;
314 int m_entryInsertionIndex;
315 int m_entryProcessingIndex;
316 int m_entryFrameOutputIndex;
317 request_manager_entry_t entries[NUM_MAX_REQUEST_MGR_ENTRY];
318 int m_completedIndex;
319
320 Mutex m_requestMutex;
321
322 //TODO : alloc dynamically
323 char m_tempFrameMetadataBuf[2000];
324 camera_metadata_t *m_tempFrameMetadata;
325
326 int m_sensorPipelineSkipCnt;
327 int m_cropX;
328 int m_frameIndex;
329 int m_lastAeMode;
330 int m_lastAaMode;
331 int m_lastAwbMode;
332 int m_lastAeComp;
333 bool m_vdisBubbleEn;
334 nsecs_t m_lastTimeStamp;
335 List<int> m_sensorQ;
336 };
337
338
339 typedef struct bayer_buf_entry {
340 int status;
341 int reqFrameCnt;
342 nsecs_t timeStamp;
343 } bayer_buf_entry_t;
344
345
346 class BayerBufManager {
347 public:
348 BayerBufManager();
349 ~BayerBufManager();
350 int GetIndexForSensorEnqueue();
351 int MarkSensorEnqueue(int index);
352 int MarkSensorDequeue(int index, int reqFrameCnt, nsecs_t *timeStamp);
353 int GetIndexForIspEnqueue(int *reqFrameCnt);
354 int GetIndexForIspDequeue(int *reqFrameCnt);
355 int MarkIspEnqueue(int index);
356 int MarkIspDequeue(int index);
357 int GetNumOnSensor();
358 int GetNumOnHalFilled();
359 int GetNumOnIsp();
360
361 private:
362 int GetNextIndex(int index);
363
364 int sensorEnqueueHead;
365 int sensorDequeueHead;
366 int ispEnqueueHead;
367 int ispDequeueHead;
368 int numOnSensor;
369 int numOnIsp;
370 int numOnHalFilled;
371 int numOnHalEmpty;
372
373 bayer_buf_entry_t entries[NUM_BAYER_BUFFERS];
374 };
375
376
377 #define NOT_AVAILABLE (0)
378 #define REQUIRES_DQ_FROM_SVC (1)
379 #define ON_DRIVER (2)
380 #define ON_HAL (3)
381 #define ON_SERVICE (4)
382
383 #define BAYER_NOT_AVAILABLE (0)
384 #define BAYER_ON_SENSOR (1)
385 #define BAYER_ON_HAL_FILLED (2)
386 #define BAYER_ON_ISP (3)
387 #define BAYER_ON_SERVICE (4)
388 #define BAYER_ON_HAL_EMPTY (5)
389
390 typedef struct stream_parameters {
391 uint32_t width;
392 uint32_t height;
393 int format;
394 const camera2_stream_ops_t* streamOps;
395 uint32_t usage;
396 int numHwBuffers;
397 int numSvcBuffers;
398 int numOwnSvcBuffers;
399 int planes;
400 int metaPlanes;
401 int numSvcBufsInHal;
402 buffer_handle_t svcBufHandle[NUM_MAX_CAMERA_BUFFERS];
403 ExynosBuffer svcBuffers[NUM_MAX_CAMERA_BUFFERS];
404 ExynosBuffer metaBuffers[NUM_MAX_CAMERA_BUFFERS];
405 int svcBufStatus[NUM_MAX_CAMERA_BUFFERS];
406 int bufIndex;
407 node_info_t *node;
408 int minUndequedBuffer;
409 } stream_parameters_t;
410
411 typedef struct substream_parameters {
412 int type;
413 uint32_t width;
414 uint32_t height;
415 int format;
416 const camera2_stream_ops_t* streamOps;
417 uint32_t usage;
418 int numSvcBuffers;
419 int numOwnSvcBuffers;
420 int internalFormat;
421 int internalPlanes;
422 int svcPlanes;
423 buffer_handle_t svcBufHandle[NUM_MAX_CAMERA_BUFFERS];
424 ExynosBuffer svcBuffers[NUM_MAX_CAMERA_BUFFERS];
425 int svcBufStatus[NUM_MAX_CAMERA_BUFFERS];
426 int svcBufIndex;
427 int numSvcBufsInHal;
428 bool needBufferInit;
429 int minUndequedBuffer;
430 } substream_parameters_t;
431
432 typedef struct substream_entry {
433 int priority;
434 int streamId;
435 } substream_entry_t;
436
437 class ExynosCameraHWInterface2 : public virtual RefBase {
438 public:
439 ExynosCameraHWInterface2(int cameraId, camera2_device_t *dev, ExynosCamera2 * camera, int *openInvalid);
440 virtual ~ExynosCameraHWInterface2();
441
442 virtual void release();
443
444 inline int getCameraId() const;
445
446 virtual int setRequestQueueSrcOps(const camera2_request_queue_src_ops_t *request_src_ops);
447 virtual int notifyRequestQueueNotEmpty();
448 virtual int setFrameQueueDstOps(const camera2_frame_queue_dst_ops_t *frame_dst_ops);
449 virtual int getInProgressCount();
450 virtual int flushCapturesInProgress();
451 virtual int constructDefaultRequest(int request_template, camera_metadata_t **request);
452 virtual int allocateStream(uint32_t width, uint32_t height,
453 int format, const camera2_stream_ops_t *stream_ops,
454 uint32_t *stream_id, uint32_t *format_actual, uint32_t *usage, uint32_t *max_buffers);
455 virtual int registerStreamBuffers(uint32_t stream_id, int num_buffers, buffer_handle_t *buffers);
456 virtual int releaseStream(uint32_t stream_id);
457 virtual int allocateReprocessStream(uint32_t width, uint32_t height,
458 uint32_t format, const camera2_stream_in_ops_t *reprocess_stream_ops,
459 uint32_t *stream_id, uint32_t *consumer_usage, uint32_t *max_buffers);
460 virtual int allocateReprocessStreamFromStream(uint32_t output_stream_id,
461 const camera2_stream_in_ops_t *reprocess_stream_ops, uint32_t *stream_id);
462 virtual int releaseReprocessStream(uint32_t stream_id);
463 virtual int triggerAction(uint32_t trigger_id, int ext1, int ext2);
464 virtual int setNotifyCallback(camera2_notify_callback notify_cb, void *user);
465 virtual int getMetadataVendorTagOps(vendor_tag_query_ops_t **ops);
466 virtual int dump(int fd);
467 private:
468 class MainThread : public SignalDrivenThread {
469 ExynosCameraHWInterface2 *mHardware;
470 public:
471 MainThread(ExynosCameraHWInterface2 *hw):
472 SignalDrivenThread(),
473 mHardware(hw) { }
474 ~MainThread();
475 void threadFunctionInternal()
476 {
477 mHardware->m_mainThreadFunc(this);
478 return;
479 }
480 void release(void);
481 bool m_releasing;
482 };
483
484 class SensorThread : public SignalDrivenThread {
485 ExynosCameraHWInterface2 *mHardware;
486 public:
487 SensorThread(ExynosCameraHWInterface2 *hw):
488 SignalDrivenThread(),
489 mHardware(hw) { }
490 ~SensorThread();
491 void threadFunctionInternal() {
492 mHardware->m_sensorThreadFunc(this);
493 return;
494 }
495 void release(void);
496 //private:
497 bool m_releasing;
498 };
499
500 class StreamThread : public SignalDrivenThread {
501 ExynosCameraHWInterface2 *mHardware;
502 public:
503 StreamThread(ExynosCameraHWInterface2 *hw, uint8_t new_index):
504 SignalDrivenThread(),
505 mHardware(hw),
506 m_index(new_index) { }
507 ~StreamThread();
508 void threadFunctionInternal() {
509 mHardware->m_streamThreadFunc(this);
510 return;
511 }
512 void setParameter(stream_parameters_t * new_parameters);
513 status_t attachSubStream(int stream_id, int priority);
514 status_t detachSubStream(int stream_id);
515 void release(void);
516 int findBufferIndex(void * bufAddr);
517 int findBufferIndex(buffer_handle_t * bufHandle);
518
519 uint8_t m_index;
520 bool m_activated;
521 //private:
522 stream_parameters_t m_parameters;
523 stream_parameters_t *m_tempParameters;
524 substream_entry_t m_attachedSubStreams[NUM_MAX_SUBSTREAM];
525 bool m_isBufferInit;
526 bool m_releasing;
527 int streamType;
528 int m_numRegisteredStream;
529 };
530
531 sp<MainThread> m_mainThread;
532 sp<SensorThread> m_sensorThread;
533 sp<StreamThread> m_streamThreads[NUM_MAX_STREAM_THREAD];
534 substream_parameters_t m_subStreams[STREAM_ID_LAST+1];
535
536
537
538 RequestManager *m_requestManager;
539 BayerBufManager *m_BayerManager;
540 ExynosCamera2 *m_camera2;
541
542 void m_mainThreadFunc(SignalDrivenThread * self);
543 void m_sensorThreadFunc(SignalDrivenThread * self);
544 void m_streamThreadFunc(SignalDrivenThread * self);
545 void m_streamThreadInitialize(SignalDrivenThread * self);
546
547 void m_streamFunc_direct(SignalDrivenThread *self);
548 void m_streamFunc_indirect(SignalDrivenThread *self);
549
550 void m_streamBufferInit(SignalDrivenThread *self);
551
552 int m_runSubStreamFunc(StreamThread *selfThread, ExynosBuffer *srcImageBuf,
553 int stream_id, nsecs_t frameTimeStamp);
554 int m_jpegCreator(StreamThread *selfThread, ExynosBuffer *srcImageBuf, nsecs_t frameTimeStamp);
555 int m_recordCreator(StreamThread *selfThread, ExynosBuffer *srcImageBuf, nsecs_t frameTimeStamp);
556 int m_prvcbCreator(StreamThread *selfThread, ExynosBuffer *srcImageBuf, nsecs_t frameTimeStamp);
557 void m_getAlignedYUVSize(int colorFormat, int w, int h,
558 ExynosBuffer *buf);
559 bool m_getRatioSize(int src_w, int src_h,
560 int dst_w, int dst_h,
561 int *crop_x, int *crop_y,
562 int *crop_w, int *crop_h,
563 int zoom);
564 int createIonClient(ion_client ionClient);
565 int deleteIonClient(ion_client ionClient);
566
567 int allocCameraMemory(ion_client ionClient, ExynosBuffer *buf, int iMemoryNum);
568 int allocCameraMemory(ion_client ionClient, ExynosBuffer *buf, int iMemoryNum, int cacheFlag);
569 void freeCameraMemory(ExynosBuffer *buf, int iMemoryNum);
570 void initCameraMemory(ExynosBuffer *buf, int iMemoryNum);
571
572 void DumpInfoWithShot(struct camera2_shot_ext * shot_ext);
573 bool m_checkThumbnailSize(int w, int h);
574 bool yuv2Jpeg(ExynosBuffer *yuvBuf,
575 ExynosBuffer *jpegBuf,
576 ExynosRect *rect);
577 int InitializeISPChain();
578 void StartISP();
579 void StartSCCThread(bool threadExists);
580 int GetAfState();
581 void SetAfMode(enum aa_afmode afMode);
582 void OnAfTriggerStart(int id);
583 void OnAfTrigger(int id);
584 void OnAfTriggerAutoMacro(int id);
585 void OnAfTriggerCAFPicture(int id);
586 void OnAfTriggerCAFVideo(int id);
587 void OnPrecaptureMeteringTriggerStart(int id);
588 void OnAfCancel(int id);
589 void OnAfCancelAutoMacro(int id);
590 void OnAfCancelCAFPicture(int id);
591 void OnAfCancelCAFVideo(int id);
592 void OnPrecaptureMeteringNotificationISP();
593 void OnPrecaptureMeteringNotificationSensor();
594 void OnAfNotification(enum aa_afstate noti);
595 void OnAfNotificationAutoMacro(enum aa_afstate noti);
596 void OnAfNotificationCAFPicture(enum aa_afstate noti);
597 void OnAfNotificationCAFVideo(enum aa_afstate noti);
598 void SetAfStateForService(int newState);
599 int GetAfStateForService();
600 exif_attribute_t mExifInfo;
601 void m_setExifFixedAttribute(void);
602 void m_setExifChangedAttribute(exif_attribute_t *exifInfo, ExynosRect *rect,
603 camera2_shot *currentEntry);
604 void m_preCaptureSetter(struct camera2_shot_ext * shot_ext);
605 void m_preCaptureListenerSensor(struct camera2_shot_ext * shot_ext);
606 void m_preCaptureListenerISP(struct camera2_shot_ext * shot_ext);
607 void m_updateAfRegion(struct camera2_shot_ext * shot_ext);
608 void m_afTrigger(struct camera2_shot_ext * shot_ext);
609 void *m_exynosPictureCSC;
610 void *m_exynosVideoCSC;
611
612
613 camera2_request_queue_src_ops_t *m_requestQueueOps;
614 camera2_frame_queue_dst_ops_t *m_frameQueueOps;
615 camera2_notify_callback m_notifyCb;
616 void *m_callbackCookie;
617
618 int m_numOfRemainingReqInSvc;
619 bool m_isRequestQueuePending;
620 bool m_isRequestQueueNull;
621 camera2_device_t *m_halDevice;
622 static gralloc_module_t const* m_grallocHal;
623
624
625 camera_hw_info_t m_camera_info;
626
627 ion_client m_ionCameraClient;
628
629 bool m_isIspStarted;
630
631 int m_need_streamoff;
632
633
634 int indexToQueue[3+1];
635
636 bool m_scp_flushing;
637 bool m_closing;
638 ExynosBuffer m_resizeBuf;
639 #ifndef ENABLE_FRAME_SYNC
640 int m_currentOutputStreams;
641 #endif
642 int m_currentReprocessOutStreams;
643 ExynosBuffer m_previewCbBuf;
644 int m_cameraId;
645 bool m_scp_closing;
646 bool m_scp_closed;
647 bool m_wideAspect;
648 uint32_t lastAfRegion[4];
649 float m_zoomRatio;
650
651 int m_vdisBubbleCnt;
652 int m_vdisDupFrame;
653
654 mutable Mutex m_qbufLock;
655
656 int m_afState;
657 int m_afTriggerId;
658 enum aa_afmode m_afMode;
659 enum aa_afmode m_afMode2;
660 bool m_IsAfModeUpdateRequired;
661 bool m_IsAfTriggerRequired;
662 bool m_IsAfLockRequired;
663 int m_serviceAfState;
664 bool m_AfHwStateFailed;
665 int m_afPendingTriggerId;
666 int m_afModeWaitingCnt;
667 struct camera2_shot m_jpegMetadata;
668 int m_scpOutputSignalCnt;
669 int m_scpOutputImageCnt;
670 int m_nightCaptureCnt;
671 int m_nightCaptureFrameCnt;
672 int m_thumbNailW;
673 int m_thumbNailH;
674 int m_reprocessStreamId;
675 const camera2_stream_in_ops_t * m_reprocessOps;
676 int m_reprocessOutputStreamId;
677 int m_reprocessingFrameCnt;
678 ctl_request_info_t m_ctlInfo;
679 };
680
681 }; // namespace android
682
683 #endif