1/****************************************************************************
2**
3** Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
4** Copyright (C) 2016 The Qt Company Ltd.
5** Copyright (C) 2016 Pelagicore AG
6** Contact: https://www.qt.io/licensing/
7**
8** This file is part of the plugins of the Qt Toolkit.
9**
10** $QT_BEGIN_LICENSE:LGPL$
11** Commercial License Usage
12** Licensees holding valid commercial Qt licenses may use this file in
13** accordance with the commercial license agreement provided with the
14** Software or, alternatively, in accordance with the terms contained in
15** a written agreement between you and The Qt Company. For licensing terms
16** and conditions see https://www.qt.io/terms-conditions. For further
17** information use the contact form at https://www.qt.io/contact-us.
18**
19** GNU Lesser General Public License Usage
20** Alternatively, this file may be used under the terms of the GNU Lesser
21** General Public License version 3 as published by the Free Software
22** Foundation and appearing in the file LICENSE.LGPL3 included in the
23** packaging of this file. Please review the following information to
24** ensure the GNU Lesser General Public License version 3 requirements
25** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
26**
27** GNU General Public License Usage
28** Alternatively, this file may be used under the terms of the GNU
29** General Public License version 2.0 or (at your option) the GNU General
30** Public license version 3 or any later version approved by the KDE Free
31** Qt Foundation. The licenses are as published by the Free Software
32** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
33** included in the packaging of this file. Please review the following
34** information to ensure the GNU General Public License requirements will
35** be met: https://www.gnu.org/licenses/gpl-2.0.html and
36** https://www.gnu.org/licenses/gpl-3.0.html.
37**
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef QEGLFSKMSSCREEN_H
43#define QEGLFSKMSSCREEN_H
44
45//
46// W A R N I N G
47// -------------
48//
49// This file is not part of the Qt API. It exists purely as an
50// implementation detail. This header file may change from version to
51// version without notice, or even be removed.
52//
53// We mean it.
54//
55
56#include "private/qeglfsscreen_p.h"
57#include <QtCore/QList>
58#include <QtCore/QMutex>
59
60#include <QtKmsSupport/private/qkmsdevice_p.h>
61#include <QtGui/private/qedidparser_p.h>
62
63QT_BEGIN_NAMESPACE
64
65class QEglFSKmsDevice;
66class QEglFSKmsInterruptHandler;
67
68class Q_EGLFS_EXPORT QEglFSKmsScreen : public QEglFSScreen
69{
70public:
71 QEglFSKmsScreen(QEglFSKmsDevice *device, const QKmsOutput &output, bool headless = false);
72 ~QEglFSKmsScreen();
73
74 void setVirtualPosition(const QPoint &pos);
75
76 QRect rawGeometry() const override;
77
78 int depth() const override;
79 QImage::Format format() const override;
80
81 QSizeF physicalSize() const override;
82 QDpi logicalDpi() const override;
83 QDpi logicalBaseDpi() const override;
84 Qt::ScreenOrientation nativeOrientation() const override;
85 Qt::ScreenOrientation orientation() const override;
86
87 QString name() const override;
88
89 QString manufacturer() const override;
90 QString model() const override;
91 QString serialNumber() const override;
92
93 qreal refreshRate() const override;
94
95 QList<QPlatformScreen *> virtualSiblings() const override { return m_siblings; }
96 void setVirtualSiblings(QList<QPlatformScreen *> sl) { m_siblings = sl; }
97
98 QList<QPlatformScreen::Mode> modes() const override;
99
100 int currentMode() const override;
101 int preferredMode() const override;
102
103 QEglFSKmsDevice *device() const { return m_device; }
104
105 virtual void waitForFlip();
106
107 QKmsOutput &output() { return m_output; }
108 void restoreMode();
109
110 SubpixelAntialiasingType subpixelAntialiasingTypeHint() const override;
111
112 QPlatformScreen::PowerState powerState() const override;
113 void setPowerState(QPlatformScreen::PowerState state) override;
114
115 bool isCursorOutOfRange() const { return m_cursorOutOfRange; }
116 void setCursorOutOfRange(bool b) { m_cursorOutOfRange = b; }
117
118protected:
119 QEglFSKmsDevice *m_device;
120
121 QKmsOutput m_output;
122 QEdidParser m_edid;
123 QPoint m_pos;
124 bool m_cursorOutOfRange;
125
126 QList<QPlatformScreen *> m_siblings;
127
128 PowerState m_powerState;
129
130 QEglFSKmsInterruptHandler *m_interruptHandler;
131
132 bool m_headless;
133};
134
135QT_END_NAMESPACE
136
137#endif
138