hardware: samsung_slsi: libcamera2: ZSL Bug fixes
[GitHub/LineageOS/android_hardware_samsung_slsi_exynos5.git] / libcamera2 / ExynosCameraHWInterface2.h
CommitLineData
c15a6b00
JS
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)
13d8c7b4 23 * \date 2012/07/10
c15a6b00
JS
24 *
25 * <b>Revision History: </b>
26 * - 2012/05/31 : Sungjoong Kang(sj3.kang@samsung.com) \n
27 * Initial Release
13d8c7b4
SK
28 *
29 * - 2012/07/10 : Sungjoong Kang(sj3.kang@samsung.com) \n
30 * 2nd Release
31 *
c15a6b00 32 */
13d8c7b4 33
c15a6b00
JS
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>
52f54308 40#include <utils/List.h>
c15a6b00
JS
41#include "SignalDrivenThread.h"
42#include "MetadataConverter.h"
43#include "exynos_v4l2.h"
13d8c7b4
SK
44#include "ExynosRect.h"
45#include "ExynosBuffer.h"
c15a6b00
JS
46#include "videodev2_exynos_camera.h"
47#include "gralloc_priv.h"
13d8c7b4 48#include "ExynosJpegEncoderForCamera.h"
c15a6b00
JS
49#include <fcntl.h>
50#include "fimc-is-metadata.h"
51#include "ion.h"
13d8c7b4
SK
52#include "ExynosExif.h"
53#include "csc.h"
daa1fcd6 54#include "ExynosCamera2.h"
eed7ed1b 55#include "cutils/properties.h"
c15a6b00
JS
56
57namespace android {
58
4aa4d739 59//#define EXYNOS_CAMERA_LOG
2adfa429 60#define ENABLE_FRAME_SYNC
c15a6b00
JS
61#define NODE_PREFIX "/dev/video"
62
63#define NUM_MAX_STREAM_THREAD (5)
52f54308 64#define NUM_MAX_REQUEST_MGR_ENTRY (4)
13d8c7b4
SK
65#define NUM_MAX_CAMERA_BUFFERS (16)
66#define NUM_BAYER_BUFFERS (8)
ac8c2060
SK
67#define NUM_SCC_BUFFERS (8)
68#define NUM_SCP_BUFFERS (8)
52f54308 69#define NUM_MIN_SENSOR_QBUF (3)
5506cebf 70#define NUM_MAX_SUBSTREAM (4)
13d8c7b4
SK
71
72#define PICTURE_GSC_NODE_NUM (2)
15fd8231 73#define VIDEO_GSC_NODE_NUM (1)
c15a6b00 74
37e122d5
SK
75#define STREAM_TYPE_DIRECT (0)
76#define STREAM_TYPE_INDIRECT (1)
77
13d8c7b4 78#define SIGNAL_MAIN_REQ_Q_NOT_EMPTY (SIGNAL_THREAD_COMMON_LAST<<1)
5506cebf 79
13d8c7b4
SK
80#define SIGNAL_MAIN_STREAM_OUTPUT_DONE (SIGNAL_THREAD_COMMON_LAST<<3)
81#define SIGNAL_SENSOR_START_REQ_PROCESSING (SIGNAL_THREAD_COMMON_LAST<<4)
5506cebf 82
13d8c7b4 83#define SIGNAL_THREAD_RELEASE (SIGNAL_THREAD_COMMON_LAST<<8)
c15a6b00 84
5506cebf 85#define SIGNAL_STREAM_REPROCESSING_START (SIGNAL_THREAD_COMMON_LAST<<14)
c15a6b00
JS
86#define SIGNAL_STREAM_DATA_COMING (SIGNAL_THREAD_COMMON_LAST<<15)
87
0f26b20f
SK
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)
13d8c7b4 97
5506cebf
SK
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
4aa4d739
C
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
c15a6b00
JS
133enum 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
15fd8231
SK
142enum 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};
c15a6b00 150
2d5e6ec2
SK
151int SUPPORT_THUMBNAIL_REAR_SIZE[][2] =
152{
153 {160, 120},
154 {160, 90},
155 {144, 96}
156};
157
158int SUPPORT_THUMBNAIL_FRONT_SIZE[][2] =
159{
160 {160, 120},
161 {160, 160},
162 {160, 90},
163 {144, 96}
164};
165
e117f756
YJ
166enum 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
6f19b6cf
YJ
181};
182
53f62ad9
YJ
183enum is_set_command_state {
184 IS_COMMAND_NONE = 0,
185 IS_COMMAND_EXECUTION,
186 IS_COMMAND_CLEAR,
187 IS_COMMAND_MAX
188};
189
c15a6b00
JS
190typedef struct node_info {
191 int fd;
192 int width;
193 int height;
194 int format;
195 int planes;
196 int buffers;
c15a6b00
JS
197 enum v4l2_memory memory;
198 enum v4l2_buf_type type;
be494d19 199 ExynosBuffer buffer[NUM_MAX_CAMERA_BUFFERS];
15fd8231 200 int status;
c15a6b00
JS
201} node_info_t;
202
203
204typedef struct camera_hw_info {
205 int sensor_id;
206
207 node_info_t sensor;
13d8c7b4
SK
208 node_info_t isp;
209 node_info_t capture;
5506cebf 210 node_info_t scp;
13d8c7b4
SK
211
212 /*shot*/ // temp
213 struct camera2_shot_ext dummy_shot;
c15a6b00 214
c15a6b00
JS
215} camera_hw_info_t;
216
13d8c7b4 217typedef enum request_entry_status {
c15a6b00
JS
218 EMPTY,
219 REGISTERED,
be494d19 220 REQUESTED,
2adfa429
JS
221 CAPTURED,
222 METADONE
c15a6b00
JS
223} request_entry_status_t;
224
225typedef struct request_manager_entry {
13d8c7b4 226 request_entry_status_t status;
13d8c7b4 227 camera_metadata_t *original_request;
be494d19 228 struct camera2_shot_ext internal_shot;
13d8c7b4 229 int output_stream_count;
c15a6b00
JS
230} request_manager_entry_t;
231
9a710a45
YJ
232// structure related to a specific function of camera
233typedef struct flash_control_info {
234 // UI flash mode indicator
235 enum aa_aemode i_flashMode;
236 // AF flash
237 bool m_afFlashDoneFlg;
9a710a45
YJ
238 // Capture flash
239 bool m_flashEnableFlg;
9a710a45
YJ
240 int m_flashFrameCount;
241 int m_flashCnt;
242 int m_flashTimeOut;
caea49e6
YJ
243 // Flash decision
244 // At flash auto mode only : 1 -> flash is needed, 0 -> normal case
245 bool m_flashDecisionResult;
246 // torch indicator. this will be replaced by flashMode meta
247 bool m_flashTorchMode;
e117f756
YJ
248 // for precapture metering
249 int m_precaptureState;
250 int m_precaptureTriggerId;
9a710a45
YJ
251} ctl_flash_info_t;
252
53f62ad9
YJ
253typedef struct awb_control_info {
254 // UI awb mode indicator
255 enum aa_awbmode i_awbMode;
53f62ad9
YJ
256} ctl_awb_info_t;
257
73f5ad60
YJ
258typedef struct ae_control_info {
259 // pre-capture notification state
260 enum ae_state aeStateNoti;
261} ctl_ae_info_t;
262
9a710a45
YJ
263typedef struct request_control_info {
264 ctl_flash_info_t flash;
53f62ad9 265 ctl_awb_info_t awb;
73f5ad60 266 ctl_ae_info_t ae;
9a710a45
YJ
267} ctl_request_info_t;
268
c15a6b00
JS
269class RequestManager {
270public:
271 RequestManager(SignalDrivenThread* main_thread);
272 ~RequestManager();
2adfa429 273 void ResetEntry();
c15a6b00
JS
274 int GetNumEntries();
275 bool IsRequestQueueFull();
13d8c7b4
SK
276
277 void RegisterRequest(camera_metadata_t *new_request);
278 void DeregisterRequest(camera_metadata_t **deregistered_request);
279 bool PrepareFrame(size_t *num_entries, size_t *frame_size,
0f26b20f
SK
280 camera_metadata_t **prepared_frame, int afState);
281 int MarkProcessingRequest(ExynosBuffer * buf, int *afMode);
2adfa429 282 void NotifyStreamOutput(int frameCnt);
ad37861e 283 void ApplyDynamicMetadata(struct camera2_shot_ext *shot_ext);
13d8c7b4 284 void CheckCompleted(int index);
53f62ad9 285 void UpdateIspParameters(struct camera2_shot_ext *shot_ext, int frameCnt, ctl_request_info_t *ctl_info);
9dd63e1f 286 void RegisterTimestamp(int frameCnt, nsecs_t *frameTime);
5506cebf
SK
287 nsecs_t GetTimestampByFrameCnt(int frameCnt);
288 nsecs_t GetTimestamp(int index);
9dd63e1f 289 int FindFrameCnt(struct camera2_shot_ext * shot_ext);
5c88d1f2
C
290#ifdef VDIS_ENABLE
291 bool IsVdisEnable(void);
292#endif
9dd63e1f 293 int FindEntryIndexByFrameCnt(int frameCnt);
b5237e6b
SK
294 void Dump(void);
295 int GetNextIndex(int index);
296 void SetDefaultParameters(int cropX);
297 void SetInitialSkip(int count);
ad37861e
SK
298 int GetSkipCnt();
299 void SetFrameIndex(int index);
300 int GetFrameIndex();
52f54308
SK
301 void pushSensorQ(int index);
302 int popSensorQ();
303 void releaseSensorQ();
c15a6b00
JS
304private:
305
306 MetadataConverter *m_metadataConverter;
307 SignalDrivenThread *m_mainThread;
308 int m_numOfEntries;
309 int m_entryInsertionIndex;
310 int m_entryProcessingIndex;
311 int m_entryFrameOutputIndex;
312 request_manager_entry_t entries[NUM_MAX_REQUEST_MGR_ENTRY];
13d8c7b4 313 int m_completedIndex;
c15a6b00
JS
314
315 Mutex m_requestMutex;
316
317 //TODO : alloc dynamically
318 char m_tempFrameMetadataBuf[2000];
319 camera_metadata_t *m_tempFrameMetadata;
9dd63e1f 320
b5237e6b 321 int m_sensorPipelineSkipCnt;
9dd63e1f 322 int m_cropX;
ad37861e 323 int m_frameIndex;
2bdec060
SK
324 int m_lastAeMode;
325 int m_lastAaMode;
326 int m_lastAwbMode;
327 int m_lastAeComp;
5c88d1f2
C
328#ifdef VDIS_ENABLE
329 bool m_vdisBubbleEn;
330#endif
5506cebf 331 nsecs_t m_lastTimeStamp;
52f54308 332 List<int> m_sensorQ;
c15a6b00
JS
333};
334
9dd63e1f
SK
335
336typedef struct bayer_buf_entry {
337 int status;
338 int reqFrameCnt;
339 nsecs_t timeStamp;
340} bayer_buf_entry_t;
341
342
343class BayerBufManager {
344public:
345 BayerBufManager();
346 ~BayerBufManager();
347 int GetIndexForSensorEnqueue();
348 int MarkSensorEnqueue(int index);
349 int MarkSensorDequeue(int index, int reqFrameCnt, nsecs_t *timeStamp);
350 int GetIndexForIspEnqueue(int *reqFrameCnt);
351 int GetIndexForIspDequeue(int *reqFrameCnt);
352 int MarkIspEnqueue(int index);
353 int MarkIspDequeue(int index);
354 int GetNumOnSensor();
355 int GetNumOnHalFilled();
356 int GetNumOnIsp();
357
358private:
359 int GetNextIndex(int index);
360
361 int sensorEnqueueHead;
362 int sensorDequeueHead;
363 int ispEnqueueHead;
364 int ispDequeueHead;
365 int numOnSensor;
366 int numOnIsp;
367 int numOnHalFilled;
368 int numOnHalEmpty;
369
370 bayer_buf_entry_t entries[NUM_BAYER_BUFFERS];
371};
372
373
13d8c7b4
SK
374#define NOT_AVAILABLE (0)
375#define REQUIRES_DQ_FROM_SVC (1)
376#define ON_DRIVER (2)
377#define ON_HAL (3)
378#define ON_SERVICE (4)
379
380#define BAYER_NOT_AVAILABLE (0)
381#define BAYER_ON_SENSOR (1)
382#define BAYER_ON_HAL_FILLED (2)
383#define BAYER_ON_ISP (3)
384#define BAYER_ON_SERVICE (4)
385#define BAYER_ON_HAL_EMPTY (5)
386
387typedef struct stream_parameters {
5506cebf
SK
388 uint32_t width;
389 uint32_t height;
390 int format;
c15a6b00
JS
391 const camera2_stream_ops_t* streamOps;
392 uint32_t usage;
13d8c7b4
SK
393 int numHwBuffers;
394 int numSvcBuffers;
be494d19 395 int numOwnSvcBuffers;
5506cebf 396 int planes;
feb7df4c 397 int metaPlanes;
be494d19 398 int numSvcBufsInHal;
13d8c7b4
SK
399 buffer_handle_t svcBufHandle[NUM_MAX_CAMERA_BUFFERS];
400 ExynosBuffer svcBuffers[NUM_MAX_CAMERA_BUFFERS];
5506cebf 401 ExynosBuffer metaBuffers[NUM_MAX_CAMERA_BUFFERS];
13d8c7b4 402 int svcBufStatus[NUM_MAX_CAMERA_BUFFERS];
5506cebf
SK
403 int bufIndex;
404 node_info_t *node;
405 int minUndequedBuffer;
c15a6b00
JS
406} stream_parameters_t;
407
5506cebf
SK
408typedef struct substream_parameters {
409 int type;
410 uint32_t width;
411 uint32_t height;
412 int format;
9dd63e1f
SK
413 const camera2_stream_ops_t* streamOps;
414 uint32_t usage;
415 int numSvcBuffers;
be494d19 416 int numOwnSvcBuffers;
74d78ebe
SK
417 int internalFormat;
418 int internalPlanes;
74d78ebe
SK
419 int svcPlanes;
420 buffer_handle_t svcBufHandle[NUM_MAX_CAMERA_BUFFERS];
421 ExynosBuffer svcBuffers[NUM_MAX_CAMERA_BUFFERS];
422 int svcBufStatus[NUM_MAX_CAMERA_BUFFERS];
423 int svcBufIndex;
424 int numSvcBufsInHal;
5506cebf
SK
425 bool needBufferInit;
426 int minUndequedBuffer;
427} substream_parameters_t;
428
429typedef struct substream_entry {
430 int priority;
431 int streamId;
432} substream_entry_t;
74d78ebe 433
c15a6b00
JS
434class ExynosCameraHWInterface2 : public virtual RefBase {
435public:
6044e509 436 ExynosCameraHWInterface2(int cameraId, camera2_device_t *dev, ExynosCamera2 * camera, int *openInvalid);
c15a6b00
JS
437 virtual ~ExynosCameraHWInterface2();
438
439 virtual void release();
13d8c7b4 440
c15a6b00
JS
441 inline int getCameraId() const;
442
443 virtual int setRequestQueueSrcOps(const camera2_request_queue_src_ops_t *request_src_ops);
444 virtual int notifyRequestQueueNotEmpty();
445 virtual int setFrameQueueDstOps(const camera2_frame_queue_dst_ops_t *frame_dst_ops);
446 virtual int getInProgressCount();
447 virtual int flushCapturesInProgress();
448 virtual int constructDefaultRequest(int request_template, camera_metadata_t **request);
13d8c7b4 449 virtual int allocateStream(uint32_t width, uint32_t height,
c15a6b00
JS
450 int format, const camera2_stream_ops_t *stream_ops,
451 uint32_t *stream_id, uint32_t *format_actual, uint32_t *usage, uint32_t *max_buffers);
452 virtual int registerStreamBuffers(uint32_t stream_id, int num_buffers, buffer_handle_t *buffers);
453 virtual int releaseStream(uint32_t stream_id);
454 virtual int allocateReprocessStream(uint32_t width, uint32_t height,
455 uint32_t format, const camera2_stream_in_ops_t *reprocess_stream_ops,
456 uint32_t *stream_id, uint32_t *consumer_usage, uint32_t *max_buffers);
5506cebf
SK
457 virtual int allocateReprocessStreamFromStream(uint32_t output_stream_id,
458 const camera2_stream_in_ops_t *reprocess_stream_ops, uint32_t *stream_id);
c15a6b00
JS
459 virtual int releaseReprocessStream(uint32_t stream_id);
460 virtual int triggerAction(uint32_t trigger_id, int ext1, int ext2);
461 virtual int setNotifyCallback(camera2_notify_callback notify_cb, void *user);
462 virtual int getMetadataVendorTagOps(vendor_tag_query_ops_t **ops);
463 virtual int dump(int fd);
464private:
13d8c7b4
SK
465class MainThread : public SignalDrivenThread {
466 ExynosCameraHWInterface2 *mHardware;
467 public:
468 MainThread(ExynosCameraHWInterface2 *hw):
469 SignalDrivenThread(),
053d38cf 470 mHardware(hw) { }
13d8c7b4 471 ~MainThread();
13d8c7b4 472 void threadFunctionInternal()
053d38cf 473 {
13d8c7b4
SK
474 mHardware->m_mainThreadFunc(this);
475 return;
476 }
477 void release(void);
15fd8231 478 bool m_releasing;
13d8c7b4 479 };
9dd63e1f 480
c15a6b00
JS
481 class SensorThread : public SignalDrivenThread {
482 ExynosCameraHWInterface2 *mHardware;
483 public:
484 SensorThread(ExynosCameraHWInterface2 *hw):
053d38cf 485 SignalDrivenThread(),
5506cebf 486 mHardware(hw) { }
13d8c7b4 487 ~SensorThread();
13d8c7b4 488 void threadFunctionInternal() {
c15a6b00
JS
489 mHardware->m_sensorThreadFunc(this);
490 return;
491 }
9dd63e1f 492 void release(void);
c15a6b00 493 //private:
15fd8231 494 bool m_releasing;
c15a6b00
JS
495 };
496
497 class StreamThread : public SignalDrivenThread {
498 ExynosCameraHWInterface2 *mHardware;
499 public:
500 StreamThread(ExynosCameraHWInterface2 *hw, uint8_t new_index):
053d38cf 501 SignalDrivenThread(),
c15a6b00
JS
502 mHardware(hw),
503 m_index(new_index) { }
13d8c7b4 504 ~StreamThread();
13d8c7b4 505 void threadFunctionInternal() {
c15a6b00
JS
506 mHardware->m_streamThreadFunc(this);
507 return;
508 }
13d8c7b4 509 void setParameter(stream_parameters_t * new_parameters);
5506cebf
SK
510 status_t attachSubStream(int stream_id, int priority);
511 status_t detachSubStream(int stream_id);
13d8c7b4
SK
512 void release(void);
513 int findBufferIndex(void * bufAddr);
5506cebf 514 int findBufferIndex(buffer_handle_t * bufHandle);
c15a6b00 515
13d8c7b4 516 uint8_t m_index;
9dd63e1f 517 bool m_activated;
13d8c7b4
SK
518 //private:
519 stream_parameters_t m_parameters;
9dd63e1f 520 stream_parameters_t *m_tempParameters;
5506cebf 521 substream_entry_t m_attachedSubStreams[NUM_MAX_SUBSTREAM];
13d8c7b4 522 bool m_isBufferInit;
b5237e6b 523 bool m_releasing;
5506cebf
SK
524 int streamType;
525 int m_numRegisteredStream;
13d8c7b4 526 };
c15a6b00
JS
527
528 sp<MainThread> m_mainThread;
529 sp<SensorThread> m_sensorThread;
13d8c7b4 530 sp<StreamThread> m_streamThreads[NUM_MAX_STREAM_THREAD];
5506cebf 531 substream_parameters_t m_subStreams[STREAM_ID_LAST+1];
13d8c7b4
SK
532
533
9dd63e1f 534
c15a6b00 535 RequestManager *m_requestManager;
9dd63e1f 536 BayerBufManager *m_BayerManager;
daa1fcd6 537 ExynosCamera2 *m_camera2;
c15a6b00
JS
538
539 void m_mainThreadFunc(SignalDrivenThread * self);
540 void m_sensorThreadFunc(SignalDrivenThread * self);
c15a6b00 541 void m_streamThreadFunc(SignalDrivenThread * self);
13d8c7b4
SK
542 void m_streamThreadInitialize(SignalDrivenThread * self);
543
5506cebf
SK
544 void m_streamFunc_direct(SignalDrivenThread *self);
545 void m_streamFunc_indirect(SignalDrivenThread *self);
86646da4
SK
546
547 void m_streamBufferInit(SignalDrivenThread *self);
548
5506cebf
SK
549 int m_runSubStreamFunc(StreamThread *selfThread, ExynosBuffer *srcImageBuf,
550 int stream_id, nsecs_t frameTimeStamp);
551 int m_jpegCreator(StreamThread *selfThread, ExynosBuffer *srcImageBuf, nsecs_t frameTimeStamp);
552 int m_recordCreator(StreamThread *selfThread, ExynosBuffer *srcImageBuf, nsecs_t frameTimeStamp);
553 int m_prvcbCreator(StreamThread *selfThread, ExynosBuffer *srcImageBuf, nsecs_t frameTimeStamp);
13d8c7b4
SK
554 void m_getAlignedYUVSize(int colorFormat, int w, int h,
555 ExynosBuffer *buf);
556 bool m_getRatioSize(int src_w, int src_h,
557 int dst_w, int dst_h,
558 int *crop_x, int *crop_y,
559 int *crop_w, int *crop_h,
560 int zoom);
561 int createIonClient(ion_client ionClient);
562 int deleteIonClient(ion_client ionClient);
13d8c7b4
SK
563
564 int allocCameraMemory(ion_client ionClient, ExynosBuffer *buf, int iMemoryNum);
181e425e 565 int allocCameraMemory(ion_client ionClient, ExynosBuffer *buf, int iMemoryNum, int cacheFlag);
13d8c7b4
SK
566 void freeCameraMemory(ExynosBuffer *buf, int iMemoryNum);
567 void initCameraMemory(ExynosBuffer *buf, int iMemoryNum);
568
569 void DumpInfoWithShot(struct camera2_shot_ext * shot_ext);
2d5e6ec2 570 bool m_checkThumbnailSize(int w, int h);
13d8c7b4
SK
571 bool yuv2Jpeg(ExynosBuffer *yuvBuf,
572 ExynosBuffer *jpegBuf,
573 ExynosRect *rect);
5506cebf 574 int InitializeISPChain();
ad37861e 575 void StartISP();
5506cebf 576 void StartSCCThread(bool threadExists);
0f26b20f
SK
577 int GetAfState();
578 void SetAfMode(enum aa_afmode afMode);
8e2c2fdb 579 void OnAfTriggerStart(int id);
0f26b20f
SK
580 void OnAfTrigger(int id);
581 void OnAfTriggerAutoMacro(int id);
582 void OnAfTriggerCAFPicture(int id);
583 void OnAfTriggerCAFVideo(int id);
e117f756 584 void OnPrecaptureMeteringTriggerStart(int id);
0f26b20f
SK
585 void OnAfCancel(int id);
586 void OnAfCancelAutoMacro(int id);
587 void OnAfCancelCAFPicture(int id);
588 void OnAfCancelCAFVideo(int id);
73f5ad60
YJ
589 void OnPrecaptureMeteringNotificationISP();
590 void OnPrecaptureMeteringNotificationSensor();
0f26b20f
SK
591 void OnAfNotification(enum aa_afstate noti);
592 void OnAfNotificationAutoMacro(enum aa_afstate noti);
593 void OnAfNotificationCAFPicture(enum aa_afstate noti);
594 void OnAfNotificationCAFVideo(enum aa_afstate noti);
595 void SetAfStateForService(int newState);
596 int GetAfStateForService();
13d8c7b4 597 exif_attribute_t mExifInfo;
eed7ed1b
SK
598 void m_setExifFixedAttribute(void);
599 void m_setExifChangedAttribute(exif_attribute_t *exifInfo, ExynosRect *rect,
600 camera2_shot *currentEntry);
e117f756
YJ
601 void m_preCaptureSetter(struct camera2_shot_ext * shot_ext);
602 void m_preCaptureListenerSensor(struct camera2_shot_ext * shot_ext);
603 void m_preCaptureListenerISP(struct camera2_shot_ext * shot_ext);
13d8c7b4 604 void *m_exynosPictureCSC;
9dd63e1f 605 void *m_exynosVideoCSC;
13d8c7b4 606
c15a6b00
JS
607
608 camera2_request_queue_src_ops_t *m_requestQueueOps;
609 camera2_frame_queue_dst_ops_t *m_frameQueueOps;
610 camera2_notify_callback m_notifyCb;
611 void *m_callbackCookie;
612
613 int m_numOfRemainingReqInSvc;
614 bool m_isRequestQueuePending;
13d8c7b4
SK
615 bool m_isRequestQueueNull;
616 camera2_device_t *m_halDevice;
617 static gralloc_module_t const* m_grallocHal;
c15a6b00 618
c15a6b00 619
13d8c7b4 620 camera_hw_info_t m_camera_info;
c15a6b00
JS
621
622 ion_client m_ionCameraClient;
623
ad37861e 624 bool m_isIspStarted;
13d8c7b4 625
ad37861e 626 int m_need_streamoff;
13d8c7b4 627
13d8c7b4
SK
628
629 int indexToQueue[3+1];
13d8c7b4
SK
630
631 bool m_scp_flushing;
632 bool m_closing;
633 ExynosBuffer m_resizeBuf;
5506cebf
SK
634 int m_currentOutputStreams;
635 int m_currentReprocessOutStreams;
74d78ebe 636 ExynosBuffer m_previewCbBuf;
9dd63e1f
SK
637 int m_cameraId;
638 bool m_scp_closing;
639 bool m_scp_closed;
15fd8231 640 bool m_wideAspect;
8e2c2fdb 641 uint32_t lastAfRegion[4];
308291de 642 float m_zoomRatio;
ad37861e 643
5c88d1f2
C
644#ifdef VDIS_ENABLE
645 int m_vdisBubbleCnt;
646 int m_vdisDupFrame;
647#endif
648
5506cebf 649 mutable Mutex m_qbufLock;
ad37861e 650
0f26b20f
SK
651 int m_afState;
652 int m_afTriggerId;
653 enum aa_afmode m_afMode;
654 enum aa_afmode m_afMode2;
655 bool m_IsAfModeUpdateRequired;
656 bool m_IsAfTriggerRequired;
657 bool m_IsAfLockRequired;
658 int m_serviceAfState;
36c106c9 659 bool m_AfHwStateFailed;
8e2c2fdb
SK
660 int m_afPendingTriggerId;
661 int m_afModeWaitingCnt;
eed7ed1b 662 struct camera2_shot m_jpegMetadata;
b55ed664
SK
663 int m_scpOutputSignalCnt;
664 int m_scpOutputImageCnt;
a15b4e3f
SK
665 int m_nightCaptureCnt;
666 int m_nightCaptureFrameCnt;
2d5e6ec2
SK
667 int m_thumbNailW;
668 int m_thumbNailH;
5506cebf
SK
669 int m_reprocessStreamId;
670 const camera2_stream_in_ops_t * m_reprocessOps;
671 int m_reprocessOutputStreamId;
672 int m_reprocessingFrameCnt;
9a710a45 673 ctl_request_info_t m_ctlInfo;
c15a6b00
JS
674};
675
676}; // namespace android
677
678#endif