1 /* Copyright (c) 2012-2015, The Linux Foundataion. 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 __QCAMERA3_CHANNEL_H__
31 #define __QCAMERA3_CHANNEL_H__
32 
33 #include <hardware/camera3.h>
34 #include "QCamera3Stream.h"
35 #include "QCamera3Mem.h"
36 #include "QCamera3StreamMem.h"
37 #include "QCamera3PostProc.h"
38 #include "QCamera3HALHeader.h"
39 #include "utils/Vector.h"
40 #include <utils/List.h>
41 
42 extern "C" {
43 #include <mm_camera_interface.h>
44 }
45 
46 using namespace android;
47 
48 #define MIN_STREAMING_BUFFER_NUM 7+11
49 
50 namespace qcamera {
51 
52 typedef void (*channel_cb_routine)(mm_camera_super_buf_t *metadata,
53                                 camera3_stream_buffer_t *buffer,
54                                 uint32_t frame_number, bool isInputBuffer,
55                                 void *userdata);
56 class QCamera3Channel
57 {
58 public:
59     QCamera3Channel(uint32_t cam_handle,
60                    uint32_t channel_handle,
61                    mm_camera_ops_t *cam_ops,
62                    channel_cb_routine cb_routine,
63                    cam_padding_info_t *paddingInfo,
64                    uint32_t postprocess_mask,
65                    void *userData, uint32_t numBuffers);
66     virtual ~QCamera3Channel();
67 
68     virtual int32_t start();
69     virtual int32_t stop();
70     virtual int32_t setBatchSize(uint32_t);
71     virtual int32_t queueBatchBuf();
72     virtual int32_t setPerFrameMapUnmap(bool enable);
73     int32_t bufDone(mm_camera_super_buf_t *recvd_frame);
74     int32_t setBundleInfo(const cam_bundle_config_t &bundleInfo);
75 
76     virtual uint32_t getStreamTypeMask();
77     uint32_t getStreamID(uint32_t streamMask);
78     virtual int32_t initialize(cam_is_type_t isType) = 0;
request(buffer_handle_t *,uint32_t)79     virtual int32_t request(buffer_handle_t * /*buffer*/,
80                 uint32_t /*frameNumber*/){ return 0;};
request(buffer_handle_t *,uint32_t,camera3_stream_buffer_t *,metadata_buffer_t *)81     virtual int32_t request(buffer_handle_t * /*buffer*/,
82                 uint32_t /*frameNumber*/,
83                 camera3_stream_buffer_t* /*pInputBuffer*/,
84                 metadata_buffer_t* /*metadata*/){ return 0;};
85     virtual void streamCbRoutine(mm_camera_super_buf_t *super_frame,
86                             QCamera3Stream *stream) = 0;
87 
88     virtual int32_t registerBuffer(buffer_handle_t *buffer, cam_is_type_t isType) = 0;
89     virtual QCamera3StreamMem *getStreamBufs(uint32_t len) = 0;
90     virtual void putStreamBufs() = 0;
91 
92     QCamera3Stream *getStreamByHandle(uint32_t streamHandle);
getMyHandle()93     uint32_t getMyHandle() const {return m_handle;};
getNumOfStreams()94     uint32_t getNumOfStreams() const {return m_numStreams;};
getNumBuffers()95     uint32_t getNumBuffers() const {return mNumBuffers;};
96     QCamera3Stream *getStreamByIndex(uint32_t index);
97 
98     static void streamCbRoutine(mm_camera_super_buf_t *super_frame,
99                 QCamera3Stream *stream, void *userdata);
100     void dumpYUV(mm_camera_buf_def_t *frame, cam_dimension_t dim,
101             cam_frame_len_offset_t offset, uint8_t name);
102 
103     void *mUserData;
104     cam_padding_info_t *mPaddingInfo;
105     QCamera3Stream *mStreams[MAX_STREAM_NUM_IN_BUNDLE];
106     uint32_t m_numStreams;
107 protected:
108 
109     int32_t addStream(cam_stream_type_t streamType,
110                       cam_format_t streamFormat,
111                       cam_dimension_t streamDim,
112                       cam_rotation_t streamRotation,
113                       uint8_t minStreamBufnum,
114                       uint32_t postprocessMask,
115                       cam_is_type_t isType,
116                       uint32_t batchSize = 0);
117     int32_t allocateStreamInfoBuf(camera3_stream_t *stream);
118 
119     uint32_t m_camHandle;
120     mm_camera_ops_t *m_camOps;
121     bool m_bIsActive;
122 
123     uint32_t m_handle;
124 
125 
126     mm_camera_buf_notify_t mDataCB;
127 
128 
129     QCamera3HeapMemory *mStreamInfoBuf;
130     channel_cb_routine mChannelCB;
131     //cam_padding_info_t *mPaddingInfo;
132     uint32_t mPostProcMask;
133     uint8_t mYUVDump;
134     cam_is_type_t mIsType;
135     uint32_t mNumBuffers;
136     /* Enable unmapping of buffer before issuing buffer callback. Default value
137      * for this flag is true and is selectively set to false for the usecases
138      * such as HFR to avoid any performance hit due to mapping/unmapping */
139     bool    mPerFrameMapUnmapEnable;
140 };
141 
142 /* QCamera3ProcessingChannel is used to handle all streams that are directly
143  * generated by hardware and given to frameworks without any postprocessing at HAL.
144  * It also handles input streams that require reprocessing by hardware and then
145  * returned to frameworks. */
146 class QCamera3ProcessingChannel : public QCamera3Channel
147 {
148 public:
149    QCamera3ProcessingChannel(uint32_t cam_handle,
150            uint32_t channel_handle,
151            mm_camera_ops_t *cam_ops,
152            channel_cb_routine cb_routine,
153            cam_padding_info_t *paddingInfo,
154            void *userData,
155            camera3_stream_t *stream,
156            cam_stream_type_t stream_type,
157            uint32_t postprocess_mask,
158            QCamera3Channel *metadataChannel,
159            uint32_t numBuffers = MAX_INFLIGHT_REQUESTS);
160 
161     ~QCamera3ProcessingChannel();
162 
163     virtual int32_t initialize(cam_is_type_t isType);
164     virtual int32_t request(buffer_handle_t *buffer,
165             uint32_t frameNumber,
166             camera3_stream_buffer_t* pInputBuffer,
167             metadata_buffer_t* metadata);
168     virtual void streamCbRoutine(mm_camera_super_buf_t *super_frame,
169             QCamera3Stream *stream);
170     virtual QCamera3StreamMem *getStreamBufs(uint32_t len);
171     virtual void putStreamBufs();
172     virtual int32_t registerBuffer(buffer_handle_t *buffer, cam_is_type_t isType);
173 
174     virtual int32_t stop();
175 
176     virtual reprocess_type_t getReprocessType() = 0;
177 
178     virtual void reprocessCbRoutine(buffer_handle_t *resultBuffer,
179             uint32_t resultFrameNumber);
180 
181     int32_t queueReprocMetadata(mm_camera_super_buf_t *metadata);
182     int32_t metadataBufDone(mm_camera_super_buf_t *recvd_frame);
183     int32_t translateStreamTypeAndFormat(camera3_stream_t *stream,
184             cam_stream_type_t &streamType,
185             cam_format_t &streamFormat);
186     int32_t setReprocConfig(reprocess_config_t &reproc_cfg,
187             camera3_stream_buffer_t *pInputBuffer,
188             metadata_buffer_t *metadata,
189             cam_format_t streamFormat, cam_dimension_t dim);
190     int32_t setFwkInputPPData(qcamera_fwk_input_pp_data_t *src_frame,
191             camera3_stream_buffer_t *pInputBuffer,
192             reprocess_config_t *reproc_cfg,
193             metadata_buffer_t *metadata,
194             buffer_handle_t *output_buffer,
195             uint32_t frameNumber);
196     int32_t checkStreamCbErrors(mm_camera_super_buf_t *super_frame,
197             QCamera3Stream *stream);
198     int32_t getStreamSize(cam_dimension_t &dim);
199 
200     QCamera3PostProcessor m_postprocessor; // post processor
201 
202 protected:
isWNREnabled()203     bool isWNREnabled() {return m_bWNROn;};
204     void startPostProc(const reprocess_config_t &reproc_cfg);
205     void issueChannelCb(buffer_handle_t *resultBuffer,
206             uint32_t resultFrameNumber);
207     int32_t releaseOfflineMemory(uint32_t resultFrameNumber);
208 
209     QCamera3StreamMem mMemory; //output buffer allocated by fwk
210     camera3_stream_t *mCamera3Stream;
211     uint32_t mNumBufs;
212     cam_stream_type_t mStreamType;
213     cam_format_t mStreamFormat;
214     uint8_t mIntent;
215 
216     bool mPostProcStarted;
217     bool mInputBufferConfig;   // Set when the processing channel is configured
218                                // for processing input(framework) buffers
219 
220     QCamera3Channel *m_pMetaChannel;
221     mm_camera_super_buf_t *mMetaFrame;
222     QCamera3StreamMem mOfflineMemory;      //reprocessing input buffer
223     QCamera3StreamMem mOfflineMetaMemory; //reprocessing metadata buffer
224     List<uint32_t> mFreeOfflineMetaBuffersList;
225     Mutex mFreeOfflineMetaBuffersLock;
226 
227 private:
228 
229     bool m_bWNROn;
230 };
231 
232 /* QCamera3RegularChannel is used to handle all streams that are directly
233  * generated by hardware and given to frameworks without any postprocessing at HAL.
234  * Examples are: all IMPLEMENTATION_DEFINED streams, CPU_READ streams. */
235 class QCamera3RegularChannel : public QCamera3ProcessingChannel
236 {
237 public:
238     QCamera3RegularChannel(uint32_t cam_handle,
239                     uint32_t channel_handle,
240                     mm_camera_ops_t *cam_ops,
241                     channel_cb_routine cb_routine,
242                     cam_padding_info_t *paddingInfo,
243                     void *userData,
244                     camera3_stream_t *stream,
245                     cam_stream_type_t stream_type,
246                     uint32_t postprocess_mask,
247                     QCamera3Channel *metadataChannel,
248                     uint32_t numBuffers = MAX_INFLIGHT_REQUESTS);
249 
250     virtual ~QCamera3RegularChannel();
251 
252     virtual int32_t setBatchSize(uint32_t batchSize);
253     virtual uint32_t getStreamTypeMask();
254     virtual int32_t queueBatchBuf();
255     virtual int32_t initialize(cam_is_type_t isType);
256     virtual int32_t request(buffer_handle_t *buffer, uint32_t frameNumber);
257     virtual reprocess_type_t getReprocessType();
258 
259 private:
260     int32_t initialize(struct private_handle_t *priv_handle);
261 
262     cam_rotation_t mRotation;
263     uint32_t mBatchSize;
264 
265 };
266 
267 /* QCamera3MetadataChannel is for metadata stream generated by camera daemon. */
268 class QCamera3MetadataChannel : public QCamera3Channel
269 {
270 public:
271     QCamera3MetadataChannel(uint32_t cam_handle,
272                     uint32_t channel_handle,
273                     mm_camera_ops_t *cam_ops,
274                     channel_cb_routine cb_routine,
275                     cam_padding_info_t *paddingInfo,
276                     uint32_t postprocess_mask,
277                     void *userData,
278                     uint32_t numBuffers = MIN_STREAMING_BUFFER_NUM);
279     virtual ~QCamera3MetadataChannel();
280 
281     virtual int32_t initialize(cam_is_type_t isType);
282 
283     virtual int32_t request(buffer_handle_t *buffer, uint32_t frameNumber);
284     virtual void streamCbRoutine(mm_camera_super_buf_t *super_frame,
285                             QCamera3Stream *stream);
286 
287     virtual QCamera3StreamMem *getStreamBufs(uint32_t le);
288     virtual void putStreamBufs();
registerBuffer(buffer_handle_t *,cam_is_type_t)289     virtual int32_t registerBuffer(buffer_handle_t * /*buffer*/, cam_is_type_t /*isType*/)
290             { return NO_ERROR; };
291 
292 private:
293     QCamera3StreamMem *mMemory;
294 };
295 
296 /* QCamera3RawChannel is for opaqueu/cross-platform raw stream containing
297  * vendor specific bayer data or 16-bit unpacked bayer data */
298 class QCamera3RawChannel : public QCamera3RegularChannel
299 {
300 public:
301     QCamera3RawChannel(uint32_t cam_handle,
302                     uint32_t channel_handle,
303                     mm_camera_ops_t *cam_ops,
304                     channel_cb_routine cb_routine,
305                     cam_padding_info_t *paddingInfo,
306                     void *userData,
307                     camera3_stream_t *stream,
308                     uint32_t postprocess_mask,
309                     QCamera3Channel *metadataChannel,
310                     bool raw_16 = false,
311                     uint32_t numBuffers = MAX_INFLIGHT_REQUESTS);
312 
313     virtual ~QCamera3RawChannel();
314 
315     virtual int32_t initialize(cam_is_type_t isType);
316 
317     virtual void streamCbRoutine(mm_camera_super_buf_t *super_frame,
318                             QCamera3Stream *stream);
319 
320     virtual reprocess_type_t getReprocessType();
321 
322 private:
323     bool mRawDump;
324     bool mIsRaw16;
325 
326     void dumpRawSnapshot(mm_camera_buf_def_t *frame);
327     void convertLegacyToRaw16(mm_camera_buf_def_t *frame);
328     void convertMipiToRaw16(mm_camera_buf_def_t *frame);
329 };
330 
331 /*
332  * QCamera3RawDumpChannel is for internal use only for Raw dump
333  */
334 
335 class QCamera3RawDumpChannel : public QCamera3Channel
336 {
337 public:
338     QCamera3RawDumpChannel(uint32_t cam_handle,
339                     uint32_t channel_handle,
340                     mm_camera_ops_t *cam_ops,
341                     cam_dimension_t rawDumpSize,
342                     cam_padding_info_t *paddingInfo,
343                     void *userData,
344                     uint32_t postprocess_mask, uint32_t numBuffers = 3U);
345     virtual ~QCamera3RawDumpChannel();
346     virtual int32_t initialize(cam_is_type_t isType);
347     virtual void streamCbRoutine(mm_camera_super_buf_t *super_frame,
348                             QCamera3Stream *stream);
349     virtual QCamera3StreamMem *getStreamBufs(uint32_t le);
350     virtual void putStreamBufs();
registerBuffer(buffer_handle_t *,cam_is_type_t)351     virtual int32_t registerBuffer(buffer_handle_t * /*buffer*/, cam_is_type_t /*isType*/)
352             { return NO_ERROR; };
353     virtual int32_t request(buffer_handle_t *buffer, uint32_t frameNumber);
354     void dumpRawSnapshot(mm_camera_buf_def_t *frame);
355 
356 public:
357     cam_dimension_t mDim;
358 
359 private:
360     bool mRawDump;
361     QCamera3StreamMem *mMemory;
362 };
363 
364 /* QCamera3YUVChannel is used to handle flexible YUV streams that are directly
365  * generated by hardware and given to frameworks without any postprocessing at HAL.
366  * It is also used to handle input buffers that generate YUV outputs */
367 class QCamera3YUVChannel : public QCamera3ProcessingChannel
368 {
369 public:
370     QCamera3YUVChannel(uint32_t cam_handle,
371             uint32_t channel_handle,
372             mm_camera_ops_t *cam_ops,
373             channel_cb_routine cb_routine,
374             cam_padding_info_t *paddingInfo,
375             void *userData,
376             camera3_stream_t *stream,
377             cam_stream_type_t stream_type,
378             uint32_t postprocess_mask,
379             QCamera3Channel *metadataChannel);
380     ~QCamera3YUVChannel();
381     virtual int32_t initialize(cam_is_type_t isType);
382     virtual int32_t request(buffer_handle_t *buffer,
383             uint32_t frameNumber,
384             camera3_stream_buffer_t* pInputBuffer,
385             metadata_buffer_t* metadata, bool &needMetadata);
386     virtual reprocess_type_t getReprocessType();
387     virtual void streamCbRoutine(mm_camera_super_buf_t *super_frame,
388             QCamera3Stream *stream);
389     virtual void putStreamBufs();
390     virtual void reprocessCbRoutine(buffer_handle_t *resultBuffer,
391         uint32_t resultFrameNumber);
392 
393 private:
394     typedef struct {
395         uint32_t frameNumber;
396         bool offlinePpFlag;
397         buffer_handle_t *output;
398         mm_camera_super_buf_t *callback_buffer;
399     } PpInfo;
400 
401     // Whether offline postprocessing is required for this channel
402     bool mBypass;
403     uint32_t mFrameLen;
404 
405     // Current edge, noise, and crop region setting
406     cam_edge_application_t mEdgeMode;
407     uint32_t mNoiseRedMode;
408     cam_crop_region_t mCropRegion;
409 
410     // Mutex to protect mOfflinePpFlagMap and mFreeHeapBufferList
411     Mutex mOfflinePpLock;
412     // Map between free number and whether the request needs to be
413     // postprocessed.
414     List<PpInfo> mOfflinePpInfoList;
415     // Heap buffer index list
416     List<uint32_t> mFreeHeapBufferList;
417 
418 private:
419     bool needsFramePostprocessing(metadata_buffer_t* meta);
420     int32_t handleOfflinePpCallback(uint32_t resultFrameNumber,
421             Vector<mm_camera_super_buf_t *>& pendingCbs);
422 };
423 
424 /* QCamera3PicChannel is for JPEG stream, which contains a YUV stream generated
425  * by the hardware, and encoded to a JPEG stream */
426 class QCamera3PicChannel : public QCamera3ProcessingChannel
427 {
428 public:
429     QCamera3PicChannel(uint32_t cam_handle,
430             uint32_t channel_handle,
431             mm_camera_ops_t *cam_ops,
432             channel_cb_routine cb_routine,
433             cam_padding_info_t *paddingInfo,
434             void *userData,
435             camera3_stream_t *stream,
436             uint32_t postprocess_mask,
437             bool is4KVideo,
438             bool isInputStreamConfigured,
439             QCamera3Channel *metadataChannel,
440             uint32_t numBuffers = MAX_INFLIGHT_REQUESTS);
441     ~QCamera3PicChannel();
442 
443     virtual int32_t initialize(cam_is_type_t isType);
444     virtual int32_t request(buffer_handle_t *buffer,
445             uint32_t frameNumber,
446             camera3_stream_buffer_t* pInputBuffer,
447             metadata_buffer_t* metadata);
448     virtual void streamCbRoutine(mm_camera_super_buf_t *super_frame,
449             QCamera3Stream *stream);
450 
451     virtual QCamera3StreamMem *getStreamBufs(uint32_t le);
452     virtual void putStreamBufs();
453     virtual reprocess_type_t getReprocessType();
454 
455     QCamera3Exif *getExifData(metadata_buffer_t *metadata,
456             jpeg_settings_t *jpeg_settings);
457     void overrideYuvSize(uint32_t width, uint32_t height);
458     static void jpegEvtHandle(jpeg_job_status_t status,
459             uint32_t /*client_hdl*/,
460             uint32_t jobId,
461             mm_jpeg_output_t *p_output,
462             void *userdata);
463     static void dataNotifyCB(mm_camera_super_buf_t *recvd_frame,
464             void *userdata);
465 
466 private:
467     int32_t queueJpegSetting(uint32_t out_buf_index, metadata_buffer_t *metadata);
468 
469 public:
470     cam_dimension_t m_max_pic_dim;
471 
472 private:
473     uint32_t mNumSnapshotBufs;
474     uint32_t mYuvWidth, mYuvHeight;
475     int32_t mCurrentBufIndex;
476     bool mInputBufferHint;
477     QCamera3StreamMem *mYuvMemory;
478     // Keep a list of free buffers
479     Mutex mFreeBuffersLock;
480     List<uint32_t> mFreeBufferList;
481     uint32_t mFrameLen;
482 };
483 
484 // reprocess channel class
485 class QCamera3ReprocessChannel : public QCamera3Channel
486 {
487 public:
488     QCamera3ReprocessChannel(uint32_t cam_handle,
489                             uint32_t channel_handle,
490                             mm_camera_ops_t *cam_ops,
491                             channel_cb_routine cb_routine,
492                             cam_padding_info_t *paddingInfo,
493                             uint32_t postprocess_mask,
494                             void *userData, void *ch_hdl);
495     QCamera3ReprocessChannel();
496     virtual ~QCamera3ReprocessChannel();
497     // offline reprocess
498     virtual int32_t start();
499     virtual int32_t stop();
500     int32_t doReprocessOffline(qcamera_fwk_input_pp_data_t *frame);
501     int32_t doReprocess(int buf_fd, size_t buf_length, int32_t &ret_val,
502                         mm_camera_super_buf_t *meta_buf);
503     int32_t overrideMetadata(qcamera_hal3_pp_buffer_t *pp_buffer,
504             mm_camera_buf_def_t *meta_buffer,
505             jpeg_settings_t *jpeg_settings,
506             qcamera_fwk_input_pp_data_t &fwk_frame);
507     int32_t overrideFwkMetadata(qcamera_fwk_input_pp_data_t *frame);
508     virtual QCamera3StreamMem *getStreamBufs(uint32_t len);
509     virtual void putStreamBufs();
510     virtual int32_t initialize(cam_is_type_t isType);
511     int32_t unmapOfflineBuffers(bool all);
512     int32_t bufDone(mm_camera_super_buf_t *recvd_frame);
513     virtual void streamCbRoutine(mm_camera_super_buf_t *super_frame,
514                             QCamera3Stream *stream);
515     static void dataNotifyCB(mm_camera_super_buf_t *recvd_frame,
516                                        void* userdata);
517     int32_t addReprocStreamsFromSource(cam_pp_feature_config_t &pp_config,
518            const reprocess_config_t &src_config,
519            cam_is_type_t is_type,
520            QCamera3Channel *pMetaChannel);
521     QCamera3Stream *getStreamBySrcHandle(uint32_t srcHandle);
522     QCamera3Stream *getSrcStreamBySrcHandle(uint32_t srcHandle);
523     virtual int32_t registerBuffer(buffer_handle_t * buffer, cam_is_type_t isType);
524 
525 public:
526     void *inputChHandle;
527 
528 private:
529     typedef struct {
530         QCamera3Stream *stream;
531         cam_mapping_buf_type type;
532         uint32_t index;
533     } OfflineBuffer;
534 
535     android::List<OfflineBuffer> mOfflineBuffers;
536     android::List<OfflineBuffer> mOfflineMetaBuffers;
537     int32_t mOfflineBuffersIndex;
538     int32_t mOfflineMetaIndex;
539     uint32_t mFrameLen;
540     Mutex mFreeBuffersLock; // Lock for free heap buffers
541     List<int32_t> mFreeBufferList; // Free heap buffers list
542     reprocess_type_t mReprocessType;
543     uint32_t mSrcStreamHandles[MAX_STREAM_NUM_IN_BUNDLE];
544     QCamera3ProcessingChannel *m_pSrcChannel; // ptr to source channel for reprocess
545     QCamera3Channel *m_pMetaChannel;
546     QCamera3StreamMem *mMemory;
547     QCamera3StreamMem mGrallocMemory;
548 };
549 
550 
551 /* QCamera3SupportChannel is for HAL internal consumption only */
552 class QCamera3SupportChannel : public QCamera3Channel
553 {
554 public:
555     QCamera3SupportChannel(uint32_t cam_handle,
556                     uint32_t channel_handle,
557                     mm_camera_ops_t *cam_ops,
558                     cam_padding_info_t *paddingInfo,
559                     uint32_t postprocess_mask,
560                     cam_stream_type_t streamType,
561                     cam_dimension_t *dim,
562                     cam_format_t streamFormat,
563                     void *userData,
564                     uint32_t numBuffers = MIN_STREAMING_BUFFER_NUM
565                     );
566     virtual ~QCamera3SupportChannel();
567 
568     virtual int32_t initialize(cam_is_type_t isType);
569 
570     virtual int32_t request(buffer_handle_t *buffer, uint32_t frameNumber);
571     virtual void streamCbRoutine(mm_camera_super_buf_t *super_frame,
572                             QCamera3Stream *stream);
573 
574     virtual QCamera3StreamMem *getStreamBufs(uint32_t le);
575     virtual void putStreamBufs();
registerBuffer(buffer_handle_t *,cam_is_type_t)576     virtual int32_t registerBuffer(buffer_handle_t * /*buffer*/, cam_is_type_t /*isType*/)
577             { return NO_ERROR; };
578 
579     static cam_dimension_t kDim;
580 private:
581     QCamera3StreamMem *mMemory;
582     cam_dimension_t mDim;
583     cam_stream_type_t mStreamType;
584     cam_format_t mStreamFormat;
585 };
586 
587 }; // namespace qcamera
588 
589 #endif /* __QCAMERA_CHANNEL_H__ */
590