| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | - | |||||||||||||
| 7 | - | |||||||||||||
| 8 | - | |||||||||||||
| 9 | extern const QLoggingCategory &qLcEglfsKmsDebug(); | - | ||||||||||||
| 10 | - | |||||||||||||
| 11 | enum OutputConfiguration { | - | ||||||||||||
| 12 | OutputConfigOff, | - | ||||||||||||
| 13 | OutputConfigPreferred, | - | ||||||||||||
| 14 | OutputConfigCurrent, | - | ||||||||||||
| 15 | OutputConfigMode, | - | ||||||||||||
| 16 | OutputConfigModeline | - | ||||||||||||
| 17 | }; | - | ||||||||||||
| 18 | - | |||||||||||||
| 19 | int QEglFSKmsDevice::crtcForConnector(drmModeResPtr resources, drmModeConnectorPtr connector) | - | ||||||||||||
| 20 | { | - | ||||||||||||
| 21 | for (int i = 0; i < connector->count_encoders
| 0 | ||||||||||||
| 22 | drmModeEncoderPtr encoder = drmModeGetEncoder(m_dri_fd, connector->encoders[i]); | - | ||||||||||||
| 23 | if (!encoder
| 0 | ||||||||||||
| 24 | QMessageLogger(__FILE__, 70, __PRETTY_FUNCTION__).warning("Failed to get encoder"); | - | ||||||||||||
| 25 | continue; never executed: continue; | 0 | ||||||||||||
| 26 | } | - | ||||||||||||
| 27 | - | |||||||||||||
| 28 | quint32 possibleCrtcs = encoder->possible_crtcs; | - | ||||||||||||
| 29 | drmModeFreeEncoder(encoder); | - | ||||||||||||
| 30 | - | |||||||||||||
| 31 | for (int j = 0; j < resources->count_crtcs
| 0 | ||||||||||||
| 32 | bool isPossible = possibleCrtcs & (1 << j); | - | ||||||||||||
| 33 | bool isAvailable = !(m_crtc_allocator & 1 << resources->crtcs[j]); | - | ||||||||||||
| 34 | - | |||||||||||||
| 35 | if (isPossible
| 0 | ||||||||||||
| 36 | return never executed: j;return j;never executed: return j; | 0 | ||||||||||||
| 37 | } never executed: end of block | 0 | ||||||||||||
| 38 | } never executed: end of block | 0 | ||||||||||||
| 39 | - | |||||||||||||
| 40 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||
| 41 | } | - | ||||||||||||
| 42 | - | |||||||||||||
| 43 | static const char * const connector_type_names[] = { | - | ||||||||||||
| 44 | "None", | - | ||||||||||||
| 45 | "VGA", | - | ||||||||||||
| 46 | "DVI", | - | ||||||||||||
| 47 | "DVI", | - | ||||||||||||
| 48 | "DVI", | - | ||||||||||||
| 49 | "Composite", | - | ||||||||||||
| 50 | "TV", | - | ||||||||||||
| 51 | "LVDS", | - | ||||||||||||
| 52 | "CTV", | - | ||||||||||||
| 53 | "DIN", | - | ||||||||||||
| 54 | "DP", | - | ||||||||||||
| 55 | "HDMI", | - | ||||||||||||
| 56 | "HDMI", | - | ||||||||||||
| 57 | "TV", | - | ||||||||||||
| 58 | "eDP", | - | ||||||||||||
| 59 | }; | - | ||||||||||||
| 60 | - | |||||||||||||
| 61 | static QByteArray nameForConnector(const drmModeConnectorPtr connector) | - | ||||||||||||
| 62 | { | - | ||||||||||||
| 63 | QByteArray connectorName("UNKNOWN"); | - | ||||||||||||
| 64 | - | |||||||||||||
| 65 | if (connector->connector_type < (sizeof (connector_type_names) / sizeof (connector_type_names)[0])
| 0 | ||||||||||||
| 66 | connectorName = connector_type_names[connector->connector_type]; never executed: connectorName = connector_type_names[connector->connector_type]; | 0 | ||||||||||||
| 67 | - | |||||||||||||
| 68 | connectorName += QByteArray::number(connector->connector_type_id); | - | ||||||||||||
| 69 | - | |||||||||||||
| 70 | return never executed: connectorName;return connectorName;never executed: return connectorName; | 0 | ||||||||||||
| 71 | } | - | ||||||||||||
| 72 | - | |||||||||||||
| 73 | static bool parseModeline(const QByteArray &text, drmModeModeInfoPtr mode) | - | ||||||||||||
| 74 | { | - | ||||||||||||
| 75 | char hsync[16]; | - | ||||||||||||
| 76 | char vsync[16]; | - | ||||||||||||
| 77 | float fclock; | - | ||||||||||||
| 78 | - | |||||||||||||
| 79 | mode->type = (1<<5); | - | ||||||||||||
| 80 | mode->hskew = 0; | - | ||||||||||||
| 81 | mode->vscan = 0; | - | ||||||||||||
| 82 | mode->vrefresh = 0; | - | ||||||||||||
| 83 | mode->flags = 0; | - | ||||||||||||
| 84 | - | |||||||||||||
| 85 | if (sscanf(text.constData(), "%f %hd %hd %hd %hd %hd %hd %hd %hd %15s %15s",
| 0 | ||||||||||||
| 86 | &fclock,
| 0 | ||||||||||||
| 87 | &mode->hdisplay,
| 0 | ||||||||||||
| 88 | &mode->hsync_start,
| 0 | ||||||||||||
| 89 | &mode->hsync_end,
| 0 | ||||||||||||
| 90 | &mode->htotal,
| 0 | ||||||||||||
| 91 | &mode->vdisplay,
| 0 | ||||||||||||
| 92 | &mode->vsync_start,
| 0 | ||||||||||||
| 93 | &mode->vsync_end,
| 0 | ||||||||||||
| 94 | &mode->vtotal, hsync, vsync) != 11
| 0 | ||||||||||||
| 95 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||
| 96 | - | |||||||||||||
| 97 | mode->clock = fclock * 1000; | - | ||||||||||||
| 98 | - | |||||||||||||
| 99 | if (strcmp(hsync, "+hsync") == 0
| 0 | ||||||||||||
| 100 | mode->flags |= (1<<0); never executed: mode->flags |= (1<<0); | 0 | ||||||||||||
| 101 | else if (strcmp(hsync, "-hsync") == 0
| 0 | ||||||||||||
| 102 | mode->flags |= (1<<1); never executed: mode->flags |= (1<<1); | 0 | ||||||||||||
| 103 | else | - | ||||||||||||
| 104 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||
| 105 | - | |||||||||||||
| 106 | if (strcmp(vsync, "+vsync") == 0
| 0 | ||||||||||||
| 107 | mode->flags |= (1<<2); never executed: mode->flags |= (1<<2); | 0 | ||||||||||||
| 108 | else if (strcmp(vsync, "-vsync") == 0
| 0 | ||||||||||||
| 109 | mode->flags |= (1<<3); never executed: mode->flags |= (1<<3); | 0 | ||||||||||||
| 110 | else | - | ||||||||||||
| 111 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||
| 112 | - | |||||||||||||
| 113 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||
| 114 | } | - | ||||||||||||
| 115 | - | |||||||||||||
| 116 | QEglFSKmsScreen *QEglFSKmsDevice::screenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, QPoint pos) | - | ||||||||||||
| 117 | { | - | ||||||||||||
| 118 | const QByteArray connectorName = nameForConnector(connector); | - | ||||||||||||
| 119 | - | |||||||||||||
| 120 | const int crtc = crtcForConnector(resources, connector); | - | ||||||||||||
| 121 | if (crtc < 0
| 0 | ||||||||||||
| 122 | QMessageLogger(__FILE__, 168, __PRETTY_FUNCTION__).warning() << "No usable crtc/encoder pair for connector" << connectorName; | - | ||||||||||||
| 123 | return never executed: nullptr;return nullptr;never executed: return nullptr; | 0 | ||||||||||||
| 124 | } | - | ||||||||||||
| 125 | - | |||||||||||||
| 126 | OutputConfiguration configuration; | - | ||||||||||||
| 127 | QSize configurationSize; | - | ||||||||||||
| 128 | drmModeModeInfo configurationModeline; | - | ||||||||||||
| 129 | - | |||||||||||||
| 130 | const QByteArray mode = m_integration->outputSettings().value(QString::fromUtf8(connectorName)) | - | ||||||||||||
| 131 | .value(([]() -> QString { enum { Size = sizeof(u"" "mode")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "mode" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp;never executed: }()), ([]() -> QString { enum { Size = sizeof(u"" "preferred")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "preferred" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); returnreturn qstring_literal_temp;never executed: qstring_literal_temp;return qstring_literal_temp;never executed: }())).toByteArray().toLower();return qstring_literal_temp; | 0 | ||||||||||||
| 132 | if (mode == "off"
| 0 | ||||||||||||
| 133 | configuration = OutputConfigOff; | - | ||||||||||||
| 134 | } never executed: else if (mode == "preferred"end of block
| 0 | ||||||||||||
| 135 | configuration = OutputConfigPreferred; | - | ||||||||||||
| 136 | } never executed: else if (mode == "current"end of block
| 0 | ||||||||||||
| 137 | configuration = OutputConfigCurrent; | - | ||||||||||||
| 138 | } never executed: else if (sscanf(mode.constData(), "%dx%d", &configurationSize.rwidth(), &configurationSize.rheight()) == 2end of block
| 0 | ||||||||||||
| 139 | configuration = OutputConfigMode; | - | ||||||||||||
| 140 | } never executed: else if (parseModeline(mode, &configurationModeline)end of block
| 0 | ||||||||||||
| 141 | configuration = OutputConfigModeline; | - | ||||||||||||
| 142 | } never executed: else {end of block | 0 | ||||||||||||
| 143 | QMessageLogger(__FILE__, 189, __PRETTY_FUNCTION__).warning("Invalid mode \"%s\" for output %s", mode.constData(), connectorName.constData()); | - | ||||||||||||
| 144 | configuration = OutputConfigPreferred; | - | ||||||||||||
| 145 | } never executed: end of block | 0 | ||||||||||||
| 146 | - | |||||||||||||
| 147 | const uint32_t crtc_id = resources->crtcs[crtc]; | - | ||||||||||||
| 148 | - | |||||||||||||
| 149 | if (configuration == OutputConfigOff
| 0 | ||||||||||||
| 150 | for (bool qt_category_enabled = qLcEglfsKmsDebug().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 196, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Turning off output" << connectorName; | 0 | ||||||||||||
| 151 | drmModeSetCrtc(m_dri_fd, crtc_id, 0, 0, 0, 0, 0, nullptr); | - | ||||||||||||
| 152 | return never executed: nullptr;return nullptr;never executed: return nullptr; | 0 | ||||||||||||
| 153 | } | - | ||||||||||||
| 154 | - | |||||||||||||
| 155 | - | |||||||||||||
| 156 | if (configuration == OutputConfigPreferred
| 0 | ||||||||||||
| 157 | for (bool qt_category_enabled = qLcEglfsKmsDebug().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 203, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Skipping disconnected output" << connectorName; | 0 | ||||||||||||
| 158 | return never executed: nullptr;return nullptr;never executed: return nullptr; | 0 | ||||||||||||
| 159 | } | - | ||||||||||||
| 160 | - | |||||||||||||
| 161 | - | |||||||||||||
| 162 | drmModeModeInfo crtc_mode; | - | ||||||||||||
| 163 | memset(&crtc_mode, 0, sizeof crtc_mode); | - | ||||||||||||
| 164 | if (drmModeEncoderPtr encoder = drmModeGetEncoder(m_dri_fd, connector->connector_id)
| 0 | ||||||||||||
| 165 | drmModeCrtcPtr crtc = drmModeGetCrtc(m_dri_fd, encoder->crtc_id); | - | ||||||||||||
| 166 | drmModeFreeEncoder(encoder); | - | ||||||||||||
| 167 | - | |||||||||||||
| 168 | if (!crtc
| 0 | ||||||||||||
| 169 | return never executed: nullptr;return nullptr;never executed: return nullptr; | 0 | ||||||||||||
| 170 | - | |||||||||||||
| 171 | if (crtc->mode_valid
| 0 | ||||||||||||
| 172 | crtc_mode = crtc->mode; never executed: crtc_mode = crtc->mode; | 0 | ||||||||||||
| 173 | - | |||||||||||||
| 174 | drmModeFreeCrtc(crtc); | - | ||||||||||||
| 175 | } never executed: end of block | 0 | ||||||||||||
| 176 | - | |||||||||||||
| 177 | QList<drmModeModeInfo> modes; | - | ||||||||||||
| 178 | modes.reserve(connector->count_modes); | - | ||||||||||||
| 179 | for (bool qt_category_enabled = qLcEglfsKmsDebug().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 225, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << connectorName << "mode count:" << connector->count_modes; | 0 | ||||||||||||
| 180 | for (int i = 0; i < connector->count_modes
| 0 | ||||||||||||
| 181 | const drmModeModeInfo &mode = connector->modes[i]; | - | ||||||||||||
| 182 | for (bool qt_category_enabled = qLcEglfsKmsDebug().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 228, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "mode" << i << mode.hdisplay << "x" << mode.vdisplay << '@' << mode.vrefresh << "hz"; | 0 | ||||||||||||
| 183 | << '@' << mode.vrefresh << "hz"; never executed: QMessageLogger(__FILE__, 228, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "mode" << i << mode.hdisplay << "x" << mode.vdisplay << '@' << mode.vrefresh << "hz"; | 0 | ||||||||||||
| 184 | modes << connector->modes[i]; | - | ||||||||||||
| 185 | } never executed: end of block | 0 | ||||||||||||
| 186 | - | |||||||||||||
| 187 | int preferred = -1; | - | ||||||||||||
| 188 | int current = -1; | - | ||||||||||||
| 189 | int configured = -1; | - | ||||||||||||
| 190 | int best = -1; | - | ||||||||||||
| 191 | - | |||||||||||||
| 192 | for (int i = modes.size() - 1; i >= 0
| 0 | ||||||||||||
| 193 | const drmModeModeInfo &m = modes.at(i); | - | ||||||||||||
| 194 | - | |||||||||||||
| 195 | if (configuration == OutputConfigMode
| 0 | ||||||||||||
| 196 | m.hdisplay == configurationSize.width()
| 0 | ||||||||||||
| 197 | m.vdisplay == configurationSize.height()
| 0 | ||||||||||||
| 198 | configured = i; | - | ||||||||||||
| 199 | } never executed: end of block | 0 | ||||||||||||
| 200 | - | |||||||||||||
| 201 | if (!memcmp(&crtc_mode, &m, sizeof m)
| 0 | ||||||||||||
| 202 | current = i; never executed: current = i; | 0 | ||||||||||||
| 203 | - | |||||||||||||
| 204 | if (m.type & (1<<3)
| 0 | ||||||||||||
| 205 | preferred = i; never executed: preferred = i; | 0 | ||||||||||||
| 206 | - | |||||||||||||
| 207 | best = i; | - | ||||||||||||
| 208 | } never executed: end of block | 0 | ||||||||||||
| 209 | - | |||||||||||||
| 210 | if (configuration == OutputConfigModeline
| 0 | ||||||||||||
| 211 | modes << configurationModeline; | - | ||||||||||||
| 212 | configured = modes.size() - 1; | - | ||||||||||||
| 213 | } never executed: end of block | 0 | ||||||||||||
| 214 | - | |||||||||||||
| 215 | if (current < 0
| 0 | ||||||||||||
| 216 | modes << crtc_mode; | - | ||||||||||||
| 217 | current = mode.size() - 1; | - | ||||||||||||
| 218 | } never executed: end of block | 0 | ||||||||||||
| 219 | - | |||||||||||||
| 220 | if (configuration == OutputConfigCurrent
| 0 | ||||||||||||
| 221 | configured = current; never executed: configured = current; | 0 | ||||||||||||
| 222 | - | |||||||||||||
| 223 | int selected_mode = -1; | - | ||||||||||||
| 224 | - | |||||||||||||
| 225 | if (configured >= 0
| 0 | ||||||||||||
| 226 | selected_mode = configured; never executed: selected_mode = configured; | 0 | ||||||||||||
| 227 | else if (preferred >= 0
| 0 | ||||||||||||
| 228 | selected_mode = preferred; never executed: selected_mode = preferred; | 0 | ||||||||||||
| 229 | else if (current >= 0
| 0 | ||||||||||||
| 230 | selected_mode = current; never executed: selected_mode = current; | 0 | ||||||||||||
| 231 | else if (best >= 0
| 0 | ||||||||||||
| 232 | selected_mode = best; never executed: selected_mode = best; | 0 | ||||||||||||
| 233 | - | |||||||||||||
| 234 | if (selected_mode < 0
| 0 | ||||||||||||
| 235 | QMessageLogger(__FILE__, 281, __PRETTY_FUNCTION__).warning() << "No modes available for output" << connectorName; | - | ||||||||||||
| 236 | return never executed: nullptr;return nullptr;never executed: return nullptr; | 0 | ||||||||||||
| 237 | } else { | - | ||||||||||||
| 238 | int width = modes[selected_mode].hdisplay; | - | ||||||||||||
| 239 | int height = modes[selected_mode].vdisplay; | - | ||||||||||||
| 240 | int refresh = modes[selected_mode].vrefresh; | - | ||||||||||||
| 241 | for (bool qt_category_enabled = qLcEglfsKmsDebug().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 287, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Selected mode" << selected_mode << ":" << width << "x" << height << '@' << refresh << "hz for output" << connectorName; | 0 | ||||||||||||
| 242 | << '@' << refresh << "hz for output" << connectorName; never executed: QMessageLogger(__FILE__, 287, __PRETTY_FUNCTION__, qLcEglfsKmsDebug().categoryName()).debug() << "Selected mode" << selected_mode << ":" << width << "x" << height << '@' << refresh << "hz for output" << connectorName; | 0 | ||||||||||||
| 243 | } never executed: end of block | 0 | ||||||||||||
| 244 | static const int width = qEnvironmentVariableIntValue("QT_QPA_EGLFS_PHYSICAL_WIDTH"); | - | ||||||||||||
| 245 | static const int height = qEnvironmentVariableIntValue("QT_QPA_EGLFS_PHYSICAL_HEIGHT"); | - | ||||||||||||
| 246 | QSizeF size(width, height); | - | ||||||||||||
| 247 | if (size.isEmpty()
| 0 | ||||||||||||
| 248 | size.setWidth(connector->mmWidth); | - | ||||||||||||
| 249 | size.setHeight(connector->mmHeight); | - | ||||||||||||
| 250 | } never executed: end of block | 0 | ||||||||||||
| 251 | QEglFSKmsOutput output = { | - | ||||||||||||
| 252 | QString::fromUtf8(connectorName), | - | ||||||||||||
| 253 | connector->connector_id, | - | ||||||||||||
| 254 | crtc_id, | - | ||||||||||||
| 255 | size, | - | ||||||||||||
| 256 | selected_mode, | - | ||||||||||||
| 257 | false, | - | ||||||||||||
| 258 | drmModeGetCrtc(m_dri_fd, crtc_id), | - | ||||||||||||
| 259 | modes, | - | ||||||||||||
| 260 | connector->subpixel, | - | ||||||||||||
| 261 | connectorProperty(connector, ([]() -> QByteArray { enum { Size = sizeof("DPMS") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "DPMS" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return never executed: ba;return ba;never executed: }()))return ba; | 0 | ||||||||||||
| 262 | }; | - | ||||||||||||
| 263 | - | |||||||||||||
| 264 | m_crtc_allocator |= (1 << output.crtc_id); | - | ||||||||||||
| 265 | m_connector_allocator |= (1 << output.connector_id); | - | ||||||||||||
| 266 | - | |||||||||||||
| 267 | return never executed: createScreen(m_integration, this, output, pos);return createScreen(m_integration, this, output, pos);never executed: return createScreen(m_integration, this, output, pos); | 0 | ||||||||||||
| 268 | } | - | ||||||||||||
| 269 | - | |||||||||||||
| 270 | drmModePropertyPtr QEglFSKmsDevice::connectorProperty(drmModeConnectorPtr connector, const QByteArray &name) | - | ||||||||||||
| 271 | { | - | ||||||||||||
| 272 | drmModePropertyPtr prop; | - | ||||||||||||
| 273 | - | |||||||||||||
| 274 | for (int i = 0; i < connector->count_props
| 0 | ||||||||||||
| 275 | prop = drmModeGetProperty(m_dri_fd, connector->props[i]); | - | ||||||||||||
| 276 | if (!prop
| 0 | ||||||||||||
| 277 | continue; never executed: continue; | 0 | ||||||||||||
| 278 | if (strcmp(prop->name, name.constData()) == 0
| 0 | ||||||||||||
| 279 | return never executed: prop;return prop;never executed: return prop; | 0 | ||||||||||||
| 280 | drmModeFreeProperty(prop); | - | ||||||||||||
| 281 | } never executed: end of block | 0 | ||||||||||||
| 282 | - | |||||||||||||
| 283 | return never executed: nullptr;return nullptr;never executed: return nullptr; | 0 | ||||||||||||
| 284 | } | - | ||||||||||||
| 285 | - | |||||||||||||
| 286 | QEglFSKmsDevice::QEglFSKmsDevice(QEglFSKmsIntegration *integration, const QString &path) | - | ||||||||||||
| 287 | : m_integration(integration) | - | ||||||||||||
| 288 | , m_path(path) | - | ||||||||||||
| 289 | , m_dri_fd(-1) | - | ||||||||||||
| 290 | , m_crtc_allocator(0) | - | ||||||||||||
| 291 | , m_connector_allocator(0) | - | ||||||||||||
| 292 | { | - | ||||||||||||
| 293 | } never executed: end of block | 0 | ||||||||||||
| 294 | - | |||||||||||||
| 295 | QEglFSKmsDevice::~QEglFSKmsDevice() | - | ||||||||||||
| 296 | { | - | ||||||||||||
| 297 | } | - | ||||||||||||
| 298 | - | |||||||||||||
| 299 | void QEglFSKmsDevice::createScreens() | - | ||||||||||||
| 300 | { | - | ||||||||||||
| 301 | drmModeResPtr resources = drmModeGetResources(m_dri_fd); | - | ||||||||||||
| 302 | if (!resources
| 0 | ||||||||||||
| 303 | QMessageLogger(__FILE__, 349, __PRETTY_FUNCTION__).warning("drmModeGetResources failed"); | - | ||||||||||||
| 304 | return; never executed: return; | 0 | ||||||||||||
| 305 | } | - | ||||||||||||
| 306 | - | |||||||||||||
| 307 | QEglFSKmsScreen *primaryScreen = nullptr; | - | ||||||||||||
| 308 | QList<QPlatformScreen *> siblings; | - | ||||||||||||
| 309 | QPoint pos(0, 0); | - | ||||||||||||
| 310 | QEglFSIntegration *integration = static_cast<QEglFSIntegration *>(QGuiApplicationPrivate::platformIntegration()); | - | ||||||||||||
| 311 | - | |||||||||||||
| 312 | for (int i = 0; i < resources->count_connectors
| 0 | ||||||||||||
| 313 | drmModeConnectorPtr connector = drmModeGetConnector(m_dri_fd, resources->connectors[i]); | - | ||||||||||||
| 314 | if (!connector
| 0 | ||||||||||||
| 315 | continue; never executed: continue; | 0 | ||||||||||||
| 316 | - | |||||||||||||
| 317 | QEglFSKmsScreen *screen = screenForConnector(resources, connector, pos); | - | ||||||||||||
| 318 | if (screen
| 0 | ||||||||||||
| 319 | integration->addScreen(screen); | - | ||||||||||||
| 320 | pos.rx() += screen->geometry().width(); | - | ||||||||||||
| 321 | siblings << screen; | - | ||||||||||||
| 322 | - | |||||||||||||
| 323 | if (!primaryScreen
| 0 | ||||||||||||
| 324 | primaryScreen = screen; never executed: primaryScreen = screen; | 0 | ||||||||||||
| 325 | } never executed: end of block | 0 | ||||||||||||
| 326 | - | |||||||||||||
| 327 | drmModeFreeConnector(connector); | - | ||||||||||||
| 328 | } never executed: end of block | 0 | ||||||||||||
| 329 | - | |||||||||||||
| 330 | drmModeFreeResources(resources); | - | ||||||||||||
| 331 | - | |||||||||||||
| 332 | if (!m_integration->separateScreens()
| 0 | ||||||||||||
| 333 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(siblings)>::type> _container_((siblings)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QPlatformScreen *screen = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||||||||
| 334 | static_cast< never executed: QEglFSKmsScreen *>(screen)->setVirtualSiblings(siblings);static_cast<QEglFSKmsScreen *>(screen)->setVirtualSiblings(siblings);never executed: static_cast<QEglFSKmsScreen *>(screen)->setVirtualSiblings(siblings); | 0 | ||||||||||||
| 335 | } never executed: end of block | 0 | ||||||||||||
| 336 | } never executed: end of block | 0 | ||||||||||||
| 337 | - | |||||||||||||
| 338 | int QEglFSKmsDevice::fd() const | - | ||||||||||||
| 339 | { | - | ||||||||||||
| 340 | return never executed: m_dri_fd;return m_dri_fd;never executed: return m_dri_fd; | 0 | ||||||||||||
| 341 | } | - | ||||||||||||
| 342 | - | |||||||||||||
| 343 | QString QEglFSKmsDevice::devicePath() const | - | ||||||||||||
| 344 | { | - | ||||||||||||
| 345 | return never executed: m_path;return m_path;never executed: return m_path; | 0 | ||||||||||||
| 346 | } | - | ||||||||||||
| 347 | - | |||||||||||||
| 348 | QEglFSKmsScreen *QEglFSKmsDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output, QPoint position) | - | ||||||||||||
| 349 | { | - | ||||||||||||
| 350 | return never executed: new QEglFSKmsScreen(integration, device, output, position);return new QEglFSKmsScreen(integration, device, output, position);never executed: return new QEglFSKmsScreen(integration, device, output, position); | 0 | ||||||||||||
| 351 | } | - | ||||||||||||
| 352 | - | |||||||||||||
| 353 | void QEglFSKmsDevice::setFd(int fd) | - | ||||||||||||
| 354 | { | - | ||||||||||||
| 355 | m_dri_fd = fd; | - | ||||||||||||
| 356 | } never executed: end of block | 0 | ||||||||||||
| 357 | - | |||||||||||||
| 358 | - | |||||||||||||
| Switch to Source code | Preprocessed file |