Debian Codegraph @

src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qvsp2blendingdevice.h

raw
1 // Copyright (C) 2017 The Qt Company Ltd.
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4 #ifndef QVSP2BLENDINGDEVICE_H
5 #define QVSP2BLENDINGDEVICE_H
6
7 #include <QtCore/QList>
8 #include <QtCore/QRect>
9 #include <QtCore/qglobal.h>
10
11 #include "qlinuxmediadevice.h"
12
13 QT_BEGIN_NAMESPACE
14
15 class QSize;
16
17 class QVsp2BlendingDevice
18 {
19 public:
20 QVsp2BlendingDevice(const QSize& screenSize); //TODO: add support for output format as well?
21 bool enableInput(int i, const QRect &bufferGeometry, uint drmFormat, uint bytesPerLine);
22 int enableInput(const QRect &bufferGeometry, uint drmFormat, uint bytesPerLine);
23 bool disableInput(int i);
24 bool setInputBuffer(int index, int dmabufFd);
25 bool setInputPosition(int index, const QPoint &position);
26 bool setInputAlpha(int index, qreal alpha);
27 bool blend(int outputDmabufFd);
28 int numInputs() const;
29 bool isDirty() const { return m_dirty; }
30 bool hasContinuousLayers() const;
31 private:
32 bool streamOn();
33 bool streamOff();
34 bool setInputFormat(int i, const QRect &bufferGeometry, uint pixelFormat, uint bytesPerLine);
35 QLinuxMediaDevice m_mediaDevice;
36 QLinuxMediaDevice::CaptureSubDevice *m_wpfOutput = nullptr; // wpf output
37 struct Input {
38 bool enabled = false;
39 QRect geometry;
40 qreal alpha = 1;
41 struct {
42 int fd = -1;
43 uint bytesUsed = 0;
44 uint length = 0;
45 } dmabuf;
46 struct media_link *linkToBru = nullptr; //rpf.x:1 -> bru:x
47 struct media_pad *inputFormatPad = nullptr; // rpf.x:0
48 struct media_pad *outputFormatPad = nullptr; // rpf.x:1
49 int outputFormatFd = -1; // rpf.x:1 (again, because v4l2_subdev_* doesn't have a way to set alpha)
50 struct media_pad *bruInputFormatPad = nullptr; // bru:x
51 QLinuxMediaDevice::OutputSubDevice *rpfInput = nullptr; // rpf.x input
52 };
53 QList<struct Input> m_inputs;
54 const QSize m_screenSize;
55 bool m_dirty = true;
56 };
57
58 QT_END_NAMESPACE
59
60 #endif // QVSP2BLENDINGDEVICE