| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||
| 2 | - | |||||||
| 3 | - | |||||||
| 4 | - | |||||||
| 5 | - | |||||||
| 6 | - | |||||||
| 7 | - | |||||||
| 8 | - | |||||||
| 9 | const QLoggingCategory &qLcEglfsKmsDebug() { static const QLoggingCategory category("qt.qpa.eglfs.kms"); return never executed: category;return category;never executed: }return category; | 0 | ||||||
| 10 | - | |||||||
| 11 | QEglFSKmsIntegration::QEglFSKmsIntegration() | - | ||||||
| 12 | : m_device(nullptr) | - | ||||||
| 13 | , m_hwCursor(false) | - | ||||||
| 14 | , m_pbuffers(false) | - | ||||||
| 15 | , m_separateScreens(false) | - | ||||||
| 16 | {} never executed: end of block | 0 | ||||||
| 17 | - | |||||||
| 18 | void QEglFSKmsIntegration::platformInit() | - | ||||||
| 19 | { | - | ||||||
| 20 | loadConfig(); | - | ||||||
| 21 | - | |||||||
| 22 | if (!m_devicePath.isEmpty()
| 0 | ||||||
| 23 | for (bool qt_category_enabled = qLcEglfsKmsDebug().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 75, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Using DRM device" << m_devicePath << "specified in config file"; | 0 | ||||||
| 24 | } never executed: end of block | 0 | ||||||
| 25 | - | |||||||
| 26 | m_device = createDevice(m_devicePath); | - | ||||||
| 27 | if (__builtin_expect(!!(!m_device->open()), false)
| 0 | ||||||
| 28 | QMessageLogger(__FILE__, 80, __PRETTY_FUNCTION__).fatal("Could not open device %s - aborting!", QString(m_devicePath).toLocal8Bit().constData()); never executed: QMessageLogger(__FILE__, 80, __PRETTY_FUNCTION__).fatal("Could not open device %s - aborting!", QString(m_devicePath).toLocal8Bit().constData()); | 0 | ||||||
| 29 | } never executed: end of block | 0 | ||||||
| 30 | - | |||||||
| 31 | void QEglFSKmsIntegration::platformDestroy() | - | ||||||
| 32 | { | - | ||||||
| 33 | m_device->close(); | - | ||||||
| 34 | delete m_device; | - | ||||||
| 35 | m_device = nullptr; | - | ||||||
| 36 | } never executed: end of block | 0 | ||||||
| 37 | - | |||||||
| 38 | EGLNativeDisplayType QEglFSKmsIntegration::platformDisplay() const | - | ||||||
| 39 | { | - | ||||||
| 40 | ((!(m_device)) ? qt_assert("m_device",__FILE__,92) : qt_noop()); | - | ||||||
| 41 | return never executed: m_device->nativeDisplay();return m_device->nativeDisplay();never executed: return m_device->nativeDisplay(); | 0 | ||||||
| 42 | } | - | ||||||
| 43 | - | |||||||
| 44 | bool QEglFSKmsIntegration::usesDefaultScreen() | - | ||||||
| 45 | { | - | ||||||
| 46 | return never executed: false;return false;never executed: return false; | 0 | ||||||
| 47 | } | - | ||||||
| 48 | - | |||||||
| 49 | void QEglFSKmsIntegration::screenInit() | - | ||||||
| 50 | { | - | ||||||
| 51 | m_device->createScreens(); | - | ||||||
| 52 | } never executed: end of block | 0 | ||||||
| 53 | - | |||||||
| 54 | QSurfaceFormat QEglFSKmsIntegration::surfaceFormatFor(const QSurfaceFormat &inputFormat) const | - | ||||||
| 55 | { | - | ||||||
| 56 | QSurfaceFormat format(inputFormat); | - | ||||||
| 57 | format.setRenderableType(QSurfaceFormat::OpenGLES); | - | ||||||
| 58 | format.setSwapBehavior(QSurfaceFormat::DoubleBuffer); | - | ||||||
| 59 | format.setRedBufferSize(8); | - | ||||||
| 60 | format.setGreenBufferSize(8); | - | ||||||
| 61 | format.setBlueBufferSize(8); | - | ||||||
| 62 | return never executed: format;return format;never executed: return format; | 0 | ||||||
| 63 | } | - | ||||||
| 64 | - | |||||||
| 65 | bool QEglFSKmsIntegration::hasCapability(QPlatformIntegration::Capability cap) const | - | ||||||
| 66 | { | - | ||||||
| 67 | switch (cap) { | - | ||||||
| 68 | case never executed: QPlatformIntegration::ThreadedPixmaps:case QPlatformIntegration::ThreadedPixmaps:never executed: case QPlatformIntegration::ThreadedPixmaps: | 0 | ||||||
| 69 | case never executed: QPlatformIntegration::OpenGL:case QPlatformIntegration::OpenGL:never executed: case QPlatformIntegration::OpenGL: | 0 | ||||||
| 70 | case never executed: QPlatformIntegration::ThreadedOpenGL:case QPlatformIntegration::ThreadedOpenGL:never executed: case QPlatformIntegration::ThreadedOpenGL: | 0 | ||||||
| 71 | return never executed: true;return true;never executed: return true; | 0 | ||||||
| 72 | default never executed: :default:never executed: default: | 0 | ||||||
| 73 | return never executed: false;return false;never executed: return false; | 0 | ||||||
| 74 | } | - | ||||||
| 75 | } | - | ||||||
| 76 | - | |||||||
| 77 | void QEglFSKmsIntegration::waitForVSync(QPlatformSurface *surface) const | - | ||||||
| 78 | { | - | ||||||
| 79 | QWindow *window = static_cast<QWindow *>(surface->surface()); | - | ||||||
| 80 | QEglFSKmsScreen *screen = static_cast<QEglFSKmsScreen *>(window->screen()->handle()); | - | ||||||
| 81 | - | |||||||
| 82 | screen->waitForFlip(); | - | ||||||
| 83 | } never executed: end of block | 0 | ||||||
| 84 | - | |||||||
| 85 | bool QEglFSKmsIntegration::supportsPBuffers() const | - | ||||||
| 86 | { | - | ||||||
| 87 | return never executed: m_pbuffers;return m_pbuffers;never executed: return m_pbuffers; | 0 | ||||||
| 88 | } | - | ||||||
| 89 | - | |||||||
| 90 | bool QEglFSKmsIntegration::hwCursor() const | - | ||||||
| 91 | { | - | ||||||
| 92 | return never executed: m_hwCursor;return m_hwCursor;never executed: return m_hwCursor; | 0 | ||||||
| 93 | } | - | ||||||
| 94 | - | |||||||
| 95 | bool QEglFSKmsIntegration::separateScreens() const | - | ||||||
| 96 | { | - | ||||||
| 97 | return never executed: m_separateScreens;return m_separateScreens;never executed: return m_separateScreens; | 0 | ||||||
| 98 | } | - | ||||||
| 99 | - | |||||||
| 100 | QMap<QString, QVariantMap> QEglFSKmsIntegration::outputSettings() const | - | ||||||
| 101 | { | - | ||||||
| 102 | return never executed: m_outputSettings;return m_outputSettings;never executed: return m_outputSettings; | 0 | ||||||
| 103 | } | - | ||||||
| 104 | - | |||||||
| 105 | QEglFSKmsDevice *QEglFSKmsIntegration::device() const | - | ||||||
| 106 | { | - | ||||||
| 107 | return never executed: m_device;return m_device;never executed: return m_device; | 0 | ||||||
| 108 | } | - | ||||||
| 109 | - | |||||||
| 110 | void QEglFSKmsIntegration::loadConfig() | - | ||||||
| 111 | { | - | ||||||
| 112 | static QByteArray json = qgetenv("QT_QPA_EGLFS_KMS_CONFIG"); | - | ||||||
| 113 | if (json.isEmpty()
| 0 | ||||||
| 114 | return; never executed: return; | 0 | ||||||
| 115 | - | |||||||
| 116 | for (bool qt_category_enabled = qLcEglfsKmsDebug().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 168, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Loading KMS setup from" << json; | 0 | ||||||
| 117 | - | |||||||
| 118 | QFile file(QString::fromUtf8(json)); | - | ||||||
| 119 | if (!file.open(QFile::ReadOnly)
| 0 | ||||||
| 120 | for (bool qt_category_enabled = qLcEglfsKmsDebug().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 172, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Could not open config file" << json << "for reading"; | 0 | ||||||
| 121 | << json << "for reading"; never executed: QMessageLogger(__FILE__, 172, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Could not open config file" << json << "for reading"; | 0 | ||||||
| 122 | return; never executed: return; | 0 | ||||||
| 123 | } | - | ||||||
| 124 | - | |||||||
| 125 | const QJsonDocument doc = QJsonDocument::fromJson(file.readAll()); | - | ||||||
| 126 | if (!doc.isObject()
| 0 | ||||||
| 127 | for (bool qt_category_enabled = qLcEglfsKmsDebug().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 179, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Invalid config file" << json << "- no top-level JSON object"; | 0 | ||||||
| 128 | << "- no top-level JSON object"; never executed: QMessageLogger(__FILE__, 179, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Invalid config file" << json << "- no top-level JSON object"; | 0 | ||||||
| 129 | return; never executed: return; | 0 | ||||||
| 130 | } | - | ||||||
| 131 | - | |||||||
| 132 | const QJsonObject object = doc.object(); | - | ||||||
| 133 | - | |||||||
| 134 | m_hwCursor = object.value(QLatin1String("hwcursor")).toBool(m_hwCursor); | - | ||||||
| 135 | m_pbuffers = object.value(QLatin1String("pbuffers")).toBool(m_pbuffers); | - | ||||||
| 136 | m_devicePath = object.value(QLatin1String("device")).toString(); | - | ||||||
| 137 | m_separateScreens = object.value(QLatin1String("separateScreens")).toBool(m_separateScreens); | - | ||||||
| 138 | - | |||||||
| 139 | const QJsonArray outputs = object.value(QLatin1String("outputs")).toArray(); | - | ||||||
| 140 | for (int i = 0; i < outputs.size()
| 0 | ||||||
| 141 | const QVariantMap outputSettings = outputs.at(i).toObject().toVariantMap(); | - | ||||||
| 142 | - | |||||||
| 143 | if (outputSettings.contains(([]() -> QString { enum { Size = sizeof(u"" "name")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "name" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()))
| 0 | ||||||
| 144 | const QString name = outputSettings.value(([]() -> QString { enum { Size = sizeof(u"" "name")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "name" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp;never executed: }())).toString();return qstring_literal_temp; | 0 | ||||||
| 145 | - | |||||||
| 146 | if (m_outputSettings.contains(name)
| 0 | ||||||
| 147 | for (bool qt_category_enabled = qLcEglfsKmsDebug().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 199, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Output" << name << "configured multiple times!"; | 0 | ||||||
| 148 | } never executed: end of block | 0 | ||||||
| 149 | - | |||||||
| 150 | m_outputSettings.insert(name, outputSettings); | - | ||||||
| 151 | } never executed: end of block | 0 | ||||||
| 152 | } never executed: end of block | 0 | ||||||
| 153 | - | |||||||
| 154 | for (bool qt_category_enabled = qLcEglfsKmsDebug().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 206, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Configuration:\n" << "\thwcursor:" << m_hwCursor << "\n" << "\tpbuffers:" << m_pbuffers << "\n" << "\tseparateScreens:" << m_separateScreens << "\n" << "\toutputs:" << m_outputSettings; | 0 | ||||||
| 155 | << "\thwcursor:" << m_hwCursor << "\n" never executed: QMessageLogger(__FILE__, 206, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Configuration:\n" << "\thwcursor:" << m_hwCursor << "\n" << "\tpbuffers:" << m_pbuffers << "\n" << "\tseparateScreens:" << m_separateScreens << "\n" << "\toutputs:" << m_outputSettings; | 0 | ||||||
| 156 | << "\tpbuffers:" << m_pbuffers << "\n" never executed: QMessageLogger(__FILE__, 206, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Configuration:\n" << "\thwcursor:" << m_hwCursor << "\n" << "\tpbuffers:" << m_pbuffers << "\n" << "\tseparateScreens:" << m_separateScreens << "\n" << "\toutputs:" << m_outputSettings; | 0 | ||||||
| 157 | << "\tseparateScreens:" << m_separateScreens << "\n" never executed: QMessageLogger(__FILE__, 206, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Configuration:\n" << "\thwcursor:" << m_hwCursor << "\n" << "\tpbuffers:" << m_pbuffers << "\n" << "\tseparateScreens:" << m_separateScreens << "\n" << "\toutputs:" << m_outputSettings; | 0 | ||||||
| 158 | << "\toutputs:" << m_outputSettings; never executed: QMessageLogger(__FILE__, 206, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Configuration:\n" << "\thwcursor:" << m_hwCursor << "\n" << "\tpbuffers:" << m_pbuffers << "\n" << "\tseparateScreens:" << m_separateScreens << "\n" << "\toutputs:" << m_outputSettings; | 0 | ||||||
| 159 | } never executed: end of block | 0 | ||||||
| 160 | - | |||||||
| 161 | - | |||||||
| Switch to Source code | Preprocessed file |