| /* |
| ** |
| ** Copyright 2013, Samsung Electronics Co. LTD |
| ** |
| ** Licensed under the Apache License, Version 2.0 (the "License"); |
| ** you may not use this file except in compliance with the License. |
| ** You may obtain a copy of the License at |
| ** |
| ** http://www.apache.org/licenses/LICENSE-2.0 |
| ** |
| ** Unless required by applicable law or agreed to in writing, software |
| ** distributed under the License is distributed on an "AS IS" BASIS, |
| ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| ** See the License for the specific language governing permissions and |
| ** limitations under the License. |
| */ |
| |
| #ifndef EXYNOS_CAMERA_FRAME_FACTORY_H |
| #define EXYNOS_CAMERA_FRAME_FACTORY_H |
| |
| #include "ExynosCameraFrame.h" |
| |
| #include "ExynosCameraPipe.h" |
| #include "ExynosCameraMCPipe.h" |
| #include "ExynosCameraPipeFlite.h" |
| #include "ExynosCameraPipeGSC.h" |
| #include "ExynosCameraPipeJpeg.h" |
| #ifdef BOARD_CAMERA_USES_DUAL_CAMERA |
| #include "ExynosCameraPipeFusion.h" |
| #endif |
| #include "ExynosCameraFrameManager.h" |
| #include "ExynosCameraStreamMutex.h" |
| |
| #include "ExynosCamera1Parameters.h" |
| |
| namespace android { |
| |
| #define SET_OUTPUT_DEVICE_BASIC_INFO(perframeInfo) \ |
| pipeInfo[nodeType].rectInfo = tempRect;\ |
| pipeInfo[nodeType].bufInfo.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;\ |
| pipeInfo[nodeType].bufInfo.memory = V4L2_CAMERA_MEMORY_TYPE;\ |
| pipeInfo[nodeType].perFrameNodeGroupInfo.perframeSupportNodeNum = CAPTURE_NODE_MAX;\ |
| pipeInfo[nodeType].perFrameNodeGroupInfo.perFrameLeaderInfo.perframeInfoIndex = perframeInfo;\ |
| pipeInfo[nodeType].perFrameNodeGroupInfo.perFrameLeaderInfo.perFrameNodeType = PERFRAME_NODE_TYPE_LEADER;\ |
| pipeInfo[nodeType].perFrameNodeGroupInfo.perFrameLeaderInfo.perFrameVideoID = (m_deviceInfo[INDEX(pipeId)].nodeNum[nodeType] - FIMC_IS_VIDEO_BAS_NUM); |
| #define SET_CAPTURE_DEVICE_BASIC_INFO() \ |
| pipeInfo[nodeType].rectInfo = tempRect;\ |
| pipeInfo[nodeType].bufInfo.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;\ |
| pipeInfo[nodeType].bufInfo.memory = V4L2_CAMERA_MEMORY_TYPE;\ |
| pipeInfo[leaderNodeType].perFrameNodeGroupInfo.perFrameCaptureInfo[perFramePos].perFrameNodeType = PERFRAME_NODE_TYPE_CAPTURE;\ |
| pipeInfo[leaderNodeType].perFrameNodeGroupInfo.perFrameCaptureInfo[perFramePos].perFrameVideoID = (m_deviceInfo[INDEX(pipeId)].nodeNum[nodeType] - FIMC_IS_VIDEO_BAS_NUM);\ |
| |
| class ExynosCameraFrameFactory { |
| public: |
| ExynosCameraFrameFactory() |
| { |
| m_init(); |
| } |
| |
| ExynosCameraFrameFactory(int cameraId, ExynosCamera1Parameters *param) |
| { |
| m_init(); |
| |
| m_cameraId = cameraId; |
| m_parameters = param; |
| m_activityControl = m_parameters->getActivityControl(); |
| } |
| |
| public: |
| virtual ~ExynosCameraFrameFactory(); |
| |
| virtual status_t create(bool active = true) = 0; |
| virtual status_t precreate(void); |
| virtual status_t postcreate(void); |
| virtual status_t destroy(void); |
| virtual bool isCreated(void); |
| |
| virtual status_t initPipes(void) = 0; |
| virtual status_t mapBuffers(void); |
| virtual status_t preparePipes(void) = 0; |
| virtual status_t startPipes(void) = 0; |
| virtual status_t stopPipes(void) = 0; |
| virtual status_t startInitialThreads(void) = 0; |
| |
| virtual status_t fastenAeStable(int32_t numFrames, ExynosCameraBuffer *buffers); |
| |
| virtual status_t setStopFlag(void); |
| virtual status_t stopPipe(uint32_t pipeId); |
| virtual status_t startThread(uint32_t pipeId); |
| virtual status_t stopThread(uint32_t pipeId); |
| virtual status_t stopThreadAndWait(uint32_t pipeId, int sleep = 5, int times = 40); |
| virtual bool checkPipeThreadRunning(uint32_t pipeId); |
| virtual void setThreadOneShotMode(uint32_t pipeId, bool enable); |
| |
| virtual status_t setFrameManager(ExynosCameraFrameManager *manager); |
| virtual status_t getFrameManager(ExynosCameraFrameManager **manager); |
| |
| virtual status_t setBufferManagerToPipe(ExynosCameraBufferManager **bufferManager, uint32_t pipeId); |
| |
| virtual status_t setOutputFrameQToPipe(frame_queue_t *outputQ, uint32_t pipeId); |
| virtual status_t getOutputFrameQToPipe(frame_queue_t **outputQ, uint32_t pipeId); |
| virtual status_t setFrameDoneQToPipe(frame_queue_t *frameDoneQ, uint32_t pipeId); |
| virtual status_t getFrameDoneQToPipe(frame_queue_t **frameDoneQ, uint32_t pipeId); |
| virtual status_t getInputFrameQToPipe(frame_queue_t **inputFrameQ, uint32_t pipeId); |
| |
| virtual status_t pushFrameToPipe(ExynosCameraFrame **newFrame, uint32_t pipeId); |
| |
| virtual status_t setParam(struct v4l2_streamparm *streamParam, uint32_t pipeId); |
| virtual status_t setControl(int cid, int value, uint32_t pipeId); |
| virtual status_t setControl(int cid, int value, uint32_t pipeId, enum NODE_TYPE nodeType); |
| virtual status_t getControl(int cid, int *value, uint32_t pipeId); |
| virtual status_t setExtControl(struct v4l2_ext_controls *ctrl, uint32_t pipeId); |
| |
| virtual void setRequest(int pipeId, bool enable); |
| virtual void setRequestFLITE(bool enable); |
| virtual void setRequest3AC(bool enable); |
| virtual void setRequestISPC(bool enable); |
| virtual void setRequestISPP(bool enable); |
| virtual void setRequestSCC(bool enable); |
| virtual void setRequestDIS(bool enable); |
| |
| virtual status_t getThreadState(int **threadState, uint32_t pipeId); |
| virtual status_t getThreadInterval(uint64_t **threadInterval, uint32_t pipeId); |
| virtual status_t getThreadRenew(int **threadRenew, uint32_t pipeId); |
| virtual status_t incThreadRenew(uint32_t pipeId); |
| |
| virtual int getRunningFrameCount(uint32_t pipeId); |
| |
| virtual enum NODE_TYPE getNodeType(uint32_t pipeId); |
| |
| virtual ExynosCameraFrame *createNewFrameOnlyOnePipe(int pipeId, int frameCnt=-1, uint32_t frameType = 0); |
| virtual ExynosCameraFrame *createNewFrameVideoOnly(void); |
| virtual ExynosCameraFrame *createNewFrame(void) = 0; |
| |
| virtual void dump(void); |
| /* only for debugging */ |
| virtual status_t dumpFimcIsInfo(uint32_t pipeId, bool bugOn); |
| #ifdef MONITOR_LOG_SYNC |
| virtual status_t syncLog(uint32_t pipeId, uint32_t syncId); |
| #endif |
| |
| protected: |
| virtual status_t m_setCreate(bool create); |
| |
| /* flite pipe setting */ |
| virtual status_t m_initFlitePipe(int sensorW, int sensorH, uint32_t frameRate); |
| |
| virtual status_t m_initFrameMetadata(ExynosCameraFrame *frame); |
| virtual status_t m_initPipelines(ExynosCameraFrame *frame); |
| virtual status_t m_checkPipeInfo(uint32_t srcPipeId, uint32_t dstPipeId); |
| |
| virtual int m_getSensorId(unsigned int nodeNum, bool reprocessing); |
| virtual int m_getSensorId(unsigned int nodeNum, unsigned int connectionMode, bool flagLeader, bool reprocessing); |
| |
| virtual int m_getFliteNodenum(void); |
| #ifdef SUPPORT_DEPTH_MAP |
| virtual int m_getDepthVcNodeNum(void); |
| #endif |
| virtual void m_initDeviceInfo(int pipeId); |
| |
| private: |
| void m_init(void); |
| |
| protected: |
| int m_cameraId; |
| uint32_t m_frameCount; |
| |
| char m_name[EXYNOS_CAMERA_NAME_STR_SIZE]; |
| int32_t m_nodeNums[MAX_NUM_PIPES][MAX_NODE]; |
| int32_t m_sensorIds[MAX_NUM_PIPES][MAX_NODE]; |
| camera_device_info_t m_deviceInfo[MAX_NUM_PIPES]; |
| |
| ExynosCameraPipe *m_pipes[MAX_NUM_PIPES]; |
| ExynosCamera1Parameters *m_parameters; |
| ExynosCameraFrameManager *m_frameMgr; |
| ExynosCameraActivityControl *m_activityControl; |
| |
| Mutex m_frameLock; |
| Mutex m_createLock; |
| |
| uint32_t m_requestFLITE; |
| uint32_t m_requestVC1; |
| uint32_t m_requestVC2; |
| uint32_t m_requestVC3; |
| uint32_t m_request3AC; |
| uint32_t m_request3AP; |
| uint32_t m_requestISP; |
| uint32_t m_requestISPC; |
| uint32_t m_requestISPP; |
| uint32_t m_requestDIS; |
| uint32_t m_requestSCC; |
| uint32_t m_requestSCP; |
| uint32_t m_requestMCSC0; |
| uint32_t m_requestMCSC1; |
| uint32_t m_requestMCSC2; |
| uint32_t m_requestMCSC3; |
| uint32_t m_requestMCSC4; |
| uint32_t m_requestJPEG; |
| uint32_t m_requestThumbnail; |
| |
| bool m_bypassDRC; |
| bool m_bypassDIS; |
| bool m_bypassDNR; |
| bool m_bypassFD; |
| |
| bool m_flagFlite3aaOTF; |
| bool m_flag3aaIspOTF; |
| bool m_flagIspTpuOTF; |
| bool m_flagIspMcscOTF; |
| bool m_flagTpuMcscOTF; |
| |
| bool m_supportReprocessing; |
| bool m_flagReprocessing; |
| bool m_supportPureBayerReprocessing; |
| bool m_supportSCC; |
| bool m_supportSingleChain; |
| |
| private: |
| bool m_create; |
| struct camera2_shot_ext *m_shot_ext; |
| }; |
| |
| }; /* namespace android */ |
| |
| #endif |