blob: 236ad287354a0bf6668f3275247b7e4cfc1913a1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2019, Google Inc.
*
* cio2.h - Intel IPU3 CIO2
*/
#ifndef __LIBCAMERA_PIPELINE_IPU3_CIO2_H__
#define __LIBCAMERA_PIPELINE_IPU3_CIO2_H__
#include <memory>
#include <queue>
#include <vector>
#include <libcamera/signal.h>
#include "libcamera/internal/v4l2_videodevice.h"
namespace libcamera {
class CameraSensor;
class FrameBuffer;
class MediaDevice;
class PixelFormat;
class Request;
class Size;
class SizeRange;
class V4L2Subdevice;
struct StreamConfiguration;
class CIO2Device
{
public:
static constexpr unsigned int CIO2_BUFFER_COUNT = 4;
CIO2Device();
std::vector<PixelFormat> formats() const;
std::vector<SizeRange> sizes() const;
int init(const MediaDevice *media, unsigned int index);
int configure(const Size &size, V4L2DeviceFormat *outputFormat);
StreamConfiguration generateConfiguration(Size size) const;
int exportBuffers(unsigned int count,
std::vector<std::unique_ptr<FrameBuffer>> *buffers);
int start();
int stop();
CameraSensor *sensor() { return sensor_.get(); }
const CameraSensor *sensor() const { return sensor_.get(); }
int queueBuffer(Request *request, FrameBuffer *rawBuffer);
void tryReturnBuffer(FrameBuffer *buffer);
Signal<FrameBuffer *> &bufferReady() { return output_->bufferReady; }
private:
void freeBuffers();
void cio2BufferReady(FrameBuffer *buffer);
std::unique_ptr<CameraSensor> sensor_;
std::unique_ptr<V4L2Subdevice> csi2_;
std::unique_ptr<V4L2VideoDevice> output_;
std::vector<std::unique_ptr<FrameBuffer>> buffers_;
std::queue<FrameBuffer *> availableBuffers_;
};
} /* namespace libcamera */
#endif /* __LIBCAMERA_PIPELINE_IPU3_CIO2_H__ */
|